Whamcloud - gitweb
b=22298 Buffalo should be able to detect test failures
authorManoj Joseph <manoj.p.joseph@oracle.com>
Fri, 28 May 2010 00:42:32 +0000 (18:42 -0600)
committerRobert Read <robert.read@oracle.com>
Fri, 28 May 2010 17:38:50 +0000 (10:38 -0700)
Buffalo should be able to detect test failures even when the test
does not use run_test.

i=robert.read
i=nicolas.williams

lustre/tests/acceptance-small.sh
lustre/tests/test-framework.sh
lustre/tests/yaml.sh

index 2a52d82..f92f3fa 100755 (executable)
@@ -31,6 +31,8 @@ fi
 [ "$DEBUG_OFF" ] || DEBUG_OFF="eval lctl set_param debug=\"$DEBUG_LVL\""
 [ "$DEBUG_ON" ] || DEBUG_ON="eval lctl set_param debug=0x33f0484"
 
+export TF_FAIL=$TMP/tf.fail
+
 if [ "$ACC_SM_ONLY" ]; then
     for O in $DEFAULT_SUITES; do
         O=$(echo $O | tr "-" "_" | tr "[:lower:]" "[:upper:]")
@@ -104,7 +106,7 @@ title() {
             esac
         fi
     fi 
-    log "-----============= acceptance-small: "$*" ============----- `date`"
+    log "-----============= acceptance-small: "$*" ============----- $(date)"
 }
 
 is_sanity_benchmark() {
@@ -141,9 +143,24 @@ run_suite() {
 
     echo "$suite_script located."
     if [[ ${!suite} != no ]]; then
+        local rc
+        local status
+        local duration
+        local start_ts=$(date +%s)
+        rm -rf $TF_FAIL
         title $suite_name
         log_test $suite_name
         bash $suite_script ${!suite_only}
+        rc=$?
+        duration=$(($(date +%s) - $start_ts))
+        if [ -f $TF_FAIL -o $rc -ne 0 ]; then
+            status="FAIL"
+        else
+            status="PASS"
+        fi
+        echo "Script: $status"
+        log_test_status $duration $status
+
         $CLEANUP
         $SETUP
         eval ${suite}="done"
index 2c31167..97bdb60 100644 (file)
@@ -1,11 +1,11 @@
 #!/bin/bash
 # vim:expandtab:shiftwidth=4:softtabstop=4:tabstop=4:
 
-trap 'print_summary && echo "test-framework exiting on error"' ERR
+trap 'print_summary && touch $TF_FAIL && \
+    echo "test-framework exiting on error"' ERR
 set -e
 #set -x
 
-
 export REFORMAT=${REFORMAT:-""}
 export WRITECONF=${WRITECONF:-""}
 export VERBOSE=false
@@ -3929,6 +3929,10 @@ log_test() {
     yml_log_test $1 >> $YAML_LOG
 }
 
+log_test_status() {
+     yml_log_test_status $@ >> $YAML_LOG
+}
+
 log_sub_test_begin() {
     yml_log_sub_test_begin $@ >> $YAML_LOG
 }
index 4dbdfe7..f5803e2 100644 (file)
@@ -147,6 +147,7 @@ yml_log_test() {
         name: $1
         description: $TESTSUITE $1
         submission: $(date)
+        report_version: 2
         SubTests:
 EOF
     fi
@@ -154,8 +155,8 @@ EOF
 
 yml_log_test_status() {
     cat <<EOF
-    duration: $1
-    status: $2
+        duration: $1
+        status: $2
 EOF
 }