merge back enhancements from Thomas

This commit is contained in:
George Danchev
2011-07-15 06:08:29 +00:00
parent f904a29561
commit b9c439f2c9
4 changed files with 218 additions and 433 deletions

View File

@ -1,11 +1,13 @@
# Copyright 2011 George Danchev <danchev@spnet.net>
# Licensed under GNU GPL version 2
# Copyright 2011 Thomas Schmitt <scdbackup@gmx.net>
# Licensed under GNU GPL version 2 or later
SELF=$(basename $0)
RELENG_XORRISO=0
KEEP=0
SIMULATE_FAILURE=0
CLEANUP=1
RELENG_PRINTED_HELP=0
START_DIR_DONT_CHANGE=`pwd`
GEN_DATA_DIR=releng_generated_data/${SELF}
@ -14,12 +16,15 @@ GEN_DATA_DIR=releng_generated_data/${SELF}
print_help() {
cat << EOF
Usage: $SELF -x path/to/xorriso [-k0|1] [-f0|1] [-h]
Usage: $SELF -x path/to/xorriso [-k0|1] [-f0|1] [-c0|1] [-h]
[-- ...test specific options...]
General options:
-x absolute or relative path to binary to be run.
-k keep selfgenerated data (values 0,1, default 0).
-c cleanup selfgenerated data kept from previous
run and exit (values 0,1, default 0).
-f simulate failure (values 0,1, default 0).
-- end of general options, begin of test specific options.
EOF
}
@ -79,9 +84,73 @@ cleanup() {
}
#############################################
no_getopts=1
if test "$no_getopts" = 1
then
next_is=
for i in "$@"
do
if test "$next_is" = "ignore"
then
dummy=dummy
elif test "$next_is" = "x"
then
RELENG_XORRISO="$i"
next_is=
elif test x"$i" = x"-x"
then
next_is="x"
elif test x"$i" = x"-k" -o x"$i" = x"-k0"
then
KEEP=0
elif test x"$i" = x"-k1"
then
KEEP=1
elif test x"$i" = x"-c" -o x"$i" = x"-c0"
then
CLEANUP=0
elif test x"$i" = x"-c1"
then
CLEANUP=1
elif test x"$i" = x"-f" -o x"$i" = x"-f0"
then
SIMULATE_FAILURE=0
elif test x"$i" = x"-f1"
then
SIMULATE_FAILURE=1
elif test x"$i" = x"-h"
then
print_help
RELENG_PRINTED_HELP=1
elif test x"$i" = x"--"
then
# Begin of private arguments for caller
next_is="ignore"
else
echo >&2
echo "Unknown general option: $i" >&2
print_help
exit 31
fi
done
if test "$next_is" = x
then
echo >&2
echo "Option -x expects an argument (the path to the xorriso program)" >&2
print_help
exit 31
fi
# no_getopts = 1
else
# no_getopts != 1
while getopts "x:k:c:f:h" OPTION
do
case $OPTION in
case $OPTION in
x)
RELENG_XORRISO=$OPTARG
;;
@ -101,12 +170,16 @@ do
exit 0
;;
*)
print_help
exit 31
# print_help
# exit 31
;;
esac
done
# no_getopts != 1
fi
# Each releng_ test should decide whether or not to check that
#if [ ! -x $RELENG_XORRISO ]; then
# print_help
@ -126,6 +199,8 @@ if [ x"$CLEANUP" != x"0" -a x"$CLEANUP" != x"1" ]; then
exit 31
fi
# <<< This cannot happen if $no_getopts = 1
if [ x"$SIMULATE_FAILURE" != x"0" -a x"$SIMULATE_FAILURE" != x"1" ]; then
print_help
printf "\n${SELF}: -f simulate failure.\n\n"