mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 10:11:27 +01:00
... and use them from their installed location. The full reclusive 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.cooper3@citrix.com> Reviewed-by: Anthony PERARD <anthony.perard@vates.tech> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org> Reviewed-by: Denis Mukhin <dmukhin@ford.com>
43 lines
1.1 KiB
Bash
Executable File
43 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
usage() {
|
|
echo "Usage: $0 tests-dir xml-out"
|
|
}
|
|
|
|
xml_out=$2
|
|
if [ -z "$xml_out" ]; then
|
|
xml_out=/dev/null
|
|
fi
|
|
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
|
|
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
|
|
printf ' </testsuite>\n' >> "$xml_out"
|
|
printf '</testsuites>\n' >> "$xml_out"
|
|
|
|
if [ -n "$failed" ]; then
|
|
exit 1
|
|
fi
|