diff --git a/druntime/Makefile b/druntime/Makefile index 2c022c6997b1..327d8ef03d5b 100644 --- a/druntime/Makefile +++ b/druntime/Makefile @@ -497,10 +497,17 @@ $(addsuffix /.run,$(filter-out test/shared,$(ADDITIONAL_TESTS))): $(DRUNTIME) test/shared/.run: $(DRUNTIMESO) endif +ifeq ($(OS),linux) + # FIXME: detect musl libc robustly; just checking Alpine Linux' apk tool for now + ifeq (1,$(shell which apk >/dev/null 2>&1 && echo 1)) + IS_MUSL := 1 + endif +endif + test/%/.run: test/%/Makefile $(DMD) $(QUIET)$(MAKE) -C test/$* MODEL=$(MODEL) OS=$(OS) DMD=$(abspath $(DMD)) BUILD=$(BUILD) \ DRUNTIME=$(abspath $(DRUNTIME)) DRUNTIMESO=$(abspath $(DRUNTIMESO)) LINKDL=$(LINKDL) \ - QUIET=$(QUIET) TIMELIMIT='$(TIMELIMIT)' PIC=$(PIC) SHARED=$(SHARED) + QUIET=$(QUIET) TIMELIMIT='$(TIMELIMIT)' PIC=$(PIC) SHARED=$(SHARED) IS_MUSL=$(IS_MUSL) test/%/.clean: test/%/Makefile $(QUIET)$(MAKE) -C test/$* MODEL=$(MODEL) OS=$(OS) BUILD=$(BUILD) clean diff --git a/druntime/test/common.mak b/druntime/test/common.mak index 2310c79cfbe8..bfd90e70fe66 100644 --- a/druntime/test/common.mak +++ b/druntime/test/common.mak @@ -10,6 +10,7 @@ QUIET:= TIMELIMIT:= PIC:= SHARED:= +IS_MUSL:= # Variables that can be specified by users, with the same meaning as used by GNU make # $(CC) $(CXX) $(DMD) # the compiler diff --git a/druntime/test/exceptions/Makefile b/druntime/test/exceptions/Makefile index 39651243b1e8..9d42022bd3dd 100644 --- a/druntime/test/exceptions/Makefile +++ b/druntime/test/exceptions/Makefile @@ -1,10 +1,3 @@ -ifeq ($(OS),linux) - # FIXME: detect musl libc robustly; just checking Alpine Linux' apk tool for now - ifeq (1,$(shell which apk &>/dev/null && echo 1)) - IS_MUSL:=1 - endif -endif - TESTS=stderr_msg unittest_assert invalid_memory_operation static_dtor \ future_message refcounted rt_trap_exceptions_drt catch_in_finally \ message_with_null diff --git a/druntime/test/importc_compare/Makefile b/druntime/test/importc_compare/Makefile index 47af3d811537..72bf800a65f5 100644 --- a/druntime/test/importc_compare/Makefile +++ b/druntime/test/importc_compare/Makefile @@ -2,10 +2,8 @@ TESTS := importc_compare # FIXME: fails on Alpine v3.21 with conflicting struct declarations in the C headers: # /usr/include/asm-generic/fcntl.h(195): Error: struct `importc_includes.flock` conflicts with struct `importc_includes.flock` at /usr/include/fcntl.h(24) -ifeq ($(OS),linux) - ifeq (1,$(shell which apk &>/dev/null && echo 1)) - TESTS := - endif +ifeq ($(IS_MUSL),1) + TESTS := endif include ../common.mak