-
-
Notifications
You must be signed in to change notification settings - Fork 614
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GHA main: Add Alpine Linux job, to CI-test musl libc #20741
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,19 @@ | ||
TESTS=stderr_msg unittest_assert invalid_memory_operation unknown_gc static_dtor \ | ||
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 | ||
JohanEngelen marked this conversation as resolved.
Show resolved
Hide resolved
|
||
endif | ||
|
||
TESTS=stderr_msg unittest_assert invalid_memory_operation static_dtor \ | ||
future_message refcounted rt_trap_exceptions_drt catch_in_finally \ | ||
message_with_null | ||
|
||
# FIXME: segfaults with musl libc | ||
ifneq ($(IS_MUSL),1) | ||
TESTS += unknown_gc | ||
endif | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was unexpected, works with LDC (and its druntime v2.110 though). The test looks as harmless as it gets. |
||
# fails on 32 bit linux | ||
ifneq ($(OS),linux) | ||
TESTS += assert_fail | ||
|
@@ -12,8 +24,11 @@ SED:=sed | |
GDB:=gdb | ||
|
||
ifeq ($(OS),linux) | ||
TESTS+=line_trace line_trace_21656 long_backtrace_trunc rt_trap_exceptions cpp_demangle \ | ||
memoryerror_null_read memoryerror_null_write memoryerror_null_call memoryerror_stackoverflow | ||
TESTS+=line_trace line_trace_21656 long_backtrace_trunc rt_trap_exceptions cpp_demangle | ||
# registerMemoryAssertHandler requires glibc | ||
ifneq ($(IS_MUSL),1) | ||
TESTS+=memoryerror_null_read memoryerror_null_write memoryerror_null_call memoryerror_stackoverflow | ||
endif | ||
line_trace_dflags:=-L--export-dynamic | ||
endif | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,13 @@ | ||
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 := | ||
JohanEngelen marked this conversation as resolved.
Show resolved
Hide resolved
|
||
endif | ||
endif | ||
|
||
include ../common.mak | ||
|
||
extra_dflags += -d |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,7 +32,7 @@ extern (C) alias SetFinalizeCounter = void function(shared(size_t*)); | |
|
||
void main(string[] args) | ||
{ | ||
import utils : dllExt, loadSym; | ||
import utils : dllExt, isDlcloseNoop, loadSym; | ||
|
||
auto name = args[0] ~ '\0'; | ||
const pathlen = strrchr(name.ptr, '/') - name.ptr + 1; | ||
|
@@ -44,7 +44,7 @@ void main(string[] args) | |
auto nf1 = new NoFinalize; | ||
auto nf2 = new NoFinalizeBig; | ||
|
||
shared size_t finalizeCounter; | ||
static shared size_t finalizeCounter; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Must be a global (not on the stack), as due to the dlclose no-op, the finalizers might run after main() ends, causing a segfault. |
||
SetFinalizeCounter setFinalizeCounter; | ||
loadSym(h, setFinalizeCounter, "setFinalizeCounter"); | ||
setFinalizeCounter(&finalizeCounter); | ||
|
@@ -57,8 +57,11 @@ void main(string[] args) | |
auto r = Runtime.unloadLibrary(h); | ||
if (!r) | ||
assert(0); | ||
if (finalizeCounter != 4) | ||
assert(0); | ||
static if (!isDlcloseNoop) | ||
{ | ||
if (finalizeCounter != 4) | ||
assert(0); | ||
} | ||
if (nf1._finalizeCounter) | ||
assert(0); | ||
if (nf2._finalizeCounter) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,29 @@ | ||
module utils; | ||
|
||
version (OSX) | ||
version = Darwin; | ||
else version (iOS) | ||
version = Darwin; | ||
else version (TVOS) | ||
version = Darwin; | ||
else version (WatchOS) | ||
version = Darwin; | ||
|
||
version (Windows) | ||
enum dllExt = "dll"; | ||
else version (darwin) | ||
else version (Darwin) | ||
enum dllExt = "dylib"; | ||
else | ||
enum dllExt = "so"; | ||
|
||
// on some platforms, dlclose() is a no-op | ||
version (Darwin) | ||
enum isDlcloseNoop = true; // since macOS ~10.12.6 if shared lib uses TLS: https://github.com/rust-lang/rust/issues/28794#issuecomment-368693049 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This hasn't been a problem for DMD - simply because it doesn't support shared druntime/Phobos on Darwin, and these tests are skipped. This matters for LDC though, which has tweaked these tests. |
||
else version (CRuntime_Musl) | ||
enum isDlcloseNoop = true; // https://wiki.musl-libc.org/functional-differences-from-glibc.html | ||
else | ||
enum isDlcloseNoop = false; | ||
|
||
void loadSym(T)(void* handle, ref T val, const char* mangle) | ||
{ | ||
version (Windows) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why was this needed and how does this help? (seems to add
&& true
which is a no-op?)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It runs all of the test steps (if all steps before were successful IIRC), doesn't abort after the 1st failing test step. I.e., you see all failures and don 't have to fix the compiler testsuite before seeing results for druntime and Phobos etc.