add gnash_la_CPPFLAGS to see if it makes distcheck happy
[gnash.git] / testsuite / generic-testrunner.sh
blob4cf362f57a88dc303f7b5eb333236f0c146d0119
1 #!/bin/sh
3 #
4 # Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
5 #
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 3 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 runs=1
21 advances=0
22 delay=1 # milliseconds between advances
23 endtagpat=
24 endtagexp=""
26 while getopts r:f:c:C:d: name; do
27 case $name in
28 r) runs="$OPTARG" ;;
29 f) advances="$OPTARG" ;;
30 c) endtagpat="$OPTARG" ;;
31 C) endtagpat="$OPTARG"; endtagexp=X ;;
32 d) delay="$OPTARG" ;;
35 echo "Usage: $0 [-r <runs>] [-f <advances>] [-c <string>] <swf> ..."
36 echo " -r <runs> : allow for <runs> jump-backs"
37 echo " -f <advances> : only advance <advances> times"
38 echo " -c <pattern> : verify that the test ends with a trace matching <pattern>, or print a failure"
39 echo " -C <pattern> : same as -c <pattern> but a failure is expected"
40 } >&2
41 exit 1;;
42 esac
43 done
44 shift $(($OPTIND - 1))
46 top_builddir=$1
47 shift
48 testfiles=$@
50 echo "#!/bin/sh"
51 echo
53 echo "# Environment"
54 env | grep GNASH | while read REPLY; do
55 echo "export ${REPLY}"
56 done
58 cat << EOF
60 for t in ${testfiles}; do
61 #outlog=\${t}.output.\$$
62 outlog=${top_builddir}/testoutlog.\$$
63 echo "NOTE: Running test \${t}"
65 exec > \${outlog}
66 ${top_builddir}/utilities/gprocessor -d${delay} -r${runs} -f${advances} -v \${t} || echo "FAILED: gprocessor returned an error while playing '\${t}'"
68 cat \${outlog}
69 if test "x${endtagpat}" != x; then
70 lasttrace=\`grep TRACE \${outlog} | tail -1 | sed 's/.*TRACE: //'\`
71 if ! expr "\${lasttrace}" : '${endtagpat}' > /dev/null; then
72 echo "${endtagexp}FAILED: consistency check: last trace from run of test \${t} (\${lasttrace}) doesn't match pattern (${endtagpat})"
73 else
74 echo "${endtagexp}PASSED: consistency check: last trace from run of test \${t} (\${lasttrace}) matches pattern (${endtagpat})"
77 rm \${outlog}
78 done
79 EOF