]>
Commit | Line | Data |
---|---|---|
6c009867 RW |
1 | #! /bin/sh |
2 | ||
3 | # (C) 2010 Free Software Foundation | |
4 | # Written by Ralf Wildenhues <Ralf.Wildenhues@gmx.de>. | |
5 | ||
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 | |
9 | ||
10 | PROGNAME=test_recheck | |
11 | ||
12 | usage () | |
13 | { | |
14 | cat <<EOF | |
15 | Usage: $PROGNAME [-h] [-n] DIR|FILE.sum... | |
16 | ||
17 | Rerun unsuccessful tests for testsuites below DIR or for FILE.sum. | |
18 | ||
19 | -h display this help and exit | |
20 | -n dry run, only show what would be run | |
21 | EOF | |
22 | exit $? | |
23 | } | |
24 | ||
25 | error () | |
26 | { | |
27 | echo "$@" >&2 | |
28 | exit 1 | |
29 | } | |
30 | ||
31 | dry= | |
32 | for arg | |
33 | do | |
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 | |
42 | ||
43 | # Find a good awk. | |
44 | if test -z "$AWK" ; then | |
45 | for AWK in gawk nawk awk | |
46 | do | |
47 | if type $AWK 2>&1 | grep 'not found' > /dev/null 2>&1 ; then | |
48 | : | |
49 | else | |
50 | break | |
51 | fi | |
52 | done | |
53 | fi | |
54 | ||
55 | : ${MAKE=make} | |
56 | : ${filesuffix=} | |
57 | cwd=`pwd` | |
58 | files=`find "$@" -name \*.sum$filesuffix -print | grep testsuite | sort` | |
59 | st=0 | |
60 | ||
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 = "" | |
72 | } | |
73 | /^(FAIL|XPASS|UNRESOLVED|WARNING|ERROR): / { | |
74 | if (test != $2 "" && $2 != "" ) { | |
75 | test = $2 | |
76 | tests = tests sep test | |
77 | sep = " " | |
78 | } | |
79 | } | |
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` | |
90 | fi | |
91 | echo "(cd $dir && runtest $amflags --tool $base $flags)" | |
92 | if test -z "$dry"; then | |
93 | eval runtest --tool $base $flags || st=$? | |
94 | fi | |
95 | cd "$cwd" | |
96 | fi | |
97 | done | |
98 | exit $st |