summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rwxr-xr-xtest/TEST-01-BASIC/test.sh3
-rwxr-xr-xtest/TEST-03-JOBS/test.sh3
-rwxr-xr-xtest/TEST-04-JOURNAL/test.sh3
-rwxr-xr-xtest/TEST-05-RLIMITS/test.sh3
-rwxr-xr-xtest/TEST-07-ISSUE-1981/test.sh6
-rwxr-xr-xtest/TEST-12-ISSUE-3171/test.sh3
-rw-r--r--test/test-functions9
7 files changed, 12 insertions, 18 deletions
diff --git a/test/TEST-01-BASIC/test.sh b/test/TEST-01-BASIC/test.sh
index 21eed9b22a..041195dcd8 100755
--- a/test/TEST-01-BASIC/test.sh
+++ b/test/TEST-01-BASIC/test.sh
@@ -25,8 +25,7 @@ test_run() {
else
dwarn "can't run QEMU, skipping"
fi
- if check_nspawn; then
- run_nspawn
+ if run_nspawn; then
check_result_nspawn || return 1
else
dwarn "can't run systemd-nspawn, skipping"
diff --git a/test/TEST-03-JOBS/test.sh b/test/TEST-03-JOBS/test.sh
index 83393435f0..ab0de0bfd1 100755
--- a/test/TEST-03-JOBS/test.sh
+++ b/test/TEST-03-JOBS/test.sh
@@ -25,8 +25,7 @@ test_run() {
else
dwarn "can't run QEMU, skipping"
fi
- if check_nspawn; then
- run_nspawn
+ if run_nspawn; then
check_result_nspawn || return 1
else
dwarn "can't run systemd-nspawn, skipping"
diff --git a/test/TEST-04-JOURNAL/test.sh b/test/TEST-04-JOURNAL/test.sh
index 1a14f76060..3ccf113019 100755
--- a/test/TEST-04-JOURNAL/test.sh
+++ b/test/TEST-04-JOURNAL/test.sh
@@ -25,8 +25,7 @@ test_run() {
else
dwarn "can't run QEMU, skipping"
fi
- if check_nspawn; then
- run_nspawn
+ if run_nspawn; then
check_result_nspawn || return 1
else
dwarn "can't run systemd-nspawn, skipping"
diff --git a/test/TEST-05-RLIMITS/test.sh b/test/TEST-05-RLIMITS/test.sh
index 6eaa0b8f34..a5f7e8de0b 100755
--- a/test/TEST-05-RLIMITS/test.sh
+++ b/test/TEST-05-RLIMITS/test.sh
@@ -25,8 +25,7 @@ test_run() {
else
dwarn "can't run QEMU, skipping"
fi
- if check_nspawn; then
- run_nspawn
+ if run_nspawn; then
check_result_nspawn || return 1
else
dwarn "can't run systemd-nspawn, skipping"
diff --git a/test/TEST-07-ISSUE-1981/test.sh b/test/TEST-07-ISSUE-1981/test.sh
index d97c4ec27d..2f7f01058e 100755
--- a/test/TEST-07-ISSUE-1981/test.sh
+++ b/test/TEST-07-ISSUE-1981/test.sh
@@ -5,11 +5,11 @@ TEST_DESCRIPTION="https://github.com/systemd/systemd/issues/1981"
. $TEST_BASE_DIR/test-functions
+NSPAWN_TIMEOUT=30s
+
test_run() {
dwarn "skipping QEMU"
- if check_nspawn; then
- NSPAWN_TIMEOUT=30s
- run_nspawn
+ if run_nspawn; then
check_result_nspawn || return 1
else
dwarn "can't run systemd-nspawn, skipping"
diff --git a/test/TEST-12-ISSUE-3171/test.sh b/test/TEST-12-ISSUE-3171/test.sh
index d0e934898c..e20f470143 100755
--- a/test/TEST-12-ISSUE-3171/test.sh
+++ b/test/TEST-12-ISSUE-3171/test.sh
@@ -6,8 +6,7 @@ TEST_DESCRIPTION="https://github.com/systemd/systemd/issues/3171"
. $TEST_BASE_DIR/test-functions
test_run() {
- if check_nspawn; then
- run_nspawn
+ if run_nspawn; then
check_result_nspawn || return 1
else
dwarn "can't run systemd-nspawn, skipping"
diff --git a/test/test-functions b/test/test-functions
index d8b7109671..4583c02f97 100644
--- a/test/test-functions
+++ b/test/test-functions
@@ -108,7 +108,11 @@ $KERNEL_APPEND \
return 0
}
+# Return 0 if nspawn did run (then you must check the result state/logs for actual
+# success), or 1 if nspawn is not available.
run_nspawn() {
+ [[ -d /run/systemd/system ]] || return 1
+
local _nspawn_cmd="../../systemd-nspawn --register=no --kill-signal=SIGKILL --directory=$TESTDIR/nspawn-root $ROOTLIBDIR/systemd $KERNEL_APPEND"
if [[ "$NSPAWN_TIMEOUT" != "infinity" ]]; then
_nspawn_cmd="timeout --foreground $NSPAWN_TIMEOUT $_nspawn_cmd"
@@ -1284,11 +1288,6 @@ inst_libdir_file() {
fi
}
-check_nspawn() {
- [[ -d /run/systemd/system ]]
-}
-
-
do_test() {
if [[ $UID != "0" ]]; then
echo "TEST: $TEST_DESCRIPTION [SKIPPED]: not root" >&2