From: Yu Watanabe Date: Mon, 27 Jun 2022 21:33:38 +0000 (+0900) Subject: test: add udev tests for SYSTEMD_WANTS X-Git-Tag: v252-rc1~479^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9fd1f8eea9dfea920274ebbf7349c02e9268a18a;p=thirdparty%2Fsystemd.git test: add udev tests for SYSTEMD_WANTS For issue #23410. --- diff --git a/test/units/testsuite-17.07.sh b/test/units/testsuite-17.07.sh new file mode 100755 index 00000000000..549107af101 --- /dev/null +++ b/test/units/testsuite-17.07.sh @@ -0,0 +1,205 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: LGPL-2.1-or-later +set -ex +set -o pipefail + +# shellcheck source=test/units/assert.sh +. "$(dirname "$0")"/assert.sh + +wait_service_active() {( + set +ex + for (( i = 0; i < 20; i++ )); do + if (( i != 0 )); then sleep 0.5; fi + if systemctl --quiet is-active "${1?}"; then + return 0 + fi + done + return 1 +)} + +wait_service_inactive() {( + set +ex + for (( i = 0; i < 20; i++ )); do + if (( i != 0 )); then sleep 0.5; fi + systemctl --quiet is-active "${1?}" + if [[ "$?" == "3" ]]; then + return 0 + fi + done + return 1 +)} + +mkdir -p /run/systemd/system +cat >/run/systemd/system/both.service </run/systemd/system/on-add.service </run/systemd/system/on-change.service </run/udev/rules.d/50-testsuite.rules </run/systemd/system/both.service </run/systemd/system/on-add.service </run/systemd/system/on-change.service <