| 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 |
| 27 | report_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 | |
| 44 | date |
| 45 | |
| 46 | DIR0="$1" |
| 47 | DIR1="$2" |
| 48 | UTILSTATUS=0 |
| 49 | INIT_MEM_STAT |
| 50 | |
| 51 | # Check the multi-result directories |
| 52 | |
| 53 | check_dir "$DIR0" |
| 54 | check_dir "$DIR1" |
| 55 | |
| 56 | # Do compare per each possible run mode |
| 57 | |
| 58 | # 32-bit unoptimized code |
| 59 | do_compare_two_runs "$DIR0" $NORM32 "$DIR1" $NORM32 |
| 60 | CMP0=$? |
| 61 | |
| 62 | # 64-bit unoptimized code |
| 63 | do_compare_two_runs "$DIR0" $NORM64 "$DIR1" $NORM64 |
| 64 | CMP1=$? |
| 65 | |
| 66 | # 32-bit optimized code |
| 67 | do_compare_two_runs "$DIR0" $OPT32 "$DIR1" $OPT32 |
| 68 | CMP2=$? |
| 69 | |
| 70 | # 64-bit optimized code |
| 71 | do_compare_two_runs "$DIR0" $OPT64 "$DIR1" $OPT64 |
| 72 | CMP3=$? |
| 73 | |
| 74 | # Report the summary of comparing |
| 75 | report_multi_runs_cmp "$DIR1" "$DIR0" "$CMP0" "$CMP1" "$CMP2" "$CMP3" |
| 76 | |
| 77 | if [ $UTILSTATUS == 0 ]; then |
| 78 | msg "Ok" |
| 79 | else |
| 80 | msg "MISCOMPARED!" |
| 81 | fi |
| 82 | |
| 83 | date |
| 84 | |
| 85 | exit $UTILSTATUS |
| 86 | |
| 87 | |
| 88 |