From: Frantisek Sumsal Date: Fri, 26 Aug 2022 13:59:37 +0000 (+0200) Subject: test: use a unique machine name for each nspawn test X-Git-Tag: v252-rc1~324^2~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=10d7ed12c9aedae3055218452de452800c3ea39d;p=thirdparty%2Fsystemd.git test: use a unique machine name for each nspawn test to avoid scope clashing in case some previous test crashed and/or didn't clean up properly. Currently all test machines are called `root`, since the name is automagically derived from the container path (in this case `/var/tmp/systemd-test.XXXXXX/root`). E.g. (from Ubuntu CI): ``` [23:10:12] --x-- Running TEST-71-HOSTNAME --x-- make: Entering directory '/tmp/autopkgtest.5LjnBV/build.0mE/systemd/test/TEST-71-HOSTNAME' + make -C TEST-71-HOSTNAME setup run TEST-71-HOSTNAME SETUP: test hostnamed Reusing existing cached image /tmp/autopkgtest.5LjnBV/build.0mE/systemd/test/TEST-71-HOSTNAME/../default.img → /tmp/autopkgtest.5LjnBV/build.0mE/systemd/test/default.img '/var/tmp/systemd-test.1yy2SS/default.img' -> '/tmp/autopkgtest.5LjnBV/build.0mE/systemd/test/default.img' I: Masking supporting services '/var/tmp/systemd-test.1yy2SS/root/etc/systemd/system/systemd-hwdb-update.service' -> '/dev/null' '/var/tmp/systemd-test.1yy2SS/root/etc/systemd/system/systemd-journal-catalog-update.service' -> '/dev/null' '/var/tmp/systemd-test.1yy2SS/root/etc/systemd/system/systemd-networkd.service' -> '/dev/null' '/var/tmp/systemd-test.1yy2SS/root/etc/systemd/system/systemd-networkd.socket' -> '/dev/null' '/var/tmp/systemd-test.1yy2SS/root/etc/systemd/system/systemd-resolved.service' -> '/dev/null' TEST-71-HOSTNAME RUN: test hostnamed + env --unset=UNIFIED_CGROUP_HIERARCHY --unset=SYSTEMD_NSPAWN_UNIFIED_HIERARCHY timeout --foreground 1200 /bin/systemd-nspawn --register=no --kill-signal=SIGKILL --directory=/var/tmp/systemd-test.1yy2SS/root --setenv=SYSTEMD_UNIT_PATH=/usr/lib/systemd/tests/testdata/testsuite-71.units:/usr/lib/systemd/tests/testdata/units: /lib/systemd/systemd systemd.unit=testsuite.target systemd.wants=testsuite-71.service systemd.wants=end.service Spawning container root on /var/tmp/systemd-test.1yy2SS/root. Press ^] three times within 1s to kill container. Failed to allocate scope: Unit root.scope already exists. E: nspawn failed with exit code 1 ``` --- diff --git a/test/test-functions b/test/test-functions index 359eb90314f..1c0441e7c55 100644 --- a/test/test-functions +++ b/test/test-functions @@ -538,6 +538,7 @@ run_nspawn() { "--kill-signal=SIGKILL" "--directory=${1:?}" "--setenv=SYSTEMD_UNIT_PATH=/usr/lib/systemd/tests/testdata/testsuite-$2.units:/usr/lib/systemd/tests/testdata/units:" + "--machine=TEST-$TESTID" ) local kernel_params=( "$PATH_TO_INIT"