Skip to content

Commit 01e0354

Browse files
committed
druntime-test: Detect musl more robustly
Try to detect musl on more systems than just Alpine. This also fixes an issue in the Github runners where the default shell is dash which doesn't understand the `&>` operator leading to the musl-excluded tests to also be skipped on glibc linux. Signed-off-by: Andrei Horodniceanu <a.horodniceanu@proton.me>
1 parent 6986b4e commit 01e0354

3 files changed

Lines changed: 10 additions & 14 deletions

File tree

druntime/Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,10 +497,15 @@ $(addsuffix /.run,$(filter-out test/shared,$(ADDITIONAL_TESTS))): $(DRUNTIME)
497497
test/shared/.run: $(DRUNTIMESO)
498498
endif
499499

500+
ifeq (linux,$(OS))
501+
LDD = ldd
502+
IS_MUSL != $(LDD) --version 2>&1 | grep -q musl && echo 1
503+
endif
504+
500505
test/%/.run: test/%/Makefile $(DMD)
501506
$(QUIET)$(MAKE) -C test/$* MODEL=$(MODEL) OS=$(OS) DMD=$(abspath $(DMD)) BUILD=$(BUILD) \
502507
DRUNTIME=$(abspath $(DRUNTIME)) DRUNTIMESO=$(abspath $(DRUNTIMESO)) LINKDL=$(LINKDL) \
503-
QUIET=$(QUIET) TIMELIMIT='$(TIMELIMIT)' PIC=$(PIC) SHARED=$(SHARED)
508+
QUIET=$(QUIET) TIMELIMIT='$(TIMELIMIT)' PIC=$(PIC) SHARED=$(SHARED) IS_MUSL=$(IS_MUSL)
504509

505510
test/%/.clean: test/%/Makefile
506511
$(QUIET)$(MAKE) -C test/$* MODEL=$(MODEL) OS=$(OS) BUILD=$(BUILD) clean

druntime/test/exceptions/Makefile

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,9 @@
1-
ifeq ($(OS),linux)
2-
# FIXME: detect musl libc robustly; just checking Alpine Linux' apk tool for now
3-
ifeq (1,$(shell which apk &>/dev/null && echo 1))
4-
IS_MUSL:=1
5-
endif
6-
endif
7-
81
TESTS=stderr_msg unittest_assert invalid_memory_operation static_dtor \
92
future_message refcounted rt_trap_exceptions_drt catch_in_finally \
103
message_with_null
114

125
# FIXME: segfaults with musl libc
13-
ifneq ($(IS_MUSL),1)
6+
ifndef IS_MUSL
147
TESTS += unknown_gc
158
endif
169

@@ -26,7 +19,7 @@ GDB:=gdb
2619
ifeq ($(OS),linux)
2720
TESTS+=line_trace line_trace_21656 long_backtrace_trunc rt_trap_exceptions cpp_demangle
2821
# registerMemoryAssertHandler requires glibc
29-
ifneq ($(IS_MUSL),1)
22+
ifndef IS_MUSL
3023
TESTS+=memoryerror_null_read memoryerror_null_write memoryerror_null_call memoryerror_stackoverflow
3124
endif
3225
line_trace_dflags:=-L--export-dynamic

druntime/test/importc_compare/Makefile

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@ TESTS := importc_compare
22

33
# FIXME: fails on Alpine v3.21 with conflicting struct declarations in the C headers:
44
# /usr/include/asm-generic/fcntl.h(195): Error: struct `importc_includes.flock` conflicts with struct `importc_includes.flock` at /usr/include/fcntl.h(24)
5-
ifeq ($(OS),linux)
6-
ifeq (1,$(shell which apk &>/dev/null && echo 1))
7-
TESTS :=
8-
endif
5+
ifdef IS_MUSL
6+
TESTS :=
97
endif
108

119
include ../common.mak

0 commit comments

Comments
 (0)