/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <fnmatch.h>
+#include <gnu/libc-version.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/mount.h>
}
static void test_exec_basic(Manager *m) {
+ if (isempty(gnu_get_libc_version()))
+ return (void) log_tests_skipped("ConditionVersion=glibc will not pass under musl");
+
if (MANAGER_IS_SYSTEM(m) || have_userns_privileges())
test(m, "exec-basic.service", can_unshare || MANAGER_IS_SYSTEM(m) ? 0 : EXIT_NAMESPACE, CLD_EXITED);
else
set -eux
set -o pipefail
+# shellcheck source=test/units/util.sh
+. "$(dirname "$0")"/util.sh
+
if ! systemd-detect-virt -qc && [[ "${TEST_CMDLINE_NEWLINE:-}" != bar ]]; then
cat /proc/cmdline
echo >&2 "Expected TEST_CMDLINE_NEWLINE=bar from the kernel command line"
exit 1
fi
+if built_with_musl; then
+ SYSTEMD_LIBC=musl
+else
+ SYSTEMD_LIBC=glibc
+fi
+export SYSTEMD_LIBC
+
if [[ -z "${TEST_MATCH_SUBTEST:-}" ]]; then
# If we're running with TEST_PREFER_NSPAWN=1 limit the set of tests we run
# in QEMU to only those that can't run in a container to avoid running
--property Delegate=1 \
--property EnvironmentFile=-/usr/lib/systemd/systemd-asan-env \
--property "Environment=$environment" \
+ --setenv SYSTEMD_LIBC \
--unit="$name" \
--wait "$test" && ret=0 || ret=$?
# shellcheck source=test/units/test-control.sh
. "$(dirname "$0")"/test-control.sh
+# shellcheck source=test/units/util.sh
+. "$(dirname "$0")"/util.sh
# Check if homectl is installed, and if it isn't bail out early instead of failing
if ! command -v homectl >/dev/null; then
homectl list-signing-keys | grep -q local.public
(! (homectl list-signing-keys | grep -q signtest.public))
+ if built_with_musl; then
+ # FIXME: musl does not support yescrypt. Use SHA512 and update signature.
+ return 0
+ fi
+
print_identity() {
cat <<\EOF
{
systemd-analyze dump systemd-journald.service >/dev/null
(! systemd-analyze dump "")
(! systemd-analyze dump --global systemd-journald.service)
-# malloc
-systemd-analyze malloc >/dev/null
+# malloc (supported only when built with glibc)
+if built_with_musl; then
+ (! systemd-analyze malloc)
+else
+ systemd-analyze malloc >/dev/null
+fi
(! systemd-analyze malloc --global)
# unit-files
systemd-analyze unit-files >/dev/null
locale-gen "$locale"
fi
}
+
+built_with_musl() (
+ set +ex
+ ! systemd-analyze --quiet condition 'ConditionVersion=glibc $= ?*'
+)