On Thursday, 2017-02-23 16:43:10 +0000, Emil Velikov wrote: > From: Emil Velikov <emil.veli...@collabora.com> > > At the moment things are completely bonkers (as can be seen from last > commit). Regardless if we run the test as part of "make check" or > standalone the most of the paths are wrong. > > Untangle things by issuing "cd `dirname "$0`" and working from there. > Otherwise it's nearly impossible to consider all the permutations one > can use while running outside of "make check" > > Clearly document the variables and the intended behaviour. > > Signed-off-by: Emil Velikov <emil.veli...@collabora.com> > --- > We really want to cut down all the crazy design here. Dylan ? > > sh script which executes a python one, with the latter creating a bunch > of sh ones and hardcoding binary location. Then call the generated sh > scripts, to create the tested OP files. Now compare the expected vs the > tested via another python script which decodes [in to a temporary file] > and calls "diff" to compare them. > --- > src/compiler/glsl/tests/optimization-test | 22 +++++++++++++++++----- > 1 file changed, 17 insertions(+), 5 deletions(-) > > diff --git a/src/compiler/glsl/tests/optimization-test > b/src/compiler/glsl/tests/optimization-test > index d84b83cfaa..e851e13bfb 100755 > --- a/src/compiler/glsl/tests/optimization-test > +++ b/src/compiler/glsl/tests/optimization-test > @@ -1,10 +1,18 @@ > #!/usr/bin/env bash > > -if [ ! -z "$srcdir" ]; then > - compare_ir=`pwd`/tests/compare_ir > -else > - compare_ir=./compare_ir > +# The srcdir variable must point to the location where the Makefile.am or > +# Makefile.glsl.am in particular is. Even if we execute this test manually. > + > +if [ -z "$srcdir" ]; then > + srcdir=./../../ > + > + # In the manual invokation case, we must CD otherwise we cannot manage > all > + # the permutations of our scripts which calls a script to create a script > + # then execute the script design. > + cd `dirname "$0"` > + > fi > +compare_ir=$srcdir/glsl/tests/compare_ir
Like I said in the other email, I think if someone wants to run the checks manually, they can be expected to set $srcdir correctly. Bailing out when it's unset would be good enough IMHO. > > if [ -z "$PYTHON2" ]; then > PYTHON2=python2 > @@ -20,10 +28,13 @@ total=0 > pass=0 > has_tests=0 > > +# Store our location before we start diving into subdirectories. > +ORIGDIR=`pwd` How about pushd/popd instead? > echo "====== Generating tests ======" > -for dir in tests/*/; do > +for dir in $srcdir/glsl/tests/*/; do > if [ -e "${dir}create_test_cases.py" ]; then > cd $dir; > + echo found Guessing this line can go? :) > $PYTHON2 create_test_cases.py > if [ "x$?" = x0 ]; then > has_tests=1 > @@ -32,6 +43,7 @@ for dir in tests/*/; do > fi > echo "$dir" > done > +cd "$ORIGDIR" > > if [ "x$has_tests" = x0 ]; then > echo "Could not generate any tests." > -- > 2.11.0 > _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev