From d9188dd4e3cd04473ca50c37d024468e2462df92 Mon Sep 17 00:00:00 2001
From: tianzy <tianzy>
Date: Tue, 14 Oct 2008 07:39:48 +0000
Subject: [PATCH] Branch b1_6 fix the statistics output of sanity-quota.sh
 b=14909 i=adilger i=grev

---
 lustre/tests/sanity-quota.sh   |  2 +-
 lustre/tests/test-framework.sh | 10 ++++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/lustre/tests/sanity-quota.sh b/lustre/tests/sanity-quota.sh
index 5328acec18..6b5d61d265 100644
--- a/lustre/tests/sanity-quota.sh
+++ b/lustre/tests/sanity-quota.sh
@@ -147,7 +147,7 @@ run_test_with_stat() {
 	    do_facet ost$j "lctl set_param lquota.${FSNAME}-OST*.stats=0" > /dev/null
 	done
 	run_test "$@"
-	if [ ${STAT:-"yes"} != "no" ]; then
+	if [ ${STAT:-"yes"} != "no" -a -z "$LAST_SKIPPED" ]; then
 	    echo "statistics info begin ***************************************"
 	    do_facet mds  "lctl get_param lquota.${FSNAME}-MDT*.stats"
 	    for j in `seq $OSTCOUNT`; do
diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh
index a64249ccaa..a5f90126d4 100644
--- a/lustre/tests/test-framework.sh
+++ b/lustre/tests/test-framework.sh
@@ -1313,6 +1313,8 @@ basetest() {
     IFS=abcdefghijklmnopqrstuvwxyz _basetest $1
 }
 
+# print a newline if the last test was skipped
+export LAST_SKIPPED=
 run_test() {
     assert_DIR
 
@@ -1320,38 +1322,46 @@ run_test() {
     if [ ! -z "$ONLY" ]; then
         testname=ONLY_$1
         if [ ${!testname}x != x ]; then
+            [ "$LAST_SKIPPED" ] && echo "" && LAST_SKIPPED=
             run_one $1 "$2"
             return $?
         fi
         testname=ONLY_$base
         if [ ${!testname}x != x ]; then
+            [ "$LAST_SKIPPED" ] && echo "" && LAST_SKIPPED=
             run_one $1 "$2"
             return $?
         fi
+        LAST_SKIPPED="y"
         echo -n "."
         return 0
     fi
     testname=EXCEPT_$1
     if [ ${!testname}x != x ]; then
+        LAST_SKIPPED="y"
         TESTNAME=test_$1 skip "skipping excluded test $1"
         return 0
     fi
     testname=EXCEPT_$base
     if [ ${!testname}x != x ]; then
+        LAST_SKIPPED="y"
         TESTNAME=test_$1 skip "skipping excluded test $1 (base $base)"
         return 0
     fi
     testname=EXCEPT_SLOW_$1
     if [ ${!testname}x != x ]; then
+        LAST_SKIPPED="y"
         TESTNAME=test_$1 skip "skipping SLOW test $1"
         return 0
     fi
     testname=EXCEPT_SLOW_$base
     if [ ${!testname}x != x ]; then
+        LAST_SKIPPED="y"
         TESTNAME=test_$1 skip "skipping SLOW test $1 (base $base)"
         return 0
     fi
 
+    LAST_SKIPPED=
     run_one $1 "$2"
     
     return $?
-- 
GitLab