aboutsummaryrefslogtreecommitdiff
path: root/contrib/compare_tests
blob: bed97429d6677ad03ea4ba90c49269c72ef7b75d (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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#!/bin/sh
# This script automatically test the given tool with the tool's test cases,
# reporting anything of interest.

# exits with 0 if there is nothing of interest
# exits with 1 if there is something interesting
# exits with 2 if an error occurred

# Give two .sum files to compare them

# Written by Mike Stump <mrs@cygnus.com>

tool=gxx

tmp1=/tmp/$tool-testing.$$a
tmp2=/tmp/$tool-testing.$$b
now_s=/tmp/$tool-testing.$$d
before_s=/tmp/$tool-testing.$$e

if [ "$2" = "" ]; then
	echo "Usage: $0 previous current" >&2
	exit 2
fi

sed 's/^XFAIL/FAIL/; s/^XPASS/PASS/' < "$1" | awk '/^Running target / {target = $3} { if (target != "unix") { sub(/: /, "&"target": " ); }; print $0; }' >$tmp1
sed 's/^XFAIL/FAIL/; s/^XPASS/PASS/' < "$2" | awk '/^Running target / {target = $3} { if (target != "unix") { sub(/: /, "&"target": " ); }; print $0; }' >$tmp2

before=$tmp1
now=$tmp2

exit_status=0
trap "rm -f $tmp1 $tmp2 $now_s $before_s" 0 1 2 3 5 9 13 15

if sort -k 2 </dev/null >/dev/null 2>&1; then
  skip1='-k 2'
else
  skip1='+1'
fi

sort -t ':' $skip1 "$now" > "$now_s"
sort -t ':' $skip1 "$before" > "$before_s"

grep '^FAIL:' "$now_s" | sed 's/^[^:]*:[ 	]//' >$tmp1
grep '^PASS' "$before_s" | sed 's/^[^:]*:[ 	]//' | comm -12 $tmp1 - >$tmp2

grep -s . $tmp2 >/dev/null
if [ $? = 0 ]; then
	echo "Tests that now fail, but worked before:"
	echo
	cat $tmp2
	echo
	exit_status=1
fi

grep '^PASS' "$now_s" | sed 's/^[^:]*:[ 	]//' >$tmp1
grep '^FAIL' "$before_s" | sed 's/^[^:]*:[ 	]//' | comm -12 $tmp1 - >$tmp2

grep -s . $tmp2 >/dev/null
if [ $? = 0 ]; then
	echo "Tests that now work, but didn't before:"
	echo
	cat $tmp2
	echo
fi

grep '^FAIL' "$now_s" | sed 's/^[^:]*:[ 	]//' >$tmp1
grep '^[PF]A[SI][SL]' "$before_s" | sed 's/^[^:]*:[ 	]//' | comm -23 $tmp1 - >$tmp2

grep -s . $tmp2 >/dev/null
if [ $? = 0 ]; then
	echo "New tests that FAIL:"
	echo
	cat $tmp2
	echo
	exit_status=1
fi

grep '^PASS' "$now_s" | sed 's/^[^:]*:[ 	]//' >$tmp1
grep '^[PF]A[SI][SL]' "$before_s" | sed 's/^[^:]*:[ 	]//' | comm -23 $tmp1 - >$tmp2

grep -s . $tmp2 >/dev/null
if [ $? = 0 ]; then
	echo "New tests that PASS:"
	echo
	cat $tmp2
	echo
fi

grep '^[PF]A[SI][SL]' "$now_s" | sed 's/^[^:]*:[ 	]//' >$tmp1
grep '^PASS' "$before_s" | sed 's/^[^:]*:[ 	]//' | comm -13 $tmp1 - >$tmp2

grep -s . $tmp2 >/dev/null
if [ $? = 0 ]; then
	echo "Old tests that passed, that have disappeared: (Eeek!)"
	echo
	cat $tmp2
	echo
fi

grep '^[PF]A[SI][SL]' "$now_s" | sed 's/^[^:]*:[ 	]//' >$tmp1
grep '^FAIL' "$before_s" | sed 's/^[^:]*:[ 	]//' | comm -13 $tmp1 - >$tmp2

grep -s . $tmp2 >/dev/null
if [ $? = 0 ]; then
	echo "Old tests that failed, that have disappeared: (Eeek!)"
	echo
	cat $tmp2
	echo
fi

exit $exit_status