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

[PATCH v2 6/9] automation: allow run-tools-tests to exclude tests



As run-tools-tests runs all tests in the directory, a failing test leads
to the whole job to fail, so the other tests can't be used to block
regressions.

To fix this, take a list of shell patterns after the JUnit output file,
and report tests whose name matches one of them as skipped instead of
running them.

Signed-off-by: Julian Vetter <julian.vetter@xxxxxxxxxx>
---
Changes in v2:
- New patch
---
 automation/scripts/run-tools-tests | 23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/automation/scripts/run-tools-tests 
b/automation/scripts/run-tools-tests
index 15766ca0f0..4cb3d278a5 100755
--- a/automation/scripts/run-tools-tests
+++ b/automation/scripts/run-tools-tests
@@ -1,10 +1,15 @@
 #!/bin/bash
 
 usage() {
-    echo "Usage: $0 tests-dir xml-out"
+    echo "Usage: $0 tests-dir xml-out [exclude-pattern...]"
+    echo "Tests whose name matches an exclude-pattern (a shell glob) are"
+    echo "reported as skipped instead of being run."
 }
 
+tests_dir=$1
 xml_out=$2
+excludes=("${@:3}")
+
 if [ -z "$xml_out" ]; then
   xml_out=/dev/null
 fi
@@ -12,7 +17,21 @@ printf '<?xml version="1.0" encoding="UTF-8"?>\n' > 
"$xml_out"
 printf '<testsuites name="tools.tests">\n' >> "$xml_out"
 printf ' <testsuite name="tools.tests">\n' >> "$xml_out"
 failed=
-for f in "$1"/*; do
+for f in "$tests_dir"/*; do
+    excluded=
+    for pattern in "${excludes[@]}"; do
+        if [[ "${f##*/}" == $pattern ]]; then
+            excluded=1
+            break
+        fi
+    done
+    if [ -n "$excluded" ]; then
+        echo "SKIP: $f excluded"
+        printf '  <testcase name="%s">\n' "$f" >> "$xml_out"
+        printf '   <skipped message="excluded"/>\n' >> "$xml_out"
+        printf '  </testcase>\n' >> "$xml_out"
+        continue
+    fi
     if [ ! -x "$f" ]; then
         echo "SKIP: $f not executable"
         continue
-- 
2.53.0



--
Julian Vetter | Vates Hypervisor & Kernel Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.