From e37fb554408a59aa3cb9d7394f65ae930e7a401a Mon Sep 17 00:00:00 2001
From: nathan <nathan>
Date: Thu, 18 Oct 2007 17:42:47 +0000
Subject: [PATCH] b=5494 i=adilger add error_ignore method to run test but
 ignore failures

---
 lustre/tests/recovery-small.sh |  2 +-
 lustre/tests/test-framework.sh | 16 +++++++++++++---
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/lustre/tests/recovery-small.sh b/lustre/tests/recovery-small.sh
index fbcc420938..ae099f3d8e 100755
--- a/lustre/tests/recovery-small.sh
+++ b/lustre/tests/recovery-small.sh
@@ -550,7 +550,7 @@ test_24() {	# bug 2248 - eviction fails writeback but app doesn't see it
 	rc=$?
 	sysctl -w lustre.fail_loc=0x0
 	client_reconnect
-	[ $rc -eq 0 ] && error "multiop didn't fail fsync: rc $rc" || true
+	[ $rc -eq 0 ] && error_ignore 5494 "multiop didn't fail fsync: rc $rc" || true
 }
 run_test 24 "fsync error (should return error)"
 
diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh
index 7f3a1f639b..37f50e501d 100644
--- a/lustre/tests/test-framework.sh
+++ b/lustre/tests/test-framework.sh
@@ -1032,13 +1032,16 @@ debugrestore() {
     DEBUGSAVE=""
 }
 
-FAIL_ON_ERROR=true
 ##################################
 # Test interface 
+##################################
+
 error() {
+    local FAIL_ON_ERROR=${FAIL_ON_ERROR:-true}
+    local TYPE=${TYPE:-"FAIL"}
     local ERRLOG
     sysctl -w lustre.fail_loc=0 2> /dev/null || true
-    log "${TESTSUITE} ${TESTNAME}: **** FAIL:" $@
+    log "${TESTSUITE} ${TESTNAME}: **** ${TYPE}:" $@
     ERRLOG=$TMP/lustre_${TESTSUITE}_${TESTNAME}.$(date +%s)
     echo "Dumping lctl log to $ERRLOG"
     # We need to dump the logs on all nodes
@@ -1046,12 +1049,19 @@ error() {
     [ ! "$mds_HOST" = "$(hostname)" ] && do_node $mds_HOST $LCTL dk $ERRLOG
     [ ! "$ost_HOST" = "$(hostname)" -a ! "$ost_HOST" = "$mds_HOST" ] && do_node $ost_HOST $LCTL dk $ERRLOG
     debugrestore
-    [ "$TESTSUITELOG" ] && echo "$0: FAIL: $TESTNAME $@" >> $TESTSUITELOG
+    [ "$TESTSUITELOG" ] && echo "$0: ${TYPE}: $TESTNAME $@" >> $TESTSUITELOG
     if $FAIL_ON_ERROR; then
 	exit 1
     fi
 }
 
+# use only if we are ignoring failures for this test, bugno required.
+# (like ALWAYS_EXCEPT, but run the test and ignore the results.)
+# e.g. error_ignore 5494 "your message"
+error_ignore() {
+    FAIL_ON_ERROR=false TYPE="IGNORE (bz$1)" error $2
+}
+
 skip () {
 	log " SKIP: ${TESTSUITE} ${TESTNAME} $@"
 	[ "$TESTSUITELOG" ] && echo "${TESTSUITE}: SKIP: $TESTNAME $@" >> $TESTSUITELOG
-- 
GitLab