From: Ruediger Meier Date: Mon, 7 Mar 2016 08:20:59 +0000 (+0100) Subject: tests: improve getopt loop error case X-Git-Tag: v2.28-rc1~41 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0ab03906c1a97d474f431aa7e9d90174a36ed9a1;p=thirdparty%2Futil-linux.git tests: improve getopt loop error case Avoid exit 1 in test scripts. Simplify and complete redirection to TS_OUPUT. Signed-off-by: Ruediger Meier --- diff --git a/tests/ts/misc/getopt b/tests/ts/misc/getopt index 715ec36ec3..460f8a83be 100755 --- a/tests/ts/misc/getopt +++ b/tests/ts/misc/getopt @@ -31,17 +31,18 @@ eval set -- "$TEMP" while true ; do case "$1" in - -a|--a-long) echo "Option a" >> $TS_OUTPUT 2>&1; shift ;; - -b|--b-long) echo "Option b, argument \`$2'" >> $TS_OUTPUT 2>&1; shift 2 ;; + -a|--a-long) echo "Option a"; shift ;; + -b|--b-long) echo "Option b, argument \`$2'"; shift 2 ;; -c|--c-long) case "$2" in - "") echo "Option c, no argument" >> $TS_OUTPUT 2>&1; shift 2 ;; - *) echo "Option c, argument \`$2'" >> $TS_OUTPUT 2>&1; shift 2 ;; + "") echo "Option c, no argument"; shift 2 ;; + *) echo "Option c, argument \`$2'"; shift 2 ;; esac ;; --) shift ; break ;; - *) echo "Internal error!" >> $TS_OUTPUT 2>&1; exit 1 ;; + *) echo "Internal error!"; break;; esac -done +done >> $TS_OUTPUT 2>&1 + echo "Remaining arguments:" >> $TS_OUTPUT 2>&1 for arg do echo '--> '"\`$arg'" >> $TS_OUTPUT 2>&1; done