druntime: Make most *test* Makefiles usable on Windows too

Still to do: `test/{shared,stdcpp}`.
This commit is contained in:
Martin Kinkelin 2023-12-09 18:43:13 +01:00 committed by Nicholas Wilson
parent 1bd0c930d3
commit b99b9d2c20
38 changed files with 303 additions and 435 deletions

View file

@ -1,5 +1,10 @@
setlocal
@echo on
:: put bash and GNU tools in front of PATH
set PATH=C:\Program Files\Git\usr\bin;%PATH%
:: now set up MSVC environment (=> first link.exe etc. in PATH is MSVC's, not GNU's)
call "%VSINSTALLDIR%\VC\Auxiliary\Build\vcvarsall.bat" %ARCH%
@echo on
@ -60,7 +65,6 @@ run.exe tools "BUILD=%CONFIGURATION%" "DMD_MODEL=%PLATFORM%" || exit /B 4
:: FIXME: skip unit_tests temporarily due to unclear (spurious?) CI failures
:: set DMD_TESTS=all
set DMD_TESTS=runnable runnable_cxx compilable fail_compilation dshell
set DRUNTIME_TESTS=test_all
cd "%DMD_DIR%"
if not "%C_RUNTIME%" == "mingw" goto not_mingw
rem install recent LLD and mingw libraries to built dmd
@ -86,15 +90,12 @@ if not "%C_RUNTIME%" == "mingw" goto not_mingw
set DMD_TESTS=runnable compilable fail_compilation dshell
rem FIXME: debug info incomplete when linking through lld-link
del compiler\test\runnable\testpdb.d
set DRUNTIME_TESTS=test_mingw
:not_mingw
echo [STEP]: Building and running druntime tests
cd "%DMD_DIR%\druntime"
:: only build & run the debug unittests, skip the release ones (Azure CI running out of memory when doing these in parallel)
make -j%N% MODEL=%MODEL% "DMD=%DMD%" BUILD=debug unittest || exit /B 5
"%DM_MAKE%" -f win64.mak MODEL=%MODEL% "DMD=%DMD%" "VCDIR=%VCINSTALLDIR%." "CC=%MSVC_CC%" "MAKE=%DM_MAKE%" %DRUNTIME_TESTS% || exit /B 5
make -j%N% MODEL=%MODEL% "DMD=%DMD%" BUILD=debug "CC=%MSVC_CC%" unittest || exit /B 5
echo [STEP]: Running DMD testsuite
cd "%DMD_DIR%\compiler\test"

View file

@ -164,8 +164,7 @@ fi
################################################################################
cd "$DMD_DIR/druntime"
"$GNU_MAKE" -j$N MODEL=$MODEL DMD="$DMD_BIN_PATH" unittest
"$DM_MAKE" "${LIBS_MAKE_ARGS[@]}" test_all
"$GNU_MAKE" -j$N MODEL=$MODEL DMD="$DMD_BIN_PATH" CC="$CC" unittest
################################################################################
# Build and run Phobos unittests

View file

@ -61,7 +61,10 @@ endif
ifeq (windows,$(OS))
# Note: setting SHELL to an absolute path to bash.exe does NOT suffice.
# The GNU tools like {rm,cp,mkdir}.exe need to be in PATH.
export PATH:=C:\Program Files\Git\usr\bin;$(PATH)
ifeq (,$(findstring C:\Program Files\Git\usr\bin,$(PATH)))
export PATH:=C:\Program Files\Git\usr\bin;$(PATH)
endif
# setting SHELL is very special on Windows: https://www.gnu.org/software/make/manual/html_node/Choosing-the-Shell.html#Choosing-a-Shell-in-DOS-and-Windows
SHELL=bash.exe
$(info Using make SHELL "$(SHELL)", should be bash.)
endif

1
druntime/.gitignore vendored
View file

@ -7,7 +7,6 @@ druntime.json
.DS_Store
trace.def
trace.log
/Makefile
/errno_c*.obj
/msvc*.obj
make

View file

@ -410,14 +410,16 @@ $(DRUNTIME): $(OBJS) $(SRCS) $(DMD)
lib: $(DRUNTIME)
UT_MODULES:=$(patsubst src/%.d,$(ROOT)/unittest/%,$(SRCS))
# TODO: Windows
HAS_ADDITIONAL_TESTS:=$(if $(findstring $(OS),windows),,$(shell test -d test && echo 1))
HAS_ADDITIONAL_TESTS:=$(shell test -d test && echo 1)
ifeq ($(HAS_ADDITIONAL_TESTS),1)
ADDITIONAL_TESTS:=test/init_fini test/exceptions test/coverage test/profile test/cycles test/allocations test/typeinfo \
test/aa test/cpuid test/gc test/hash test/lifetime \
test/thread test/unittest test/imports test/betterc test/stdcpp test/config \
test/traits test/valgrind
ADDITIONAL_TESTS+=$(if $(SHARED),test/shared,)
ADDITIONAL_TESTS:=test/init_fini test/exceptions test/coverage test/profile test/cycles test/allocations test/typeinfo \
test/aa test/cpuid test/gc test/hash test/lifetime \
test/thread test/unittest test/imports test/betterc test/config \
test/traits test/uuid test/valgrind
ifneq (windows,$(OS)) # FIXME
ADDITIONAL_TESTS+=test/stdcpp
endif
ADDITIONAL_TESTS+=$(if $(SHARED),test/shared,)
endif
.PHONY : unittest

View file

@ -5,12 +5,12 @@ TESTS:=test_aa
.PHONY: all clean
all: $(addprefix $(ROOT)/,$(addsuffix .done,$(TESTS)))
$(ROOT)/test_aa.done: $(ROOT)/%.done : $(ROOT)/%
$(ROOT)/%.done: $(ROOT)/%$(DOTEXE)
@echo Testing $*
$(QUIET)$(TIMELIMIT)$(ROOT)/$* $(RUN_ARGS)
@touch $@
$(ROOT)/%: $(SRC)/%.d
$(ROOT)/%$(DOTEXE): $(SRC)/%.d
$(QUIET)$(DMD) $(DFLAGS) -of$@ $<
clean:

View file

@ -8,20 +8,20 @@ SED:=sed
.PHONY: all clean
all: $(addprefix $(ROOT)/,$(addsuffix .done,$(TESTS)))
$(ROOT)/alloc_from_assert.done: $(ROOT)/alloc_from_assert
$(ROOT)/alloc_from_assert.done: $(ROOT)/alloc_from_assert$(DOTEXE)
@echo Testing $*
$(QUIET)$(TIMELIMIT)$(ROOT)/alloc_from_assert $(RUN_ARGS)
@touch $@
$(ROOT)/overflow_from_zero.done: STDERR_EXP="Memory allocation failed"
$(ROOT)/overflow_from_existing.done: STDERR_EXP="Memory allocation failed"
$(ROOT)/%.done: $(ROOT)/%
$(ROOT)/%.done: $(ROOT)/%$(DOTEXE)
@echo Testing $*
$(NEGATE) $(QUIET)$(TIMELIMIT)$(ROOT)/$* $(RUN_ARGS) 2>&1 1>/dev/null | head -n 1 | grep -qF $(STDERR_EXP)
$(NEGATE) $(QUIET)$(TIMELIMIT)$(ROOT)/$* $(RUN_ARGS) 2>&1 1>/dev/null | head -n 2 | grep -qF $(STDERR_EXP)
@touch $@
$(ROOT)/unittest_assert: DFLAGS+=-unittest -version=CoreUnittest
$(ROOT)/%: $(SRC)/%.d
$(ROOT)/unittest_assert$(DOTEXE): DFLAGS+=-unittest -version=CoreUnittest
$(ROOT)/%$(DOTEXE): $(SRC)/%.d
$(QUIET)$(DMD) $(DFLAGS) -of$@ $<
clean:

View file

@ -1,12 +0,0 @@
# built from the druntime top-level folder
# to be overwritten by caller
DMD=dmd
MODEL=64
DRUNTIMELIB=druntime64.lib
test: alloc_from_assert
alloc_from_assert:
$(DMD) -m$(MODEL) -conf= -Iimport -defaultlib=$(DRUNTIMELIB) test\allocations\src\$@.d
$@.exe
del $@.*

View file

@ -3,15 +3,23 @@ include ../common.mak
TESTS:=test18828 test19416 test19421 test19561 test20088 test20613 test19924 test22336 test19933
.PHONY: all clean
all: $(addprefix $(ROOT)/,$(addsuffix ,$(TESTS))) $(addprefix $(ROOT)/,test19924.done)
all: $(addprefix $(ROOT)/,$(addsuffix .done,$(TESTS)))
$(ROOT)/test19924.done: $(ROOT)/%.done : $(ROOT)/%
$(ROOT)/%.done: $(ROOT)/%$(DOTEXE)
@echo Running $*
$(QUIET)$(TIMELIMIT)$(ROOT)/$* $(RUN_ARGS)
@touch $@
$(ROOT)/%: $(SRC)/%.d
$(QUIET)$(DMD) -betterC -of$@ $<
# for the Windows MinGW CI job:
ifneq (,$(findstring -mscrtlib=msvcrt120,$(DFLAGS)))
# DFLAGS=-mscrtlib=msvcrt120 takes precedence over any command line flags, so
# specify vcruntime140.lib explicitly for using mingw with Universal CRT.
$(ROOT)/test19933$(DOTEXE): $(SRC)/test19933.d
$(QUIET)$(DMD) $(MODEL_FLAG) -I../../src -betterC -of$@ $< -Lvcruntime140.lib -Llegacy_stdio_definitions.lib -L/NODEFAULTLIB:msvcrt120.lib
endif
$(ROOT)/%$(DOTEXE): $(SRC)/%.d
$(QUIET)$(DMD) $(MODEL_FLAG) -I../../src -betterC -of$@ $<
clean:
rm -rf $(ROOT)

View file

@ -1,50 +0,0 @@
# built from the druntime top-level folder
# to be overwritten by caller
DMD=dmd
MODEL=64
TESTS=test18828 test19416 test19421 test19561 test20088 test20613 test19924 test22336 test19933$(MINGW)
test: $(TESTS)
test18828:
$(DMD) -m$(MODEL) -conf= -Iimport -betterC -run test\betterc\src\$@.d
del $@.*
test19416:
$(DMD) -m$(MODEL) -conf= -Iimport -betterC -run test\betterc\src\$@.d
del $@.*
test19421:
$(DMD) -m$(MODEL) -conf= -Iimport -betterC -run test\betterc\src\$@.d
del $@.*
test19561:
$(DMD) -m$(MODEL) -conf= -Iimport -betterC -run test\betterc\src\$@.d
del $@.*
test20088:
$(DMD) -m$(MODEL) -conf= -Iimport -betterC -run test\betterc\src\$@.d
del $@.*
test20613:
$(DMD) -m$(MODEL) -conf= -Iimport -betterC -run test\betterc\src\$@.d
del $@.*
test19924:
$(DMD) -m$(MODEL) -conf= -Iimport -betterC -run test\betterc\src\$@.d
del $@.*
test22336:
$(DMD) -m$(MODEL) -conf= -Iimport -betterC -run test\betterc\src\$@.d
del $@.*
test19933:
$(DMD) -m$(MODEL) -conf= -Iimport -betterC -run test\betterc\src\$@.d
del $@.*
test19933_mingw:
# DFLAGS=-mscrtlib=msvcrt120 takes precedence over any command line flags, so
# specify vcruntime140.lib explicitly for using mingw with Universal CRT
$(DMD) -m$(MODEL) -conf= -Iimport -betterC -Lvcruntime140.lib -Llegacy_stdio_definitions.lib -L/NODEFAULTLIB:msvcrt120.lib -run test\betterc\src\test19933.d
del $@.*

View file

@ -1,4 +1,4 @@
# set from top makefile
# set explicitly in the make cmdline in druntime/Makefile (`test/%/.run` rule):
OS:=
MODEL:=
BUILD:=
@ -8,30 +8,44 @@ DRUNTIMESO:=
LINKDL:=
QUIET:=
TIMELIMIT:=
LDL:=$(subst -L,,$(LINKDL)) # -ldl
PIC:=
# Windows: set up bash shell
ifeq (windows,$(OS))
include ../../../compiler/src/osmodel.mak
endif
LDL:=$(subst -L,,$(LINKDL)) # -ldl
SRC:=src
GENERATED:=./generated
ROOT:=$(GENERATED)/$(OS)/$(BUILD)/$(MODEL)
ifneq (default,$(MODEL))
MODEL_FLAG:=-m$(MODEL)
MODEL_FLAG:=$(if $(findstring $(MODEL),default),,-m$(MODEL))
CFLAGS_BASE:=$(if $(findstring $(OS),windows),/Wall,$(MODEL_FLAG) $(PIC) -Wall)
ifeq (osx64,$(OS)$(MODEL))
CFLAGS_BASE+=--target=x86_64-darwin-apple # ARM cpu is not supported by dmd
endif
CFLAGS_BASE:= $(MODEL_FLAG) $(PIC) -Wall
ifeq (osx,$(OS))
ifeq (64,$(MODEL))
CFLAGS_BASE+=--target=x86_64-darwin-apple # ARM cpu is not supported by dmd
endif
endif
DFLAGS:=$(MODEL_FLAG) $(PIC) -w -I../../src -I../../import -I$(SRC) -defaultlib= -debuglib= -preview=dip1000 -L-lpthread -L-lm $(LINKDL)
DFLAGS:=$(MODEL_FLAG) $(PIC) -w -I../../src -I../../import -I$(SRC) -defaultlib= -preview=dip1000 $(if $(findstring $(OS),windows),,-L-lpthread -L-lm $(LINKDL))
# LINK_SHARED may be set by importing makefile
DFLAGS+=$(if $(LINK_SHARED),-L$(DRUNTIMESO),-L$(DRUNTIME))
ifeq ($(BUILD),debug)
DFLAGS += -g -debug
CFLAGS := $(CFLAGS_BASE) -g
DFLAGS+=-g -debug
CFLAGS:=$(CFLAGS_BASE) $(if $(findstring $(OS),windows),/Zi,-g)
else
DFLAGS += -O -release
CFLAGS := $(CFLAGS_BASE) -O3
DFLAGS+=-O -release
CFLAGS:=$(CFLAGS_BASE) $(if $(findstring $(OS),windows),/O2,-O3)
endif
CXXFLAGS_BASE := $(CFLAGS_BASE)
CXXFLAGS_BASE:=$(CFLAGS_BASE)
CXXFLAGS:=$(CFLAGS)
ifeq (windows,$(OS))
DOTEXE:=.exe
DOTDLL:=.dll
DOTLIB:=.lib
DOTOBJ:=.obj
else
DOTEXE:=
DOTDLL:=$(if $(findstring $(OS),osx),.dylib,.so)
DOTLIB:=.a
DOTOBJ:=.o
endif

View file

@ -5,15 +5,15 @@ TESTS:=test19433 test20459 test22523
.PHONY: all clean
all: $(addprefix $(ROOT)/,$(addsuffix .done,$(TESTS)))
$(ROOT)/%: $(SRC)/%.d
$(ROOT)/%$(DOTEXE): $(SRC)/%.d
$(QUIET)$(DMD) $(DFLAGS) -of$@ $<
$(ROOT)/test19433.done: $(ROOT)/test19433
$(ROOT)/test19433.done: $(ROOT)/test19433$(DOTEXE)
@echo Testing test19433
$(QUIET)$(ROOT)/test19433 --DRT-dont-eat-me
@touch $@
$(ROOT)/test20459.done: $(ROOT)/test20459
$(ROOT)/test20459.done: $(ROOT)/test20459$(DOTEXE)
@echo Testing test20459
$(QUIET)$(ROOT)/test20459 foo bar -- --DRT-gcopts=profile:1
@touch $@
@ -21,8 +21,8 @@ $(ROOT)/test20459.done: $(ROOT)/test20459
$(ROOT)/test22523.done: $(SRC)/test22523.d
@echo Testing $<
$(QUIET)$(DMD) $(DFLAGS) -unittest -of$(ROOT)/test22523 $<
$(QUIET) $(ROOT)/test22523 -- --DRT-testmode=run-main
$(QUIET)$(DMD) $(DFLAGS) -unittest -of$(ROOT)/test22523$(DOTEXE) $<
$(QUIET)$(ROOT)/test22523 -- --DRT-testmode=run-main
@touch $@
clean:

View file

@ -5,57 +5,73 @@ DFLAGS+=-cov
NORMAL_TESTS:=$(addprefix $(ROOT)/,$(addsuffix .done,basic))
MERGE_TESTS:=$(addprefix $(ROOT)/,$(addsuffix .done,merge merge_true))
DIFF:=diff
DIFF:=diff --strip-trailing-cr
SED:=sed
ifeq ($(OS),$(filter $(OS),freebsd osx))
SED_INPLACE:=-i ''
SED_INPLACE:=-i ''
else
SED_INPLACE:=-i''
SED_INPLACE:=-i''
endif
.PHONY: all clean
all: $(NORMAL_TESTS) $(MERGE_TESTS) $(ROOT)/no_code.done $(ROOT)/merge_override.done
$(NORMAL_TESTS): $(ROOT)/%.done: $(ROOT)/%
$(NORMAL_TESTS): $(ROOT)/%.done: $(ROOT)/%$(DOTEXE)
@echo Testing $*
@rm -f $(ROOT)/src-$*.lst
$(QUIET)$(ROOT)/$* $(ROOT) $(RUN_ARGS)
ifeq (windows,$(OS))
$(QUIET)$(SED) $(SED_INPLACE) 's:^src\\:src/:g' $(ROOT)/src-$*.lst
endif
$(QUIET)$(DIFF) src-$*.lst.exp $(ROOT)/src-$*.lst
@touch $@
$(MERGE_TESTS): $(ROOT)/%.done: $(ROOT)/%
$(MERGE_TESTS): $(ROOT)/%.done: $(ROOT)/%$(DOTEXE)
@echo Testing $*
@rm -f $(ROOT)/src-$*.lst
$(QUIET)$(ROOT)/$* $(ROOT) $(RUN_ARGS)
$(QUIET)$(ROOT)/$* $(ROOT) $(RUN_ARGS)
ifeq (windows,$(OS))
$(QUIET)$(SED) $(SED_INPLACE) 's:^src\\:src/:g' $(ROOT)/src-$*.lst
endif
$(QUIET)$(DIFF) src-$*.lst.exp $(ROOT)/src-$*.lst
@touch $@
$(ROOT)/merge_override.done: $(ROOT)/%.done: $(ROOT)/%
$(ROOT)/merge_override.done: $(ROOT)/%.done: $(ROOT)/%$(DOTEXE)
@echo Testing $*
@rm -f $(ROOT)/src-$*.lst
$(QUIET)$(SED) $(SED_INPLACE) 's/CHANGEVAR/CHANGE_VAR/g' src/$*.d
$(QUIET)$(ROOT)/$* $(ROOT) $(RUN_ARGS)
$(QUIET)$(SED) $(SED_INPLACE) 's/CHANGE_VAR/CHANGEVAR/g' src/$*.d
ifeq (windows,$(OS))
$(QUIET)$(SED) $(SED_INPLACE) 's:^src\\:src/:g' $(ROOT)/src-$*.lst
endif
$(QUIET)$(DIFF) src-$*.lst_1.exp $(ROOT)/src-$*.lst
$(QUIET)$(ROOT)/$* $(ROOT) $(RUN_ARGS)
$(QUIET)$(SED) $(SED_INPLACE) 's/CHANGEVAR/CHANGE_VAR/g' src/$*.d
ifeq (windows,$(OS))
$(QUIET)$(SED) $(SED_INPLACE) 's:^src\\:src/:g' $(ROOT)/src-$*.lst
endif
$(QUIET)$(DIFF) src-$*.lst_2.exp $(ROOT)/src-$*.lst
@touch $@
$(ROOT)/no_code.done: $(ROOT)/%.done: $(ROOT)/%
$(ROOT)/no_code.done: $(ROOT)/%.done: $(ROOT)/%$(DOTEXE)
@echo Testing $*
@rm -f $(ROOT)/src-$*.lst
$(QUIET)$(ROOT)/$* $(ROOT) $(RUN_ARGS)
$(QUIET)$(ROOT)/$* $(ROOT) $(RUN_ARGS)
ifeq (windows,$(OS))
$(QUIET)$(SED) $(SED_INPLACE) 's:^src\\:src/:g' $(ROOT)/src-$*.lst
$(QUIET)$(SED) $(SED_INPLACE) 's:^src\\:src/:g' $(ROOT)/src-$*_imp.lst
endif
$(QUIET)$(DIFF) src-$*.lst.exp $(ROOT)/src-$*.lst
$(QUIET)$(DIFF) src-$*_imp.lst.exp $(ROOT)/src-$*_imp.lst
@touch $@
$(ROOT)/no_code: $(SRC)/no_code_imp.d
$(ROOT)/%: $(SRC)/%.d
$(QUIET)$(DMD) $(DFLAGS) -of$(ROOT)/$* $^
$(ROOT)/no_code$(DOTEXE): $(SRC)/no_code_imp.d
$(ROOT)/%$(DOTEXE): $(SRC)/%.d
$(QUIET)$(DMD) $(DFLAGS) -of$@ $^
clean:
rm -rf $(GENERATED) *.lst

View file

@ -5,12 +5,12 @@ TESTS:=cpuid
.PHONY: all clean
all: $(addprefix $(ROOT)/,$(addsuffix .done,$(TESTS)))
$(ROOT)/%.done: $(ROOT)/%
$(ROOT)/%.done: $(ROOT)/%$(DOTEXE)
@echo Testing $*
$(QUIET)$(TIMELIMIT)$< $(RUN_ARGS)
@touch $@
$(ROOT)/cpuid: $(SRC)/cpuid.d
$(ROOT)/%$(DOTEXE): $(SRC)/%.d
$(QUIET)$(DMD) $(DFLAGS) -of$@ $<
clean:

View file

@ -1,12 +0,0 @@
# built from the druntime top-level folder
# to be overwritten by caller
DMD=dmd
MODEL=64
DRUNTIMELIB=druntime64.lib
test: cpuid
cpuid:
$(DMD) -g -m$(MODEL) -conf= -Iimport -defaultlib=$(DRUNTIMELIB) test\cpuid\src\cpuid.d
cpuid.exe
del cpuid.exe cpuid.obj

View file

@ -11,17 +11,17 @@ all: $(addprefix $(ROOT)/,$(addsuffix .done,$(TESTS)))
$(ROOT)/cycle_ignore.done: RETCODE=0
$(ROOT)/cycle_ignore.done: LINES=0
$(ROOT)/cycle_abort.done: RETCODE=1
$(ROOT)/cycle_abort.done: LINES=7
$(ROOT)/cycle_abort.done: LINES=$(if $(findstring $(OS),windows),8,7)
$(ROOT)/cycle_print.done: RETCODE=0
$(ROOT)/cycle_print.done: LINES=6
$(ROOT)/cycle_deprecate.done: RETCODE=1
$(ROOT)/cycle_deprecate.done: LINES=8
$(ROOT)/%.done: $(ROOT)/test_cycles
$(ROOT)/cycle_deprecate.done: LINES=$(if $(findstring $(OS),windows),9,8)
$(ROOT)/%.done: $(ROOT)/test_cycles$(DOTEXE)
@echo Testing $*
$(QUIET)$(TIMELIMIT)$(ROOT)/test_cycles --DRT-oncycle=$(patsubst cycle_%.done,%, $(notdir $@)) > $@ 2>&1; test $$? -eq $(RETCODE)
test `cat $@ | wc -l` -eq $(LINES)
$(ROOT)/test_cycles: $(SRC)/*.d
$(ROOT)/test_cycles$(DOTEXE): $(SRC)/*.d
$(QUIET)$(DMD) $(DFLAGS) -of$@ $^
clean:

View file

@ -1,31 +1,34 @@
include ../common.mak
TESTS=stderr_msg unittest_assert invalid_memory_operation unknown_gc static_dtor \
future_message refcounted rt_trap_exceptions_drt catch_in_finally \
message_with_null
future_message refcounted rt_trap_exceptions_drt catch_in_finally \
message_with_null
ifeq ($(OS)-$(BUILD),linux-debug)
TESTS+=line_trace line_trace_21656 long_backtrace_trunc rt_trap_exceptions cpp_demangle
LINE_TRACE_DFLAGS:=-L--export-dynamic
TESTS+=line_trace line_trace_21656 long_backtrace_trunc rt_trap_exceptions cpp_demangle
LINE_TRACE_DFLAGS:=-L--export-dynamic
endif
ifeq ($(OS),linux)
TESTS+=rt_trap_exceptions_drt_gdb
TESTS+=rt_trap_exceptions_drt_gdb
endif
ifeq ($(OS)-$(BUILD),freebsd-debug)
TESTS+=line_trace line_trace_21656 long_backtrace_trunc cpp_demangle
LINE_TRACE_DFLAGS:=-L--export-dynamic
TESTS+=line_trace line_trace_21656 long_backtrace_trunc cpp_demangle
LINE_TRACE_DFLAGS:=-L--export-dynamic
endif
ifeq ($(OS)-$(BUILD),dragonflybsd-debug)
TESTS+=line_trace line_trace_21656 long_backtrace_trunc cpp_demangle
LINE_TRACE_DFLAGS:=-L--export-dynamic
TESTS+=line_trace line_trace_21656 long_backtrace_trunc cpp_demangle
LINE_TRACE_DFLAGS:=-L--export-dynamic
endif
ifeq ($(OS)-$(BUILD),osx-debug)
TESTS+=line_trace line_trace_21656 long_backtrace_trunc cpp_demangle
LINE_TRACE_DFLAGS:=
TESTS+=line_trace line_trace_21656 long_backtrace_trunc cpp_demangle
LINE_TRACE_DFLAGS:=
endif
ifeq ($(OS)-$(BUILD),windows-debug)
TESTS+=winstack
endif
ifeq ($(BUILD),debug)
TESTS+=assert_fail
TESTS+=assert_fail
endif
DIFF:=diff
@ -35,7 +38,7 @@ GDB:=gdb
.PHONY: all clean
all: $(addprefix $(ROOT)/,$(addsuffix .done,$(TESTS)))
$(ROOT)/line_trace.done: $(ROOT)/line_trace
$(ROOT)/line_trace.done: $(ROOT)/line_trace$(DOTEXE)
@echo Testing line_trace
$(QUIET)$(TIMELIMIT)$(ROOT)/line_trace $(RUN_ARGS) > $(ROOT)/line_trace.output
# Use sed to canonicalize line_trace.output and compare against expected output in line_trace.exp
@ -44,7 +47,7 @@ $(ROOT)/line_trace.done: $(ROOT)/line_trace
@touch $@
# https://issues.dlang.org/show_bug.cgi?id=21656
$(ROOT)/line_trace_21656.done: $(ROOT)/line_trace
$(ROOT)/line_trace_21656.done: $(ROOT)/line_trace$(DOTEXE)
@echo Testing line_trace_21656
@mkdir -p $(ROOT)/line_trace_21656
@touch $(ROOT)/line_trace_21656/line_trace
@ -53,7 +56,7 @@ $(ROOT)/line_trace_21656.done: $(ROOT)/line_trace
@rm -rf $(ROOT)/line_trace_21656
@touch $@
$(ROOT)/long_backtrace_trunc.done: $(ROOT)/long_backtrace_trunc
$(ROOT)/long_backtrace_trunc.done: $(ROOT)/long_backtrace_trunc$(DOTEXE)
@echo Testing long_backtrace_trunc
$(QUIET)$(TIMELIMIT)$(ROOT)/long_backtrace_trunc $(RUN_ARGS) > $(ROOT)/long_backtrace_trunc.output
# Use sed to canonicalize long_backtrace_trunc.output and compare against expected output in long_backtrace_trunc.exp
@ -61,12 +64,17 @@ $(ROOT)/long_backtrace_trunc.done: $(ROOT)/long_backtrace_trunc
@rm -f $(ROOT)/long_backtrace_trunc.output
@touch $@
$(ROOT)/chain.done: $(ROOT)/chain
$(ROOT)/chain.done: $(ROOT)/chain$(DOTEXE)
@echo Testing chain
$(QUIET)$(TIMELIMIT)$(ROOT)/chain $(RUN_ARGS) > $(ROOT)/chain.output
@rm -f $(ROOT)/chain.output
@touch $@
$(ROOT)/winstack.done: $(ROOT)/winstack$(DOTEXE)
@echo Testing winstack
$(QUIET)$(TIMELIMIT)$(ROOT)/winstack $(RUN_ARGS)
@touch $@
$(ROOT)/stderr_msg.done: STDERR_EXP="stderr_msg msg"
$(ROOT)/unittest_assert.done: STDERR_EXP="unittest_assert msg"
$(ROOT)/invalid_memory_operation.done: STDERR_EXP="InvalidMemoryOperationError"
@ -82,7 +90,7 @@ $(ROOT)/cpp_demangle.done: STDERR_EXP="thrower(int)"
$(ROOT)/message_with_null.done: STDERR_EXP=" world"
$(ROOT)/%.done: $(ROOT)/%
$(ROOT)/%.done: $(ROOT)/%$(DOTEXE)
@echo Testing $*
$(QUIET)$(TIMELIMIT)$(ROOT)/$* $(RUN_ARGS) 2>$(ROOT)/$*.stderr || true
@ -105,7 +113,7 @@ $(ROOT)/rt_trap_exceptions_drt.done: RUN_ARGS="--DRT-trapExceptions=0"
$(ROOT)/rt_trap_exceptions_drt.done: NEGATE=!
$(ROOT)/rt_trap_exceptions_drt_gdb.done: $(ROOT)/rt_trap_exceptions_drt
$(ROOT)/rt_trap_exceptions_drt_gdb.done: $(ROOT)/rt_trap_exceptions_drt$(DOTEXE)
@echo Testing rt_trap_exceptions_drt_gdb
$(QUIET)$(TIMELIMIT) $(GDB) -n -ex 'set confirm off' -ex run -ex 'bt full' -ex q --args $< --DRT-trapExceptions=0 \
> $(ROOT)/rt_trap_exceptions_drt_gdb.output 2>&1 || true
@ -115,23 +123,23 @@ $(ROOT)/rt_trap_exceptions_drt_gdb.done: $(ROOT)/rt_trap_exceptions_drt
! grep "No stack." > /dev/null < $(ROOT)/rt_trap_exceptions_drt_gdb.output
@touch $@
$(ROOT)/refcounted.done: $(ROOT)/refcounted
$(ROOT)/refcounted.done: $(ROOT)/refcounted$(DOTEXE)
$(QUIET) $<
@touch $@
ifeq (ldmd,$(findstring ldmd,$(DMD)))
ifneq (,$(findstring ldmd,$(DMD)))
# LDC: Make sure allocation intended to provoke exception is not elided.
$(ROOT)/invalid_memory_operation: DFLAGS+=-disable-gc2stack
$(ROOT)/invalid_memory_operation$(DOTEXE): DFLAGS+=-disable-gc2stack
endif
$(ROOT)/unittest_assert: DFLAGS+=-unittest -version=CoreUnittest
$(ROOT)/line_trace: DFLAGS+=$(LINE_TRACE_DFLAGS)
$(ROOT)/long_backtrace_trunc: DFLAGS+=$(LINE_TRACE_DFLAGS)
$(ROOT)/rt_trap_exceptions: DFLAGS+=$(LINE_TRACE_DFLAGS)
$(ROOT)/rt_trap_exceptions_drt: DFLAGS+=-g
$(ROOT)/refcounted: DFLAGS+=-dip1008
$(ROOT)/cpp_demangle: DFLAGS+=-L-lstdc++ $(LINE_TRACE_DFLAGS)
$(ROOT)/unittest_assert$(DOTEXE): DFLAGS+=-unittest -version=CoreUnittest
$(ROOT)/line_trace$(DOTEXE): DFLAGS+=$(LINE_TRACE_DFLAGS)
$(ROOT)/long_backtrace_trunc$(DOTEXE): DFLAGS+=$(LINE_TRACE_DFLAGS)
$(ROOT)/rt_trap_exceptions$(DOTEXE): DFLAGS+=$(LINE_TRACE_DFLAGS)
$(ROOT)/rt_trap_exceptions_drt$(DOTEXE): DFLAGS+=-g
$(ROOT)/refcounted$(DOTEXE): DFLAGS+=-dip1008
$(ROOT)/cpp_demangle$(DOTEXE): DFLAGS+=-L-lstdc++ $(LINE_TRACE_DFLAGS)
$(ROOT)/%: $(SRC)/%.d $(DMD) $(DRUNTIME)
$(ROOT)/%$(DOTEXE): $(SRC)/%.d $(DMD) $(DRUNTIME)
$(QUIET)$(DMD) $(DFLAGS) -of$@ $<
clean:

View file

@ -1,10 +0,0 @@
# built from the druntime top-level folder
# to be overwritten by caller
DMD=dmd
MODEL=64
DRUNTIMELIB=druntime64.lib
test:
$(DMD) -m$(MODEL) -conf= -Iimport -defaultlib=$(DRUNTIMELIB) -g test\exceptions\src\winstack.d
winstack.exe
del winstack.*

View file

@ -1,22 +1,29 @@
include ../common.mak
TESTS := attributes sentinel sentinel1 sentinel2 printf memstomp invariant logging \
precise precisegc forkgc forkgc2 \
sigmaskgc startbackgc recoverfree nocollect concurrent precise_concurrent hospital
TESTS:=attributes sentinel printf memstomp invariant logging \
precise precisegc \
recoverfree nocollect
ifeq ($(OS),linux)
TESTS+=issue22843
ifneq ($(OS),windows)
# some .d files are for Posix only
TESTS+=sentinel1 sentinel2 forkgc forkgc2 sigmaskgc startbackgc
# and some tests require the `fork` GC, only supported on Posix
TEST+=concurrent precise_concurrent hospital
endif
SRC_GC = ../../src/core/internal/gc/impl/conservative/gc.d
SRC = $(SRC_GC) ../../src/rt/lifetime.d
ifeq ($(OS),linux)
TESTS+=issue22843
endif
SRC_GC=../../src/core/internal/gc/impl/conservative/gc.d
SRC=$(SRC_GC) ../../src/rt/lifetime.d
# ../../src/object.d causes duplicate symbols
UDFLAGS = $(DFLAGS) -unittest -version=CoreUnittest
UDFLAGS=$(DFLAGS) -unittest -version=CoreUnittest
.PHONY: all clean
all: $(addprefix $(ROOT)/,$(addsuffix .done,$(TESTS)))
$(ROOT)/%.done: $(ROOT)/%
$(ROOT)/%.done: $(ROOT)/%$(DOTEXE)
@echo Testing $*
$(QUIET)$(TIMELIMIT)$(ROOT)/$* $(RUN_ARGS)
@touch $@
@ -24,7 +31,7 @@ $(ROOT)/%.done: $(ROOT)/%
# https://issues.dlang.org/show_bug.cgi?id=22843
# needs to run under valgrind
# versions before 3.13.0 don't handle clone() correctly, skip them
$(ROOT)/issue22843.done: $(ROOT)/issue22843
$(ROOT)/issue22843.done: $(ROOT)/issue22843$(DOTEXE)
@echo Testing issue22843
$(QUIET)if ! command -v valgrind >/dev/null; then \
echo valgrind not installed, skipping; \
@ -35,70 +42,70 @@ $(ROOT)/issue22843.done: $(ROOT)/issue22843
fi
@touch $@
$(ROOT)/sentinel: $(SRC)
$(ROOT)/sentinel$(DOTEXE): $(SRC)
$(DMD) -debug=SENTINEL $(UDFLAGS) -main -of$@ $(SRC)
$(ROOT)/sentinel1: $(SRC) sentinel1.d
$(ROOT)/sentinel1$(DOTEXE): $(SRC) sentinel1.d
$(DMD) -debug=SENTINEL -debug=GC_RECURSIVE_LOCK $(DFLAGS) sentinel1.d -of$@ $(SRC)
$(ROOT)/sentinel2: $(SRC) sentinel2.d
$(ROOT)/sentinel2$(DOTEXE): $(SRC) sentinel2.d
$(DMD) -debug=SENTINEL -debug=GC_RECURSIVE_LOCK $(DFLAGS) sentinel2.d -gx -of$@ $(SRC)
$(ROOT)/printf: $(SRC)
$(ROOT)/printf$(DOTEXE): $(SRC)
$(DMD) -debug=PRINTF -debug=PRINTF_TO_FILE -debug=COLLECT_PRINTF $(UDFLAGS) -main -of$@ $(SRC_GC)
$(ROOT)/memstomp: $(SRC)
$(ROOT)/memstomp$(DOTEXE): $(SRC)
$(DMD) -debug=MEMSTOMP $(UDFLAGS) -main -of$@ $(SRC)
$(ROOT)/invariant: $(SRC)
$(ROOT)/invariant$(DOTEXE): $(SRC)
$(DMD) -debug -debug=INVARIANT -debug=PTRCHECK -debug=PTRCHECK2 $(UDFLAGS) -main -of$@ $(SRC)
$(ROOT)/logging: $(SRC)
$(ROOT)/logging$(DOTEXE): $(SRC)
$(DMD) -debug=LOGGING $(UDFLAGS) -main -of$@ $(SRC)
$(ROOT)/precise: $(SRC)
$(ROOT)/precise$(DOTEXE): $(SRC)
$(DMD) -debug -debug=INVARIANT -debug=MEMSTOMP $(UDFLAGS) -main -of$@ $(SRC)
$(ROOT)/precise.done: RUN_ARGS += --DRT-gcopt=gc:precise
$(ROOT)/precise.done: RUN_ARGS+=--DRT-gcopt=gc:precise
$(ROOT)/precisegc: $(SRC) precisegc.d
$(ROOT)/precisegc$(DOTEXE): $(SRC) precisegc.d
$(DMD) $(UDFLAGS) -gx -of$@ $(SRC) precisegc.d
$(ROOT)/concurrent: $(SRC)
$(ROOT)/concurrent$(DOTEXE): $(SRC)
$(DMD) $(UDFLAGS) -main -of$@ $(SRC)
$(ROOT)/concurrent.done: RUN_ARGS += --DRT-gcopt=fork:1
$(ROOT)/concurrent.done: RUN_ARGS+=--DRT-gcopt=fork:1
$(ROOT)/precise_concurrent: $(SRC)
$(ROOT)/precise_concurrent$(DOTEXE): $(SRC)
$(DMD) $(UDFLAGS) -main -of$@ $(SRC)
$(ROOT)/precise_concurrent.done: RUN_ARGS += "--DRT-gcopt=gc:precise fork:1"
$(ROOT)/precise_concurrent.done: RUN_ARGS+="--DRT-gcopt=gc:precise fork:1"
$(ROOT)/attributes: attributes.d
$(ROOT)/attributes$(DOTEXE): attributes.d
$(DMD) $(UDFLAGS) -of$@ attributes.d
$(ROOT)/forkgc: forkgc.d
$(ROOT)/forkgc$(DOTEXE): forkgc.d
$(DMD) $(UDFLAGS) -of$@ forkgc.d
$(ROOT)/forkgc2: forkgc2.d
$(ROOT)/forkgc2$(DOTEXE): forkgc2.d
$(DMD) $(UDFLAGS) -of$@ forkgc2.d
$(ROOT)/sigmaskgc: sigmaskgc.d
$(ROOT)/sigmaskgc$(DOTEXE): sigmaskgc.d
$(DMD) $(UDFLAGS) -of$@ sigmaskgc.d
$(ROOT)/startbackgc: startbackgc.d
$(DMD) $(UDFLAGS) -of$@ sigmaskgc.d
$(ROOT)/startbackgc$(DOTEXE): startbackgc.d
$(DMD) $(UDFLAGS) -of$@ startbackgc.d
$(ROOT)/recoverfree: recoverfree.d
$(ROOT)/recoverfree$(DOTEXE): recoverfree.d
$(DMD) $(DFLAGS) -of$@ recoverfree.d
$(ROOT)/nocollect: nocollect.d
$(ROOT)/nocollect$(DOTEXE): nocollect.d
$(DMD) $(DFLAGS) -of$@ nocollect.d
$(ROOT)/hospital: hospital.d
$(ROOT)/hospital$(DOTEXE): hospital.d
$(DMD) $(DFLAGS) -d -of$@ hospital.d
$(ROOT)/hospital.done: RUN_ARGS += --DRT-gcopt=fork:1
$(ROOT)/hospital.done: RUN_ARGS+=--DRT-gcopt=fork:1
$(ROOT)/issue22843: issue22843.d
$(ROOT)/issue22843$(DOTEXE): issue22843.d
$(DMD) $(UDFLAGS) -of$@ issue22843.d
$(ROOT)/issue22843.done: RUN_ARGS += "--DRT-gcopt=fork:1 initReserve:0 minPoolSize:1"
$(ROOT)/issue22843.done: RUN_ARGS+="--DRT-gcopt=fork:1 initReserve:0 minPoolSize:1"
clean:
rm -rf $(ROOT)

View file

@ -1,58 +0,0 @@
# built from the druntime top-level folder
# to be overwritten by caller
DMD=dmd
MODEL=64
DRUNTIMELIB=druntime64.lib
SRC_GC = src/core/internal/gc/impl/conservative/gc.d
SRC = $(SRC_GC) src/rt/lifetime.d src/object.d
_DFLAGS = -m$(MODEL) -g -conf= -Iimport -Isrc -defaultlib=$(DRUNTIMELIB)
UDFLAGS = $(_DFLAGS) -unittest -version=CoreUnittest
RM = del
test: sentinel printf memstomp invariant logging precise precisegc recoverfree nocollect
sentinel:
$(DMD) -debug=SENTINEL $(UDFLAGS) -main -of$@.exe $(SRC)
.\$@.exe
$(RM) $@.exe $@.obj $@.ilk $@.pdb
printf:
$(DMD) -debug=PRINTF -debug=PRINTF_TO_FILE -debug=COLLECT_PRINTF $(UDFLAGS) -main -of$@.exe $(SRC_GC)
.\$@.exe
$(RM) $@.exe $@.obj $@.ilk $@.pdb gcx.log
memstomp:
$(DMD) -debug=MEMSTOMP $(UDFLAGS) -main -of$@.exe $(SRC)
.\$@.exe
$(RM) $@.exe $@.obj $@.ilk $@.pdb
invariant:
$(DMD) -debug -debug=INVARIANT -debug=PTRCHECK -debug=PTRCHECK2 $(UDFLAGS) -main -of$@.exe $(SRC)
.\$@.exe
$(RM) $@.exe $@.obj $@.ilk $@.pdb
logging:
$(DMD) -debug=LOGGING $(UDFLAGS) -of$@.exe -main $(SRC)
.\$@.exe
$(RM) $@.exe $@.obj $@.ilk $@.pdb
precise:
$(DMD) -debug -debug=INVARIANT -debug=MEMSTOMP $(UDFLAGS) -main -of$@.exe $(SRC)
.\$@.exe --DRT-gcopt=gc:precise
$(RM) $@.exe $@.obj $@.ilk $@.pdb
precisegc:
$(DMD) $(UDFLAGS) -of$@.exe -gx $(SRC) test/gc/precisegc.d
.\$@.exe
$(RM) $@.exe $@.obj $@.ilk $@.pdb
recoverfree:
$(DMD) $(_DFLAGS) -of$@.exe -gx test/gc/recoverfree.d
.\$@.exe
$(RM) $@.exe $@.obj $@.ilk $@.pdb
nocollect:
$(DMD) $(_DFLAGS) -of$@.exe -gx test/gc/nocollect.d
.\$@.exe
$(RM) $@.exe $@.obj $@.ilk $@.pdb

View file

@ -5,12 +5,12 @@ TESTS:=test_hash
.PHONY: all clean
all: $(addprefix $(ROOT)/,$(addsuffix .done,$(TESTS)))
$(ROOT)/test_hash.done: $(ROOT)/%.done : $(ROOT)/%
$(ROOT)/%.done: $(ROOT)/%$(DOTEXE)
@echo Testing $*
$(QUIET)$(TIMELIMIT)$(ROOT)/$* $(RUN_ARGS)
@touch $@
$(ROOT)/%: $(SRC)/%.d
$(ROOT)/%$(DOTEXE): $(SRC)/%.d
$(QUIET)$(DMD) $(DFLAGS) -of$@ $<
clean:

View file

@ -8,7 +8,7 @@ all: $(addprefix $(ROOT)/,$(addsuffix .done,$(TESTS)))
$(ROOT)/%.done:
@echo Testing $*
@mkdir -p $(basename $@)
$(QUIET)$(DMD) -version=Shared -o- -deps=$@ -Isrc -I../../import src/$*
$(QUIET)$(DMD) -version=Shared -o- -deps=$@ -Isrc -I../../import src/$*.d
clean:
rm -rf $(GENERATED)

View file

@ -5,12 +5,12 @@ TESTS:=thread_join runtime_args test18996 custom_gc
.PHONY: all clean
all: $(addprefix $(ROOT)/,$(addsuffix .done,$(TESTS)))
$(ROOT)/%.done: $(ROOT)/%
$(ROOT)/%.done: $(ROOT)/%$(DOTEXE)
@echo Testing $*
$(QUIET)$(TIMELIMIT)$(ROOT)/$* $(RUN_ARGS)
@touch $@
$(ROOT)/%: $(SRC)/%.d
$(ROOT)/%$(DOTEXE): $(SRC)/%.d
$(QUIET)$(DMD) $(DFLAGS) -of$@ $<
clean:

View file

@ -1,12 +0,0 @@
# built from the druntime top-level folder
# to be overwritten by caller
DMD=dmd
MODEL=64
DRUNTIMELIB=druntime64.lib
test: custom_gc
custom_gc:
$(DMD) -m$(MODEL) -conf= -Iimport -defaultlib=$(DRUNTIMELIB) test\init_fini\src\custom_gc.d
custom_gc.exe
del custom_gc.exe custom_gc.obj

View file

@ -5,12 +5,12 @@ TESTS:=large_aggregate_destroy_21097
.PHONY: all clean
all: $(addprefix $(ROOT)/,$(addsuffix .done,$(TESTS)))
$(ROOT)/%.done: $(ROOT)/%
$(ROOT)/%.done: $(ROOT)/%$(DOTEXE)
@echo Testing $*
$(QUIET)$(TIMELIMIT)$(ROOT)/$* $(RUN_ARGS)
@touch $@
$(ROOT)/%: $(SRC)/%.d
$(ROOT)/%$(DOTEXE): $(SRC)/%.d
$(QUIET)$(DMD) $(DFLAGS) -of$@ $<
clean:

View file

@ -2,8 +2,9 @@ include ../common.mak
TESTS:=profile profilegc both
DIFF:=diff
DIFF:=diff --strip-trailing-cr
GREP:=grep
SED:=sed
ifeq (freebsd,$(OS))
SHELL=/usr/local/bin/bash
@ -13,7 +14,7 @@ else ifeq (netbsd,$(OS))
SHELL=/usr/pkg/bin/bash
else ifeq (dragonflybsd,$(OS))
SHELL=/usr/local/bin/bash
else
else ifneq (windows,$(OS)) # already using a bash shell on Windows via common.mak
SHELL=/bin/bash
endif
@ -21,7 +22,7 @@ endif
all: $(addprefix $(ROOT)/,$(addsuffix .done,$(TESTS)))
$(ROOT)/profile.done: DFLAGS+=-profile
$(ROOT)/profile.done: $(ROOT)/%.done: $(ROOT)/%
$(ROOT)/profile.done: $(ROOT)/%.done: $(ROOT)/%$(DOTEXE)
@echo Testing $*
@rm -f $(ROOT)/mytrace.log $(ROOT)/mytrace.def
$(QUIET)$(TIMELIMIT)$(ROOT)/$* $(ROOT)/mytrace.log $(ROOT)/mytrace.def
@ -33,17 +34,17 @@ $(ROOT)/profile.done: $(ROOT)/%.done: $(ROOT)/%
@touch $@
$(ROOT)/profilegc.done: DFLAGS+=-profile=gc
$(ROOT)/profilegc.done: $(ROOT)/%.done: $(ROOT)/%
$(ROOT)/profilegc.done: $(ROOT)/%.done: $(ROOT)/%$(DOTEXE)
@echo Testing $*
@rm -f $(ROOT)/myprofilegc.log
$(QUIET)$(TIMELIMIT)$(ROOT)/$* $(ROOT)/myprofilegc.log
$(QUIET)$(DIFF) \
<($(GREP) -vF 'core.' myprofilegc.log.$(OS).$(MODEL).exp) \
<($(GREP) -vF 'core.' myprofilegc.log.$(OS).$(shell echo $(MODEL) | cut -c 1-2).exp) \
<($(GREP) -vF 'core.' $(ROOT)/myprofilegc.log)
@touch $@
$(ROOT)/both.done: DFLAGS+=-profile -profile=gc
$(ROOT)/both.done: $(ROOT)/%.done: $(ROOT)/%
$(ROOT)/both.done: $(ROOT)/%.done: $(ROOT)/%$(DOTEXE)
@echo Testing $*
@rm -f $(ROOT)/both.log $(ROOT)/both.def $(ROOT)/bothgc.log
$(QUIET)$(TIMELIMIT)$(ROOT)/$* $(ROOT)/both.log $(ROOT)/both.def $(ROOT)/bothgc.log
@ -52,12 +53,18 @@ $(ROOT)/both.done: $(ROOT)/%.done: $(ROOT)/%
$(QUIET) cat $(ROOT)/both.def
$(QUIET) sort $(ROOT)/both.def -o $(ROOT)/both.def
$(QUIET)(sort bothnew.def.exp | $(DIFF) - $(ROOT)/both.def)
ifeq (windows,$(OS))
$(QUIET)$(DIFF) \
<($(GREP) -vF 'core.' bothgc.log.exp) \
<($(GREP) -vF 'core.' $(ROOT)/bothgc.log | $(SED) 's: src\\\\: src/:g')
else
$(QUIET)$(DIFF) \
<($(GREP) -vF 'core.' bothgc.log.exp) \
<($(GREP) -vF 'core.' $(ROOT)/bothgc.log)
endif
@touch $@
$(ROOT)/%: $(SRC)/%.d
$(ROOT)/%$(DOTEXE): $(SRC)/%.d
$(QUIET)$(DMD) $(DFLAGS) -of$(ROOT)/$* $<
clean:

View file

@ -0,0 +1,21 @@
bytes allocated, allocations, type, function, file:line
256 1 immutable(char)[][int] D main src\profilegc.d:23
128 1 float D main src\profilegc.d:18
128 1 int D main src\profilegc.d:15
64 1 double[] profilegc.main src\profilegc.d:56
48 1 float[] D main src\profilegc.d:42
48 1 int[] D main src\profilegc.d:41
32 1 void[] profilegc.main src\profilegc.d:55
16 1 C D main src\profilegc.d:12
16 1 char[] D main src\profilegc.d:34
16 1 char[] D main src\profilegc.d:36
16 1 closure profilegc.main.foo src\profilegc.d:45
16 1 float D main src\profilegc.d:16
16 1 float D main src\profilegc.d:17
16 1 int D main src\profilegc.d:13
16 1 int D main src\profilegc.d:14
16 1 int[] D main src\profilegc.d:22
16 1 int[] D main src\profilegc.d:37
16 1 uint[] D main src\profilegc.d:15
16 1 uint[] D main src\profilegc.d:18
16 1 wchar[] D main src\profilegc.d:35

View file

@ -0,0 +1,21 @@
bytes allocated, allocations, type, function, file:line
496 1 immutable(char)[][int] D main src\profilegc.d:23
160 1 float D main src\profilegc.d:18
160 1 int D main src\profilegc.d:15
64 1 double[] profilegc.main src\profilegc.d:56
48 1 float[] D main src\profilegc.d:42
48 1 int[] D main src\profilegc.d:41
32 1 C D main src\profilegc.d:12
32 1 ulong[] D main src\profilegc.d:15
32 1 ulong[] D main src\profilegc.d:18
32 1 void[] profilegc.main src\profilegc.d:55
16 1 char[] D main src\profilegc.d:34
16 1 char[] D main src\profilegc.d:36
16 1 closure profilegc.main.foo src\profilegc.d:45
16 1 float D main src\profilegc.d:16
16 1 float D main src\profilegc.d:17
16 1 int D main src\profilegc.d:13
16 1 int D main src\profilegc.d:14
16 1 int[] D main src\profilegc.d:22
16 1 int[] D main src\profilegc.d:37
16 1 wchar[] D main src\profilegc.d:35

View file

@ -1,6 +1,6 @@
LINK_SHARED:=1
include ../common.mak
include ../common.mak # affected by LINK_SHARED!
TESTS:=link load linkD linkDR loadDR host finalize dynamiccast
TESTS+=link_linkdep load_linkdep link_loaddep load_loaddep load_13414

View file

@ -1,40 +1,45 @@
include ../common.mak
TESTS:=fiber_guard_page external_threads tlsgc_sections test_import tlsstack join_detach
TESTS:=tlsgc_sections test_import tlsstack join_detach
# some .d files support Posix only
ifneq ($(OS),windows)
TEST+=fiber_guard_page external_threads
endif
.PHONY: all clean
all: $(addprefix $(ROOT)/,$(addsuffix .done,$(TESTS)))
# segfault || bus error (OSX)
$(ROOT)/fiber_guard_page.done: $(ROOT)/%.done : $(ROOT)/%
$(ROOT)/fiber_guard_page.done: $(ROOT)/%.done : $(ROOT)/%$(DOTEXE)
@echo Testing $*
$(QUIET)$(TIMELIMIT)$(ROOT)/$* $(RUN_ARGS); rc=$$?; [ $$rc -eq 139 ] || [ $$rc -eq 138 ]
@touch $@
$(ROOT)/external_threads.done: $(ROOT)/%.done : $(ROOT)/%
$(ROOT)/external_threads.done: $(ROOT)/%.done : $(ROOT)/%$(DOTEXE)
@echo Testing $*
$(QUIET)$(TIMELIMIT)$(ROOT)/$*
@touch $@
$(ROOT)/tlsgc_sections.done: $(ROOT)/%.done : $(ROOT)/%
$(ROOT)/tlsgc_sections.done: $(ROOT)/%.done : $(ROOT)/%$(DOTEXE)
@echo Testing $*
$(QUIET)$(TIMELIMIT)$(ROOT)/$*
@touch $@
$(ROOT)/test_import.done: $(ROOT)/%.done : $(ROOT)/%
$(ROOT)/test_import.done: $(ROOT)/%.done : $(ROOT)/%$(DOTEXE)
@echo Testing $*
$(QUIET)$(TIMELIMIT)$(ROOT)/$*
@touch $@
$(ROOT)/tlsstack.done: $(ROOT)/%.done : $(ROOT)/%
$(ROOT)/tlsstack.done: $(ROOT)/%.done : $(ROOT)/%$(DOTEXE)
@echo Testing $*
$(QUIET)$(TIMELIMIT)$(ROOT)/$*
@touch $@
$(ROOT)/join_detach.done: $(ROOT)/%.done : $(ROOT)/%
$(ROOT)/join_detach.done: $(ROOT)/%.done : $(ROOT)/%$(DOTEXE)
@echo Testing $* is currently disabled!
$(ROOT)/%: $(SRC)/%.d
$(ROOT)/%$(DOTEXE): $(SRC)/%.d
$(QUIET)$(DMD) $(DFLAGS) -of$@ $<
clean:

View file

@ -5,12 +5,12 @@ TESTS:=all_satisfy
.PHONY: all clean
all: $(addprefix $(ROOT)/,$(addsuffix .done,$(TESTS)))
$(ROOT)/%.done: $(ROOT)/%
$(ROOT)/%.done: $(ROOT)/%$(DOTEXE)
@echo Testing $*
$(QUIET)$(TIMELIMIT)$(ROOT)/$* $(RUN_ARGS)
@touch $@
$(ROOT)/%: $(SRC)/%.d
$(ROOT)/%$(DOTEXE): $(SRC)/%.d
$(QUIET)$(DMD) $(DFLAGS) -of$@ $<
clean:

View file

@ -5,12 +5,12 @@ TESTS:=comparison isbaseof enum_
.PHONY: all clean
all: $(addprefix $(ROOT)/,$(addsuffix .done,$(TESTS)))
$(ROOT)/%.done: $(ROOT)/%
$(ROOT)/%.done: $(ROOT)/%$(DOTEXE)
@echo Testing $*
$(QUIET)$(TIMELIMIT)$(ROOT)/$* $(RUN_ARGS)
@touch $@
$(ROOT)/%: $(SRC)/%.d
$(ROOT)/%$(DOTEXE): $(SRC)/%.d
$(QUIET)$(DMD) $(DFLAGS) -of$@ $<
clean:

View file

@ -34,11 +34,12 @@ $(ROOT)/na.done: TESTTEXT=
$(ROOT)/%.done: customhandler.d
@echo Testing $*
$(QUIET)$(DMD) $(DFLAGS) -of$(ROOT)/tester_$(patsubst %.done,%, $(notdir $@)) customhandler.d -version=$(VER)
$(QUIET)$(DMD) $(DFLAGS) -of$(ROOT)/tester_$(patsubst %.done,%, $(notdir $@))$(DOTEXE) customhandler.d -version=$(VER)
$(QUIET)$(TIMELIMIT)$(ROOT)/tester_$(patsubst %.done,%, $(notdir $@)) > $@ 2>&1; test $$? -eq $(RETCODE)
$(QUIET)test $(HASMAIN) -eq 0 || grep -q main $@
$(QUIET)test $(HASMAIN) -eq 1 || ! grep -q main $@
$(QUIET)test -z "$(TESTTEXT)" || grep -q "$(TESTTEXT) unittests" $@
$(QUIET)test -n "$(TESTTEXT)" || ! grep -q "unittests" $@
clean:
rm -rf $(GENERATED)

View file

@ -0,0 +1,23 @@
include ../common.mak
SUPPORTED:=0
ifeq (windows,$(OS))
ifneq (32omf,$(MODEL))
SUPPORTED:=1
endif
endif
.PHONY: all clean
ifneq (1,$(SUPPORTED))
all:
@echo "Skipping uuid test on platforms other than Windows MSVC"
else
all: $(ROOT)/test$(DOTEXE)
$(ROOT)/%$(DOTEXE): %.d
$(QUIET)$(DMD) $(DFLAGS) -of$@ $< uuid.lib
endif
clean:
rm -rf $(ROOT)

View file

@ -1,9 +0,0 @@
# built from the druntime top-level folder
# to be overwritten by caller
DMD=dmd
MODEL=64
DRUNTIMELIB=druntime64.lib
test:
$(DMD) -m$(MODEL) -conf= -Iimport -defaultlib=$(DRUNTIMELIB) test\uuid\test.d uuid.lib
del test.exe test.obj

View file

@ -1,8 +1,13 @@
include ../common.mak
TESTS := ok_append no_use_after_free no_oob no_oob_sentinel no_use_after_gc
ifeq (windows,$(OS))
# no valgrind on Windows
TESTS:=
else
TESTS:=ok_append no_use_after_free no_oob no_oob_sentinel no_use_after_gc
endif
GC_SRC = \
GC_SRC:= \
../../src/core/internal/gc/impl/conservative/gc.d \
../../src/etc/valgrind/valgrind.d \
../../src/rt/lifetime.d
@ -10,7 +15,7 @@ GC_SRC = \
.PHONY: all clean
all: $(addprefix $(ROOT)/,$(addsuffix .done,$(TESTS)))
$(ROOT)/ok_%.done: $(ROOT)/ok_%
$(ROOT)/ok_%.done: $(ROOT)/ok_%$(DOTEXE)
@echo Testing ok_$*
$(QUIET)if ! command -v valgrind >/dev/null; then \
echo valgrind not installed, skipping; \
@ -19,7 +24,7 @@ $(ROOT)/ok_%.done: $(ROOT)/ok_%
fi
$(QUIET)touch $@
$(ROOT)/no_%.done: $(ROOT)/no_%
$(ROOT)/no_%.done: $(ROOT)/no_%$(DOTEXE)
@echo Testing no_$*
$(QUIET)if ! command -v valgrind >/dev/null; then \
echo valgrind not installed, skipping; \
@ -28,7 +33,8 @@ $(ROOT)/no_%.done: $(ROOT)/no_%
fi
$(QUIET)touch $@
$(ROOT)/%: $(SRC)/%.d $(GC_SRC)
$(ROOT)/%$(DOTEXE): $(SRC)/%.d $(GC_SRC)
$(QUIET)$(DMD) -debug=VALGRIND -debug=SENTINEL $(DFLAGS) -of$@ $< $(GC_SRC)
clean:
rm -rf $(ROOT)

View file

@ -1,45 +0,0 @@
# Makefile to build D runtime library druntime.lib for Win32 OMF
# MS COFF builds use win64.mak for 32 and 64 bit
# Ignored, only the default value is supported
#MODEL=32omf
DMD_DIR=..\compiler
BUILD=release
OS=windows
DMD=$(DMD_DIR)\..\generated\$(OS)\$(BUILD)\32\dmd
# Used for running MASM assembler on .asm files
CC=dmc
MAKE=make
DRUNTIME=$(DMD_DIR)\..\generated\$(OS)\$(BUILD)\32omf\druntime.lib
################### tests ######################################
test_aa:
$(DMD) -m32omf -conf= -Isrc -defaultlib=$(DRUNTIME) -run test\aa\src\test_aa.d
test_allocations:
"$(MAKE)" -f test\allocations\win64.mak "DMD=$(DMD)" MODEL=32omf "VCDIR=$(VCDIR)" DRUNTIMELIB=$(DRUNTIME) "CC=$(CC)" test
test_cpuid:
"$(MAKE)" -f test\cpuid\win64.mak "DMD=$(DMD)" MODEL=32omf "VCDIR=$(VCDIR)" DRUNTIMELIB=$(DRUNTIME) "CC=$(CC)" test
test_exceptions:
"$(MAKE)" -f test\exceptions\win64.mak "DMD=$(DMD)" MODEL=32omf "VCDIR=$(VCDIR)" DRUNTIMELIB=$(DRUNTIME) "CC=$(CC)" test
test_hash:
$(DMD) -m32omf -conf= -Isrc -defaultlib=$(DRUNTIME) -run test\hash\src\test_hash.d
test_gc:
"$(MAKE)" -f test\gc\win64.mak "DMD=$(DMD)" MODEL=32omf "VCDIR=$(VCDIR)" DRUNTIMELIB=$(DRUNTIME) "CC=$(CC)" test
custom_gc:
$(MAKE) -f test\init_fini\win64.mak "DMD=$(DMD)" MODEL=32omf "VCDIR=$(VCDIR)" DRUNTIMELIB=$(DRUNTIME) "CC=$(CC)" test
test_shared:
$(MAKE) -f test\shared\win64.mak "DMD=$(DMD)" MODEL=32omf "VCDIR=$(VCDIR)" DRUNTIMELIB=$(DRUNTIME) "CC=$(CC)" test
test_all: test_aa test_allocations test_cpuid test_exceptions test_hash test_gc custom_gc test_shared

View file

@ -1,65 +0,0 @@
# Makefile to build D runtime library lib\druntime64.lib for 64 bit Windows and
# lib\druntime32mscoff.lib for 32 bit Windows. Both are for use with the MSVC toolchain.
# Determines whether lib\druntime32mscoff.lib is built or lib\druntime64.lib
# Set to `32mscoff` for a 32-bit build, `64` for 64-bit build.
MODEL=64
DMD_DIR=..\compiler
BUILD=release
OS=windows
# The D compiler used to build things
DMD=$(DMD_DIR)\..\generated\$(OS)\$(BUILD)\$(MODEL)\dmd
# Make program to use. Designed to be run with make.exe which can be obtained from
# https://downloads.dlang.org/other/dm857c.zip
MAKE=make
DRUNTIME=$(DMD_DIR)\..\generated\$(OS)\$(BUILD)\$(MODEL)\druntime.lib
################### tests ######################################
test_uuid:
"$(MAKE)" -f test\uuid\win64.mak "DMD=$(DMD)" MODEL=$(MODEL) DRUNTIMELIB=$(DRUNTIME) test
test_aa:
"$(DMD)" -m$(MODEL) -conf= -Isrc -defaultlib=$(DRUNTIME) -run test\aa\src\test_aa.d
test_allocations:
"$(MAKE)" -f test\allocations\win64.mak "DMD=$(DMD)" MODEL=$(MODEL) DRUNTIMELIB=$(DRUNTIME) test
test_betterc:
"$(MAKE)" -f test\betterc\win64.mak "DMD=$(DMD)" MODEL=$(MODEL) DRUNTIMELIB=$(DRUNTIME) test
test_betterc_mingw:
"$(MAKE)" -f test\betterc\win64.mak "DMD=$(DMD)" MODEL=$(MODEL) DRUNTIMELIB=$(DRUNTIME) MINGW=_mingw test
test_cpuid:
"$(MAKE)" -f test\cpuid\win64.mak "DMD=$(DMD)" MODEL=$(MODEL) DRUNTIMELIB=$(DRUNTIME) test
test_exceptions:
"$(MAKE)" -f test\exceptions\win64.mak "DMD=$(DMD)" MODEL=$(MODEL) DRUNTIMELIB=$(DRUNTIME) test
test_hash:
"$(DMD)" -m$(MODEL) -conf= -Isrc -defaultlib=$(DRUNTIME) -run test\hash\src\test_hash.d
test_stdcpp:
setmscver.bat
"$(MAKE)" -f test\stdcpp\win64.mak "DMD=$(DMD)" MODEL=$(MODEL) DRUNTIMELIB=$(DRUNTIME) test
test_gc:
"$(MAKE)" -f test\gc\win64.mak "DMD=$(DMD)" MODEL=$(MODEL) DRUNTIMELIB=$(DRUNTIME) test
custom_gc:
$(MAKE) -f test\init_fini\win64.mak "DMD=$(DMD)" MODEL=$(MODEL) DRUNTIMELIB=$(DRUNTIME) test
test_shared:
$(MAKE) -f test\shared\win64.mak "DMD=$(DMD)" MODEL=$(MODEL) DRUNTIMELIB=$(DRUNTIME) test
test_common: test_shared test_aa test_allocations test_cpuid test_exceptions test_hash test_gc custom_gc
test_mingw: test_common test_betterc_mingw
test_all: test_common test_betterc test_uuid test_stdcpp