summaryrefslogtreecommitdiffstats
path: root/src/glsl/tests/optimization-test
diff options
context:
space:
mode:
authorPaul Berry <stereotype441@gmail.com>2011-07-05 11:52:06 -0700
committerPaul Berry <stereotype441@gmail.com>2011-07-22 09:45:11 -0700
commit659cdedb532e675da5676d40ee39278aadd8f0a1 (patch)
tree75e5affe4434d782ab50ed5fb2591d65ff868925 /src/glsl/tests/optimization-test
parentf1f76e157ed1ba554fc3a0172113997344049e07 (diff)
downloadexternal_mesa3d-659cdedb532e675da5676d40ee39278aadd8f0a1.zip
external_mesa3d-659cdedb532e675da5676d40ee39278aadd8f0a1.tar.gz
external_mesa3d-659cdedb532e675da5676d40ee39278aadd8f0a1.tar.bz2
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>
Diffstat (limited to 'src/glsl/tests/optimization-test')
-rwxr-xr-xsrc/glsl/tests/optimization-test28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/glsl/tests/optimization-test b/src/glsl/tests/optimization-test
new file mode 100755
index 0000000..0c130be
--- /dev/null
+++ b/src/glsl/tests/optimization-test
@@ -0,0 +1,28 @@
+#!/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