Skip to contentSkip to conversation

dtc: Remove some small bashisms from test scripts

PATCH Applied David Gibson 3 participants 3 messages May 29, 2008

lore
Share & tools
lore
#0 lore raw

Some of the helper scripts used to run testcases contain some constructs that are bashisms. Or at least which don't work on dash, the minimal shell used as /bin/sh on recent Ubuntu systems.

This patch removes these constructs so that the testsuite will pass "out of the box" on systems where /bin/sh is dash.

tests/dtc-checkfails.sh +1 -1
Index: dtc/tests/dtc-checkfails.sh
===================================================================
@@ -1,6 +1,6 @@
 #! /bin/sh
 
-. tests.sh
+. ./tests.sh
 
 for x; do
     shift
tests/dtc-fatal.sh +1 -1
Index: dtc/tests/dtc-fatal.sh
===================================================================
@@ -1,6 +1,6 @@
 #! /bin/sh
 
-. tests.sh
+. ./tests.sh
 
 verbose_run $VALGRIND "$DTC" -o/dev/null "$@"
 ret="$?"
tests/tests.sh +1 -1
Index: dtc/tests/tests.sh
===================================================================
@@ -23,7 +23,7 @@ verbose_run () {
 verbose_run_log () {
     LOG="$1"
     shift
-    "$@" &> "$LOG"
+    "$@" > "$LOG" 2>&1
     ret=$?
     if [ -z "$QUIET_TEST" ]; then
 	cat "$LOG" >&2
Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
#1 lore raw
Quoted 3 lines

Some of the helper scripts used to run testcases contain some constructs that are bashisms. Or at least which don't work on dash, the minimal shell used as /bin/sh on recent Ubuntu systems.

Both of these (the >& redirection, and "source" searching the current directory if the script isn't found in $PATH) are indeed bashisms.

This patch looks good to me.

Segher

Applied
#2 lore raw
In reply to David Gibson
Quoted 8 lines

Some of the helper scripts used to run testcases contain some constructs that are bashisms. Or at least which don't work on dash, the minimal shell used as /bin/sh on recent Ubuntu systems.

This patch removes these constructs so that the testsuite will pass "out of the box" on systems where /bin/sh is dash.

Applied.

jdl