From 50bbf65fec92adbcedf1706eb881e2a156874d0d Mon Sep 17 00:00:00 2001 From: Minh Diep Date: Wed, 1 Aug 2012 09:18:21 -0700 Subject: [PATCH] LU-1685 test: fix FAIL_ON_ERROR=false parameter The previous fix on LU-1528 which was supposed to fix the overall status to FAIL when a subtest FAIL didn't work. This commit will provide the proper fix. The issue is grep FAIL: in exit_status() should not include ":" Signed-off-by: Minh Diep Change-Id: I7eaf14351ac8a2c3d21f530e43c75871b4b01f6a Reviewed-on: http://review.whamcloud.com/3507 Tested-by: Hudson Reviewed-by: Yu Jian Tested-by: Maloo Reviewed-by: Cliff White Reviewed-by: Oleg Drokin --- lustre/tests/test-framework.sh | 60 +++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh index d76ca5e..b7216d2 100644 --- a/lustre/tests/test-framework.sh +++ b/lustre/tests/test-framework.sh @@ -3625,11 +3625,11 @@ error_noexit() { } exit_status () { - local status=0 - local log=$TESTSUITELOG + local status=0 + local log=$TESTSUITELOG - [ -f "$log" ] && grep -q FAIL: $log && status=1 - exit $status + [ -f "$log" ] && grep -q FAIL $log && status=1 + exit $status } error() { @@ -3885,34 +3885,34 @@ run_one() { # - test result is saved to data file # run_one_logged() { - local BEFORE=`date +%s` - local TEST_ERROR - local name=${TESTSUITE}.test_${1}.test_log.$(hostname -s).log - local test_log=$LOGDIR/$name - rm -rf $LOGDIR/err - local SAVE_UMASK=`umask` - umask 0022 - - echo - 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)" - [ -f $LOGDIR/err ] && TEST_ERROR=$(cat $LOGDIR/err) - log_sub_test_end $TEST_STATUS $duration "$RC" "$TEST_ERROR" - - if [ -f $LOGDIR/err ]; then - $FAIL_ON_ERROR && exit $RC - fi + local BEFORE=`date +%s` + local TEST_ERROR + local name=${TESTSUITE}.test_${1}.test_log.$(hostname -s).log + local test_log=$LOGDIR/$name + rm -rf $LOGDIR/err + local SAVE_UMASK=`umask` + umask 0022 + + echo + 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)" + [ -f $LOGDIR/err ] && TEST_ERROR=$(cat $LOGDIR/err) + log_sub_test_end $TEST_STATUS $duration "$RC" "$TEST_ERROR" + + if [ -f $LOGDIR/err ]; then + $FAIL_ON_ERROR && exit $RC + fi - umask $SAVE_UMASK + umask $SAVE_UMASK - return $RC + return 0 } # -- 1.8.3.1