summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDimitri John Ledkov <xnox@ubuntu.com>2017-11-06 17:00:13 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2018-09-15 10:11:18 +0200
commite180bdb5ebed947a879c0ba1b7c189d17c44e903 (patch)
tree781cabf8df509fa2cac7c8c7c48753e193f79701 /test
parentsocket-util: attempt SO_RCVBUFFORCE/SO_SNDBUFFORCE only if SO_RCVBUF/SO_SNDBU... (diff)
downloadsystemd-e180bdb5ebed947a879c0ba1b7c189d17c44e903.tar.xz
systemd-e180bdb5ebed947a879c0ba1b7c189d17c44e903.zip
test/test-functions: drop all prefixes
When parsing and installing binaries mentioned in Exec*= lines the 5ed0dcf4d552271115d96d8d22b1a25494b85277 commit added parsing logic to drop prefixes, including handling duplicate exclamation marks. But this did not handle arbitrary combination of multiple prefixes, ie. StartExec=+-/bin/sh was parsed as -/bin/sh which then would fail to install. Instead of using egrep and shell replacements, replace both with sed command that does it all. This sed script extract a group of characters starting with a / up to the first space (if any) after the equals sign. This correctly handles existing non-prefixed, prefixed, multiple-prefixed commands. About half commands seem to repeat themself, thus sort -u cuts the list of binaries to install about in half. To validate change of behaviour both old and new functions were modified to echo parsed binaries into separate files, and then diffed. The incorrect -/bin/sh was missing in the new output. Without this patch tests fail on default Ubuntu installs.
Diffstat (limited to 'test')
-rw-r--r--test/test-functions5
1 files changed, 2 insertions, 3 deletions
diff --git a/test/test-functions b/test/test-functions
index 438ecbb288..767b41e597 100644
--- a/test/test-functions
+++ b/test/test-functions
@@ -504,9 +504,8 @@ install_execs() {
export PKG_CONFIG_PATH=$BUILD_DIR/src/core/
systemdsystemunitdir=$(pkg-config --variable=systemdsystemunitdir systemd)
systemduserunitdir=$(pkg-config --variable=systemduserunitdir systemd)
- egrep -ho '^Exec[^ ]*=[^ ]+' $initdir/{$systemdsystemunitdir,$systemduserunitdir}/*.service \
- | while read i; do
- i=${i##Exec*=}; i=${i##[@+\!-]}; i=${i##\!}
+ sed -n 's|^Exec[a-zA-Z]*=[^/]*\(/[^ ]*\).*|\1|gp' $initdir/{$systemdsystemunitdir,$systemduserunitdir}/*.service \
+ | sort -u | while read i; do
# some {rc,halt}.local scripts and programs are okay to not exist, the rest should
inst $i || [ "${i%.local}" != "$i" ] || [ "${i%systemd-update-done}" != "$i" ]
done