]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: skip several test cases when built with musl
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 29 Nov 2025 01:01:56 +0000 (10:01 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 7 Dec 2025 00:09:03 +0000 (09:09 +0900)
src/test/test-execute.c
test/units/TEST-02-UNITTESTS.sh
test/units/TEST-46-HOMED.sh
test/units/TEST-65-ANALYZE.sh
test/units/util.sh

index 16476bc0d5d8d65926652af4af90e7c5a40faae0..d5b7e3416c724af919e4c14370175b043c26a093 100644 (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
index dec727f804da2cdb12e6dbdc265ba80b2a5ab807..ee5eab08d566dfe8f7362e282170fb2937fa54dc 100755 (executable)
@@ -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=$?
 
index e7ea57409318da929d8b535cb67402a988aa7e88..bb6d64bfed629456676bd4c35850cb9862dc8de7 100755 (executable)
@@ -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
 {
index 929796751d8b8539899d26b786e0fbae62c21626..af73c7dc7c87ad874ebf16f89a678132dfd465c9 100755 (executable)
@@ -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
index d07364922f2fae78f1f2135daf1656a6b4f5d4c5..445b71836ad78185bd6c0306ecb3bec0691fe68c 100755 (executable)
@@ -453,3 +453,8 @@ generate_locale() {
         locale-gen "$locale"
     fi
 }
+
+built_with_musl() (
+    set +ex
+    ! systemd-analyze --quiet condition 'ConditionVersion=glibc $= ?*'
+)