consistent usage/help with other releng scripts

This commit is contained in:
George Danchev 2011-12-14 06:09:22 +00:00
parent 90cd8429b5
commit 4049d75ebf
1 changed files with 39 additions and 26 deletions

View File

@ -13,10 +13,13 @@ PASSED_OPTIONS="$@"
RELENG_XORRISO= RELENG_XORRISO=
CLEANUP_LOG=0 CLEANUP_LOG=0
not_in_releng_exit() { # It is not a good idea to include inc/releng_getopts.inc with the
# master script as it calls the subordinate scripts and they include
# this file too, and we want to avoid sharing variable with subshells
if [ ! -f inc/releng_getopts.inc ]; then
printf "\nPlease execute the tests from releng directory.\n\n" printf "\nPlease execute the tests from releng directory.\n\n"
exit 1 exit 1
} fi
# To catch the exit value of a command in a pipe # To catch the exit value of a command in a pipe
return_value_file="$GEN_DATA_DIR"/run_all_"$$"_return_value return_value_file="$GEN_DATA_DIR"/run_all_"$$"_return_value
@ -52,17 +55,45 @@ count_lines()
return 0 return 0
} }
# It is not a good idea to include inc/releng_getopts.inc with the #############################################
# master script as it calls the subordinate scripts and they include print_usage()
# this file too, and we want to avoid sharing variable with subshells {
if [ ! -f inc/releng_getopts.inc ]; then cat << HLP
not_in_releng_exit
fi ${SELF} runs executables from releng directory starting with auto_*,
and passing them its own options. stdout/stderr output is stored in:
./${CLOG}
Usage: ${SELF} -x path/to/xorriso [-k] [-c] [-h]
-x absolute or relative path to xorriso binary to be run.
-k keep self-generated data in ./${GEN_DATA_DIR}.
-c cleanup self-generated data kept from previous run and exit.
-h print this help text
Examples:
# run xorriso and keep the self-generated data
$ ./${SELF} -x path/to/xorriso -k
# clean up self-generated data from previous run
$ ./${SELF} -c
HLP
}
############################################# #############################################
if [ ! "${1}" ]; then
print_usage
exit 0
fi
next_is= next_is=
for i in "$@" for i in "$@"
do do
if test x"$i" = x"-h" -o x"$i" = x"--h" -o x"$i" = x"-help" -o x"$i" = x"--help"
then :
print_usage
exit 0
fi
if test "$next_is" = "ignore" if test "$next_is" = "ignore"
then : then :
elif test "$next_is" = "x" elif test "$next_is" = "x"
@ -85,24 +116,6 @@ then
exit 31 exit 31
fi fi
if [ ! "${1}" ]; then
cat << HLP
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
${SELF} runs executables from CWD starting
with auto_*, passing them its own options.
stdout/stderr output stored in:
${CLOG}
examples:
# run xorriso and keep the self-generated data
$ ./${SELF} -x path/to/xorriso [-k]
# clean up self-generated data from previous run
$ ./${SELF} -c
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HLP
exit 31
fi
######################################################## ########################################################
if [ -f "${CLOG}" ]; then if [ -f "${CLOG}" ]; then