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