1#!/bin/bash
2#
3# @echo off
4#
5# Compare two multi-results
6#
7# The first specified multi-result is being compared against the second one,
8# that is, if something in the first multi-result is worse than in the second
9# one, it could be treated as some kind regression of the product being tested.
10#
11# (for additional comments see Do and asltsrun utilities).
12
13# Includes
14
15. common
16. settings
17. diffproc
18
19# Report summary of comparing.
20# arg1 - first multi-result directory
21# arg2 - against the second multi-result directory
22#        Opcodes of comparing results:
23# arg3 - 32-bit unoptimized code
24# arg4 - 64-bit unoptimized code
25# arg5 - 32-bit optimized code
26# arg6 - 64-bit optimized code
27report_multi_runs_cmp()
28{
29	local msg
30
31	echo ""
32	echo "Summary of comparing:"
33	echo "  -         multi-result directory (new) : $1"
34	echo "  - against multi-result directory (old) : $2"
35	echo "Summary of comparing:"
36	echo "  `get_mode_string $NORM32 1`: `cmp_result_opcode_to_str $3`"
37	echo "  `get_mode_string $NORM64 1`: `cmp_result_opcode_to_str $4`"
38	echo "  `get_mode_string $OPT32 1`: `cmp_result_opcode_to_str $5`"
39	echo "  `get_mode_string $OPT64 1`: `cmp_result_opcode_to_str $6`"
40}
41
42# ############################## MAIN ###############################
43
44date
45
46DIR0="$1"
47DIR1="$2"
48UTILSTATUS=0
49INIT_MEM_STAT
50
51# Check the multi-result directories
52
53check_dir "$DIR0"
54check_dir "$DIR1"
55
56# Do compare per each possible run mode
57
58# 32-bit unoptimized code
59do_compare_two_runs "$DIR0" $NORM32 "$DIR1" $NORM32
60CMP0=$?
61
62# 64-bit unoptimized code
63do_compare_two_runs "$DIR0" $NORM64 "$DIR1" $NORM64
64CMP1=$?
65
66# 32-bit optimized code
67do_compare_two_runs "$DIR0" $OPT32 "$DIR1" $OPT32
68CMP2=$?
69
70# 64-bit optimized code
71do_compare_two_runs "$DIR0" $OPT64 "$DIR1" $OPT64
72CMP3=$?
73
74# Report the summary of comparing
75report_multi_runs_cmp "$DIR1" "$DIR0" "$CMP0" "$CMP1" "$CMP2" "$CMP3"
76
77if [ $UTILSTATUS == 0 ]; then
78	msg "Ok"
79else
80	msg "MISCOMPARED!"
81fi
82
83date
84
85exit $UTILSTATUS
86
87
88
89