Skip to content
Open
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion runtime/DRuntimeIntegrationTests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ foreach(name ${testnames})
ROOT=${outdir} DMD=${LDMD_EXE_FULL} BUILD=${build} SHARED=1
DRUNTIME=${druntime_path_build} DRUNTIMESO=${shared_druntime_path_build}
${cc} ${cxx} CFLAGS_BASE=${cflags_base} DFLAGS_BASE=${dflags_base} ${linkdl}
IN_LDC=1 ${musl}
IN_LDC=1 ${musl} BUILD_SHARED_LIBS=${BUILD_SHARED_LIBS}
)
set_tests_properties(${fullname} PROPERTIES DEPENDS clean-${fullname})
endforeach()
Expand Down
7 changes: 7 additions & 0 deletions runtime/druntime/src/__importc_builtins.di
Original file line number Diff line number Diff line change
Expand Up @@ -193,3 +193,10 @@ else version (LDC)
version (X86) public import ldc.gccbuiltins_x86;
version (X86_64) public import ldc.gccbuiltins_x86;
}

version (CRuntime_Glibc) version (AArch64)
{
// math.h needs these
alias __Float32x4_t = __vector(float[4]);
alias __Float64x2_t = __vector(double[2]);
}
6 changes: 3 additions & 3 deletions runtime/druntime/src/core/sys/posix/sys/shm.d
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ version (linux)
ipc_perm shm_perm;
size_t shm_segsz;
time_t shm_atime;
version (X86_64) {} else c_ulong __unused1;
static if (time_t.sizeof == 4) c_ulong __unused1;
time_t shm_dtime;
version (X86_64) {} else c_ulong __unused2;
static if (time_t.sizeof == 4) c_ulong __unused2;
time_t shm_ctime;
version (X86_64) {} else c_ulong __unused3;
static if (time_t.sizeof == 4) c_ulong __unused3;
pid_t shm_cpid;
pid_t shm_lpid;
shmatt_t shm_nattch;
Expand Down
15 changes: 14 additions & 1 deletion runtime/druntime/src/core/sys/posix/sys/types.d
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,20 @@ version (linux)
alias ulong dev_t;
alias uint gid_t;
alias uint mode_t;
alias ulong_t nlink_t;

version (X86_64)
alias ulong nlink_t;
else version (S390)
alias size_t nlink_t;
else version (PPC64)
alias size_t nlink_t;
else version (MIPS64)
alias size_t nlink_t;
else version (HPPA64)
alias size_t nlink_t;
else
alias uint nlink_t;

alias int pid_t;
//size_t (defined in core.stdc.stddef)
alias c_long ssize_t;
Expand Down
8 changes: 8 additions & 0 deletions runtime/druntime/src/importc.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,16 @@ typedef unsigned long long __uint64_t;
#define _Float128 long double
#define __float128 long double
#endif

#ifdef __aarch64__
// glibc's math.h needs these types to be defined
typedef struct {} __SVBool_t;
typedef struct {} __SVFloat32_t;
typedef struct {} __SVFloat64_t;
#endif

#endif // __linux__

#if __APPLE__
#undef __SIZEOF_INT128__
#endif
34 changes: 27 additions & 7 deletions runtime/druntime/test/exceptions/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,6 @@ ifdef IN_LDC
include ../../../../dmd/osmodel.mak
endif

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
Expand Down Expand Up @@ -65,6 +58,33 @@ endif
ifeq ($(OS),windows)
TESTS+=winstack
endif

ifdef IN_LDC
ifeq ($(OS)-$(ARCH),linux-aarch64)
# This hits the "should never happen" default branch in the
# rt.dwarfeh._d_throw_exception:399 unwind switch statement.
# The value is 0xf7fe7fb8 which is complete garbage.
TESTS := $(filter-out memoryerror_null_call,$(TESTS))

# The aarch64 github runners fail but it works locally
TESTS := $(filter-out memoryerror_%,$(TESTS))
endif

ifeq ($(OS),linux)
# These maybe fail with a shared runtime.
#
# CircleCI fails on x86_64, other CI and locally work.
# aarch64 fails locally, shared-only is not tested in CI.
#
# The failure is caused by the backtrace call in
# core.runtime.DefaultTraceInfo.this
ifeq ($(BUILD_SHARED_LIBS),ON)
TESTS := $(filter-out memoryerror_%,$(TESTS))
endif
$(ROOT)/memoryerror_%: private extra_ldflags.d += -link-defaultlib-shared=false
endif
endif

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the most controversial part. Whenever something only failed for (some) CI systems, I've tried to remove the test on that CI platform only - which is doable for compiler and druntime/Phobos unittests, but the druntime integration tests with their Makefiles are unfortunately a PITA in that regard. Just so that the tests are all included in a normal test run.

It might pay off to investigate further, incl. checking whether we can disable based on the BUILD var (debug/release).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

which is doable for compiler and druntime/Phobos unittests, but the druntime integration tests with their Makefiles are unfortunately a PITA in that regard

Adding something akin to:

TESTS := $(filter-out $(LDC_SKIP_DRUNTIME_TESTS),$(TESTS))

in common.mak, alongside setting that environment variable when ctest -E 'ldc2-unittest|lit-tests|dmd-testsuite' is run should work. I can't test right now though.

It might pay off to investigate further, incl. checking whether we can disable based on the BUILD var (debug/release).

Yeah, I agree that we shouldn't skip tests on all runners simply because 1 misbehaves. Yet debugging in online CI is a pretty miserable experience

include ../common.mak

$(ROOT)/line_trace.done: $(ROOT)/line_trace$(DOTEXE)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
import etc.linux.memoryerror;
import core.volatile;

pragma(inline, false):

void f(ref ubyte[1024] buf)
{
ubyte[1024] cpy = buf;
volatileStore(&cpy[0], 1);
g(cpy);
}

void g(ref ubyte[1024] buf)
{
ubyte[1024] cpy = buf;
volatileStore(&cpy[0], 2);
f(cpy);
}

Expand Down
2 changes: 1 addition & 1 deletion runtime/druntime/test/importc_compare/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ 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))
ifeq (1,$(IS_MUSL))
TESTS :=
endif
endif
Expand Down
4 changes: 0 additions & 4 deletions tests/dmd/compilable/stdcheaders.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,10 @@
#include <limits.h>
#include <locale.h>

#if !(defined(__linux__) && defined(__aarch64__)) // /usr/include/bits/math-vector.h(162): Error: undefined identifier `__Float32x4_t`
#include <math.h>
#ifndef _MSC_VER // C:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt\corecrt_math.h(93): Error: reinterpretation through overlapped field `f` is not allowed in CTFE
float x = NAN;
#endif
#endif

#ifndef _MSC_VER // setjmp.h(51): Error: missing tag `identifier` after `struct
#include <setjmp.h>
Expand Down Expand Up @@ -66,11 +64,9 @@ float x = NAN;
// Apple: /Applications/Xcode-14.2.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/tgmath.h(39): Error: named parameter required before `...`
// OpenBSD: /usr/lib/clang/13.0.0/include/tgmath.h(34): Error: named parameter required before `...`
// Linux: /tmp/clang/lib/clang/15.0.3/include/tgmath.h(34): Error: named parameter required before `...`
#if !(defined(__linux__) && defined(__aarch64__)) // /usr/include/bits/math-vector.h(162): Error: undefined identifier `__Float32x4_t`
#include <tgmath.h>
#endif
#endif
#endif

#ifndef __linux__
#ifndef __APPLE__
Expand Down
Loading