[PATCH blktests 01/10] common/rc: introduce _have_systemctl_unit()
Shin'ichiro Kawasaki
shinichiro.kawasaki at wdc.com
Wed Apr 2 00:08:57 PDT 2025
From: Hannes Reinecke <hare at suse.de>
To check that the test system has a specific systemctl unit, introduce
the new helper function _have_systemctl_unit.
Signed-off-by: Hannes Reinecke <hare at suse.de>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki at wdc.com>
---
common/rc | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/common/rc b/common/rc
index bc6c2e4..ce7f975 100644
--- a/common/rc
+++ b/common/rc
@@ -500,6 +500,17 @@ _have_writeable_kmsg() {
return 0
}
+_have_systemctl_unit() {
+ local unit="$1"
+
+ _have_program systemctl || return 1
+ if ! grep -qe "$unit" < <(systemctl list-unit-files); then
+ SKIP_REASONS+=("systemctl unit '${unit}' is missing")
+ return 1
+ fi
+ return 0
+}
+
# Run the given command as NORMAL_USER
_run_user() {
su "$NORMAL_USER" -c "$1"
--
2.49.0
More information about the Linux-nvme
mailing list