summaryrefslogtreecommitdiff
path: root/lib/mesa/src/glx/tests
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2017-08-14 09:45:54 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2017-08-14 09:45:54 +0000
commit4c58069f5013f0a621503525f7d5193bfe9976b3 (patch)
treebd8f8a08b889e9a8b99c9de01ae12459d527ea6d /lib/mesa/src/glx/tests
parent5caa025e6b62d0456faad86c89f239a14d1eaadb (diff)
Import Mesa 17.1.6
Diffstat (limited to 'lib/mesa/src/glx/tests')
-rw-r--r--lib/mesa/src/glx/tests/Makefile.am3
-rwxr-xr-xlib/mesa/src/glx/tests/dispatch-index-check30
2 files changed, 32 insertions, 1 deletions
diff --git a/lib/mesa/src/glx/tests/Makefile.am b/lib/mesa/src/glx/tests/Makefile.am
index bdc78c0d5..a41759b86 100644
--- a/lib/mesa/src/glx/tests/Makefile.am
+++ b/lib/mesa/src/glx/tests/Makefile.am
@@ -12,8 +12,9 @@ AM_CPPFLAGS = \
$(LIBDRM_CFLAGS) \
$(X11_INCLUDES)
-TESTS = glx-test
+TESTS = glx-test dispatch-index-check
check_PROGRAMS = glx-test
+EXTRA_DIST = dispatch-index-check
glx_test_SOURCES = \
clientinfo_unittest.cpp \
diff --git a/lib/mesa/src/glx/tests/dispatch-index-check b/lib/mesa/src/glx/tests/dispatch-index-check
new file mode 100755
index 000000000..d1d073134
--- /dev/null
+++ b/lib/mesa/src/glx/tests/dispatch-index-check
@@ -0,0 +1,30 @@
+#!/usr/bin/env bash
+set -e
+
+if [ -z "$srcdir" ]
+then
+ srcdir=$(dirname "$0")
+fi
+
+# extract enum definition
+dispatch_list=$(sed '/__GLXdispatchIndex/,/__GLXdispatchIndex/!d' \
+ "$srcdir"/../g_glxglvnddispatchindices.h)
+
+# extract values inside of enum
+dispatch_list=$(sed '1d;$d' <<< "$dispatch_list")
+
+# remove indentation
+dispatch_list=$(sed 's/^\s\+//' <<< "$dispatch_list")
+
+# extract function names
+dispatch_list=$(sed 's/DI_//;s/,//' <<< "$dispatch_list")
+
+# same for commented functions, we want to keep them sorted too
+dispatch_list=$(sed 's#// ##;s/ implemented by [a-z]\+//' <<< "$dispatch_list")
+
+# remove LAST_INDEX, as it will not be in alphabetical order
+dispatch_list=$(sed '/LAST_INDEX/d' <<< "$dispatch_list")
+
+sorted=$(LC_ALL=C sort <<< "$dispatch_list")
+
+test "$dispatch_list" = "$sorted"