summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorFrantisek Sumsal <frantisek@sumsal.cz>2019-07-08 21:05:51 +0200
committerFrantisek Sumsal <frantisek@sumsal.cz>2019-07-08 21:05:51 +0200
commit3cdb93d07b5294993a5a46aabf733cd522dbc112 (patch)
tree8af4446c2dd51c2132e4c9a5df246a36c30bb517 /test
parentFUNDING: this needs to be yaml (diff)
downloadsystemd-3cdb93d07b5294993a5a46aabf733cd522dbc112.tar.xz
systemd-3cdb93d07b5294993a5a46aabf733cd522dbc112.zip
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.
Diffstat (limited to 'test')
-rw-r--r--test/test-functions8
1 files changed, 8 insertions, 0 deletions
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