summaryrefslogtreecommitdiffstats
path: root/tests/ts/misc
diff options
context:
space:
mode:
authorRuediger Meier2016-03-07 09:20:59 +0100
committerRuediger Meier2016-03-07 23:36:42 +0100
commit0ab03906c1a97d474f431aa7e9d90174a36ed9a1 (patch)
treee4cf8bc60c651151f01f7e419599bd2034b86b2b /tests/ts/misc
parenttests: getopt2, add function gnu_getopt_clean() (diff)
downloadkernel-qcow2-util-linux-0ab03906c1a97d474f431aa7e9d90174a36ed9a1.tar.gz
kernel-qcow2-util-linux-0ab03906c1a97d474f431aa7e9d90174a36ed9a1.tar.xz
kernel-qcow2-util-linux-0ab03906c1a97d474f431aa7e9d90174a36ed9a1.zip
tests: improve getopt loop error case
Avoid exit 1 in test scripts. Simplify and complete redirection to TS_OUPUT. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Diffstat (limited to 'tests/ts/misc')
-rwxr-xr-xtests/ts/misc/getopt13
1 files changed, 7 insertions, 6 deletions
diff --git a/tests/ts/misc/getopt b/tests/ts/misc/getopt
index 715ec36ec..460f8a83b 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