test: copy portable profiles into the image if they don't exist there

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.
This commit is contained in:
Frantisek Sumsal 2022-01-31 14:19:09 +01:00
parent 187df3dd91
commit 6f73ef8b30

View 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() {