use different exit codes for ayn failure

This commit is contained in:
George Danchev 2011-06-26 21:06:32 +00:00
parent 158fd1ab2c
commit 219f8ff076
2 changed files with 43 additions and 42 deletions

View File

@ -17,6 +17,7 @@ http://www.gnu.org/software/xorriso/
+ well documented configuration file test.conf{.template} + well documented configuration file test.conf{.template}
+ throw FAIL string to stdout if any failure is detected + throw FAIL string to stdout if any failure is detected
+ exit code 0 on success, non-zero on failure + exit code 0 on success, non-zero on failure
+ use different exit codes for any failure (10, 20, ... 100)
* TESTS LIST * TESTS LIST

View File

@ -32,14 +32,14 @@ HLP
} }
# help # help
if [ ! "${1}" -o "${1}" == "-help" ]; then print_help && exit 0; fi if [ ! "${1}" -o "${1}" == "-help" ]; then print_help && exit 10; fi
# config file # config file
if [ "${1}" == "-rc" ]; then if [ "${1}" == "-rc" ]; then
if [ -e ${CONFFILE} ]; then if [ -e ${CONFFILE} ]; then
. ${CONFFILE} . ${CONFFILE}
printf "$0: Using config file %s\n" ${CONFFILE} printf "$0: Using config file %s\n" ${CONFFILE}
else else
echo -e "\n$0: Config file ${CONFFILE} not found.\n" && exit 1 echo -e "\n$0: Config file ${CONFFILE} not found.\n" && exit 20
fi fi
if [ "${2}" == "-clean" ]; then CLEAN=1; fi if [ "${2}" == "-clean" ]; then CLEAN=1; fi
# command line args # command line args
@ -54,17 +54,17 @@ elif [ "${3}" ]; then
fi fi
# the rest # the rest
else else
print_help && exit 0 print_help && exit 30
fi fi
if [ "${XOR}" == "" -o "${DIR}" == "" -o "${IMG}" == "" ]; then if [ "${XOR}" == "" -o "${DIR}" == "" -o "${IMG}" == "" ]; then
echo -e "\n$0: xorriso_cmd IN_dir and OUT_image are required\n" echo -e "\n$0: xorriso_cmd IN_dir and OUT_image are required\n"
exit 1 exit 40
fi fi
if [ ! -x "${XOR}" ]; then if [ ! -x "${XOR}" ]; then
printf "$0: Not found or not an executable: $XOR\n" printf "$0: Not found or not an executable: $XOR\n"
exit 1 exit 50
fi fi
# all must be set at this point # all must be set at this point
@ -94,7 +94,7 @@ if which jigdo-gen-md5-list >/dev/null 2>&1; then
else else
printf "\n$0: Not found: jigdo-gen-md5-list. Install jigit." printf "\n$0: Not found: jigdo-gen-md5-list. Install jigit."
printf "\n$0: See http://www.einval.com/~steve/software/JTE/\n" printf "\n$0: See http://www.einval.com/~steve/software/JTE/\n"
exit 1 exit 60
fi fi
# build the command - general section # build the command - general section
@ -149,7 +149,7 @@ if which jigit-mkimage >/dev/null 2>&1; then
else else
printf "\n$0: Not found: jigit-mkimage. Install jigit." printf "\n$0: Not found: jigit-mkimage. Install jigit."
printf "\n$0: See http://www.einval.com/~steve/software/JTE/\n" printf "\n$0: See http://www.einval.com/~steve/software/JTE/\n"
exit 1 exit 70
fi fi
# trap the exit code of diff and let the Universe explode # trap the exit code of diff and let the Universe explode
@ -168,7 +168,7 @@ esac
if [ ${CLEAN} -eq 1 ]; then if [ ${CLEAN} -eq 1 ]; then
# safety net, just in case -> we want to be in the starting # safety net, just in case -> we want to be in the starting
# directory before removing whatever self-generated stuff # directory before removing whatever self-generated stuff
cd "${START_DIR_DONT_CHANGE}" || exit 1 cd "${START_DIR_DONT_CHANGE}" || exit 80
rm -f ${RES} rm -f ${RES}
printf "$0: removed %s\n" ${RES} printf "$0: removed %s\n" ${RES}
else else