3 if [ -z "$srcdir" -o -z "$abs_builddir" ]; then
5 echo "Warning: you're invoking the script manually and things may fail."
6 echo "Attempting to determine/set srcdir and abs_builddir variables."
9 # Should point to `dirname Makefile.glsl.am`
12 # Should point to `dirname Makefile` equivalent to the above.
13 abs_builddir
=`pwd`/..
/..
/..
/
16 testdir
=$srcdir/glsl
/glcpp
/tests
17 outdir
=$abs_builddir/glsl
/glcpp
/tests
18 glcpp
=$abs_builddir/glsl
/glcpp
/glcpp
20 trap 'rm $test.valgrind-errors; exit 1' INT QUIT
25 Usage: glcpp [options...]
27 Run the test suite for mesa's GLSL pre-processor.
29 Valid options include:
31 --testdir=<DIR> Use tests in the given <DIR> (default is ".")
32 --valgrind Run the test suite a second time under valgrind
40 tr "\r" "\n" < "$test" |
grep 'glcpp-args:' |
sed -e 's,^.*glcpp-args: *,,'
43 # Parse command-line options
54 testdir
="${option#--testdir=}"
55 outdir
="${outdir}/${option#--testdir=}"
58 echo "Unrecognized option: $option" >&2
72 echo "====== Testing for correctness ======"
73 for test in $testdir/*.c
; do
74 out
=$outdir/${test##*/}.out
76 printf "Testing `basename $test`... "
77 $glcpp $
(test_specific_args
$test) < $test > $out 2>&1
79 if cmp $test.expected
$out >/dev
/null
2>&1; then
84 diff -u $test.expected
$out
89 echo "$pass/$total tests returned correct results"
92 if [ "$do_valgrind" = "yes" ]; then
93 echo "====== Testing for valgrind cleanliness ======"
94 for test in $testdir/*.c
; do
95 printf "Testing `basename $test` with valgrind..."
96 valgrind
--error-exitcode=31 --log-file=$test.valgrind-errors
$glcpp $
(test_specific_args
$test) < $test >/dev
/null
2>&1
97 if [ "$?" = "31" ]; then
99 cat $test.valgrind-errors
103 rm $test.valgrind-errors
108 echo "$pass/$total tests returned correct results"
109 echo "$clean/$total tests are valgrind-clean"
112 if [ "$pass" = "$total" ] && [ "$do_valgrind" != "yes" ] ||
[ "$pass" = "$total" ]; then