From: Frantisek Sumsal Date: Thu, 1 Jun 2023 06:47:51 +0000 (+0200) Subject: test: add a couple of tests for systemd-run X-Git-Tag: v254-rc1~304^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F27891%2Fhead;p=thirdparty%2Fsystemd.git test: add a couple of tests for systemd-run --- diff --git a/test/test-functions b/test/test-functions index 073777a0eb3..25021779083 100644 --- a/test/test-functions +++ b/test/test-functions @@ -2668,7 +2668,7 @@ inst_binary() { # nsswitch.conf uses [SUCCESS=merge] (like on Arch Linux) # delv, dig - pull in nss_resolve if `resolve` is in nsswitch.conf # tar - called by machinectl in TEST-25 - bin_rx='/(chown|delv|dig|getent|login|ls|mkfs\.[a-z0-9]+|mksquashfs|mkswap|setfacl|setpriv|stat|su|tar|useradd|userdel)$' + bin_rx='/(chown|delv|dig|getent|id|login|ls|mkfs\.[a-z0-9]+|mksquashfs|mkswap|setfacl|setpriv|stat|su|tar|useradd|userdel)$' if get_bool "$IS_BUILT_WITH_ASAN" && [[ "$bin" =~ $bin_rx ]]; then wrap_binary=1 fi diff --git a/test/units/testsuite-74.run.sh b/test/units/testsuite-74.run.sh new file mode 100755 index 00000000000..33a8e1ebd22 --- /dev/null +++ b/test/units/testsuite-74.run.sh @@ -0,0 +1,200 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: LGPL-2.1-or-later +# shellcheck disable=SC2016 +set -eux +set -o pipefail + +# shellcheck source=test/units/util.sh +. "$(dirname "$0")"/util.sh + +# FIXME(?): +# - empty ExecStart= is always inserted +# - weird results with systemd-run --property=ExecStart=false true +# - group settings for each section? +# - i.e systemd-run --remain-after-exit --on-clock-change +# --timer-property=After=systemd-journald.service true +# generates a unit that has two [Unit] and two [Timer] sections + +systemd-run --help --no-pager +systemd-run --version +systemd-run --no-ask-password true + +export PARENT_FOO=bar +touch /tmp/public-marker + +: "Transient service (system daemon)" +systemd-run --wait --pipe \ + bash -xec '[[ "$(