From dee4a9923b2724362739e956632310de48e24741 Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Thu, 1 Jun 2023 08:47:51 +0200 Subject: [PATCH] test: add a couple of tests for systemd-run --- test/test-functions | 2 +- test/units/testsuite-74.run.sh | 200 +++++++++++++++++++++++++++++++++ 2 files changed, 201 insertions(+), 1 deletion(-) create mode 100755 test/units/testsuite-74.run.sh 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 '[[ "$(