From 3cdb93d07b5294993a5a46aabf733cd522dbc112 Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Mon, 8 Jul 2019 21:05:51 +0200 Subject: [PATCH 1/4] test: correctly handle installation of newly introduced binaries 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. This was discovered during installation of /usr/lib/systemd/systemd-bless-boot, which was not present in Ubuntu CI (as the installed systemd was from the Ubuntu repositories), and the binary itself was already in the image thanks to `ninja install`. However, during extraction of binaries from the systemd service files, another attempt to install this binary was made, which failed due to `find_binary` being unable to find it. --- test/test-functions | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/test-functions b/test/test-functions index 4a76dd70ea..c4ac25fbc5 100644 --- a/test/test-functions +++ b/test/test-functions @@ -1238,6 +1238,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 From 71a0de36e562da72590cdeb625acd4385e7a6e6d Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Mon, 8 Jul 2019 21:10:21 +0200 Subject: [PATCH 2/4] test: be a little bit more verbose when installing service binaries --- test/test-functions | 1 + 1 file changed, 1 insertion(+) diff --git a/test/test-functions b/test/test-functions index c4ac25fbc5..d66956711d 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 ) From cc469c3dfc398210f38f819d367e68646c71d8da Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Mon, 8 Jul 2019 21:11:32 +0200 Subject: [PATCH 3/4] test: drop || return 1 expression which is incompatible with set -e The `set -e` option is incompatible with a subshell/compound command, which is followed by || . In such case, the -e option is ignored in all affected subshells/functions (see man bash(1) for command `set`). --- test/TEST-01-BASIC/test.sh | 2 +- test/TEST-02-CRYPTSETUP/test.sh | 2 +- test/TEST-03-JOBS/test.sh | 2 +- test/TEST-04-JOURNAL/test.sh | 2 +- test/TEST-05-RLIMITS/test.sh | 2 +- test/TEST-06-SELINUX/test.sh | 2 +- test/TEST-07-ISSUE-1981/test.sh | 2 +- test/TEST-08-ISSUE-2730/test.sh | 2 +- test/TEST-09-ISSUE-2691/test.sh | 2 +- test/TEST-10-ISSUE-2467/test.sh | 2 +- test/TEST-11-ISSUE-3166/test.sh | 2 +- test/TEST-12-ISSUE-3171/test.sh | 2 +- test/TEST-13-NSPAWN-SMOKE/test.sh | 2 +- test/TEST-14-MACHINE-ID/test.sh | 2 +- test/TEST-16-EXTEND-TIMEOUT/test.sh | 2 +- test/TEST-17-UDEV-WANTS/test.sh | 2 +- test/TEST-18-FAILUREACTION/test.sh | 2 +- test/TEST-19-DELEGATE/test.sh | 2 +- test/TEST-20-MAINPIDGAMES/test.sh | 2 +- test/TEST-23-TYPE-EXEC/test.sh | 2 +- test/TEST-24-UNIT-TESTS/test.sh | 2 +- test/TEST-25-IMPORT/test.sh | 2 +- test/TEST-26-SETENV/test.sh | 2 +- test/TEST-27-STDOUTFILE/test.sh | 2 +- test/TEST-28-PERCENTJ-WANTEDBY/test.sh | 2 +- test/TEST-29-UDEV-ID_RENAMING/test.sh | 2 +- test/TEST-30-ONCLOCKCHANGE/test.sh | 2 +- test/TEST-31-DEVICE-ENUMERATION/test.sh | 2 +- test/TEST-32-OOMPOLICY/test.sh | 2 +- test/TEST-34-DYNAMICUSERMIGRATE/test.sh | 2 +- 30 files changed, 30 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 < Date: Mon, 8 Jul 2019 21:28:10 +0200 Subject: [PATCH 4/4] test: install missing dependencies for CIs --- travis-ci/managers/fuzzbuzz.sh | 2 +- travis-ci/managers/xenial.sh | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/travis-ci/managers/fuzzbuzz.sh b/travis-ci/managers/fuzzbuzz.sh index 0080b065d8..3fe7e1a803 100755 --- a/travis-ci/managers/fuzzbuzz.sh +++ b/travis-ci/managers/fuzzbuzz.sh @@ -9,7 +9,7 @@ REPO_ROOT=${REPO_ROOT:-$(pwd)} sudo bash -c "echo 'deb-src http://archive.ubuntu.com/ubuntu/ xenial main restricted universe multiverse' >>/etc/apt/sources.list" sudo apt-get update -y sudo apt-get build-dep systemd -y -sudo apt-get install -y ninja-build python3-pip python3-setuptools +sudo apt-get install -y ninja-build python3-pip python3-setuptools quota pip3 install meson cd $REPO_ROOT diff --git a/travis-ci/managers/xenial.sh b/travis-ci/managers/xenial.sh index 475a1510aa..076e8f9325 100755 --- a/travis-ci/managers/xenial.sh +++ b/travis-ci/managers/xenial.sh @@ -32,6 +32,7 @@ PACKAGES=(cryptsetup-bin python3-pyparsing python3-setuptools qemu-system-x86 + quota strace unifont util-linux)