aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkate.ward <kate.ward@forestent.com>2013-01-16 22:35:45 +0000
committerkate.ward <kate.ward@forestent.com>2013-01-16 22:35:45 +0000
commitaf8d27d01bf074e06bf1326d4d9c5da9851d084e (patch)
treeee160377a8d6ea09a9eaaa7f820303d4315e2e13
parentf5f46cbbd9db2cb5d220712eb7ff0b9f61796253 (diff)
downloadshflags-af8d27d01bf074e06bf1326d4d9c5da9851d084e.tar.gz
fixes so the help output works
-rwxr-xr-xsource/1.0/bin/gen_test_results.sh68
1 files changed, 37 insertions, 31 deletions
diff --git a/source/1.0/bin/gen_test_results.sh b/source/1.0/bin/gen_test_results.sh
index 1178d1b..79d2fd4 100755
--- a/source/1.0/bin/gen_test_results.sh
+++ b/source/1.0/bin/gen_test_results.sh
@@ -44,39 +44,45 @@ DEFINE_boolean force false 'force overwrite' f
DEFINE_string output_dir "`pwd`" 'output dir' d
DEFINE_string output_file "${os_name}-${os_version}.txt" 'output file' o
DEFINE_boolean dry_run false "supress logging to a file" n
-FLAGS "${@:-}" || exit $?
-eval set -- "${FLAGS_ARGV}"
-
-# determine output filename
-output="${FLAGS_output_dir:+${FLAGS_output_dir}/}${FLAGS_output_file}"
-output=`shlib_relToAbsPath "${output}"`
-# checks
-[ -n "${FLAGS_suite:-}" ] || die 'suite flag missing'
-
-if [ ${FLAGS_dry_run} -eq ${FLAGS_FALSE} -a -f "${output}" ]; then
- if [ ${FLAGS_force} -eq ${FLAGS_TRUE} ]; then
- rm -f "${output}"
- else
- echo "not overwriting '${output}'" >&2
- exit ${FLAGS_ERROR}
+main()
+{
+ # determine output filename
+ output="${FLAGS_output_dir:+${FLAGS_output_dir}/}${FLAGS_output_file}"
+ output=`shlib_relToAbsPath "${output}"`
+
+ # checks
+ [ -n "${FLAGS_suite:-}" ] || die 'suite flag missing'
+
+ if [ ${FLAGS_dry_run} -eq ${FLAGS_FALSE} -a -f "${output}" ]; then
+ if [ ${FLAGS_force} -eq ${FLAGS_TRUE} ]; then
+ rm -f "${output}"
+ else
+ echo "not overwriting '${output}'" >&2
+ exit ${FLAGS_ERROR}
+ fi
fi
-fi
-if [ ${FLAGS_dry_run} -eq ${FLAGS_FALSE} ]; then
- touch "${output}" 2>/dev/null || die "unable to write to '${output}'"
-fi
-
-# run tests
-(
- cd "${SRC_DIR}";
if [ ${FLAGS_dry_run} -eq ${FLAGS_FALSE} ]; then
- ./${FLAGS_suite} |tee "${output}"
- else
- ./${FLAGS_suite}
+ touch "${output}" 2>/dev/null || die "unable to write to '${output}'"
+ fi
+
+ # run tests
+ (
+ cd "${SRC_DIR}";
+ if [ ${FLAGS_dry_run} -eq ${FLAGS_FALSE} ]; then
+ ./${FLAGS_suite} |tee "${output}"
+ else
+ ./${FLAGS_suite}
+ fi
+ )
+
+ if [ ! ${FLAGS_dry_run} ]; then
+ echo >&2
+ echo "output written to '${output}'" >&2
fi
-)
+}
-if [ ! ${FLAGS_dry_run} ]; then
- echo >&2
- echo "output written to '${output}'" >&2
-fi
+FLAGS "$@" || exit $?
+[ ${FLAGS_help} -eq ${FALSE} ] || exit
+eval set -- "${FLAGS_ARGV}"
+main "$@"