aboutsummaryrefslogtreecommitdiff
path: root/test-suite/compare_lnt_failures.sh
blob: 314fdd05d57283f615ee7f1300ff6cd1ea1bcb60 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/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