From 745e507c2fd06f9349212efe86f8143a1f0c5a0e Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Thu, 11 Jul 2013 12:53:28 +0100 Subject: [PATCH 1/2] ./run: Add a better comment describing --test mode. This is just code motion, there is no functional change. --- run.in | 49 ++++++++++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/run.in b/run.in index 5d9ad75..f49df8e 100755 --- a/run.in +++ b/run.in @@ -214,28 +214,31 @@ export GNOME_KEYRING_PID= # Run the program. if [ -z "$test_mode" ]; then exec $libtool "$@" +fi + +# For tests (./run --test): +# - redirect all output to a file, and only print the file if the +# test fails +# - print how long it takes to run the test + +pid=$$ +tmpout=$b/tmp/run-$pid +rm -f $tmpout +start_t="$(date +'%s')" +$libtool "$@" > $tmpout 2>&1 +fail=$? +end_t="$(date +'%s')" +if [ "$fail" -eq 0 ]; then + # Test successful. + echo $(($end_t - $start_t)) seconds: "$@" +elif [ "$fail" -eq 77 ]; then + # Tests return 77 to mean skipped. + cat $tmpout else - # For tests (./run --test), redirect all output to a file, and - # only print the file if the test fails. - pid=$$ - tmpout=$b/tmp/run-$pid - rm -f $tmpout - start_t="$(date +'%s')" - $libtool "$@" > $tmpout 2>&1 - fail=$? - end_t="$(date +'%s')" - if [ "$fail" -eq 0 ]; then - # Test successful. - echo $(($end_t - $start_t)) seconds: "$@" - elif [ "$fail" -eq 77 ]; then - # Tests return 77 to mean skipped. - cat $tmpout - else - # Test failed. - echo "$b/run --test" "$@" - cat $tmpout - echo "$b/run: command failed with exit code $fail" - fi - rm -f $tmpout - exit $fail + # Test failed. + echo "$b/run --test" "$@" + cat $tmpout + echo "$b/run: command failed with exit code $fail" fi +rm -f $tmpout +exit $fail -- 1.8.3.1