summaryrefslogtreecommitdiff
path: root/test/test-functions
diff options
context:
space:
mode:
authorLuca Boccassi <luca.boccassi@microsoft.com>2021-06-21 20:05:47 +0100
committerLuca Boccassi <luca.boccassi@microsoft.com>2021-06-21 20:45:56 +0100
commitfa1fdd3099dd580af382f0cb5200230a8ae72a31 (patch)
tree1ebe7af16d0e905953fed84ba535edd9d0dfdd87 /test/test-functions
parent85d3f132545b0170da04331a209910509b1a7cbc (diff)
downloadsystemd-fa1fdd3099dd580af382f0cb5200230a8ae72a31.tar.gz
test: move custom result checks from TEST-02-UNITTESTS to test-functions
Diffstat (limited to 'test/test-functions')
-rw-r--r--test/test-functions60
1 files changed, 60 insertions, 0 deletions
diff --git a/test/test-functions b/test/test-functions
index 69921442ba..7edb55251d 100644
--- a/test/test-functions
+++ b/test/test-functions
@@ -1229,6 +1229,66 @@ check_result_qemu() {
return $ret
}
+check_result_nspawn_unittests() {
+ local workspace="${1:?}"
+ local ret=1
+
+ [[ -e "$workspace/testok" ]] && ret=0
+
+ if [[ -s "$workspace/failed" ]]; then
+ ret=$((ret + 1))
+ echo "=== Failed test log ==="
+ cat "$workspace/failed"
+ else
+ if [[ -s "$workspace/skipped" ]]; then
+ echo "=== Skipped test log =="
+ cat "$workspace/skipped"
+ # We might have only skipped tests - that should not fail the job
+ ret=0
+ fi
+ if [[ -s "$workspace/testok" ]]; then
+ echo "=== Passed tests ==="
+ cat "$workspace/testok"
+ fi
+ fi
+
+ save_journal "$workspace/var/log/journal"
+ _umount_dir "${initdir:?}"
+
+ [[ -n "${TIMED_OUT:=}" ]] && ret=1
+ return $ret
+}
+
+check_result_qemu_unittests() {
+ local ret=1
+
+ mount_initdir
+ [[ -e "${initdir:?}/testok" ]] && ret=0
+
+ if [[ -s "$initdir/failed" ]]; then
+ ret=$((ret + 1))
+ echo "=== Failed test log ==="
+ cat "$initdir/failed"
+ else
+ if [[ -s "$initdir/skipped" ]]; then
+ echo "=== Skipped test log =="
+ cat "$initdir/skipped"
+ # We might have only skipped tests - that should not fail the job
+ ret=0
+ fi
+ if [[ -s "$initdir/testok" ]]; then
+ echo "=== Passed tests ==="
+ cat "$initdir/testok"
+ fi
+ fi
+
+ save_journal "$initdir/var/log/journal"
+ _umount_dir "$initdir"
+
+ [[ -n "${TIMED_OUT:=}" ]] && ret=1
+ return $ret
+}
+
strip_binaries() {
dinfo "Strip binaries"
if [[ "$STRIP_BINARIES" = "no" ]]; then