]> git.ipfire.org Git - thirdparty/gcc.git/blame - contrib/compare_tests
compareSumTests3: Changed to GPLv3.
[thirdparty/gcc.git] / contrib / compare_tests
CommitLineData
31e9c6ed
MS
1#!/bin/sh
2# This script automatically test the given tool with the tool's test cases,
3# reporting anything of interest.
4
112a0bfd
MS
5# exits with 0 if there is nothing of interest
6# exits with 1 if there is something interesting
31e9c6ed
MS
7# exits with 2 if an error occurred
8
9# Give two .sum files to compare them
10
11# Written by Mike Stump <mrs@cygnus.com>
12
112a0bfd
MS
13tool=gxx
14
31e9c6ed
MS
15tmp1=/tmp/$tool-testing.$$a
16tmp2=/tmp/$tool-testing.$$b
17now_s=/tmp/$tool-testing.$$d
18before_s=/tmp/$tool-testing.$$e
19
20if [ "$2" = "" ]; then
21 echo "Usage: $0 previous current" >&2
22 exit 2
23fi
24
e58b87f7
RE
25sed 's/^XFAIL/FAIL/; s/^XPASS/PASS/' < "$1" | awk '/^Running target / {target = $3} { if (target != "unix") { sub(/: /, "&"target": " ); }; print $0; }' >$tmp1
26sed 's/^XFAIL/FAIL/; s/^XPASS/PASS/' < "$2" | awk '/^Running target / {target = $3} { if (target != "unix") { sub(/: /, "&"target": " ); }; print $0; }' >$tmp2
31e9c6ed
MS
27
28before=$tmp1
29now=$tmp2
30
112a0bfd 31exit_status=0
31e9c6ed
MS
32trap "rm -f $tmp1 $tmp2 $now_s $before_s" 0 1 2 3 5 9 13 15
33
27b56ba6
PE
34if sort -k 2 </dev/null >/dev/null 2>&1; then
35 skip1='-k 2'
36else
37 skip1='+1'
38fi
39
40sort -t ':' $skip1 "$now" > "$now_s"
41sort -t ':' $skip1 "$before" > "$before_s"
31e9c6ed 42
112a0bfd
MS
43grep '^FAIL:' "$now_s" | sed 's/^[^:]*:[ ]//' >$tmp1
44grep '^PASS' "$before_s" | sed 's/^[^:]*:[ ]//' | comm -12 $tmp1 - >$tmp2
31e9c6ed
MS
45
46grep -s . $tmp2 >/dev/null
47if [ $? = 0 ]; then
48 echo "Tests that now fail, but worked before:"
49 echo
50 cat $tmp2
51 echo
112a0bfd 52 exit_status=1
31e9c6ed
MS
53fi
54
112a0bfd
MS
55grep '^PASS' "$now_s" | sed 's/^[^:]*:[ ]//' >$tmp1
56grep '^FAIL' "$before_s" | sed 's/^[^:]*:[ ]//' | comm -12 $tmp1 - >$tmp2
31e9c6ed
MS
57
58grep -s . $tmp2 >/dev/null
59if [ $? = 0 ]; then
60 echo "Tests that now work, but didn't before:"
61 echo
62 cat $tmp2
63 echo
64fi
65
112a0bfd
MS
66grep '^FAIL' "$now_s" | sed 's/^[^:]*:[ ]//' >$tmp1
67grep '^[PF]A[SI][SL]' "$before_s" | sed 's/^[^:]*:[ ]//' | comm -23 $tmp1 - >$tmp2
31e9c6ed
MS
68
69grep -s . $tmp2 >/dev/null
70if [ $? = 0 ]; then
71 echo "New tests that FAIL:"
72 echo
73 cat $tmp2
74 echo
112a0bfd 75 exit_status=1
31e9c6ed
MS
76fi
77
112a0bfd
MS
78grep '^PASS' "$now_s" | sed 's/^[^:]*:[ ]//' >$tmp1
79grep '^[PF]A[SI][SL]' "$before_s" | sed 's/^[^:]*:[ ]//' | comm -23 $tmp1 - >$tmp2
31e9c6ed
MS
80
81grep -s . $tmp2 >/dev/null
82if [ $? = 0 ]; then
83 echo "New tests that PASS:"
84 echo
85 cat $tmp2
86 echo
87fi
88
112a0bfd
MS
89grep '^[PF]A[SI][SL]' "$now_s" | sed 's/^[^:]*:[ ]//' >$tmp1
90grep '^PASS' "$before_s" | sed 's/^[^:]*:[ ]//' | comm -13 $tmp1 - >$tmp2
31e9c6ed
MS
91
92grep -s . $tmp2 >/dev/null
93if [ $? = 0 ]; then
94 echo "Old tests that passed, that have disappeared: (Eeek!)"
95 echo
96 cat $tmp2
97 echo
98fi
99
112a0bfd
MS
100grep '^[PF]A[SI][SL]' "$now_s" | sed 's/^[^:]*:[ ]//' >$tmp1
101grep '^FAIL' "$before_s" | sed 's/^[^:]*:[ ]//' | comm -13 $tmp1 - >$tmp2
31e9c6ed
MS
102
103grep -s . $tmp2 >/dev/null
104if [ $? = 0 ]; then
105 echo "Old tests that failed, that have disappeared: (Eeek!)"
106 echo
107 cat $tmp2
108 echo
109fi
112a0bfd
MS
110
111exit $exit_status