[Mesa-dev] [PATCH 4/5] glsl: add warning-test

Alejandro PiƱeiro apinheiro at igalia.com
Tue May 10 07:13:28 UTC 2016


It executes compiler-glsl on all the available shaders, and it checks
that the outcome is the expected.

Bash code based on the already existing optimization-test
---
 src/compiler/Makefile.glsl.am         |  3 ++-
 src/compiler/glsl/tests/warnings-test | 31 +++++++++++++++++++++++++++++++
 2 files changed, 33 insertions(+), 1 deletion(-)
 create mode 100755 src/compiler/glsl/tests/warnings-test

diff --git a/src/compiler/Makefile.glsl.am b/src/compiler/Makefile.glsl.am
index daf98f6..645b94f 100644
--- a/src/compiler/Makefile.glsl.am
+++ b/src/compiler/Makefile.glsl.am
@@ -35,7 +35,8 @@ TESTS += glsl/glcpp/tests/glcpp-test			\
 	glsl/tests/general-ir-test			\
 	glsl/tests/optimization-test			\
 	glsl/tests/sampler-types-test			\
-	glsl/tests/uniform-initializer-test
+	glsl/tests/uniform-initializer-test             \
+	glsl/tests/warnings-test
 
 TESTS_ENVIRONMENT= \
 	export PYTHON2=$(PYTHON2); \
diff --git a/src/compiler/glsl/tests/warnings-test b/src/compiler/glsl/tests/warnings-test
new file mode 100755
index 0000000..7ec029b
--- /dev/null
+++ b/src/compiler/glsl/tests/warnings-test
@@ -0,0 +1,31 @@
+#!/usr/bin/env bash
+
+# Execute several shaders, and check that the InfoLog outcome is the expected.
+
+compiler=./glsl_compiler
+total=0
+pass=0
+
+echo "====== Testing compilation output ======"
+for test in `find . -iname '*.vert'`; do
+    echo -n "Testing $test..."
+    $compiler --just-log "$test" > "$test.out" 2>&1
+    total=$((total+1))
+    if diff "$test.expected" "$test.out" >/dev/null 2>&1; then
+        echo "PASS"
+        pass=$((pass+1))
+    else
+        echo "FAIL"
+        diff "$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
-- 
2.7.4



More information about the mesa-dev mailing list