From 177f1313850aa6f5a02df11efebfd3b874555cf7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?P=C3=A1draig=20Brady?=
Date: Sat, 16 Dec 2017 13:34:19 -0800 Subject: [PATCH] tests: fix recent regressions with dash * tests/misc/timeout.sh: dash outputs the "Killed" message to stderr rather than the terminal. * tests/misc/usage_vs_getopt.sh: dash doesn't yet support the POSIX proposed $'...' shell quoting syntax. --- tests/misc/timeout.sh | 3 ++- tests/misc/usage_vs_getopt.sh | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/misc/timeout.sh b/tests/misc/timeout.sh index 77d5998db8..268897171b 100755 --- a/tests/misc/timeout.sh +++ b/tests/misc/timeout.sh @@ -63,7 +63,8 @@ timeout: sending signal EXIT to command 'sleep' timeout: sending signal KILL to command 'sleep' EOF for opt in -v --verbose; do - timeout $opt -s0 -k .1 .1 sleep 10 2> err + timeout $opt -s0 -k .1 .1 sleep 10 2> errt + sed '/^Killed/d' < errt > err || framework_failure_ compare exp err || fail=1 done diff --git a/tests/misc/usage_vs_getopt.sh b/tests/misc/usage_vs_getopt.sh index 1d6cf92424..bcecbc562f 100755 --- a/tests/misc/usage_vs_getopt.sh +++ b/tests/misc/usage_vs_getopt.sh @@ -34,7 +34,7 @@ checkprg () { grep -F "$o" err || framework_failure_ sed -n "1s/--$o/OPT/p" < err > pat || framework_failure_ - # Append the pattern for a short unkown option. + # Append the pattern for a short unknown option. returns_ $rcexp $prg -/ >/dev/null 2> err || fail=1 grep -F "'/'" err || framework_failure_ sed -n "1s/'\/'/'OPT'/p" < err >> pat || framework_failure_ @@ -43,8 +43,10 @@ checkprg () { $prg --help > help || fail=1 # Extract all options mention in the above --help output. + nl=" + " sed -n -e '/--version/q' \ - -e 's/^ \{2,6\}-/-/; s/ .*//; s/[=[].*//; s/, /\'$'\n''/g; s/^-/-/p' help \ + -e 's/^ \{2,6\}-/-/; s/ .*//; s/[=[].*//; s/, /\'"$nl"'/g; s/^-/-/p' help \ > opts || framework_failure_ cat opts # for debugging purposes -- 2.47.2