mesa/src/glsl/tests/optimization-test
Paul Berry 659cdedb53 glsl: Add unit tests for lower_jumps.cpp
These tests invoke do_lower_jumps() in isolation (using the glsl_test
executable) and verify that it transforms the IR in the expected way.

The unit tests may be run from the top level directory using "make
check".

For reference, I've also checked in the Python script
create_test_cases.py, which was used to generate these tests.  It is
not necessary to run this script in order to run the tests.

Acked-by: Chad Versace <chad@chad-versace.us>
2011-07-22 09:45:11 -07:00

28 lines
582 B
Bash
Executable file

#!/bin/bash
total=0
pass=0
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 ./compare_ir "$test.expected" "$test.out" >/dev/null 2>&1; then
echo "PASS"
pass=$((pass+1))
else
echo "FAIL"
./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