summaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl/tests/optimization-test
diff options
context:
space:
mode:
authorEmil Velikov <[email protected]>2016-01-18 12:16:48 +0200
committerEmil Velikov <[email protected]>2016-01-26 16:08:33 +0000
commiteb63640c1d38a200a7b1540405051d3ff79d0d8a (patch)
treeda46321a41f309b1d02aeb14d5d5487791c45aeb /src/compiler/glsl/tests/optimization-test
parenta39a8fbbaa129f4e52f2a3ad2747182e9a74d910 (diff)
glsl: move to compiler/
Signed-off-by: Emil Velikov <[email protected]> Acked-by: Matt Turner <[email protected]> Acked-by: Jose Fonseca <[email protected]>
Diffstat (limited to 'src/compiler/glsl/tests/optimization-test')
-rwxr-xr-xsrc/compiler/glsl/tests/optimization-test42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/compiler/glsl/tests/optimization-test b/src/compiler/glsl/tests/optimization-test
new file mode 100755
index 00000000000..26a51be6980
--- /dev/null
+++ b/src/compiler/glsl/tests/optimization-test
@@ -0,0 +1,42 @@
+#!/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