summaryrefslogtreecommitdiffstats
path: root/src/glx
diff options
context:
space:
mode:
authorEric Engestrom <[email protected]>2017-02-21 16:49:25 +0000
committerEric Engestrom <[email protected]>2017-02-24 14:44:58 +0000
commit3cc33e7640114de3ea3f0618385fdd0ddffef13f (patch)
tree11edae525c5c58a79d51aefc0e0d387d5a44990b /src/glx
parentcaf4252a01dc95fbc47e8a50988040f67396b278 (diff)
glx: add GLXdispatchIndex sort check
Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
Diffstat (limited to 'src/glx')
-rw-r--r--src/glx/tests/Makefile.am2
-rwxr-xr-xsrc/glx/tests/dispatch-index-check24
2 files changed, 25 insertions, 1 deletions
diff --git a/src/glx/tests/Makefile.am b/src/glx/tests/Makefile.am
index bdc78c0d5af..8874c20b010 100644
--- a/src/glx/tests/Makefile.am
+++ b/src/glx/tests/Makefile.am
@@ -12,7 +12,7 @@ AM_CPPFLAGS = \
$(LIBDRM_CFLAGS) \
$(X11_INCLUDES)
-TESTS = glx-test
+TESTS = glx-test dispatch-index-check
check_PROGRAMS = glx-test
glx_test_SOURCES = \
diff --git a/src/glx/tests/dispatch-index-check b/src/glx/tests/dispatch-index-check
new file mode 100755
index 00000000000..78464b83051
--- /dev/null
+++ b/src/glx/tests/dispatch-index-check
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+# 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"