... 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. Signed-off-by: Andrew Cooper <andrew.coop...@citrix.com> --- CC: Anthony PERARD <anthony.per...@vates.tech> CC: Stefano Stabellini <sstabell...@kernel.org> CC: Marek Marczykowski-Górecki <marma...@invisiblethingslab.com> 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(-) diff --git a/automation/scripts/build b/automation/scripts/build index cdb8cd7c722b..0e7494ff6d87 100755 --- a/automation/scripts/build +++ b/automation/scripts/build @@ -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 diff --git a/automation/scripts/qubes-x86-64.sh b/automation/scripts/qubes-x86-64.sh index aa47ba6bf5c0..577a00238a75 100755 --- a/automation/scripts/qubes-x86-64.sh +++ b/automation/scripts/qubes-x86-64.sh @@ -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 diff --git a/automation/scripts/run-tools-tests b/automation/scripts/run-tools-tests index 770e97c3e943..8d7aa8fa5140 100755 --- a/automation/scripts/run-tools-tests +++ b/automation/scripts/run-tools-tests @@ -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" - 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 + 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 -- 2.39.5