naccyde / rpms / systemd

Forked from rpms/systemd a year ago
Clone
8d419f
From 90fb011c43410958e5bda6f470137522f536adb4 Mon Sep 17 00:00:00 2001
8d419f
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
8d419f
Date: Mon, 28 Mar 2022 20:03:37 +0200
8d419f
Subject: [PATCH] test-systemctl-enable: also use freshly-built systemd-id128
8d419f
8d419f
Tests were failing on centos7 because systemd-id128 is not in path.
8d419f
8d419f
(cherry picked from commit 2a2d002fb0913fe931b4ac903ca425a725aa79c0)
8d419f
8d419f
Related: #2082131
8d419f
---
8d419f
 meson.build                   | 21 ++++++++++++---------
8d419f
 test/test-systemctl-enable.sh |  5 +++--
8d419f
 2 files changed, 15 insertions(+), 11 deletions(-)
8d419f
8d419f
diff --git a/meson.build b/meson.build
8d419f
index 005af872cf..4fc3e64e54 100644
8d419f
--- a/meson.build
8d419f
+++ b/meson.build
8d419f
@@ -2371,7 +2371,7 @@ public_programs += executable(
8d419f
         install_rpath : rootlibexecdir,
8d419f
         install : true)
8d419f
 
8d419f
-exe = executable(
8d419f
+systemctl = executable(
8d419f
         'systemctl',
8d419f
         systemctl_sources,
8d419f
         include_directories : includes,
8d419f
@@ -2385,13 +2385,7 @@ exe = executable(
8d419f
         install_rpath : rootlibexecdir,
8d419f
         install : true,
8d419f
         install_dir : rootbindir)
8d419f
-public_programs += exe
8d419f
-if want_tests != 'false'
8d419f
-        test('test-systemctl-enable',
8d419f
-             test_systemctl_enable_sh,
8d419f
-             # https://github.com/mesonbuild/meson/issues/2681
8d419f
-             args : exe.full_path())
8d419f
-endif
8d419f
+public_programs += systemctl
8d419f
 
8d419f
 if conf.get('ENABLE_PORTABLED') == 1
8d419f
         dbus_programs += executable(
8d419f
@@ -3188,13 +3182,22 @@ executable(
8d419f
         install : true,
8d419f
         install_dir : rootlibexecdir)
8d419f
 
8d419f
-public_programs += executable(
8d419f
+systemd_id128 = executable(
8d419f
         'systemd-id128',
8d419f
         'src/id128/id128.c',
8d419f
         include_directories : includes,
8d419f
         link_with : [libshared],
8d419f
         install_rpath : rootlibexecdir,
8d419f
         install : true)
8d419f
+public_programs += systemd_id128
8d419f
+
8d419f
+if want_tests != 'false'
8d419f
+        test('test-systemctl-enable',
8d419f
+             test_systemctl_enable_sh,
8d419f
+             # https://github.com/mesonbuild/meson/issues/2681
8d419f
+             args : [systemctl.full_path(),
8d419f
+                     systemd_id128.full_path()])
8d419f
+endif
8d419f
 
8d419f
 public_programs += executable(
8d419f
         'systemd-path',
8d419f
diff --git a/test/test-systemctl-enable.sh b/test/test-systemctl-enable.sh
8d419f
index ecb433380e..8eb2828e35 100644
8d419f
--- a/test/test-systemctl-enable.sh
8d419f
+++ b/test/test-systemctl-enable.sh
8d419f
@@ -6,6 +6,7 @@ set -ex
8d419f
 export SYSTEMD_IGNORE_CHROOT=1
8d419f
 
8d419f
 systemctl=${1:-systemctl}
8d419f
+systemd_id128=${2:-systemd-id128}
8d419f
 
8d419f
 unset root
8d419f
 cleanup() {
8d419f
@@ -606,7 +607,7 @@ check_alias o 'the-id'
8d419f
 check_alias w '39a'
8d419f
 check_alias W 'right'
8d419f
 
8d419f
-check_alias b "$(systemd-id128 boot-id)"
8d419f
+check_alias b "$("$systemd_id128" boot-id)"
8d419f
 
8d419f
 # Specifiers not available for [Install]
8d419f
 ( ! check_alias C '' )
8d419f
@@ -637,7 +638,7 @@ check_alias l "$(uname -n | sed 's/\..*//')"
8d419f
 test ! -e "$root/etc/machine-id"
8d419f
 ( ! check_alias m '' )
8d419f
 
8d419f
-systemd-id128 new >"$root/etc/machine-id"
8d419f
+"$systemd_id128" new >"$root/etc/machine-id"
8d419f
 check_alias m "$(cat "$root/etc/machine-id")"
8d419f
 
8d419f
 check_alias n 'some-some-link6@.socket'