ada: Error in prefix-notation call
[official-gcc.git] / contrib / test_recheck
blob193cd3df2a3cb376508636b59e776da5f0b4e9fd
1 #! /bin/sh
3 # (C) 2010 Free Software Foundation
4 # Written by Ralf Wildenhues <Ralf.Wildenhues@gmx.de>.
6 # This script is Free Software, and it can be copied, distributed and
7 # modified as defined in the GNU General Public License. A copy of
8 # its license can be downloaded from http://www.gnu.org/copyleft/gpl.html
10 PROGNAME=test_recheck
12 usage ()
14 cat <<EOF
15 Usage: $PROGNAME [-h] [-n] DIR|FILE.sum...
17 Rerun unsuccessful tests for testsuites below DIR or for FILE.sum.
19 -h display this help and exit
20 -n dry run, only show what would be run
21 EOF
22 exit $?
25 error ()
27 echo "$@" >&2
28 exit 1
31 dry=
32 for arg
34 case $arg in
35 -h | \?) usage ;;
36 -n) dry=:; shift ;;
37 -*) error "unknown argument $arg" ;;
38 *) break ;;
39 esac
40 done
41 test $# -gt 0 || usage
43 # Find a good awk.
44 if test -z "$AWK" ; then
45 for AWK in gawk nawk awk
47 if type $AWK 2>&1 | grep 'not found' > /dev/null 2>&1 ; then
49 else
50 break
52 done
55 : ${MAKE=make}
56 : ${filesuffix=}
57 cwd=`pwd`
58 files=`find "$@" -name \*.sum$filesuffix -print | grep testsuite | sort`
59 st=0
61 for file in $files; do
62 dir=`echo $file | sed 's,/[^/]*$,,'`
63 base=`echo $file | sed 's,.*/,,; s,\.sum$,,'`
64 flags=`$AWK '
65 /^Running .*\.exp \.\.\./ {
66 if (expfile != "" && tests != "")
67 printf (" %s=\"%s\"", expfile, tests)
68 expfile = $2
69 sub (/^[^ ]*\//, "", expfile)
70 sep = ""
71 tests = ""
73 /^(FAIL|XPASS|UNRESOLVED|WARNING|ERROR): / {
74 if (test != $2 "" && $2 != "" ) {
75 test = $2
76 tests = tests sep test
77 sep = " "
80 END {
81 if (expfile != "" && tests != "")
82 printf (" %s=\"%s\"", expfile, tests)
83 }' $file`
84 if test -n "$flags"; then
85 cd $dir
86 amflags=
87 if grep '^AM_RUNTESTFLAGS =' Makefile >/dev/null 2>&1; then
88 amflags=`echo 'print-runtestflags: ; @echo $(AM_RUNTESTFLAGS)' \
89 | ${MAKE} -s -f Makefile -f - print-runtestflags`
91 echo "(cd $dir && runtest $amflags --tool $base $flags)"
92 if test -z "$dry"; then
93 eval runtest --tool $base $flags || st=$?
95 cd "$cwd"
97 done
98 exit $st