]> git.cworth.org Git - glfps/commitdiff
Add simple test suite runner for glfps
authorCarl Worth <cworth@cworth.org>
Fri, 20 Sep 2013 22:38:11 +0000 (15:38 -0700)
committerCarl Worth <cworth@cworth.org>
Mon, 23 Sep 2013 14:09:50 +0000 (07:09 -0700)
This simply calls into the test suite of the fips project to take
advantage of all of its test.

glfps-test [new file with mode: 0755]

diff --git a/glfps-test b/glfps-test
new file mode 100755 (executable)
index 0000000..f424686
--- /dev/null
@@ -0,0 +1,64 @@
+#!/bin/sh
+
+FIPS_TEST_DIR=/home/cworth/src/fips/test
+
+if [ ! -d ${FIPS_TEST_DIR} ] ; then
+   echo "Failed to find fips test suite at: ${FIPS_TEST_DIR}"
+   echo "Please download fips and update this script to point to its test directory."
+   exit 1
+fi
+
+tests=0
+errors=0
+
+test ()
+{
+    script="$1"
+
+    tests=$((tests + 1))
+
+    if ${FIPS_TEST_DIR}/${script} | grep -q "^glfps"; then
+       printf "PASS\n"
+    else
+       printf "FAIL\n"
+       errors=$((errors + 1))
+    fi
+}
+
+echo "Testing glfps with programs using different window-system interfaces to"
+echo "OpenGL, different linking mechanisms, and different symbol-lookup."
+echo ""
+
+export LD_PRELOAD=./libglfps.so
+
+printf "       Window sys.     Link-mode       Lookup\n"
+printf "       -----------     -------------   -----------------\n"
+
+printf "Testing        GLX             link to libGL   direct calls            ... "
+test glx-link-call
+
+printf "Testing        GLX             link to libGL   glXGetProcAddress       ... "
+test glx-link-gpa
+
+printf "Testing        GLX             link to libGL   glXGetProcAddressARB    ... "
+test glx-link-gpaa
+
+printf "Testing        GLX             dlopen(libGL)   dlsym                   ... "
+test glx-dlopen-dlsym
+
+printf "Testing        GLX             dlopen(libGL)   glXGetProcAddress       ... "
+test glx-dlopen-gpa
+
+printf "Testing        GLX             dlopen(libGL)   glXGetProcAddressARB    ... "
+test glx-dlopen-gpaa
+
+echo ""
+
+if [ $errors -gt 0 ]; then
+    echo "Error: $errors/$tests tests failed."
+    exit 1
+else
+    echo "All $tests tests passed."
+    exit 0
+fi
+