[Mesa-dev] [PATCH] glx/tests: Fix bash-specific code in dispatch-index-check
emil.l.velikov at gmail.com
Sun Feb 26 18:37:59 UTC 2017
On 26 February 2017 at 13:51, Eric Engestrom <eric at engestrom.ch> wrote:
> On Friday, 2017-02-24 22:03:36 -0600, Aaron Watry wrote:
>> Using <<< for variable redirection is bash-specific behavior.
>> Ubuntu redirects sh -> dash, so this was erroring out.
>> Also, the initial error that led me to this was that srcdir is null when running make check
>> so I just copied something similar to what the optimization-test script does.
>> src/glx/tests/dispatch-index-check | 21 ++++++++++++++-------
>> 1 file changed, 14 insertions(+), 7 deletions(-)
>> diff --git a/src/glx/tests/dispatch-index-check b/src/glx/tests/dispatch-index-check
>> index 78464b8..ee1b9ee 100755
>> --- a/src/glx/tests/dispatch-index-check
>> +++ b/src/glx/tests/dispatch-index-check
>> @@ -1,24 +1,31 @@
>> +if [ -z "$srcdir" ]; then
>> + scriptdir=`dirname "$0"`
>> + scriptdir=$srcdir
>> # extract enum definition
>> dispatch_list=$(sed '/__GLXdispatchIndex/,/__GLXdispatchIndex/!d' \
>> - "$srcdir"/../g_glxglvnddispatchindices.h)
>> + "$scriptdir"/../g_glxglvnddispatchindices.h)
> No need to create a new var that just copies the old one :)
>> # extract values inside of enum
>> -dispatch_list=$(sed '1d;$d' <<< "$dispatch_list")
>> +dispatch_list=$(printf "$dispatch_list" | sed '1d;$d')
> Never use a variable you have no control over as the format string for
> printf! Use `printf '%s' "$var"` instead.
> I just pushed a1e5e55989 ("check: mark two tests are requiring bash")
> which fixes this by simply asking for bash in the shebang, which was
> what my original patch did, and was changed just before pushing because
> of a review comment that turned out to be wrong :)
Yes, my bad on that one - guess I shouldn't trust checkbashisms/zsh that much.
I won't object if we can make these tests 'generic' sh - patches welcome ;-)
More information about the mesa-dev