dcavalca / rpms / systemd

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