diff options
author | Evgeny Vereshchagin <evvers@ya.ru> | 2019-07-09 01:27:39 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-09 01:27:39 +0200 |
commit | 869250e6b813840f24dac1204745dee37800d25b (patch) | |
tree | 22866ebdd48be147a1efdf44eaaedd7dd6302fb8 /test | |
parent | pid1: fix serialization/deserialization of commmands with spaces (diff) | |
parent | test: install missing dependencies for CIs (diff) | |
download | systemd-869250e6b813840f24dac1204745dee37800d25b.tar.xz systemd-869250e6b813840f24dac1204745dee37800d25b.zip |
Merge pull request #12992 from mrc0mmand/test-functions-fixes
Various test/test-functions fixes/improvements
Diffstat (limited to 'test')
31 files changed, 39 insertions, 30 deletions
diff --git a/test/TEST-01-BASIC/test.sh b/test/TEST-01-BASIC/test.sh index 0f29ad7eda..a34e2adbe2 100755 --- a/test/TEST-01-BASIC/test.sh +++ b/test/TEST-01-BASIC/test.sh @@ -29,7 +29,7 @@ Type=oneshot EOF setup_testsuite - ) || return 1 + ) setup_nspawn_root ddebug "umount $TESTDIR/root" diff --git a/test/TEST-02-CRYPTSETUP/test.sh b/test/TEST-02-CRYPTSETUP/test.sh index aed1c59106..9d25e94250 100755 --- a/test/TEST-02-CRYPTSETUP/test.sh +++ b/test/TEST-02-CRYPTSETUP/test.sh @@ -75,7 +75,7 @@ EOF cat >>$initdir/etc/fstab <<EOF /dev/mapper/varcrypt /var ext4 defaults 0 1 EOF - ) || return 1 + ) ddebug "umount $TESTDIR/root/var" umount $TESTDIR/root/var diff --git a/test/TEST-03-JOBS/test.sh b/test/TEST-03-JOBS/test.sh index 89125109d8..2a7df79a47 100755 --- a/test/TEST-03-JOBS/test.sh +++ b/test/TEST-03-JOBS/test.sh @@ -44,7 +44,7 @@ EOF cp test-jobs.sh $initdir/ setup_testsuite - ) || return 1 + ) setup_nspawn_root ddebug "umount $TESTDIR/root" diff --git a/test/TEST-04-JOURNAL/test.sh b/test/TEST-04-JOURNAL/test.sh index f24a8f6be7..a5ba7c8434 100755 --- a/test/TEST-04-JOURNAL/test.sh +++ b/test/TEST-04-JOURNAL/test.sh @@ -46,7 +46,7 @@ EOF cp test-journal.sh $initdir/ setup_testsuite - ) || return 1 + ) setup_nspawn_root ddebug "umount $TESTDIR/root" diff --git a/test/TEST-05-RLIMITS/test.sh b/test/TEST-05-RLIMITS/test.sh index 3c29b2ee3f..176014d270 100755 --- a/test/TEST-05-RLIMITS/test.sh +++ b/test/TEST-05-RLIMITS/test.sh @@ -42,7 +42,7 @@ EOF cp test-rlimits.sh $initdir/ setup_testsuite - ) || return 1 + ) setup_nspawn_root ddebug "umount $TESTDIR/root" diff --git a/test/TEST-06-SELINUX/test.sh b/test/TEST-06-SELINUX/test.sh index 2b49b3d5ae..5d26cb0f0a 100755 --- a/test/TEST-06-SELINUX/test.sh +++ b/test/TEST-06-SELINUX/test.sh @@ -92,7 +92,7 @@ EOF dracut_install -o sesearch dracut_install runcon dracut_install checkmodule semodule semodule_package m4 make /usr/libexec/selinux/hll/pp load_policy sefcontext_compile - ) || return 1 + ) # mask some services that we do not want to run in these tests ln -s /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service diff --git a/test/TEST-07-ISSUE-1981/test.sh b/test/TEST-07-ISSUE-1981/test.sh index 93ddb6f5fb..e488cb4347 100755 --- a/test/TEST-07-ISSUE-1981/test.sh +++ b/test/TEST-07-ISSUE-1981/test.sh @@ -40,7 +40,7 @@ EOF cp test-segfault.sh $initdir/ setup_testsuite - ) || return 1 + ) setup_nspawn_root ddebug "umount $TESTDIR/root" diff --git a/test/TEST-08-ISSUE-2730/test.sh b/test/TEST-08-ISSUE-2730/test.sh index ef2aba0e17..d455d5d555 100755 --- a/test/TEST-08-ISSUE-2730/test.sh +++ b/test/TEST-08-ISSUE-2730/test.sh @@ -60,7 +60,7 @@ ExecStart=/bin/systemctl reload / EOF setup_testsuite - ) || return 1 + ) ln -s /etc/systemd/system/-.mount $initdir/etc/systemd/system/root.mount mkdir -p $initdir/etc/systemd/system/local-fs.target.wants diff --git a/test/TEST-09-ISSUE-2691/test.sh b/test/TEST-09-ISSUE-2691/test.sh index 8e7402fcd4..bef31cd096 100755 --- a/test/TEST-09-ISSUE-2691/test.sh +++ b/test/TEST-09-ISSUE-2691/test.sh @@ -32,7 +32,7 @@ TimeoutStopSec=270s EOF setup_testsuite - ) || return 1 + ) # mask some services that we do not want to run in these tests ln -s /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service diff --git a/test/TEST-10-ISSUE-2467/test.sh b/test/TEST-10-ISSUE-2467/test.sh index dc7a9acaa1..081d22b44d 100755 --- a/test/TEST-10-ISSUE-2467/test.sh +++ b/test/TEST-10-ISSUE-2467/test.sh @@ -45,7 +45,7 @@ ExecStart=/bin/true EOF setup_testsuite - ) || return 1 + ) setup_nspawn_root # mask some services that we do not want to run in these tests diff --git a/test/TEST-11-ISSUE-3166/test.sh b/test/TEST-11-ISSUE-3166/test.sh index 3419b78fe7..267224c042 100755 --- a/test/TEST-11-ISSUE-3166/test.sh +++ b/test/TEST-11-ISSUE-3166/test.sh @@ -64,7 +64,7 @@ EOF chmod 0755 $initdir/test-fail-on-restart.sh setup_testsuite - ) || return 1 + ) ddebug "umount $TESTDIR/root" umount $TESTDIR/root diff --git a/test/TEST-12-ISSUE-3171/test.sh b/test/TEST-12-ISSUE-3171/test.sh index 31cf1b471a..08b59ae165 100755 --- a/test/TEST-12-ISSUE-3171/test.sh +++ b/test/TEST-12-ISSUE-3171/test.sh @@ -90,7 +90,7 @@ EOF chmod 0755 $initdir/test-socket-group.sh setup_testsuite - ) || return 1 + ) setup_nspawn_root diff --git a/test/TEST-13-NSPAWN-SMOKE/test.sh b/test/TEST-13-NSPAWN-SMOKE/test.sh index 8252c4b2aa..6a40bebbe0 100755 --- a/test/TEST-13-NSPAWN-SMOKE/test.sh +++ b/test/TEST-13-NSPAWN-SMOKE/test.sh @@ -184,7 +184,7 @@ EOF chmod 0755 $initdir/test-nspawn.sh setup_testsuite - ) || return 1 + ) ddebug "umount $TESTDIR/root" umount $TESTDIR/root diff --git a/test/TEST-14-MACHINE-ID/test.sh b/test/TEST-14-MACHINE-ID/test.sh index 33e311a1e7..c22fc7c3c0 100755 --- a/test/TEST-14-MACHINE-ID/test.sh +++ b/test/TEST-14-MACHINE-ID/test.sh @@ -73,7 +73,7 @@ EOF chmod +x $initdir/test-machine-id-setup.sh setup_testsuite - ) || return 1 + ) # mask some services that we do not want to run in these tests ln -s /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service diff --git a/test/TEST-16-EXTEND-TIMEOUT/test.sh b/test/TEST-16-EXTEND-TIMEOUT/test.sh index 6613e32fc9..7e6dc45f6b 100755 --- a/test/TEST-16-EXTEND-TIMEOUT/test.sh +++ b/test/TEST-16-EXTEND-TIMEOUT/test.sh @@ -30,7 +30,7 @@ test_setup() { cp $BUILD_DIR/src/shared/libsystemd-shared-*.so ${initdir}/usr/lib setup_testsuite - ) || return 1 + ) # mask some services that we do not want to run in these tests ln -s /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service ln -s /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service diff --git a/test/TEST-17-UDEV-WANTS/test.sh b/test/TEST-17-UDEV-WANTS/test.sh index 9bd6e98644..02578d33c7 100755 --- a/test/TEST-17-UDEV-WANTS/test.sh +++ b/test/TEST-17-UDEV-WANTS/test.sh @@ -38,7 +38,7 @@ EOF cp testsuite.sh $initdir/ setup_testsuite - ) || return 1 + ) ddebug "umount $TESTDIR/root" umount $TESTDIR/root diff --git a/test/TEST-18-FAILUREACTION/test.sh b/test/TEST-18-FAILUREACTION/test.sh index 277cc2c798..0cf6391bdc 100755 --- a/test/TEST-18-FAILUREACTION/test.sh +++ b/test/TEST-18-FAILUREACTION/test.sh @@ -30,7 +30,7 @@ EOF cp testsuite.sh $initdir/ setup_testsuite - ) || return 1 + ) setup_nspawn_root # mask some services that we do not want to run in these tests diff --git a/test/TEST-19-DELEGATE/test.sh b/test/TEST-19-DELEGATE/test.sh index 3ed6a1b928..25461af9dc 100755 --- a/test/TEST-19-DELEGATE/test.sh +++ b/test/TEST-19-DELEGATE/test.sh @@ -40,7 +40,7 @@ EOF cp testsuite.sh $initdir/ setup_testsuite - ) || return 1 + ) ddebug "umount $TESTDIR/root" umount $TESTDIR/root diff --git a/test/TEST-20-MAINPIDGAMES/test.sh b/test/TEST-20-MAINPIDGAMES/test.sh index bf80e8b584..8adaf490e2 100755 --- a/test/TEST-20-MAINPIDGAMES/test.sh +++ b/test/TEST-20-MAINPIDGAMES/test.sh @@ -38,7 +38,7 @@ EOF cp testsuite.sh $initdir/ setup_testsuite - ) || return 1 + ) setup_nspawn_root ddebug "umount $TESTDIR/root" diff --git a/test/TEST-23-TYPE-EXEC/test.sh b/test/TEST-23-TYPE-EXEC/test.sh index 6ed22be366..68423637ce 100755 --- a/test/TEST-23-TYPE-EXEC/test.sh +++ b/test/TEST-23-TYPE-EXEC/test.sh @@ -38,7 +38,7 @@ EOF cp testsuite.sh $initdir/ setup_testsuite - ) || return 1 + ) setup_nspawn_root ddebug "umount $TESTDIR/root" diff --git a/test/TEST-24-UNIT-TESTS/test.sh b/test/TEST-24-UNIT-TESTS/test.sh index 038303edf8..5d60b548dd 100755 --- a/test/TEST-24-UNIT-TESTS/test.sh +++ b/test/TEST-24-UNIT-TESTS/test.sh @@ -91,7 +91,7 @@ EOF cp testsuite.sh $initdir/ setup_testsuite - ) || return 1 + ) setup_nspawn_root # mask some services that we do not want to run in these tests diff --git a/test/TEST-25-IMPORT/test.sh b/test/TEST-25-IMPORT/test.sh index 7fe367c3be..4beaa6456e 100755 --- a/test/TEST-25-IMPORT/test.sh +++ b/test/TEST-25-IMPORT/test.sh @@ -31,7 +31,7 @@ EOF cp testsuite.sh $initdir/ setup_testsuite - ) || return 1 + ) setup_nspawn_root ddebug "umount $TESTDIR/root" diff --git a/test/TEST-26-SETENV/test.sh b/test/TEST-26-SETENV/test.sh index 9a2913d330..b1a965aff1 100755 --- a/test/TEST-26-SETENV/test.sh +++ b/test/TEST-26-SETENV/test.sh @@ -30,7 +30,7 @@ EOF cp testsuite.sh $initdir/ setup_testsuite - ) || return 1 + ) setup_nspawn_root ddebug "umount $TESTDIR/root" diff --git a/test/TEST-27-STDOUTFILE/test.sh b/test/TEST-27-STDOUTFILE/test.sh index fb35f80ec1..e78e317d6d 100755 --- a/test/TEST-27-STDOUTFILE/test.sh +++ b/test/TEST-27-STDOUTFILE/test.sh @@ -40,7 +40,7 @@ EOF cp testsuite.sh $initdir/ setup_testsuite - ) || return 1 + ) setup_nspawn_root ddebug "umount $TESTDIR/root" diff --git a/test/TEST-28-PERCENTJ-WANTEDBY/test.sh b/test/TEST-28-PERCENTJ-WANTEDBY/test.sh index 67be1d51cc..42db3b621d 100755 --- a/test/TEST-28-PERCENTJ-WANTEDBY/test.sh +++ b/test/TEST-28-PERCENTJ-WANTEDBY/test.sh @@ -49,7 +49,7 @@ ExecStart=/bin/true EOF setup_testsuite - ) || return 1 + ) setup_nspawn_root # mask some services that we do not want to run in these tests diff --git a/test/TEST-29-UDEV-ID_RENAMING/test.sh b/test/TEST-29-UDEV-ID_RENAMING/test.sh index 26ad2f902d..3e297492ea 100755 --- a/test/TEST-29-UDEV-ID_RENAMING/test.sh +++ b/test/TEST-29-UDEV-ID_RENAMING/test.sh @@ -38,7 +38,7 @@ EOF cp testsuite.sh $initdir/ setup_testsuite - ) || return 1 + ) ddebug "umount $TESTDIR/root" umount $TESTDIR/root diff --git a/test/TEST-30-ONCLOCKCHANGE/test.sh b/test/TEST-30-ONCLOCKCHANGE/test.sh index 40e6ff25cd..47f1fff1d3 100755 --- a/test/TEST-30-ONCLOCKCHANGE/test.sh +++ b/test/TEST-30-ONCLOCKCHANGE/test.sh @@ -49,7 +49,7 @@ EOF cp testsuite.sh $initdir/ setup_testsuite - ) || return 1 + ) ddebug "umount $TESTDIR/root" umount $TESTDIR/root diff --git a/test/TEST-31-DEVICE-ENUMERATION/test.sh b/test/TEST-31-DEVICE-ENUMERATION/test.sh index 7156528873..1eda377ea0 100755 --- a/test/TEST-31-DEVICE-ENUMERATION/test.sh +++ b/test/TEST-31-DEVICE-ENUMERATION/test.sh @@ -38,7 +38,7 @@ EOF cp testsuite.sh $initdir/ setup_testsuite - ) || return 1 + ) ddebug "umount $TESTDIR/root" umount $TESTDIR/root diff --git a/test/TEST-32-OOMPOLICY/test.sh b/test/TEST-32-OOMPOLICY/test.sh index 7e9431dd11..aef3db5db5 100755 --- a/test/TEST-32-OOMPOLICY/test.sh +++ b/test/TEST-32-OOMPOLICY/test.sh @@ -41,7 +41,7 @@ EOF cp testsuite.sh $initdir/ setup_testsuite - ) || return 1 + ) ddebug "umount $TESTDIR/root" umount $TESTDIR/root diff --git a/test/TEST-34-DYNAMICUSERMIGRATE/test.sh b/test/TEST-34-DYNAMICUSERMIGRATE/test.sh index 8ef28b05f7..5964311793 100755 --- a/test/TEST-34-DYNAMICUSERMIGRATE/test.sh +++ b/test/TEST-34-DYNAMICUSERMIGRATE/test.sh @@ -38,7 +38,7 @@ EOF cp testsuite.sh $initdir/ setup_testsuite - ) || return 1 + ) setup_nspawn_root ddebug "umount $TESTDIR/root" diff --git a/test/test-functions b/test/test-functions index 8db4060ced..5dbbff0f06 100644 --- a/test/test-functions +++ b/test/test-functions @@ -659,6 +659,7 @@ install_execs() { # some {rc,halt}.local scripts and programs are okay to not exist, the rest should # also, plymouth is pulled in by rescue.service, but even there the exit code # is ignored; as it's not present on some distros, don't fail if it doesn't exist + dinfo "Attempting to install $i" inst $i || [ "${i%.local}" != "$i" ] || [ "${i%systemd-update-done}" != "$i" ] || [ "/bin/plymouth" == "$i" ] done ) @@ -1238,6 +1239,14 @@ find_binary() { # Install binary executable, and all shared library dependencies, if any. inst_binary() { local _bin _target + + # In certain cases we might attempt to install a binary which is already + # present in the test image, yet it's missing from the host system. + # In such cases, let's check if the binary indeed exists in the image + # before doing any other chcecks. If it does, immediately return with + # success. + [[ $# -eq 1 && -e $initdir/$1 ]] && return 0 + _bin=$(find_binary "$1") || return 1 _target=${2:-$_bin} [[ -e $initdir/$_target ]] && return 0 |