glsl/tests/warnings-test: error if zero tests were executed
[mesa.git] / src / compiler / glsl / tests / warnings-test.sh
1 #!/bin/sh
2
3 if [ -z "$srcdir" -o -z "$abs_builddir" ]; then
4 echo ""
5 echo "Warning: you're invoking the script manually and things may fail."
6 echo "Attempting to determine/set srcdir and abs_builddir variables."
7 echo ""
8
9 # Variable should point to the Makefile.glsl.am
10 srcdir=./../../
11 cd `dirname "$0"`
12 # Variable should point to glsl_compiler
13 abs_builddir=`pwd`/../../
14 fi
15
16 # Execute several shaders, and check that the InfoLog outcome is the expected.
17
18 compiler=$abs_builddir/glsl_compiler
19 total=0
20 pass=0
21
22 if [ ! -x "$compiler" ]; then
23 echo "Could not find glsl_compiler. Ensure that it is build via make check"
24 exit 1
25 fi
26
27 tests_relative_dir="glsl/tests/warnings"
28
29 echo "====== Testing compilation output ======"
30 for test in $srcdir/$tests_relative_dir/*.vert; do
31 test_output="$abs_builddir/$tests_relative_dir/`basename $test`"
32 mkdir -p $abs_builddir/$tests_relative_dir/
33 echo -n "Testing $test..."
34 $compiler --just-log --version 150 "$test" > "$test_output.out" 2>&1
35 total=$((total+1))
36 if diff "$test.expected" "$test_output.out" >/dev/null 2>&1; then
37 echo "PASS"
38 pass=$((pass+1))
39 else
40 echo "FAIL"
41 diff "$test.expected" "$test_output.out"
42 fi
43 done
44
45 if [ $total -eq 0 ]; then
46 echo "Could not find any tests."
47 exit 1
48 fi
49
50 echo ""
51 echo "$pass/$total tests returned correct results"
52 echo ""
53
54 if [ $pass = $total ]; then
55 exit 0
56 else
57 exit 1
58 fi