diff options
Diffstat (limited to 'source/1.0')
-rwxr-xr-x | source/1.0/bin/gen_test_results.sh | 68 |
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 "$@" |