[PATCH v1 1/2] tap13: list testcases individually

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The current tap13 support summarizes testcases on a rather coarse
granularity. Which sort of defeats the purpose, especially in CI
environments.
This patch improves things by post-processing the log files, extracting
results for individual testcases. One could argue that post-processing the
logs is a rather fragile approach. Which is true - but apparently already
the case, see e.g. extract_summary in scripts/runtime.bash.
Plus this is quite cheap, while a proper solution would require to modify
the kernels, so we can e.g. pass in a counter for the testcase number. Plus
we would probably have to come up with reasonable testcase names, while
this approach simply derives them from each test output.

Signed-off-by: Stefan Raspl <raspl@xxxxxxxxxxxxx>
---
 run_tests.sh         | 28 +++++++++++++++++++++++-----
 scripts/runtime.bash | 10 ----------
 2 files changed, 23 insertions(+), 15 deletions(-)

diff --git a/run_tests.sh b/run_tests.sh
index 102c806..7ae37e0 100755
--- a/run_tests.sh
+++ b/run_tests.sh
@@ -107,10 +107,6 @@ mkdir $unittest_log_dir || exit 2
 
 echo "BUILD_HEAD=$(cat build-head)" > $unittest_log_dir/SUMMARY
 
-if [[ $tap_output == "yes" ]]; then
-    test_number=0
-    echo "TAP version 13"
-fi
 trap "wait; exit 130" SIGINT
 for_each_unittest $config run_task
 
@@ -118,5 +114,27 @@ for_each_unittest $config run_task
 wait
 
 if [[ $tap_output == "yes" ]]; then
-    echo "1..$test_number"
+    echo "TAP version 13"
+    echo "1..`cat $unittest_log_dir/*.log | grep -E "^PASS|^FAIL|^SKIP" | wc -l`";
+    i=1
+    for log in `ls -1 $unittest_log_dir/*.log`; do
+        while read -r line; do
+            name="`echo ${line% ==*} | cut -c 7-`"
+            case "${line:0:4}" in
+                PASS)
+                    echo "ok $i - $name"
+                    ;;
+                FAIL)
+                    echo "not ok $i - $name"
+                    ;;
+                SKIP)
+                    echo "ok $i - $name # skip"
+                    ;;
+                *)
+                    continue
+                    ;;
+            esac
+            (( i++ ))
+        done < "$log"
+    done
 fi
diff --git a/scripts/runtime.bash b/scripts/runtime.bash
index fffa7dd..e7844f0 100644
--- a/scripts/runtime.bash
+++ b/scripts/runtime.bash
@@ -69,16 +69,6 @@ function print_result()
         fi
         return
     fi
-
-    if [[ $status == "FAIL" ]]; then
-        echo "not ok $testname $reason"
-    elif [[ $status == "PASS" ]]; then
-        echo "ok $testname"
-    elif [[ $status == "SKIP" ]]; then
-        echo "ok $testname # SKIP $reason"
-    else
-        echo "not ok # TODO unknown test status"
-    fi
 }
 
 function run()
-- 
2.16.4




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux