Mesa (master): glsl/glcpp: Fix glcpp-test to correctly extract test-specific arguments

Ian Romanick idr at kemper.freedesktop.org
Thu Aug 7 23:08:47 UTC 2014


Module: Mesa
Branch: master
Commit: 7ba74c65a77afbfb2da8515fcae51c19618c7b18
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=7ba74c65a77afbfb2da8515fcae51c19618c7b18

Author: Carl Worth <cworth at cworth.org>
Date:   Wed Jul  2 22:58:57 2014 -0700

glsl/glcpp: Fix glcpp-test to correctly extract test-specific arguments

The (optional) test-specific command-line arguments to be passed to glcpp are
embedded within the source files of some tests, and glcpp-test uses grep to
extract them.

Of course, grep is line-based and looks for the native line-separator to
determine line boundaries. So, for files using non-native line separators,
grep was getting quite confused and passing bogus arguments to glcpp.

Fix this by canonical-izing the line separators in the source file prior to
using grep.

With this commit, the glcpp-test-cr-lf tests pass entirely:

	\r:	143/143 tests pass
	\r\n:	143/143 tests pass
	\n\r:	143/143 tests pass

Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

---

 src/glsl/glcpp/tests/glcpp-test |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/glsl/glcpp/tests/glcpp-test b/src/glsl/glcpp/tests/glcpp-test
index 9bf7bdb..640f576 100755
--- a/src/glsl/glcpp/tests/glcpp-test
+++ b/src/glsl/glcpp/tests/glcpp-test
@@ -28,7 +28,7 @@ test_specific_args ()
 {
     test="$1"
 
-    grep 'glcpp-args:' "$test" | sed -e 's,^.*glcpp-args: *,,'
+    tr "\r" "\n" < "$test" | grep 'glcpp-args:' | sed -e 's,^.*glcpp-args: *,,'
 }
 
 # Parse command-line options




More information about the mesa-commit mailing list