mesa/src/glsl/tests/optimization-test
Connor Abbott a1d8322fbb glsl/tests: call create_test_cases.py in optimization-test
This way, when someone modifies create_test_cases.py and forgets to
commit their changes again, people will notice.

v2: make sure we parse the right directories and check for existance the
right way.

v3 (Ken): Use $PYTHON2 instead of calling python directly.

Signed-off-by: Connor Abbott <cwabbott0@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
2014-05-28 15:06:45 -07:00

42 lines
940 B
Bash
Executable file

#!/usr/bin/env bash
if [ ! -z "$srcdir" ]; then
compare_ir=`pwd`/tests/compare_ir
else
compare_ir=./compare_ir
fi
total=0
pass=0
echo "====== Generating tests ======"
for dir in tests/*/; do
if [ -e "${dir}create_test_cases.py" ]; then
cd $dir; $PYTHON2 create_test_cases.py; cd ..
fi
echo "$dir"
done
echo "====== Testing optimization passes ======"
for test in `find . -iname '*.opt_test'`; do
echo -n "Testing $test..."
(cd `dirname "$test"`; ./`basename "$test"`) > "$test.out" 2>&1
total=$((total+1))
if $PYTHON2 $PYTHON_FLAGS $compare_ir "$test.expected" "$test.out" >/dev/null 2>&1; then
echo "PASS"
pass=$((pass+1))
else
echo "FAIL"
$PYTHON2 $PYTHON_FLAGS $compare_ir "$test.expected" "$test.out"
fi
done
echo ""
echo "$pass/$total tests returned correct results"
echo ""
if [[ $pass == $total ]]; then
exit 0
else
exit 1
fi