Home | History | Annotate | Download | only in tests
      1 #!/usr/bin/env bash
      2 set -e
      3 
      4 if [ -z "$srcdir" ]
      5 then
      6   srcdir=$(dirname "$0")
      7 fi
      8 
      9 # extract enum definition
     10 dispatch_list=$(sed '/__GLXdispatchIndex/,/__GLXdispatchIndex/!d' \
     11   "$srcdir"/../g_glxglvnddispatchindices.h)
     12 
     13 # extract values inside of enum
     14 dispatch_list=$(sed '1d;$d' <<< "$dispatch_list")
     15 
     16 # remove indentation
     17 dispatch_list=$(sed 's/^\s\+//' <<< "$dispatch_list")
     18 
     19 # extract function names
     20 dispatch_list=$(sed 's/DI_//;s/,//' <<< "$dispatch_list")
     21 
     22 # same for commented functions, we want to keep them sorted too
     23 dispatch_list=$(sed 's#// ##;s/ implemented by [a-z]\+//' <<< "$dispatch_list")
     24 
     25 # remove LAST_INDEX, as it will not be in alphabetical order
     26 dispatch_list=$(sed '/LAST_INDEX/d' <<< "$dispatch_list")
     27 
     28 sorted=$(LC_ALL=C sort <<< "$dispatch_list")
     29 
     30 test "$dispatch_list" = "$sorted"
     31