glsl/tests/optimization-test: add fallback srcdir/abs_builddir defines
authorEmil Velikov <emil.velikov@collabora.com>
Thu, 23 Feb 2017 14:27:08 +0000 (14:27 +0000)
committerEmil Velikov <emil.l.velikov@gmail.com>
Tue, 28 Mar 2017 14:31:23 +0000 (15:31 +0100)
There is no robust way to detect either one, so simply hope for the best
and warn just in case.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
src/compiler/glsl/tests/optimization-test.sh

index 7410db64f147c1e1ea746903e9deb239f2cd03bd..a7d771170c5f1873f0af23289729c8032a750389 100755 (executable)
@@ -16,6 +16,19 @@ if [ $? -ne 0 ]; then
     exit 1
 fi
 
+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 the folder two levels above glsl_test
+    abs_builddir=`pwd`/../../
+fi
+
 total=0
 pass=0