[Mesa-dev] [PATCH v2 01/12] glsl/tests: reimplement warnings-test in python

Dylan Baker dylan at pnwbakers.com
Tue Apr 10 20:13:59 UTC 2018


Quoting Eric Anholt (2018-04-10 10:50:32)
> Dylan Baker <dylan at pnwbakers.com> writes:
> 
> > This reimplements the test in python with a shell script wrapper that
> > allows autotools to continue to run the test without realizing that
> > anything has changed.
> >
> > Using python has two advantages, first it's portable so this test can be
> > run on windows as well as Linux since it just requires python, no more
> > diff, pwd or sh. It's also no longer tied to autotools implementation
> > details, like the environment variables $srcdir and $abs_builddir,
> > though the autotools shell wrapper still uses those, which makes it
> > possible to run the test in meson.
> >
> > Signed-off-by: Dylan Baker <dylan.c.baker at intel.com>
> > ---
> >  src/compiler/glsl/tests/warnings-test.sh | 57 +-------------------
> >  src/compiler/glsl/tests/warnings_test.py | 74 +++++++++++++++++++++++++-
> >  2 files changed, 75 insertions(+), 56 deletions(-)
> >  create mode 100755 src/compiler/glsl/tests/warnings_test.py
> >
> > diff --git a/src/compiler/glsl/tests/warnings-test.sh b/src/compiler/glsl/tests/warnings-test.sh
> > index d5dc3b5..debd6fd 100755
> > --- a/src/compiler/glsl/tests/warnings-test.sh
> > +++ b/src/compiler/glsl/tests/warnings-test.sh
> > @@ -1,58 +1,3 @@
> >  #!/bin/sh
> >  
> > -if [ -z "$srcdir" -o -z "$abs_builddir" ]; then
> > -    echo ""
> > -    echo "Warning: you're invoking the script manually and things may fail."
> > -    echo "Attempting to determine/set srcdir and abs_builddir variables."
> > -    echo ""
> > -
> > -    # Variable should point to the Makefile.glsl.am
> > -    srcdir=./../../
> > -    cd `dirname "$0"`
> > -    # Variable should point to glsl_compiler
> > -    abs_builddir=`pwd`/../../
> > -fi
> > -
> > -# Execute several shaders, and check that the InfoLog outcome is the expected.
> > -
> > -compiler=$abs_builddir/glsl_compiler
> > -total=0
> > -pass=0
> > -
> > -if [ ! -x "$compiler" ]; then
> > -    echo "Could not find glsl_compiler. Ensure that it is build via make check"
> > -    exit 1
> > -fi
> > -
> > -tests_relative_dir="glsl/tests/warnings"
> > -
> > -echo "====== Testing compilation output ======"
> > -for test in $srcdir/$tests_relative_dir/*.vert; do
> > -    test_output="$abs_builddir/$tests_relative_dir/`basename $test`"
> > -    mkdir -p $abs_builddir/$tests_relative_dir/
> > -    echo -n "Testing `basename $test`..."
> > -    $compiler --just-log --version 150 "$test" > "$test_output.out" 2>&1
> > -    total=$((total+1))
> > -    if diff "$test.expected" "$test_output.out" >/dev/null 2>&1; then
> > -        echo "PASS"
> > -        pass=$((pass+1))
> > -    else
> > -        echo "FAIL"
> > -        diff "$test.expected" "$test_output.out"
> > -    fi
> > -done
> > -
> > -if [ $total -eq 0 ]; then
> > -    echo "Could not find any tests."
> > -    exit 1
> > -fi
> > -
> > -echo ""
> > -echo "$pass/$total tests returned correct results"
> > -echo ""
> > -
> > -if [ $pass = $total ]; then
> > -    exit 0
> > -else
> > -    exit 1
> > -fi
> > +$srcdir/glsl/tests/warnings_test.py --glsl-compiler $abs_builddir/glsl_compiler --test-directory $srcdir/glsl/tests/warnings/
> 
> The other instance we have of calling python from a .sh
> (optimization-test.sh) uses $PYTHON2 for the invocation.  Should we do
> that here, too?

Sure, it's good to be consistent, so I've changed this locally.

> Other than that, r-b.

Thanks!

Dylan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: signature
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180410/0517ca95/attachment.sig>


More information about the mesa-dev mailing list