diff options
author | Pavel Raiskup <praiskup@redhat.com> | 2014-11-06 14:12:57 +0100 |
---|---|---|
committer | Pavel Raiskup <praiskup@redhat.com> | 2014-11-06 14:12:57 +0100 |
commit | 19aa272831c770b7660f116c6897c88dc9163c64 (patch) | |
tree | b2289c4ae4d41abf4bbd16ee9c4ff723266e8a0e | |
parent | f17298d2aa8595bae29aa4757d7a9aa6278adadd (diff) | |
download | postgresql-setup-tests-19aa272831c770b7660f116c6897c88dc9163c64.tar.gz postgresql-setup-tests-19aa272831c770b7660f116c6897c88dc9163c64.tar.xz postgresql-setup-tests-19aa272831c770b7660f116c6897c88dc9163c64.zip |
tester/run: fix --listonly option
Do not try to put some output into YML file when we are only
listing. That could cause 'Permision denied' errors even if the
permission is actually not needed.
* tester/run (__result_yml_print): New local function.
(die, run_test): Call __result_yml_print instead of hand touching
the yml file.
-rwxr-xr-x | tester/run | 15 |
1 files changed, 11 insertions, 4 deletions
@@ -28,6 +28,12 @@ export DTF_TASKS=${DTF_TASKS-$srcdir/tasks} export DTF_RESULTDIR=${DTF_RESULTDIR-/var/tmp/dtf} export DTF_RESULTS_YML=${DTF_RESULTDIR}/result.yml +__result_yml_print() +{ + test "$dtf_option_listonly" -eq 0 && \ + echo 2>/dev/null "$1" >> "$DTF_RESULTS_YML" +} + # when exists per-testsuite config.sh, source it here test -r "$srcdir/config.sh" && . "$srcdir/config.sh" @@ -50,7 +56,7 @@ info() die() { echo "$@" >&2 - echo 2>/dev/null "exit_status: 2" >> "$DTF_RESULTS_YML" + __result_yml_print "exit_status: 2" exit 2 } @@ -94,7 +100,6 @@ run_test() result_dir="$DTF_RESULTDIR/tasks/$DTF_TEST_ID" - mkdir -p "$result_dir" || exit outlog="$result_dir/run.log" output_wrapper="cat > $outlog" @@ -111,6 +116,8 @@ run_test() || exit $DTF_RESULT_TS_SKIP fi + mkdir -p "$result_dir" || exit $DTF_RESULT_TS_CONFIG + printf "%-40s" "RUN $DTF_TEST_ID ..." set -o pipefail @@ -205,8 +212,8 @@ done test $dtf_option_listonly -ne 1 && prepare_resultdir +__result_yml_print "$(date -u "+date: \"%Y%m%d_%H%M%S_UTC\"")" -date -u "+date: \"%Y%m%d_%H%M%S_UTC\"" > "$DTF_RESULTS_YML" result=0 while read i; do testdir=$(dirname "$i") @@ -233,6 +240,6 @@ while read i; do esac done <<<"$(find "$DTF_TASKS" -name runtest.sh)" -echo "exit_status: $result" >> "$DTF_RESULTS_YML" +__result_yml_print "exit_status: $result" exit $result |