| #!/usr/bin/env bash |
| |
| # This script helps comparing two outputs from a specific test failure |
| # It is a very specialised script and should be used with care. |
| |
| syntax="$0 test-dir out-file [skip-pattern]" |
| if [[ $1 = '' ]]; then |
| echo $syntax |
| exit 1 |
| fi |
| test_dir=$1 |
| if [[ $2 = '' ]]; then |
| echo $syntax |
| exit 1 |
| fi |
| out=$2 |
| echo "Differences for $test_dir" > $out |
| echo "LEFT is expected, RIGHT is achieved" >> $out |
| echo "" >> $out |
| skip='' |
| if [[ $3 != '' ]]; then |
| skip=$3 |
| fi |
| |
| failures=`grep "TEST-FAIL:" $test_dir/test.log | cut -d " " -f 3 | sort -u` |
| if [[ $failures = '' ]]; then |
| echo "No failures" |
| exit 0 |
| fi |
| |
| for f in $failures; do |
| if [[ $skip != '' && `echo $f | grep $skip` != '' ]]; then |
| echo "Skipping $f" >> $out |
| continue |
| fi |
| echo "Processing $f" >> $out |
| dir=`dirname $f` |
| file=`basename $f` |
| cd $dir/Output |
| diff $file.out-nat $file.out-simple >> $out |
| done |