glsl/glcpp/tests: reinstate srcdir/abs_builddir blurb
authorEmil Velikov <emil.velikov@collabora.com>
Tue, 24 Apr 2018 17:49:21 +0000 (18:49 +0100)
committerEmil Velikov <emil.l.velikov@gmail.com>
Thu, 21 Jun 2018 11:09:39 +0000 (12:09 +0100)
Bring back the "detection" of the said variables, to allow
standalone execution.

Fixes: db8cd8e36771 ("glcpp/tests: Convert shell scripts to a python
script")
Cc: Dylan Baker <dylan@pnwbakers.com>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
src/compiler/glsl/glcpp/tests/glcpp-test.sh

index 7ca8aa26a8767b8cd591fa8d268853f145109390..b8397ec89028957aa5137ae2476060115bd5ed87 100755 (executable)
@@ -1,3 +1,16 @@
 #!/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 ""
+
+    # Should point to `dirname Makefile.glsl.am`
+    srcdir=./../../../
+    cd `dirname "$0"`
+    # Should point to `dirname Makefile` equivalent to the above.
+    abs_builddir=`pwd`/../../../
+fi
+
 $PYTHON2 $srcdir/glsl/glcpp/tests/glcpp_test.py $abs_builddir/glsl/glcpp/glcpp $srcdir/glsl/glcpp/tests --unix --windows --oldmac --bizarro