Renato Golin | 94cc104 | 2016-04-26 11:02:23 +0100 | [diff] [blame] | 1 | #!/usr/bin/env bash |
| 2 | |
| 3 | # This script helps comparing two outputs from a specific test failure |
| 4 | # It is a very specialised script and should be used with care. |
| 5 | |
| 6 | syntax="$0 test-dir out-file [skip-pattern]" |
| 7 | if [[ $1 = '' ]]; then |
| 8 | echo $syntax |
| 9 | exit 1 |
| 10 | fi |
| 11 | test_dir=$1 |
| 12 | if [[ $2 = '' ]]; then |
| 13 | echo $syntax |
| 14 | exit 1 |
| 15 | fi |
| 16 | out=$2 |
| 17 | echo "Differences for $test_dir" > $out |
| 18 | echo "LEFT is expected, RIGHT is achieved" >> $out |
| 19 | echo "" >> $out |
| 20 | skip='' |
| 21 | if [[ $3 != '' ]]; then |
| 22 | skip=$3 |
| 23 | fi |
| 24 | |
| 25 | failures=`grep "TEST-FAIL:" $test_dir/test.log | cut -d " " -f 3 | sort -u` |
| 26 | if [[ $failures = '' ]]; then |
| 27 | echo "No failures" |
| 28 | exit 0 |
| 29 | fi |
| 30 | |
| 31 | for f in $failures; do |
| 32 | if [[ $skip != '' && `echo $f | grep $skip` != '' ]]; then |
| 33 | echo "Skipping $f" >> $out |
| 34 | continue |
| 35 | fi |
| 36 | echo "Processing $f" >> $out |
| 37 | dir=`dirname $f` |
| 38 | file=`basename $f` |
| 39 | cd $dir/Output |
| 40 | diff $file.out-nat $file.out-simple >> $out |
| 41 | done |