tests: avoid spurious failure of 't/vala-vapi.sh' on OpenIndiana
authorStefano Lattarini <stefano.lattarini@gmail.com>
Sat, 4 Aug 2012 18:38:31 +0000 (20:38 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Sat, 4 Aug 2012 19:22:53 +0000 (21:22 +0200)
* t/vala-vapi.sh: Use 'printf', not 'echo', to print strings containing
substrings like '\n', that can be interpreted like escape strings.  That
because the /bin/sh and the /bin/bash shell from OpenIndiana actually
interpret them that way:

  $ /bin/sh -c 'echo "foo\nbar"'
  foo
  bar
  $ /bin/bash -c 'echo "foo\nbar"'
  foo
  bar

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
t/vala-vapi.sh

index 1862b71..2f332da 100755 (executable)
@@ -40,7 +40,9 @@ int main ()
 }
 END
 
-echo '#define BARBAR "Zardoz!\n"' > foo.h
+# Use printf, not echo, to avoid '\n' being considered and escape
+# sequence and printed as a newline in 'foo.h'.
+printf '%s\n' '#define BARBAR "Zardoz!\n"' > foo.h
 
 cat > foo.vapi <<'END'
 [CCode (cprefix="", lower_case_cprefix="", cheader_filename="foo.h")]
@@ -74,7 +76,9 @@ cross_compiling || $MAKE test1 || exit 1
 
 # Simple check on remake rules.
 $sleep
-echo '#define BAZBAZ "Quux!\n"' > foo.h
+# Use printf, not echo, to avoid '\n' being considered and escape
+# sequence and printed as a newline in 'foo.h'.
+printf '%s\n' '#define BAZBAZ "Quux!\n"' > foo.h
 sed 's/BARBAR/BAZBAZ/' zardoz.vala > t && mv -f t zardoz.vala || exit 99
 $MAKE && exit 1
 sed 's/BARBAR/BAZBAZ/' foo.vapi > t && mv -f t foo.vapi || exit 99