blob: 314fdd05d57283f615ee7f1300ff6cd1ea1bcb60 [file] [log] [blame]
Renato Golin94cc1042016-04-26 11:02:23 +01001#!/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
6syntax="$0 test-dir out-file [skip-pattern]"
7if [[ $1 = '' ]]; then
8 echo $syntax
9 exit 1
10fi
11test_dir=$1
12if [[ $2 = '' ]]; then
13 echo $syntax
14 exit 1
15fi
16out=$2
17echo "Differences for $test_dir" > $out
18echo "LEFT is expected, RIGHT is achieved" >> $out
19echo "" >> $out
20skip=''
21if [[ $3 != '' ]]; then
22 skip=$3
23fi
24
25failures=`grep "TEST-FAIL:" $test_dir/test.log | cut -d " " -f 3 | sort -u`
26if [[ $failures = '' ]]; then
27 echo "No failures"
28 exit 0
29fi
30
31for 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
41done