dcavalca / rpms / systemd

Forked from rpms/systemd 3 months ago
Clone
152484
From 324d99159e1e64d78a580073626f5b645f1c3639 Mon Sep 17 00:00:00 2001
152484
From: Frantisek Sumsal <frantisek@sumsal.cz>
152484
Date: Mon, 31 Jan 2022 14:19:09 +0100
152484
Subject: [PATCH] test: copy portable profiles into the image if they don't
152484
 exist there
152484
152484
If we're built with `-Dportable=false`, the portable profiles won't get
152484
installed into the image. Since we need only the profile files and
152484
nothing else, let's copy them into the image explicitly in such case.
152484
152484
(cherry picked from commit 6f73ef8b30803ac1be1b2607aec1a89d778caa9a)
152484
152484
Related: #2017035
152484
---
152484
 test/test-functions | 11 +++++++++++
152484
 1 file changed, 11 insertions(+)
152484
152484
diff --git a/test/test-functions b/test/test-functions
152484
index 218d0e6888..35d8f074a9 100644
152484
--- a/test/test-functions
152484
+++ b/test/test-functions
152484
@@ -1151,6 +1151,17 @@ install_systemd() {
152484
         mkdir -p "$initdir/etc/systemd/system/service.d/"
152484
         echo -e "[Service]\nProtectSystem=no\nProtectHome=no\n" >"$initdir/etc/systemd/system/service.d/gcov-override.conf"
152484
     fi
152484
+
152484
+    # If we're built with -Dportabled=false, tests with systemd-analyze
152484
+    # --profile will fail. Since we need just the profile (text) files, let's
152484
+    # copy them into the image if they don't exist there.
152484
+    local portable_dir="${initdir:?}${ROOTLIBDIR:?}/portable"
152484
+    if [[ ! -d "$portable_dir/profile/strict" ]]; then
152484
+        dinfo "Couldn't find portable profiles in the test image"
152484
+        dinfo "Copying them directly from the source tree"
152484
+        mkdir -p "$portable_dir"
152484
+        cp -frv "${SOURCE_DIR:?}/src/portable/profile" "$portable_dir"
152484
+    fi
152484
 }
152484
 
152484
 get_ldpath() {