1#!/bin/sh 2 3if [ -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`/../../ 14fi 15 16# Execute several shaders, and check that the InfoLog outcome is the expected. 17 18compiler=$abs_builddir/glsl_compiler 19total=0 20pass=0 21 22if [ ! -x "$compiler" ]; then 23 echo "Could not find glsl_compiler. Ensure that it is build via make check" 24 exit 1 25fi 26 27tests_relative_dir="glsl/tests/warnings" 28 29echo "====== Testing compilation output ======" 30for 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 `basename $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 43done 44 45if [ $total -eq 0 ]; then 46 echo "Could not find any tests." 47 exit 1 48fi 49 50echo "" 51echo "$pass/$total tests returned correct results" 52echo "" 53 54if [ $pass = $total ]; then 55 exit 0 56else 57 exit 1 58fi 59