From: Yu Watanabe Date: Sat, 29 Nov 2025 01:01:56 +0000 (+0900) Subject: test: skip several test cases when built with musl X-Git-Tag: v259-rc3~29^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f117629f2841bf503d7e2363f34578d01db9e788;p=thirdparty%2Fsystemd.git test: skip several test cases when built with musl --- diff --git a/src/test/test-execute.c b/src/test/test-execute.c index 16476bc0d5d..d5b7e3416c7 100644 --- a/src/test/test-execute.c +++ b/src/test/test-execute.c @@ -1,6 +1,7 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #include +#include #include #include #include @@ -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 diff --git a/test/units/TEST-02-UNITTESTS.sh b/test/units/TEST-02-UNITTESTS.sh index dec727f804d..ee5eab08d56 100755 --- a/test/units/TEST-02-UNITTESTS.sh +++ b/test/units/TEST-02-UNITTESTS.sh @@ -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=$? diff --git a/test/units/TEST-46-HOMED.sh b/test/units/TEST-46-HOMED.sh index e7ea5740931..bb6d64bfed6 100755 --- a/test/units/TEST-46-HOMED.sh +++ b/test/units/TEST-46-HOMED.sh @@ -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 { diff --git a/test/units/TEST-65-ANALYZE.sh b/test/units/TEST-65-ANALYZE.sh index 929796751d8..af73c7dc7c8 100755 --- a/test/units/TEST-65-ANALYZE.sh +++ b/test/units/TEST-65-ANALYZE.sh @@ -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 diff --git a/test/units/util.sh b/test/units/util.sh index d07364922f2..445b71836ad 100755 --- a/test/units/util.sh +++ b/test/units/util.sh @@ -453,3 +453,8 @@ generate_locale() { locale-gen "$locale" fi } + +built_with_musl() ( + set +ex + ! systemd-analyze --quiet condition 'ConditionVersion=glibc $= ?*' +)