[Mesa-dev] [PATCH v2 22/23] glcpp/tests/glcpp-test-cr-lf: correctly set/use srcdir/abs_builddir
Emil Velikov
emil.l.velikov at gmail.com
Fri Mar 17 13:19:48 UTC 2017
From: Emil Velikov <emil.velikov at collabora.com>
Otherwise manual invokation of the script from elsewhere than
`dirname $0` will fail.
With these all the artefacts should be created in the correct location,
and thus we can remove the old (and slighly strange) clean-local line.
Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
---
src/compiler/Makefile.glsl.am | 1 -
src/compiler/glsl/glcpp/tests/glcpp-test-cr-lf.sh | 31 +++++++++++++----------
2 files changed, 17 insertions(+), 15 deletions(-)
diff --git a/src/compiler/Makefile.glsl.am b/src/compiler/Makefile.glsl.am
index 64572785610..8b19fe66396 100644
--- a/src/compiler/Makefile.glsl.am
+++ b/src/compiler/Makefile.glsl.am
@@ -254,7 +254,6 @@ clean-local:
$(RM) -r glsl/tests/warnings/*.out
$(RM) -r glsl/glcpp/tests/*.out
$(RM) -r glsl/glcpp/tests/subtest*/
- $(RM) -r subtest-cr subtest-cr-lf subtest-lf subtest-lf-cr
dist-hook:
$(RM) glsl/glcpp/tests/*.out
diff --git a/src/compiler/glsl/glcpp/tests/glcpp-test-cr-lf.sh b/src/compiler/glsl/glcpp/tests/glcpp-test-cr-lf.sh
index 6a77a6e6663..f0043adba10 100755
--- a/src/compiler/glsl/glcpp/tests/glcpp-test-cr-lf.sh
+++ b/src/compiler/glsl/glcpp/tests/glcpp-test-cr-lf.sh
@@ -1,18 +1,21 @@
#!/bin/sh
-# The build system runs this test from a different working directory, and may
-# be in a build directory entirely separate from the source. So if the
-# "srcdir" variable is set, we must use it to locate the test files and the
-# glcpp-test script.
-
-if [ ! -z "$srcdir" ]; then
- testdir="$srcdir/glsl/glcpp/tests"
- glcpp_test="$srcdir/glsl/glcpp/tests/glcpp-test.sh"
-else
- testdir=.
- glcpp_test=./glcpp-test.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
+testdir="$srcdir/glsl/glcpp/tests"
+glcpp_test="$srcdir/glsl/glcpp/tests/glcpp-test.sh"
+
total=0
pass=0
@@ -99,7 +102,7 @@ mkdir subtest-cr
for file in "$testdir"/*.c; do
base=$(basename "$file")
tr "\n" "\r" < "$file" > subtest-cr/"$base"
- cp `pwd`/glsl/glcpp/tests/subtest-lf/"$base".out subtest-cr/"$base".expected
+ cp $abs_builddir/glsl/glcpp/tests/subtest-lf/"$base".out subtest-cr/"$base".expected
done
run_test "${glcpp_test} --testdir=subtest-cr"
@@ -112,7 +115,7 @@ mkdir subtest-cr-lf
for file in "$testdir"/*.c; do
base=$(basename "$file")
sed -e 's/$/
/' < "$file" > subtest-cr-lf/"$base"
- cp `pwd`/glsl/glcpp/tests/subtest-lf/"$base".out subtest-cr-lf/"$base".expected
+ cp $abs_builddir/glsl/glcpp/tests/subtest-lf/"$base".out subtest-cr-lf/"$base".expected
done
run_test "${glcpp_test} --testdir=subtest-cr-lf"
@@ -125,7 +128,7 @@ mkdir subtest-lf-cr
for file in "$testdir"/*.c; do
base=$(basename "$file")
sed -e 's/$/
/' < "$file" | tr "\n\r" "\r\n" > subtest-lf-cr/"$base"
- cp `pwd`/glsl/glcpp/tests/subtest-lf/"$base".out subtest-lf-cr/"$base".expected
+ cp $abs_builddir/glsl/glcpp/tests/subtest-lf/"$base".out subtest-lf-cr/"$base".expected
done
run_test "${glcpp_test} --testdir=subtest-lf-cr"
--
2.11.1
More information about the mesa-dev
mailing list