]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: copy portable profiles into the image if they don't exist there
authorFrantisek Sumsal <frantisek@sumsal.cz>
Mon, 31 Jan 2022 13:19:09 +0000 (14:19 +0100)
committerFrantisek Sumsal <frantisek@sumsal.cz>
Mon, 31 Jan 2022 17:09:30 +0000 (17:09 +0000)
If we're built with `-Dportable=false`, the portable profiles won't get
installed into the image. Since we need only the profile files and
nothing else, let's copy them into the image explicitly in such case.

test/test-functions

index ac8bf8883b9ebe3c45a3e1bb6a80fc6ce90966ed..3ae8caed3fbfbc975450a4af395759352d27f404 100644 (file)
@@ -1163,6 +1163,17 @@ install_systemd() {
         mkdir -p "$initdir/etc/systemd/system/service.d/"
         echo -e "[Service]\nProtectSystem=no\nProtectHome=no\n" >"$initdir/etc/systemd/system/service.d/gcov-override.conf"
     fi
+
+    # If we're built with -Dportabled=false, tests with systemd-analyze
+    # --profile will fail. Since we need just the profile (text) files, let's
+    # copy them into the image if they don't exist there.
+    local portable_dir="${initdir:?}${ROOTLIBDIR:?}/portable"
+    if [[ ! -d "$portable_dir/profile/strict" ]]; then
+        dinfo "Couldn't find portable profiles in the test image"
+        dinfo "Copying them directly from the source tree"
+        mkdir -p "$portable_dir"
+        cp -frv "${SOURCE_DIR:?}/src/portable/profile" "$portable_dir"
+    fi
 }
 
 get_ldpath() {