summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgeny Vereshchagin <evvers@ya.ru>2016-04-13 16:57:06 +0300
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-04-13 09:57:06 -0400
commit43bbb8f005177bcad135ec894419361f0f420034 (patch)
tree7dc3a0971b7413e095852fa2643022e5e29cccdb
parent025ef1d2264b24e77283d312dede8af01fa050f6 (diff)
tests: don't rely on the host's systemd-nspawn, don't register test machine (#3023)
Fixes: $ cd test/TEST-07-ISSUE-1981/ $ sudo make clean setup run ... timeout: failed to run command ‘systemd-nspawn’: No such file or directory ... TEST RUN: https://github.com/systemd/systemd/issues/1981 [FAILED] Makefile:10: recipe for target 'run' failed make: *** [run] Error 1
-rwxr-xr-xtest/TEST-07-ISSUE-1981/test.sh3
-rw-r--r--test/test-functions7
2 files changed, 8 insertions, 2 deletions
diff --git a/test/TEST-07-ISSUE-1981/test.sh b/test/TEST-07-ISSUE-1981/test.sh
index dcb6ece4d4..d97c4ec27d 100755
--- a/test/TEST-07-ISSUE-1981/test.sh
+++ b/test/TEST-07-ISSUE-1981/test.sh
@@ -8,7 +8,8 @@ TEST_DESCRIPTION="https://github.com/systemd/systemd/issues/1981"
test_run() {
dwarn "skipping QEMU"
if check_nspawn; then
- timeout --foreground 30s systemd-nspawn --kill-signal=SIGKILL --boot --directory=$TESTDIR/nspawn-root $ROOTLIBDIR/systemd $KERNEL_APPEND
+ NSPAWN_TIMEOUT=30s
+ run_nspawn
check_result_nspawn || return 1
else
dwarn "can't run systemd-nspawn, skipping"
diff --git a/test/test-functions b/test/test-functions
index 8bbcddab59..b07c500339 100644
--- a/test/test-functions
+++ b/test/test-functions
@@ -8,6 +8,7 @@ LOOKS_LIKE_DEBIAN=$(source /etc/os-release && [[ "$ID" = "debian" || "$ID_LIKE"
KERNEL_VER=${KERNEL_VER-$(uname -r)}
KERNEL_MODS="/lib/modules/$KERNEL_VER/"
QEMU_TIMEOUT="${QEMU_TIMEOUT:-infinity}"
+NSPAWN_TIMEOUT="${NSPAWN_TIMEOUT:-infinity}"
FSTYPE="${FSTYPE:-ext3}"
if ! ROOTLIBDIR=$(pkg-config --variable=systemdutildir systemd); then
@@ -96,8 +97,12 @@ $KERNEL_APPEND \
}
run_nspawn() {
+ 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"
+ fi
set -x
- ../../systemd-nspawn --register=no --directory=$TESTDIR/nspawn-root $ROOTLIBDIR/systemd $KERNEL_APPEND
+ $_nspawn_cmd
}
setup_basic_environment() {