Skip to contentSkip to conversation

CI: Improvements to *-tools-test-* jobs

PATCH In review Andrew Cooper 4 participants 14 messages May 20, 2025 – May 28, 2025

lore
Share & tools
lore
#0 lore raw

cover CI: Improvements to *-tools-test-* jobs

Rearrange tools/tests to be more ameanable to running in CI, and drop the special casing holding it together.

Andrew Cooper (3):
tools/tests: Drop depriv-fd-checker tools/tests: Install tests into $(LIBEXEC)/tests
CI: Drop custom handling of tools/tests

 .gitignore                             |   1 -
 automation/scripts/build               |   1 -
 automation/scripts/qubes-x86-64.sh     |   7 +-
 automation/scripts/run-tools-tests     |  43 ++-
 tools/tests/Makefile                   |   1 -
 tools/tests/cpu-policy/Makefile        |   6 +-
 tools/tests/depriv/Makefile            |  52 ---
 tools/tests/depriv/depriv-fd-checker.c | 436 -------------------------
 tools/tests/paging-mempool/Makefile    |   6 +-
 tools/tests/rangeset/Makefile          |   6 +-
 tools/tests/resource/Makefile          |   6 +-
 tools/tests/tsx/Makefile               |   6 +-
 tools/tests/xenstore/Makefile          |   6 +-
 13 files changed, 40 insertions(+), 537 deletions(-)
 delete mode 100644 tools/tests/depriv/Makefile
 delete mode 100644 tools/tests/depriv/depriv-fd-checker.c
Signature · 1 line
2.39.5
#1 lore raw

PATCH 1/3 tools/tests: Drop depriv-fd-checker

Unlike the other tests, this is not standalone. It requires poking at a live system, making it unweildly to use.

It hasn't been touched in 7 years, despite changes in libraries and kernel devices using the deprivilege infrastructure.

---
CC: Anthony PERARD <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Marek Marczykowski-Górecki <[email protected]>

---
 .gitignore                             |   1 -
 tools/tests/Makefile                   |   1 -
 tools/tests/depriv/Makefile            |  52 ---
 tools/tests/depriv/depriv-fd-checker.c | 436 -------------------------
 4 files changed, 490 deletions(-)
 delete mode 100644 tools/tests/depriv/Makefile
 delete mode 100644 tools/tests/depriv/depriv-fd-checker.c
.gitignore +0 -1
index 53f5df000383..4a4e20680464 100644
@@ -165,7 +165,6 @@ tools/misc/xencov
 tools/pkg-config/*
 tools/qemu-xen-build
 tools/xentrace/xenalyze
-tools/tests/depriv/depriv-fd-checker
 tools/tests/x86_emulator/*.bin
 tools/tests/x86_emulator/*.tmp
 tools/tests/x86_emulator/32/x86_emulate
tools/tests/Makefile +0 -1
index 3e60ab6b268d..36928676a666 100644
@@ -9,7 +9,6 @@ ifneq ($(clang),y)
 SUBDIRS-$(CONFIG_X86) += x86_emulator
 endif
 SUBDIRS-y += xenstore
-SUBDIRS-y += depriv
 SUBDIRS-y += rangeset
 SUBDIRS-y += vpci
 SUBDIRS-y += paging-mempool
tools/tests/depriv/Makefile deleted +0 -52

52 lines not on this page · raw message

tools/tests/depriv/depriv-fd-checker.c deleted +0 -436

436 lines not on this page · raw message

Signature · 1 line
2.39.5
Acked-by on v1 1/3
#2 lore raw

Re: [PATCH 1/3] tools/tests: Drop depriv-fd-checker

Quoted 7 lines · Andrew Cooper

Unlike the other tests, this is not standalone. It requires poking at a live system, making it unweildly to use.

It hasn't been touched in 7 years, despite changes in libraries and kernel devices using the deprivilege infrastructure.

Thanks,

Signature · 1 line
Anthony PERARD
#3 lore raw

Re: [PATCH 1/3] tools/tests: Drop depriv-fd-checker

Quoted 10 lines · Anthony PERARD
Quoted 7 lines · Andrew Cooper

Unlike the other tests, this is not standalone. It requires poking at a live system, making it unweildly to use.

It hasn't been touched in 7 years, despite changes in libraries and kernel devices using the deprivilege infrastructure.

#4 lore raw

PATCH 2/3 tools/tests: Install tests into $(LIBEXEC)/tests

In reply to Andrew Cooper

$(LIBEXEC_BIN) is a dumping ground of many things. Separate the "clearly tests" from everything else so we can clean up how they're run in CI.

---
CC: Anthony PERARD <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Marek Marczykowski-Górecki <[email protected]>

---
 tools/tests/cpu-policy/Makefile     | 6 +++---
 tools/tests/paging-mempool/Makefile | 6 +++---
 tools/tests/rangeset/Makefile       | 6 +++---
 tools/tests/resource/Makefile       | 6 +++---
 tools/tests/tsx/Makefile            | 6 +++---
 tools/tests/xenstore/Makefile       | 6 +++---
 6 files changed, 18 insertions(+), 18 deletions(-)
tools/tests/cpu-policy/Makefile +3 -3
index 5df9b1ebbd7e..24f87e2eca2a 100644
@@ -29,12 +29,12 @@ distclean: clean
 
 .PHONY: install
 install: all
-	$(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN)
-	$(if $(TARGETS),$(INSTALL_PROG) $(TARGETS) $(DESTDIR)$(LIBEXEC_BIN))
+	$(INSTALL_DIR) $(DESTDIR)$(LIBEXEC)/tests
+	$(if $(TARGETS),$(INSTALL_PROG) $(TARGETS) $(DESTDIR)$(LIBEXEC)/tests)
 
 .PHONY: uninstall
 uninstall:
-	$(RM) -- $(addprefix $(DESTDIR)$(LIBEXEC_BIN)/,$(TARGETS))
+	$(RM) -- $(addprefix $(DESTDIR)$(LIBEXEC)/tests/,$(TARGETS))
 
 CFLAGS += -D__XEN_TOOLS__
 CFLAGS += $(CFLAGS_xeninclude)
tools/tests/paging-mempool/Makefile +3 -3
index a081b3baa514..a1e12584ce80 100644
@@ -16,12 +16,12 @@ distclean: clean
 
 .PHONY: install
 install: all
-	$(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN)
-	$(INSTALL_PROG) $(TARGET) $(DESTDIR)$(LIBEXEC_BIN)
+	$(INSTALL_DIR) $(DESTDIR)$(LIBEXEC)/tests
+	$(INSTALL_PROG) $(TARGET) $(DESTDIR)$(LIBEXEC)/tests
 
 .PHONY: uninstall
 uninstall:
-	$(RM) -- $(DESTDIR)$(LIBEXEC_BIN)/$(TARGET)
+	$(RM) -- $(DESTDIR)$(LIBEXEC)/tests/$(TARGET)
 
 CFLAGS += $(CFLAGS_xeninclude)
 CFLAGS += $(CFLAGS_libxenctrl)
tools/tests/rangeset/Makefile +3 -3
index 3dafcbd0546c..e3bfce471cd3 100644
@@ -20,12 +20,12 @@ distclean: clean
 
 .PHONY: install
 install: all
-	$(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN)
-	$(INSTALL_PROG) $(TARGET) $(DESTDIR)$(LIBEXEC_BIN)
+	$(INSTALL_DIR) $(DESTDIR)$(LIBEXEC)/tests
+	$(INSTALL_PROG) $(TARGET) $(DESTDIR)$(LIBEXEC)/tests
 
 .PHONY: uninstall
 uninstall:
-	$(RM) -- $(addprefix $(DESTDIR)$(LIBEXEC_BIN)/,$(TARGET))
+	$(RM) -- $(addprefix $(DESTDIR)$(LIBEXEC)/tests/,$(TARGET))
 
 list.h: $(XEN_ROOT)/xen/include/xen/list.h
 rangeset.h: $(XEN_ROOT)/xen/include/xen/rangeset.h
tools/tests/resource/Makefile +3 -3
index a5856bf09590..09d678fffe3e 100644
@@ -20,12 +20,12 @@ distclean: clean
 
 .PHONY: install
 install: all
-	$(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN)
-	$(INSTALL_PROG) $(TARGET) $(DESTDIR)$(LIBEXEC_BIN)
+	$(INSTALL_DIR) $(DESTDIR)$(LIBEXEC)/tests
+	$(INSTALL_PROG) $(TARGET) $(DESTDIR)$(LIBEXEC)/tests
 
 .PHONY: uninstall
 uninstall:
-	$(RM) -- $(DESTDIR)$(LIBEXEC_BIN)/$(TARGET)
+	$(RM) -- $(DESTDIR)$(LIBEXEC)/tests/$(TARGET)
 
 CFLAGS += $(CFLAGS_xeninclude)
 CFLAGS += $(CFLAGS_libxenctrl)
tools/tests/tsx/Makefile +3 -3
index a4f516b72597..0bb7e7010347 100644
@@ -16,12 +16,12 @@ distclean: clean
 
 .PHONY: install
 install: all
-	$(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN)
-	$(INSTALL_PROG) $(TARGET) $(DESTDIR)$(LIBEXEC_BIN)
+	$(INSTALL_DIR) $(DESTDIR)$(LIBEXEC)/tests
+	$(INSTALL_PROG) $(TARGET) $(DESTDIR)$(LIBEXEC)/tests
 
 .PHONY: uninstall
 uninstall:
-	$(RM) -- $(DESTDIR)$(LIBEXEC_BIN)/$(TARGET)
+	$(RM) -- $(DESTDIR)$(LIBEXEC)/tests/$(TARGET)
 
 .PHONY: uninstall
 uninstall:
tools/tests/xenstore/Makefile +3 -3
index 202dda0d3c23..2ee4a1327e75 100644
@@ -20,12 +20,12 @@ distclean: clean
 
 .PHONY: install
 install: all
-	$(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN)
-	$(if $(TARGETS),$(INSTALL_PROG) $(TARGETS) $(DESTDIR)$(LIBEXEC_BIN))
+	$(INSTALL_DIR) $(DESTDIR)$(LIBEXEC)/tests
+	$(if $(TARGETS),$(INSTALL_PROG) $(TARGETS) $(DESTDIR)$(LIBEXEC)/tests)
 
 .PHONY: uninstall
 uninstall:
-	$(RM) -- $(addprefix $(DESTDIR)$(LIBEXEC_BIN)/,$(TARGETS))
+	$(RM) -- $(addprefix $(DESTDIR)$(LIBEXEC)/tests/,$(TARGETS))
 
 CFLAGS += $(CFLAGS_libxenstore)
 CFLAGS += $(APPEND_CFLAGS)
Signature · 1 line
2.39.5
#7 lore raw

PATCH 3/3 CI: Drop custom handling of tools/tests

In reply to Andrew Cooper

... and use them from their installed location.

The full recusive copy of tools/tests brings in all build and intermediate artefacts. e.g. for test-tsx alone:

./tests/tsx
./tests/tsx/.test-tsx.o.d
./tests/tsx/test-tsx.o
./tests/tsx/.gitignore
./tests/tsx/test-tsx
./tests/tsx/Makefile
./tests/tsx/test-tsx.c

duplicating the test binary which is also in ./usr/lib/xen/tests

Rewrite run-tools-tests to run tests from their installed location (/usr/lib/xen/tests in alpine), which effectively removes the outer loop over $dir.

No practical change.

---
CC: Anthony PERARD <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Marek Marczykowski-Górecki <[email protected]>

This doesn't change any tests that run, although in the XML we get two fewer skips.

Both skips can be fixed by giving vpci and x86_emulator some install targets

---
 automation/scripts/build           |  1 -
 automation/scripts/qubes-x86-64.sh |  7 +++--
 automation/scripts/run-tools-tests | 43 +++++++++++++-----------------
 3 files changed, 22 insertions(+), 29 deletions(-)
automation/scripts/build +0 -1
index cdb8cd7c722b..0e7494ff6d87 100755
@@ -109,6 +109,5 @@ else
     # even though dist/ contains everything, while some containers don't even
     # build Xen
     (cd dist/install; find | cpio -o -H newc | gzip) > binaries/xen-tools.cpio.gz
-    cp -r tools/tests binaries/
     collect_xen_artefacts
 fi
automation/scripts/qubes-x86-64.sh +3 -4
index aa47ba6bf5c0..577a00238a75 100755
@@ -136,7 +136,7 @@ done
         passed="test passed"
         domU_check=""
         dom0_check="
-/tests/run-tools-tests /tests /tmp/tests-junit.xml && echo \"${passed}\"
+/root/run-tools-tests /usr/lib/xen/tests /tmp/tests-junit.xml && echo \"${passed}\"
 nc -l -p 8080 < /tmp/tests-junit.xml >/dev/null &
 "
         if [ "${test_variant}" = "tools-tests-pvh" ]; then
@@ -195,9 +195,8 @@ cat binaries/xen-tools.cpio.gz >> binaries/dom0-rootfs.cpio.gz
 # test-local configuration
 mkdir -p rootfs
 cd rootfs
-mkdir -p boot etc/local.d
-cp -ar ../binaries/tests .
-cp -a ../automation/scripts/run-tools-tests tests/
+mkdir -p boot etc/local.d root
+cp -a ../automation/scripts/run-tools-tests root/
 
 echo "#!/bin/bash
 
automation/scripts/run-tools-tests +19 -24

49 lines not on this page · raw message

Signature · 1 line
2.39.5
#8 lore raw

Re: [PATCH 3/3] CI: Drop custom handling of tools/tests

Quoted 26 lines · Andrew Cooper
automation/scripts/run-tools-tests +0 -18
index 770e97c3e943..8d7aa8fa5140 100755
@@ -12,30 +12,25 @@ 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 dir in "$1"/*; do
-    [ -d "$dir" ] || continue
-    echo "Running test in $dir"
-    printf '  <testcase name="%s">\n' "$dir" >> "$xml_out"
-    ret=
-    for f in "$dir"/*; do
-        [ -f "$f" ] || continue
-        [ -x "$f" ] || continue
-        "$f" 2>&1 | tee /tmp/out
-        ret=$?
-        if [ "$ret" -ne 0 ]; then
-            echo "FAILED: $ret"
-            failed+=" $dir"
-            printf '   <failure type="failure" message="binary %s exited with code %d">\n' "$f" "$ret" >> "$xml_out"
-            # TODO: could use xml escaping... but current tests seems to
-            # produce sane output
-            cat /tmp/out >> "$xml_out"
-            printf '   </failure>\n' >> "$xml_out"

automation/scripts/run-tools-tests printf '<?xml version="1.0" encoding="UTF-8"?>\n' > "$xml_out" · line 18

Quoted 10 lines
automation/scripts/run-tools-tests +4 -6
-        else
-            echo "PASSED"
-        fi
-    done
-    if [ -z "$ret" ]; then
-        printf '   <skipped type="skipped" message="no executable test found in %s"/>\n' "$dir" >> "$xml_out"
+for f in "$1"/*; do
+    if [ -x "$f" ]; then
+        echo "SKIP: $f not executable"
+        continue

This should be ! -x

I had that hunk in the wrong patch when posting this series.

~Andrew

Quoted 18 lines
automation/scripts/run-tools-tests +15 -0
+    fi
+    echo "Running $f"
+    printf '  <testcase name="%s">\n' "$f" >> "$xml_out"
+    "$f" 2>&1 | tee /tmp/out
+    ret=$?
+    if [ "$ret" -ne 0 ]; then
+        echo "FAILED: $f"
+        failed+=" $f"
+        printf '   <failure type="failure" message="binary %s exited with code %d">\n' "$f" "$ret" >> "$xml_out"
+        # TODO: could use xml escaping... but current tests seems to
+        # produce sane output
+        cat /tmp/out >> "$xml_out"
+        printf '   </failure>\n' >> "$xml_out"
+    else
+        echo "PASSED"
     fi
     printf '  </testcase>\n' >> "$xml_out"
 done
Reviewed-by
#9 lore raw

Re: [PATCH 3/3] CI: Drop custom handling of tools/tests

Quoted 40 lines · Andrew Cooper
Quoted 26 lines · Andrew Cooper
automation/scripts/run-tools-tests +0 -18
index 770e97c3e943..8d7aa8fa5140 100755
@@ -12,30 +12,25 @@ 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 dir in "$1"/*; do
-    [ -d "$dir" ] || continue
-    echo "Running test in $dir"
-    printf '  <testcase name="%s">\n' "$dir" >> "$xml_out"
-    ret=
-    for f in "$dir"/*; do
-        [ -f "$f" ] || continue
-        [ -x "$f" ] || continue
-        "$f" 2>&1 | tee /tmp/out
-        ret=$?
-        if [ "$ret" -ne 0 ]; then
-            echo "FAILED: $ret"
-            failed+=" $dir"
-            printf '   <failure type="failure" message="binary %s exited with code %d">\n' "$f" "$ret" >> "$xml_out"
-            # TODO: could use xml escaping... but current tests seems to
-            # produce sane output
-            cat /tmp/out >> "$xml_out"
-            printf '   </failure>\n' >> "$xml_out"

automation/scripts/run-tools-tests printf '<?xml version="1.0" encoding="UTF-8"?>\n' > "$xml_out" · line 18

Quoted 10 lines
automation/scripts/run-tools-tests +4 -6
-        else
-            echo "PASSED"
-        fi
-    done
-    if [ -z "$ret" ]; then
-        printf '   <skipped type="skipped" message="no executable test found in %s"/>\n' "$dir" >> "$xml_out"
+for f in "$1"/*; do
+    if [ -x "$f" ]; then
+        echo "SKIP: $f not executable"
+        continue

This should be ! -x

Quoted 1 line

I had that hunk in the wrong patch when posting this series.

With that fixed:

But I think there's an issue with the script...

Quoted 3 lines

automation/scripts/run-tools-tests printf '<?xml version="1.0" encoding="UTF-8"?>\n' > "$xml_out" · line 24

Quoted 3 lines
automation/scripts/run-tools-tests +3 -0
+    "$f" 2>&1 | tee /tmp/out
+    ret=$?
+    if [ "$ret" -ne 0 ]; then

Is this checking the correct exit value? It seems that without set -o pipefail, we only have the exit value of tee which should never fail. But I think we should grab the value of ${PIPESTATUS[0]} to actually read the exit value of $f.

Thanks,

Signature · 1 line
Anthony PERARD
#10 lore raw

Re: [PATCH 3/3] CI: Drop custom handling of tools/tests

Quoted 40 lines · Anthony PERARD
Quoted 39 lines · Andrew Cooper
Quoted 26 lines · Andrew Cooper
automation/scripts/run-tools-tests +0 -18
index 770e97c3e943..8d7aa8fa5140 100755
@@ -12,30 +12,25 @@ 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 dir in "$1"/*; do
-    [ -d "$dir" ] || continue
-    echo "Running test in $dir"
-    printf '  <testcase name="%s">\n' "$dir" >> "$xml_out"
-    ret=
-    for f in "$dir"/*; do
-        [ -f "$f" ] || continue
-        [ -x "$f" ] || continue
-        "$f" 2>&1 | tee /tmp/out
-        ret=$?
-        if [ "$ret" -ne 0 ]; then
-            echo "FAILED: $ret"
-            failed+=" $dir"
-            printf '   <failure type="failure" message="binary %s exited with code %d">\n' "$f" "$ret" >> "$xml_out"
-            # TODO: could use xml escaping... but current tests seems to
-            # produce sane output
-            cat /tmp/out >> "$xml_out"
-            printf '   </failure>\n' >> "$xml_out"

automation/scripts/run-tools-tests printf '<?xml version="1.0" encoding="UTF-8"?>\n' > "$xml_out" · line 18

Quoted 10 lines
automation/scripts/run-tools-tests +4 -6
-        else
-            echo "PASSED"
-        fi
-    done
-    if [ -z "$ret" ]; then
-        printf '   <skipped type="skipped" message="no executable test found in %s"/>\n' "$dir" >> "$xml_out"
+for f in "$1"/*; do
+    if [ -x "$f" ]; then
+        echo "SKIP: $f not executable"
+        continue

This should be ! -x

Quoted 3 lines
Quoted 1 line

I had that hunk in the wrong patch when posting this series.

With that fixed:

Thanks.

Quoted 10 lines

But I think there's an issue with the script...

Quoted 3 lines

automation/scripts/run-tools-tests printf '<?xml version="1.0" encoding="UTF-8"?>\n' > "$xml_out" · line 24

Quoted 3 lines
automation/scripts/run-tools-tests +3 -0
+    "$f" 2>&1 | tee /tmp/out
+    ret=$?
+    if [ "$ret" -ne 0 ]; then

Is this checking the correct exit value? It seems that without set -o pipefail, we only have the exit value of tee which should never fail. But I think we should grab the value of ${PIPESTATUS[0]} to actually read the exit value of $f.

Hmm yes, I think this needs adjusting.

It turns out there are multiple problems with junit, including the fact that putting failures in here doesn't cause the outer job to fail.

The internet suggest having a 'script: grep "<failure" junit.xml' step to work around this.

I think that wants to be a separate series.  The question is whether to do this series first or second.  I expect I'm going to need to backport all of this work to eventually get XTF back onto the older trees.

~Andrew

Reviewed-by
#11 lore raw

Re: [PATCH 3/3] CI: Drop custom handling of tools/tests

Quoted 41 lines · Andrew Cooper
Quoted 40 lines · Anthony PERARD
Quoted 39 lines · Andrew Cooper
Quoted 26 lines · Andrew Cooper
automation/scripts/run-tools-tests +0 -18
index 770e97c3e943..8d7aa8fa5140 100755
@@ -12,30 +12,25 @@ 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 dir in "$1"/*; do
-    [ -d "$dir" ] || continue
-    echo "Running test in $dir"
-    printf '  <testcase name="%s">\n' "$dir" >> "$xml_out"
-    ret=
-    for f in "$dir"/*; do
-        [ -f "$f" ] || continue
-        [ -x "$f" ] || continue
-        "$f" 2>&1 | tee /tmp/out
-        ret=$?
-        if [ "$ret" -ne 0 ]; then
-            echo "FAILED: $ret"
-            failed+=" $dir"
-            printf '   <failure type="failure" message="binary %s exited with code %d">\n' "$f" "$ret" >> "$xml_out"
-            # TODO: could use xml escaping... but current tests seems to
-            # produce sane output
-            cat /tmp/out >> "$xml_out"
-            printf '   </failure>\n' >> "$xml_out"

automation/scripts/run-tools-tests printf '<?xml version="1.0" encoding="UTF-8"?>\n' > "$xml_out" · line 18

Quoted 10 lines
automation/scripts/run-tools-tests +4 -6
-        else
-            echo "PASSED"
-        fi
-    done
-    if [ -z "$ret" ]; then
-        printf '   <skipped type="skipped" message="no executable test found in %s"/>\n' "$dir" >> "$xml_out"
+for f in "$1"/*; do
+    if [ -x "$f" ]; then
+        echo "SKIP: $f not executable"
+        continue

This should be ! -x

Quoted 3 lines
Quoted 3 lines
Quoted 1 line

I had that hunk in the wrong patch when posting this series.

With that fixed:

Quoted 18 lines

Thanks.

Quoted 10 lines

But I think there's an issue with the script...

Quoted 3 lines

automation/scripts/run-tools-tests printf '<?xml version="1.0" encoding="UTF-8"?>\n' > "$xml_out" · line 24

Quoted 3 lines
automation/scripts/run-tools-tests +3 -0
+    "$f" 2>&1 | tee /tmp/out
+    ret=$?
+    if [ "$ret" -ne 0 ]; then

Is this checking the correct exit value? It seems that without set -o pipefail, we only have the exit value of tee which should never fail. But I think we should grab the value of ${PIPESTATUS[0]} to actually read the exit value of $f.

Hmm yes, I think this needs adjusting.

It turns out there are multiple problems with junit, including the fact that putting failures in here doesn't cause the outer job to fail.

Quoted 6 lines

The internet suggest having a 'script: grep "<failure" junit.xml' step to work around this.

I think that wants to be a separate series.  The question is whether to do this series first or second.  I expect I'm going to need to backport all of this work to eventually get XTF back onto the older trees.

I'll leave the choice to you

#12 lore raw

Re: [PATCH 3/3] CI: Drop custom handling of tools/tests

Quoted 42 lines · Stefano Stabellini
Quoted 41 lines · Andrew Cooper
Quoted 40 lines · Anthony PERARD
Quoted 39 lines · Andrew Cooper
Quoted 26 lines · Andrew Cooper
automation/scripts/run-tools-tests +0 -18
index 770e97c3e943..8d7aa8fa5140 100755
@@ -12,30 +12,25 @@ 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 dir in "$1"/*; do
-    [ -d "$dir" ] || continue
-    echo "Running test in $dir"
-    printf '  <testcase name="%s">\n' "$dir" >> "$xml_out"
-    ret=
-    for f in "$dir"/*; do
-        [ -f "$f" ] || continue
-        [ -x "$f" ] || continue
-        "$f" 2>&1 | tee /tmp/out
-        ret=$?
-        if [ "$ret" -ne 0 ]; then
-            echo "FAILED: $ret"
-            failed+=" $dir"
-            printf '   <failure type="failure" message="binary %s exited with code %d">\n' "$f" "$ret" >> "$xml_out"
-            # TODO: could use xml escaping... but current tests seems to
-            # produce sane output
-            cat /tmp/out >> "$xml_out"
-            printf '   </failure>\n' >> "$xml_out"

automation/scripts/run-tools-tests printf '<?xml version="1.0" encoding="UTF-8"?>\n' > "$xml_out" · line 18

Quoted 10 lines
automation/scripts/run-tools-tests +4 -6
-        else
-            echo "PASSED"
-        fi
-    done
-    if [ -z "$ret" ]; then
-        printf '   <skipped type="skipped" message="no executable test found in %s"/>\n' "$dir" >> "$xml_out"
+for f in "$1"/*; do
+    if [ -x "$f" ]; then
+        echo "SKIP: $f not executable"
+        continue

This should be ! -x

Quoted 4 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line

I had that hunk in the wrong patch when posting this series.

With that fixed:

Thanks.

Quoted 18 lines
Quoted 18 lines

Thanks.

Quoted 9 lines

But I think there's an issue with the script...

Quoted 3 lines

automation/scripts/run-tools-tests printf '<?xml version="1.0" encoding="UTF-8"?>\n' > "$xml_out" · line 24

Quoted 3 lines
automation/scripts/run-tools-tests +3 -0
+    "$f" 2>&1 | tee /tmp/out
+    ret=$?
+    if [ "$ret" -ne 0 ]; then

Is this checking the correct exit value? It seems that without set -o pipefail, we only have the exit value of tee which should never fail. But I think we should grab the value of ${PIPESTATUS[0]} to actually read the exit value of $f.

Hmm yes, I think this needs adjusting.

It turns out there are multiple problems with junit, including the fact that putting failures in here doesn't cause the outer job to fail.

Quoted 8 lines
Quoted 6 lines

The internet suggest having a 'script: grep "<failure" junit.xml' step to work around this.

I think that wants to be a separate series.  The question is whether to do this series first or second.  I expect I'm going to need to backport all of this work to eventually get XTF back onto the older trees.

I'll leave the choice to you

In which case I'll get this committed now, because it's one useful step forward and reduces my queue a bit.

~Andrew

Reviewed-by Denis Mukhin on the v1 series
#13 lore raw
In reply to Andrew Cooper
Quoted 9 lines · Andrew Cooper

Rearrange tools/tests to be more ameanable to running in CI, and drop the special casing holding it together.

Andrew Cooper (3):
tools/tests: Drop depriv-fd-checker tools/tests: Install tests into $(LIBEXEC)/tests
CI: Drop custom handling of tools/tests

The code changes look good to me

for the series.

Quoted 22 lines
 .gitignore                             |   1 -
 automation/scripts/build               |   1 -
 automation/scripts/qubes-x86-64.sh     |   7 +-
 automation/scripts/run-tools-tests     |  43 ++-
 tools/tests/Makefile                   |   1 -
 tools/tests/cpu-policy/Makefile        |   6 +-
 tools/tests/depriv/Makefile            |  52 ---
 tools/tests/depriv/depriv-fd-checker.c | 436 -------------------------
 tools/tests/paging-mempool/Makefile    |   6 +-
 tools/tests/rangeset/Makefile          |   6 +-
 tools/tests/resource/Makefile          |   6 +-
 tools/tests/tsx/Makefile               |   6 +-
 tools/tests/xenstore/Makefile          |   6 +-
 13 files changed, 40 insertions(+), 537 deletions(-)
 delete mode 100644 tools/tests/depriv/Makefile
 delete mode 100644 tools/tests/depriv/depriv-fd-checker.c

--
2.39.5