test: skip several test cases when built with musl

This commit is contained in:
Yu Watanabe
2025-12-07 09:09:03 +09:00
parent 9fafe89bcc
commit f117629f28
5 changed files with 33 additions and 2 deletions
+4
View File
@@ -1,6 +1,7 @@
/* 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>
@@ -1176,6 +1177,9 @@ static void test_exec_capabilityboundingset(Manager *m) {
}
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
+11
View File
@@ -3,12 +3,22 @@
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
@@ -66,6 +76,7 @@ run_test() {
--property Delegate=1 \
--property EnvironmentFile=-/usr/lib/systemd/systemd-asan-env \
--property "Environment=$environment" \
--setenv SYSTEMD_LIBC \
--unit="$name" \
--wait "$test" && ret=0 || ret=$?
+7
View File
@@ -6,6 +6,8 @@ set -o pipefail
# 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
@@ -786,6 +788,11 @@ testcase_sign() {
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
{
+6 -2
View File
@@ -79,8 +79,12 @@ systemd-analyze dump "*.socket" "*.service" aaaaaaa ... >/dev/null
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
+5
View File
@@ -453,3 +453,8 @@ generate_locale() {
locale-gen "$locale"
fi
}
built_with_musl() (
set +ex
! systemd-analyze --quiet condition 'ConditionVersion=glibc $= ?*'
)