- log_sub_test_begin test_${1}
- (run_one $1 "$2") 2>&1 | tee -i $test_log
- local RC=${PIPESTATUS[0]}
-
- [ $RC -ne 0 ] && [ ! -f $LOGDIR/err ] &&
- echo "test_$1 returned $RC" | tee $LOGDIR/err
-
- duration=$(($(date +%s) - $BEFORE))
- pass "$1" "(${duration}s)"
+ # if ${ONLY_$testnum} set, repeat $ONLY_REPEAT times, otherwise once
+ local isonly=ONLY_$testnum
+ local repeat=${!isonly:+$ONLY_REPEAT}
+
+ for testiter in $(seq ${repeat:-1}); do
+ local before_sub=$SECONDS
+ log_sub_test_begin $TESTNAME
+
+ # remove temp files between repetitions to avoid test failures
+ [ -n "$append" -a -n "$DIR" -a -n "$tdir" -a -n "$tfile" ] &&
+ rm -rf $DIR/$tdir* $DIR/$tfile*
+ # loop around subshell so stack_trap EXIT triggers each time
+ (run_one $testnum "$testmsg") 2>&1 | tee -i $append $test_log
+ rc=${PIPESTATUS[0]}
+ local append=-a
+ local duration_sub=$((SECONDS - before_sub))
+ local test_error
+
+ [[ $rc != 0 && ! -f $LOGDIR/err ]] &&
+ echo "$TESTNAME returned $rc" | tee $LOGDIR/err
+
+ if [[ -f $LOGDIR/err ]]; then
+ test_error=$(cat $LOGDIR/err)
+ TEST_STATUS="FAIL"
+ elif [[ -f $LOGDIR/ignore ]]; then
+ test_error=$(cat $LOGDIR/ignore)
+ elif [[ -f $LOGDIR/skip ]]; then
+ test_error=$(cat $LOGDIR/skip)
+ TEST_STATUS="SKIP"
+ else
+ TEST_STATUS="PASS"
+ fi