mirror of
https://github.com/dlang/dmd.git
synced 2025-04-26 13:10:12 +03:00
druntime/test: rewrite the makefiles
Improvements specific to the makefiles: - reduce the amount of individual code each makefiles requires to function. - provide variables for specifying DFLAGS, CFLAGS, CXXFLAGS etc., - properly rerun the tests when DMD or DRUNTIME are updated. - don't build the few tests that are skipped - keep object files even after running the tests Fixes: - a bunch of tests were silently skipped, these include: - stdcpp/src/test_array.d (it didn't have any unittest block) - stdcpp/ C++17 tests are now run on posix, if the compiler supports it - uuid/ is now run, not just compiled - thread/ and gc/ skipped some tests because of misspelling TESTS (they were doing TEST+= instead of TESTS+=) - exceptions/src/assert_fail.d wans't being reference in the Makefile - added -check=assert to the default flags to gather meaningful results from running the tests with BUILD=release - In exceptions/ tests previously skipped when BUILD=release are now run The main change that this commit tries to fix is being able to specify compiler flags. The current makefiles make doing this pretty much impossible and this has affected at least the ldc project which needs to patch the makefiles to include variables like DFLAGS_BASE into the variables used by the makefiles in order to be able to pass its flags around. On top of being an actual needed feature, the usage of DFLAGS to specify test-specific flags (like -Isrc or -dip1000) is against the standard used by GNU make. According to the standard such variables are reserved for users to add any compiler arguments they desire and projects should: 1. make sure that those variables are respected and passed, on the command line of the compiler, after all project specific flags. 2. pass any required flags outside of DFLAGS (because that variable can be overwritten by the user). This was simply accomplished by just renaming the current variables to something like extra_cflags (note the lower case spelling) to clearly mark the separation between flags that were specified by the user and flags that are freely usable in the makefiles. The flags that the makefiles now respects are presented as a table in common.mak: $(CC) $(CXX) $(DMD) # the compiler $(CFLAGS) $(CXXFLAGS) $(DFLAGS) # flags for the compiler $(LDFLAGS) ditto $(LDFLAGS.d) # flags for the compiler when it invokes the linker $(LDLIBS) ditto $(LDLIBS.d) # library names given to the compiler when invoking the linker $(TARGET_ARCH) ditto $(TARGET_ARCH.d) # undocumented but used in the implicit rules For the purposes of writing the makefiles most the flags variables above have an extra_dflags variant which can be used to pass test specific features. Their usage, coupled with the default rules for building executables, allows the makefiles to easily specify flags, in a standard compliant manner, with minimal duplication. As an example: ``` $(OBJDIR)/my_test$(DOTEXE): private extra_dflags += -version=TEST_ME ``` is all that's needed to pass -version=TEST_ME when building the my_test executable. As specified above, there are now pattern rules that can build common artifacts. They are inspired by the GNU makefile standard rules, with the addition of rules for building D executables and the changes required to respect the extra_dflags variables. In terms of having the tests be rerun when DMD or DRUNTIME change, the current code did accomplish this, to some degree, by having the druntime/Makefile inject the dependencies, which mostly worked. The approach is problematic because: 1. the dependencies are added unconditionally, if a target doesn't use DMD or DRUNTIME it will still be rebuilt. 2. it relies on make deleting the build artifacts across runs, so that they're always rebuilt when the tests are rerun. 3. it only works inside the dmd project, where the tests are invoked as part of druntime/Makefile. This has lead to ldc needing to add a manual command that cleans the build directories of the tests in order to be able to rerun them. 4. It doesn't take into account LINK_SHARED being able to be specified on the command line. The solution is simple, simply have the rules that use DMD or DRUNTIME depend on them, so when those two change the build artifacts are rebuilt and any tests that depend on them are rerun. Signed-off-by: Andrei Horodniceanu <a.horodniceanu@proton.me>
This commit is contained in:
parent
573e81fe3f
commit
a3ed3ec690
37 changed files with 683 additions and 791 deletions
|
@ -1,17 +1,3 @@
|
|||
include ../common.mak
|
||||
|
||||
TESTS := test_aa
|
||||
|
||||
.PHONY: all clean
|
||||
all: $(addprefix $(ROOT)/,$(addsuffix .done,$(TESTS)))
|
||||
|
||||
$(ROOT)/%.done: $(ROOT)/%$(DOTEXE)
|
||||
@echo Testing $*
|
||||
$(QUIET)$(TIMELIMIT)$(ROOT)/$* $(RUN_ARGS)
|
||||
@touch $@
|
||||
|
||||
$(ROOT)/%$(DOTEXE): $(SRC)/%.d
|
||||
$(QUIET)$(DMD) $(DFLAGS) -of$@ $<
|
||||
|
||||
clean:
|
||||
rm -rf $(ROOT)
|
||||
include ../common.mak
|
||||
|
|
|
@ -1,28 +1,15 @@
|
|||
include ../common.mak
|
||||
|
||||
TESTS := overflow_from_zero overflow_from_existing alloc_from_assert
|
||||
|
||||
DIFF:=diff
|
||||
SED:=sed
|
||||
include ../common.mak
|
||||
|
||||
.PHONY: all clean
|
||||
all: $(addprefix $(ROOT)/,$(addsuffix .done,$(TESTS)))
|
||||
|
||||
$(ROOT)/alloc_from_assert.done: $(ROOT)/alloc_from_assert$(DOTEXE)
|
||||
@echo Testing $*
|
||||
$(QUIET)$(TIMELIMIT)$(ROOT)/alloc_from_assert $(RUN_ARGS)
|
||||
$(OBJDIR)/alloc_from_assert.done: $(OBJDIR)/alloc_from_assert$(DOTEXE)
|
||||
@echo Testing $(<F:$(DOTEXE)=)
|
||||
$(TIMELIMIT)$<
|
||||
@touch $@
|
||||
|
||||
$(ROOT)/overflow_from_zero.done: STDERR_EXP="Memory allocation failed"
|
||||
$(ROOT)/overflow_from_existing.done: STDERR_EXP="Memory allocation failed"
|
||||
$(ROOT)/%.done: $(ROOT)/%$(DOTEXE)
|
||||
$(OBJDIR)/overflow_from_zero.done: stderr_exp="Memory allocation failed"
|
||||
$(OBJDIR)/overflow_from_existing.done: stderr_exp="Memory allocation failed"
|
||||
$(OBJDIR)/%.done: $(OBJDIR)/%$(DOTEXE)
|
||||
@echo Testing $*
|
||||
$(NEGATE) $(QUIET)$(TIMELIMIT)$(ROOT)/$* $(RUN_ARGS) 2>&1 1>/dev/null | head -n 2 | grep -qF $(STDERR_EXP)
|
||||
$(TIMELIMIT)$< 2>&1 1>/dev/null | head -n 2 | grep -qF $(stderr_exp)
|
||||
@touch $@
|
||||
|
||||
$(ROOT)/unittest_assert$(DOTEXE): DFLAGS+=-unittest -version=CoreUnittest
|
||||
$(ROOT)/%$(DOTEXE): $(SRC)/%.d
|
||||
$(QUIET)$(DMD) $(DFLAGS) -of$@ $<
|
||||
|
||||
clean:
|
||||
rm -rf $(ROOT)
|
||||
|
|
|
@ -1,25 +1,13 @@
|
|||
TESTS:=test18828 test19416 test19421 test19561 test20088 test20613 test19924 test22336 test19933
|
||||
include ../common.mak
|
||||
|
||||
TESTS:=test18828 test19416 test19421 test19561 test20088 test20613 test19924 test22336 test19933
|
||||
|
||||
.PHONY: all clean
|
||||
all: $(addprefix $(ROOT)/,$(addsuffix .done,$(TESTS)))
|
||||
|
||||
$(ROOT)/%.done: $(ROOT)/%$(DOTEXE)
|
||||
@echo Running $*
|
||||
$(QUIET)$(TIMELIMIT)$(ROOT)/$* $(RUN_ARGS)
|
||||
@touch $@
|
||||
$(OBJDIR)/%.done: extra_dflags += -betterC
|
||||
$(OBJDIR)/%.done: extra_ldlibs.d =
|
||||
|
||||
# for the Windows MinGW CI job:
|
||||
ifneq (,$(findstring -mscrtlib=msvcrt120,$(DFLAGS)))
|
||||
ifneq (,$(findstring -mscrtlib=msvcrt120,$(DFLAGS) $(LDFLAGS.d)))
|
||||
# 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
|
||||
$(OBJDIR)/test19933$(DOTEXE): extra_ldflags.d = -L/NODEFAULTLIB:msvcrt120.lib
|
||||
$(OBJDIR)/test19933$(DOTEXE): extra_ldlibs.d = -Lvcruntime140.lib -Llegacy_stdio_definitions.lib
|
||||
endif
|
||||
|
||||
$(ROOT)/%$(DOTEXE): $(SRC)/%.d
|
||||
$(QUIET)$(DMD) $(MODEL_FLAG) -I../../src -betterC -of$@ $<
|
||||
|
||||
clean:
|
||||
rm -rf $(ROOT)
|
||||
|
|
|
@ -11,34 +11,66 @@ TIMELIMIT:=
|
|||
PIC:=
|
||||
SHARED:=
|
||||
|
||||
# Variables that can be specified by users, with the same meaning as used by GNU make
|
||||
# $(CC) $(CXX) $(DMD) # the compiler
|
||||
# $(CFLAGS) $(CXXFLAGS) $(DFLAGS) # flags for the compiler
|
||||
# $(LDFLAGS) ditto $(LDFLAGS.d) # flags for the compiler when it invokes the linker
|
||||
# $(LDLIBS) ditto $(LDLIBS.d) # library names given to the compiler when invoking the linker
|
||||
# $(TARGET_ARCH) ditto $(TARGET_ARCH.d) # undocumented but used in the implicit rules
|
||||
|
||||
# Information for writting addition tests:
|
||||
#
|
||||
# Each variable above also has a extra_* flavor that can be used by
|
||||
# the makefiles. CFLAGS et al are meant for users. Do _not_ put flags
|
||||
# in there unless the flags don't matter. Use extra_cflags for that
|
||||
# purpose. When writting recipes either use the $(COMPILE.d) or
|
||||
# $(LINK.cpp) convenience wrappers or make sure that you respect _all_
|
||||
# relevant variables. The pattern rules below should handle most cases
|
||||
# of compilation so you should only need to specify the tests'
|
||||
# recipes.
|
||||
|
||||
########## Misc setup ##########
|
||||
|
||||
# Windows: set up bash shell
|
||||
ifeq (windows,$(OS))
|
||||
include ../../../compiler/src/osmodel.mak
|
||||
endif
|
||||
|
||||
LDL:=$(subst -L,,$(LINKDL)) # -ldl
|
||||
SRC:=src
|
||||
VPATH = $(SRC)
|
||||
GENERATED:=./generated
|
||||
ROOT:=$(GENERATED)/$(OS)/$(BUILD)/$(MODEL)
|
||||
DRUNTIME_IMPLIB:=$(subst .dll,.lib,$(DRUNTIMESO))
|
||||
OBJDIR = $(ROOT)
|
||||
|
||||
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
|
||||
druntime_for_linking := $(if $(LINK_SHARED),$(DRUNTIMESO:.dll=.lib),$(DRUNTIME))
|
||||
DRUNTIME_DEP := $(if $(LINK_SHARED),$(DRUNTIMESO),$(DRUNTIME))
|
||||
# GNU make says that compiler variables like $(DMD) can contain arguments, technically.
|
||||
DMD_DEP := $(firstword $(DMD))
|
||||
d_platform_libs := $(if $(filter-out windows,$(OS)),-L-lpthread -L-lm $(LINKDL))
|
||||
|
||||
ifneq ($(strip $(QUIET)),)
|
||||
.SILENT:
|
||||
endif
|
||||
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$(DRUNTIME_IMPLIB) $(if $(findstring $(OS),windows),-dllimport=all),-L$(DRUNTIME))
|
||||
ifeq ($(BUILD),debug)
|
||||
DFLAGS+=-g -debug
|
||||
CFLAGS:=$(CFLAGS_BASE) $(if $(findstring $(OS),windows),/Zi,-g)
|
||||
else
|
||||
DFLAGS+=-O -release
|
||||
CFLAGS:=$(CFLAGS_BASE) $(if $(findstring $(OS),windows),/O2,-O3)
|
||||
endif
|
||||
CXXFLAGS_BASE:=$(CFLAGS_BASE)
|
||||
CXXFLAGS:=$(CFLAGS)
|
||||
|
||||
.SUFFIXES:
|
||||
|
||||
########## Default build commands ##########
|
||||
|
||||
# Similar to the implicit rules defined by GNU make
|
||||
COMPILE.c = $(CC) $(extra_cflags) $(CFLAGS) $(extra_cppflags) $(CPPFLAGS) $(TARGET_ARCH) -c
|
||||
COMPILE.cpp = $(CXX) $(extra_cxxflags) $(CXXFLAGS) $(extra_cppflags) $(CPPFLAGS) $(TARGET_ARCH) -c
|
||||
COMPILE.d = $(DMD) $(extra_dflags) $(DFLAGS) $(TARGET_ARCH.d) -c
|
||||
|
||||
LINK.c = $(CC) $(extra_cflags) $(CFLAGS) $(extra_cppflags) $(CPPFLAGS) $(extra_ldflags) $(LDFLAGS) $(TARGET_ARCH)
|
||||
LINK.cpp = $(CXX) $(extra_cxxflags) $(CXXFLAGS) $(extra_cppflags) $(CPPFLAGS) $(extra_ldflags) $(LDFLAGS) $(TARGET_ARCH)
|
||||
LINK.d = $(DMD) $(extra_dflags) $(DFLAGS) $(extra_ldflags.d) $(LDFLAGS.d) $(TARGET_ARCH.d)
|
||||
LINK.o = $(CC) $(extra_ldflags) $(LDFLAGS) $(TARGET_ARCH)
|
||||
|
||||
OUTPUT_OPTION = $(OUTPUT_FLAG)$@
|
||||
OUTPUT_OPTION.d = $(OUTPUT_FLAG.d)$@
|
||||
|
||||
OUTPUT_FLAG = -o #<- important space: OUTPUT_FLAG = "-o "
|
||||
OUTPUT_FLAG.d = -of=
|
||||
|
||||
ifeq (windows,$(OS))
|
||||
DOTEXE:=.exe
|
||||
|
@ -51,3 +83,94 @@ else
|
|||
DOTLIB:=.a
|
||||
DOTOBJ:=.o
|
||||
endif
|
||||
|
||||
# Default values for the D counterparts of the standard variables
|
||||
LDLIBS.d = $(LDLIBS:%=-L%)
|
||||
TARGET_ARCH.d = $(TARGET_ARCH)
|
||||
|
||||
LDFLAGS.d := $(LDFLAGS)
|
||||
# LDFLAGS.d == -Wl,-O1 -Wl,--as-needed -Wl,-z,pack-relative-relocs
|
||||
comma := ,
|
||||
empty :=
|
||||
space := $(empty) $(empty)
|
||||
LDFLAGS.d := $(subst $(comma),$(space),$(LDFLAGS.d))
|
||||
# LDFLAGS.d == -Wl -O1 -Wl --as-needed -z pack-relative-relocs
|
||||
LDFLAGS.d := $(filter-out -Wl,$(LDFLAGS.d))
|
||||
# LDFLAGS.d == -O1 --as-needed -z pack-relative-relocs
|
||||
LDFLAGS.d := $(LDFLAGS.d:%=-L%)
|
||||
# LDFLAGS.d == -L-O1 -L--as-needed -L-z -Lpack-relative-relocs
|
||||
|
||||
########## Default pattern rules ##########
|
||||
|
||||
$(OBJDIR)/%$(DOTOBJ): %.c | $(OBJDIR)
|
||||
$(COMPILE.c) $(OUTPUT_OPTION) $< $(extra_sources)
|
||||
$(OBJDIR)/%$(DOTOBJ): %.cpp | $(OBJDIR)
|
||||
$(COMPILE.cpp) $(OUTPUT_OPTION) $< $(extra_sources)
|
||||
$(OBJDIR)/%$(DOTOBJ): %.d $(DMD_DEP)
|
||||
$(COMPILE.d) $(OUTPUT_OPTION.d) $< $(extra_sources)
|
||||
|
||||
$(OBJDIR)/%$(DOTEXE): %.c | $(OBJDIR)
|
||||
$(LINK.c) $< $(extra_sources) $(extra_ldlibs) $(LDLIBS) $(OUTPUT_OPTION)
|
||||
$(OBJDIR)/%$(DOTEXE): %.cpp | $(OBJDIR)
|
||||
$(LINK.cpp) $< $(extra_sources) $(extra_ldlibs) $(LDLIBS) $(OUTPUT_OPTION)
|
||||
$(OBJDIR)/%$(DOTEXE): %.d $(DMD_DEP) $(DRUNTIME_DEP)
|
||||
$(LINK.d) $< $(extra_sources) $(extra_ldlibs.d) $(LDLIBS.d) $(OUTPUT_OPTION.d)
|
||||
$(OBJDIR)/%$(DOTEXE): %.o | $(OBJDIR)
|
||||
$(LINK.o) $< $(extra_sources) $(extra_ldlibs) $(LDLIBS) $(OUTPUT_OPTION)
|
||||
|
||||
########## Default build flags ##########
|
||||
|
||||
ifeq ($(BUILD),debug)
|
||||
CFLAGS = $(if $(filter windows,$(OS)),/Zi,-g)
|
||||
CXXFLAGS = $(if $(filter windows,$(OS)),/Zi,-g)
|
||||
DFLAGS = -g -debug
|
||||
else
|
||||
CFLAGS = $(if $(filter windows,$(OS)),/O2,-O3)
|
||||
CXXFLAGS = $(if $(filter windows,$(OS)),/O2,-O3)
|
||||
DFLAGS = -O -release
|
||||
endif
|
||||
CFLAGS += $(if $(filter windows,$(OS)),/Wall,-Wall)
|
||||
DFLAGS += -w
|
||||
|
||||
extra_cflags += $(PIC)
|
||||
extra_cxxflags += $(PIC)
|
||||
extra_dflags += $(PIC) -I../../src -I../../import -I$(SRC) -preview=dip1000
|
||||
|
||||
# A lot of the tests perform assert checks. Preserve them even with -release
|
||||
extra_dflags += -check=assert
|
||||
|
||||
ifdef LINK_SHARED
|
||||
ifeq ($(OS),windows)
|
||||
extra_ldflags.d += -dllimport=all
|
||||
endif
|
||||
endif
|
||||
extra_ldlibs.d += -L$(druntime_for_linking)
|
||||
|
||||
extra_ldflags.d += -defaultlib=
|
||||
extra_ldlibs.d += $(d_platform_libs)
|
||||
|
||||
model_flag := $(if $(filter-out default,$(MODEL)),-m$(MODEL))
|
||||
TARGET_ARCH = $(model_flag) $(if $(filter osx64,$(OS)$(MODEL)),--target=x86_64-darwin-apple)
|
||||
TARGET_ARCH.d = $(model_flag)
|
||||
|
||||
########## Other common code ##########
|
||||
|
||||
.PHONY: all cleam
|
||||
all: $(TESTS:%=$(OBJDIR)/%.done)
|
||||
|
||||
$(OBJDIR)/%.done: $(OBJDIR)/%$(DOTEXE)
|
||||
@echo Testing $*
|
||||
$(TIMELIMIT)./$< $(run_args)
|
||||
@touch $@
|
||||
|
||||
$(OBJDIR):
|
||||
mkdir -p $(OBJDIR)
|
||||
|
||||
# Preserve the executable files after running the tests
|
||||
.NOTINTERMEDIATE: $(OBJDIR)/%$(DOTEXE)
|
||||
|
||||
clean:
|
||||
$(RM) -r $(OBJDIR)
|
||||
|
||||
$(DMD_DEP): ;
|
||||
$(DRUNTIME_DEP): ;
|
||||
|
|
|
@ -1,29 +1,8 @@
|
|||
TESTS:=test19433 test20459 test22523
|
||||
include ../common.mak
|
||||
|
||||
TESTS:=test19433 test20459 test22523
|
||||
$(ROOT)/test19433.done: run_args = --DRT-dont-eat-me
|
||||
$(ROOT)/test20459.done: run_args = foo bar -- --DRT-gcopts=profile:1
|
||||
|
||||
.PHONY: all clean
|
||||
all: $(addprefix $(ROOT)/,$(addsuffix .done,$(TESTS)))
|
||||
|
||||
$(ROOT)/%$(DOTEXE): $(SRC)/%.d
|
||||
$(QUIET)$(DMD) $(DFLAGS) -of$@ $<
|
||||
|
||||
$(ROOT)/test19433.done: $(ROOT)/test19433$(DOTEXE)
|
||||
@echo Testing test19433
|
||||
$(QUIET)$(ROOT)/test19433 --DRT-dont-eat-me
|
||||
@touch $@
|
||||
|
||||
$(ROOT)/test20459.done: $(ROOT)/test20459$(DOTEXE)
|
||||
@echo Testing test20459
|
||||
$(QUIET)$(ROOT)/test20459 foo bar -- --DRT-gcopts=profile:1
|
||||
@touch $@
|
||||
|
||||
|
||||
$(ROOT)/test22523.done: $(SRC)/test22523.d
|
||||
@echo Testing $<
|
||||
$(QUIET)$(DMD) $(DFLAGS) -unittest -of$(ROOT)/test22523$(DOTEXE) $<
|
||||
$(QUIET)$(ROOT)/test22523 -- --DRT-testmode=run-main
|
||||
@touch $@
|
||||
|
||||
clean:
|
||||
rm -rf $(ROOT)
|
||||
$(ROOT)/test22523.done: extra_dflags += -unittest
|
||||
$(ROOT)/test22523.done: run_args = -- --DRT-testmode=run-main
|
||||
|
|
|
@ -1,56 +1,59 @@
|
|||
normal := basic
|
||||
merge := merge merge_true
|
||||
TESTS := $(normal) $(merge) no_code merge_override
|
||||
include ../common.mak
|
||||
|
||||
DFLAGS+=-cov
|
||||
normal_tests := $(normal:%=$(ROOT)/%.done)
|
||||
merge_tests := $(merge:%=$(ROOT)/%.done)
|
||||
|
||||
NORMAL_TESTS:=$(addprefix $(ROOT)/,$(addsuffix .done,basic))
|
||||
MERGE_TESTS:=$(addprefix $(ROOT)/,$(addsuffix .done,merge merge_true))
|
||||
extra_dflags += -cov
|
||||
|
||||
DIFF:=diff --strip-trailing-cr
|
||||
SED:=sed
|
||||
|
||||
ifeq ($(OS),$(filter $(OS),freebsd osx))
|
||||
ifneq (,$(filter $(OS),freebsd osx))
|
||||
SED_INPLACE:=-i ''
|
||||
else
|
||||
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)/%$(DOTEXE)
|
||||
$(normal_tests): $(ROOT)/%.done: $(ROOT)/%$(DOTEXE)
|
||||
@echo Testing $*
|
||||
@rm -f $(ROOT)/src-$*.lst
|
||||
$(QUIET)$(ROOT)/$* $(ROOT) $(RUN_ARGS)
|
||||
@$(RM) $(ROOT)/src-$*.lst
|
||||
$< $(ROOT)
|
||||
ifeq (windows,$(OS))
|
||||
$(QUIET)$(SED) $(SED_INPLACE) 's:^src\\:src/:g' $(ROOT)/src-$*.lst
|
||||
$(SED) $(SED_INPLACE) 's:^src\\:src/:g' $(ROOT)/src-$*.lst
|
||||
endif
|
||||
$(QUIET)$(DIFF) src-$*.lst.exp $(ROOT)/src-$*.lst
|
||||
$(DIFF) src-$*.lst.exp $(ROOT)/src-$*.lst
|
||||
@touch $@
|
||||
|
||||
$(MERGE_TESTS): $(ROOT)/%.done: $(ROOT)/%$(DOTEXE)
|
||||
$(merge_tests): $(ROOT)/%.done: $(ROOT)/%$(DOTEXE)
|
||||
@echo Testing $*
|
||||
@rm -f $(ROOT)/src-$*.lst
|
||||
$(QUIET)$(ROOT)/$* $(ROOT) $(RUN_ARGS)
|
||||
$(QUIET)$(ROOT)/$* $(ROOT) $(RUN_ARGS)
|
||||
@$(RM) $(ROOT)/src-$*.lst
|
||||
$< $(ROOT)
|
||||
$< $(ROOT)
|
||||
ifeq (windows,$(OS))
|
||||
$(QUIET)$(SED) $(SED_INPLACE) 's:^src\\:src/:g' $(ROOT)/src-$*.lst
|
||||
$(SED) $(SED_INPLACE) 's:^src\\:src/:g' $(ROOT)/src-$*.lst
|
||||
endif
|
||||
$(QUIET)$(DIFF) src-$*.lst.exp $(ROOT)/src-$*.lst
|
||||
$(DIFF) src-$*.lst.exp $(ROOT)/src-$*.lst
|
||||
@touch $@
|
||||
|
||||
$(ROOT)/merge_override.done: $(ROOT)/%.done: $(ROOT)/%$(DOTEXE) $(ROOT)/1/$(SRC)/%.d $(ROOT)/2/$(SRC)/%.d src-%.lst_1.exp src-%.lst_2.exp
|
||||
@echo Testing $*
|
||||
@rm -f $(ROOT)/src-$*.lst
|
||||
$(QUIET)$(ROOT)/$* $(ROOT) $(ROOT)/1
|
||||
@$(RM) $(ROOT)/src-$*.lst
|
||||
|
||||
$< $(ROOT) $(ROOT)/1
|
||||
ifeq (windows,$(OS))
|
||||
$(QUIET)$(SED) $(SED_INPLACE) 's:^src\\:src/:g' $(ROOT)/src-$*.lst
|
||||
$(SED) $(SED_INPLACE) 's:^src\\:src/:g' $(ROOT)/src-$*.lst
|
||||
endif
|
||||
$(QUIET)$(DIFF) src-$*.lst_1.exp $(ROOT)/src-$*.lst
|
||||
$(QUIET)$(ROOT)/$* $(ROOT) $(ROOT)/2
|
||||
$(DIFF) src-$*.lst_1.exp $(ROOT)/src-$*.lst
|
||||
|
||||
$< $(ROOT) $(ROOT)/2
|
||||
ifeq (windows,$(OS))
|
||||
$(QUIET)$(SED) $(SED_INPLACE) 's:^src\\:src/:g' $(ROOT)/src-$*.lst
|
||||
$(SED) $(SED_INPLACE) 's:^src\\:src/:g' $(ROOT)/src-$*.lst
|
||||
endif
|
||||
$(QUIET)$(DIFF) src-$*.lst_2.exp $(ROOT)/src-$*.lst
|
||||
$(DIFF) src-$*.lst_2.exp $(ROOT)/src-$*.lst
|
||||
|
||||
@touch $@
|
||||
|
||||
$(ROOT)/1/$(SRC)/merge_override.d: $(SRC)/merge_override.d | $(ROOT)/1/$(SRC)
|
||||
|
@ -63,20 +66,15 @@ $(ROOT)/1/$(SRC) $(ROOT)/2/$(SRC):
|
|||
|
||||
$(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)
|
||||
@$(RM) $(ROOT)/src-$*.lst
|
||||
$< $(ROOT)
|
||||
$< $(ROOT)
|
||||
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
|
||||
$(SED) $(SED_INPLACE) 's:^src\\:src/:g' $(ROOT)/src-$*.lst
|
||||
$(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
|
||||
$(DIFF) src-$*.lst.exp $(ROOT)/src-$*.lst
|
||||
$(DIFF) src-$*_imp.lst.exp $(ROOT)/src-$*_imp.lst
|
||||
@touch $@
|
||||
|
||||
$(ROOT)/no_code$(DOTEXE): $(SRC)/no_code_imp.d
|
||||
$(ROOT)/%$(DOTEXE): $(SRC)/%.d
|
||||
$(QUIET)$(DMD) $(DFLAGS) -of$@ $^
|
||||
|
||||
clean:
|
||||
rm -rf $(ROOT) *.lst
|
||||
$(ROOT)/no_code$(DOTEXE): extra_sources += $(SRC)/no_code_imp.d
|
||||
|
|
|
@ -1,17 +1,2 @@
|
|||
include ../common.mak
|
||||
|
||||
TESTS:=cpuid
|
||||
|
||||
.PHONY: all clean
|
||||
all: $(addprefix $(ROOT)/,$(addsuffix .done,$(TESTS)))
|
||||
|
||||
$(ROOT)/%.done: $(ROOT)/%$(DOTEXE)
|
||||
@echo Testing $*
|
||||
$(QUIET)$(TIMELIMIT)$< $(RUN_ARGS)
|
||||
@touch $@
|
||||
|
||||
$(ROOT)/%$(DOTEXE): $(SRC)/%.d
|
||||
$(QUIET)$(DMD) $(DFLAGS) -of$@ $<
|
||||
|
||||
clean:
|
||||
rm -rf $(ROOT)
|
||||
include ../common.mak
|
||||
|
|
|
@ -1,34 +1,26 @@
|
|||
TESTS:=cycle_ignore cycle_abort cycle_print cycle_deprecate
|
||||
include ../common.mak
|
||||
|
||||
TESTS:=cycle_ignore cycle_abort cycle_print cycle_deprecate
|
||||
|
||||
DIFF:=diff
|
||||
SED:=sed
|
||||
|
||||
.PHONY: all clean
|
||||
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_ignore.done: retcode=0
|
||||
$(ROOT)/cycle_ignore.done: lines=0
|
||||
$(ROOT)/cycle_abort.done: retcode=1
|
||||
# LINK_SHARED causes the abort message to contain trace lines.
|
||||
abort_lines := $(if $(filter windows,$(OS)),8,7)
|
||||
abort_lines := $(if $(LINK_SHARED),,$(abort_lines))
|
||||
$(ROOT)/cycle_abort.done: LINES=$(abort_lines)
|
||||
$(ROOT)/cycle_print.done: RETCODE=0
|
||||
$(ROOT)/cycle_print.done: LINES=6
|
||||
$(ROOT)/cycle_deprecate.done: RETCODE=1
|
||||
$(ROOT)/cycle_abort.done: lines=$(abort_lines)
|
||||
$(ROOT)/cycle_print.done: retcode=0
|
||||
$(ROOT)/cycle_print.done: lines=6
|
||||
$(ROOT)/cycle_deprecate.done: retcode=1
|
||||
# ditto for deprecate
|
||||
deprecate_lines := $(if $(filter windows,$(OS)),9,8)
|
||||
deprecate_lines := $(if $(LINK_SHARED),,$(deprecate_lines))
|
||||
$(ROOT)/cycle_deprecate.done: LINES=$(deprecate_lines)
|
||||
$(ROOT)/cycle_deprecate.done: lines=$(deprecate_lines)
|
||||
$(ROOT)/%.done: $(ROOT)/test_cycles$(DOTEXE)
|
||||
@echo Testing $*
|
||||
$(QUIET)$(TIMELIMIT)$(ROOT)/test_cycles --DRT-oncycle=$(patsubst cycle_%.done,%, $(notdir $@)) > $@ 2>&1; test $$? -eq $(RETCODE)
|
||||
[ -z "$(LINES)" ] || test `cat $@ | wc -l` -eq $(LINES)
|
||||
$(TIMELIMIT)$< --DRT-oncycle=$(@F:cycle_%.done=%) > $@ 2>&1; test $$? -eq $(retcode)
|
||||
[ -z "$(lines)" ] || test `cat $@ | wc -l` -eq $(lines)
|
||||
|
||||
$(ROOT)/test_cycles$(DOTEXE): $(SRC)/*.d
|
||||
$(QUIET)$(DMD) $(DFLAGS) -of$@ $^
|
||||
$(ROOT)/test_cycles$(DOTEXE): $(SRC)/mod*.d
|
||||
$(ROOT)/test_cycles$(DOTEXE): private extra_sources = $(wildcard $(SRC)/mod*.d)
|
||||
|
||||
clean:
|
||||
rm -rf $(ROOT)
|
||||
.DELETE_ON_ERROR:
|
||||
|
|
0
druntime/test/cycles/src/test_cycles.d
Normal file
0
druntime/test/cycles/src/test_cycles.d
Normal file
|
@ -1,124 +1,119 @@
|
|||
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
|
||||
|
||||
# fails on 32 bit linux
|
||||
ifneq ($(OS),linux)
|
||||
TESTS += assert_fail
|
||||
endif
|
||||
|
||||
DIFF:=diff
|
||||
SED:=sed
|
||||
GDB:=gdb
|
||||
|
||||
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
|
||||
|
||||
ifeq ($(OS)-$(BUILD),linux-debug)
|
||||
ifeq ($(OS),linux)
|
||||
TESTS+=line_trace line_trace_21656 long_backtrace_trunc rt_trap_exceptions cpp_demangle
|
||||
LINE_TRACE_DFLAGS:=-L--export-dynamic
|
||||
line_trace_dflags:=-L--export-dynamic
|
||||
endif
|
||||
|
||||
ifeq ($(OS),linux)
|
||||
# Only add this test if gdb is available.
|
||||
ifneq (, $(shell which $(GDB)))
|
||||
ifneq (,$(shell which $(GDB) > /dev/null 2>&1 && echo 1))
|
||||
TESTS+=rt_trap_exceptions_drt_gdb
|
||||
endif
|
||||
endif
|
||||
ifeq ($(OS)-$(BUILD),freebsd-debug)
|
||||
|
||||
ifeq ($(OS),freebsd)
|
||||
TESTS+=line_trace line_trace_21656 long_backtrace_trunc cpp_demangle
|
||||
LINE_TRACE_DFLAGS:=-L--export-dynamic
|
||||
line_trace_dflags:=-L--export-dynamic
|
||||
endif
|
||||
ifeq ($(OS)-$(BUILD),dragonflybsd-debug)
|
||||
ifeq ($(OS),dragonflybsd)
|
||||
TESTS+=line_trace line_trace_21656 long_backtrace_trunc cpp_demangle
|
||||
LINE_TRACE_DFLAGS:=-L--export-dynamic
|
||||
line_trace_dflags:=-L--export-dynamic
|
||||
endif
|
||||
ifeq ($(OS)-$(BUILD),osx-debug)
|
||||
ifeq ($(OS),osx)
|
||||
TESTS+=line_trace line_trace_21656 cpp_demangle
|
||||
LINE_TRACE_DFLAGS:=
|
||||
line_trace_dflags:=
|
||||
endif
|
||||
ifeq ($(OS)-$(BUILD),windows-debug)
|
||||
TESTS+=winstack
|
||||
endif
|
||||
|
||||
ifeq ($(BUILD),debug)
|
||||
TESTS+=assert_fail
|
||||
endif
|
||||
|
||||
.PHONY: all clean
|
||||
all: $(addprefix $(ROOT)/,$(addsuffix .done,$(TESTS)))
|
||||
include ../common.mak
|
||||
|
||||
$(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
|
||||
$(QUIET)$(SED) "s|^.*/src/|src/|g; s/\[0x[0-9a-f]*\]/\[ADDR\]/g; s/scope //g; s/Nl//g" $(ROOT)/line_trace.output | $(DIFF) line_trace.exp -
|
||||
@rm -f $(ROOT)/line_trace.output
|
||||
@touch $@
|
||||
$(TIMELIMIT)$(ROOT)/line_trace > $@
|
||||
# Use sed to canonicalize line_trace.done and compare against expected output in line_trace.exp
|
||||
$(SED) "s|^.*/src/|src/|g; s/\[0x[0-9a-f]*\]/\[ADDR\]/g; s/scope //g; s/Nl//g" $@ | $(DIFF) line_trace.exp -
|
||||
|
||||
# https://issues.dlang.org/show_bug.cgi?id=21656
|
||||
$(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
|
||||
$(QUIET)cd $(ROOT)/line_trace_21656 && PATH="..:$$PATH" $(TIMELIMIT)line_trace $(RUN_ARGS) > line_trace.output
|
||||
$(QUIET)$(SED) "s|^.*/src/|src/|g; s/\[0x[0-9a-f]*\]/\[ADDR\]/g; s/scope //g; s/Nl//g" $(ROOT)/line_trace_21656/line_trace.output | $(DIFF) line_trace.exp -
|
||||
cd $(ROOT)/line_trace_21656 && PATH="..:$$PATH" $(TIMELIMIT)line_trace > line_trace.output
|
||||
$(SED) "s|^.*/src/|src/|g; s/\[0x[0-9a-f]*\]/\[ADDR\]/g; s/scope //g; s/Nl//g" $(ROOT)/line_trace_21656/line_trace.output | $(DIFF) line_trace.exp -
|
||||
@rm -rf $(ROOT)/line_trace_21656
|
||||
@touch $@
|
||||
|
||||
$(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
|
||||
$(TIMELIMIT)$(ROOT)/long_backtrace_trunc > $(ROOT)/long_backtrace_trunc.output
|
||||
# Use sed to canonicalize long_backtrace_trunc.output and compare against expected output in long_backtrace_trunc.exp
|
||||
$(QUIET)$(SED) "s|^.*/src/|src/|g; s/\[0x[0-9a-f]*\]/\[ADDR\]/g; s/scope //g; s/Nl//g" $(ROOT)/long_backtrace_trunc.output | $(DIFF) long_backtrace_trunc.exp -
|
||||
$(SED) "s|^.*/src/|src/|g; s/\[0x[0-9a-f]*\]/\[ADDR\]/g; s/scope //g; s/Nl//g" $(ROOT)/long_backtrace_trunc.output | $(DIFF) long_backtrace_trunc.exp -
|
||||
@rm -f $(ROOT)/long_backtrace_trunc.output
|
||||
@touch $@
|
||||
|
||||
$(ROOT)/chain.done: $(ROOT)/chain$(DOTEXE)
|
||||
@echo Testing chain
|
||||
$(QUIET)$(TIMELIMIT)$(ROOT)/chain $(RUN_ARGS) > $(ROOT)/chain.output
|
||||
$(TIMELIMIT)$(ROOT)/chain > $(ROOT)/chain.output
|
||||
@rm -f $(ROOT)/chain.output
|
||||
@touch $@
|
||||
|
||||
$(ROOT)/winstack.done: $(ROOT)/winstack$(DOTEXE)
|
||||
@echo Testing winstack
|
||||
$(QUIET)$(TIMELIMIT)$(ROOT)/winstack $(RUN_ARGS)
|
||||
$(TIMELIMIT)$< $(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"
|
||||
$(ROOT)/unknown_gc.done: STDERR_EXP="'unknowngc'"
|
||||
$(ROOT)/static_dtor.done: STDERR_EXP="dtor_called_more_than_once"
|
||||
$(ROOT)/static_dtor.done: NEGATE=!
|
||||
$(ROOT)/future_message.done: STDERR_EXP="exception I have a custom message. exception exception "
|
||||
$(ROOT)/catch_in_finally.done: STDERR_EXP="success."
|
||||
$(ROOT)/rt_trap_exceptions.done: STDERR_EXP="object.Exception@src/rt_trap_exceptions.d(12): this will abort"
|
||||
$(ROOT)/rt_trap_exceptions.done: STDERR_EXP2="src/rt_trap_exceptions.d:8 main"
|
||||
$(ROOT)/assert_fail.done: STDERR_EXP="success."
|
||||
$(ROOT)/cpp_demangle.done: STDERR_EXP="thrower(int)"
|
||||
|
||||
$(ROOT)/message_with_null.done: STDERR_EXP=" world"
|
||||
$(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"
|
||||
$(ROOT)/unknown_gc.done: stderr_exp="'unknowngc'"
|
||||
$(ROOT)/static_dtor.done: stderr_exp="dtor_called_more_than_once"
|
||||
$(ROOT)/static_dtor.done: private negate=!
|
||||
$(ROOT)/future_message.done: stderr_exp="exception I have a custom message. exception exception "
|
||||
$(ROOT)/catch_in_finally.done: stderr_exp="success."
|
||||
$(ROOT)/rt_trap_exceptions.done: stderr_exp="object.Exception@src/rt_trap_exceptions.d(12): this will abort"
|
||||
$(ROOT)/rt_trap_exceptions.done: stderr_exp2="src/rt_trap_exceptions.d:8 main"
|
||||
$(ROOT)/assert_fail.done: stderr_exp="success."
|
||||
$(ROOT)/cpp_demangle.done: stderr_exp="thrower(int)"
|
||||
$(ROOT)/message_with_null.done: stderr_exp=" world"
|
||||
|
||||
$(ROOT)/%.done: $(ROOT)/%$(DOTEXE)
|
||||
@echo Testing $*
|
||||
$(QUIET)$(TIMELIMIT)$(ROOT)/$* $(RUN_ARGS) 2>$(ROOT)/$*.stderr || true
|
||||
$(TIMELIMIT)$< $(run_args) 2>$(ROOT)/$*.stderr || true
|
||||
|
||||
@if $(NEGATE) grep -qF $(STDERR_EXP) < $(ROOT)/$*.stderr ; then true ; else \
|
||||
echo 'Searched for pattern $(STDERR_EXP), NEGATE = $(NEGATE)' ;\
|
||||
@if $(negate) grep -qF $(stderr_exp) $(ROOT)/$*.stderr ; then true ; else \
|
||||
echo 'Searched for pattern $(stderr_exp), NEGATE = $(negate)' ;\
|
||||
tail --bytes=5000 $(ROOT)/$*.stderr ;\
|
||||
exit 1 ;\
|
||||
fi
|
||||
@if [ ! -z $(STDERR_EXP2) ] ; then \
|
||||
if $(NEGATE) grep -qF $(STDERR_EXP2) < $(ROOT)/$*.stderr ; then true ; else \
|
||||
echo 'Searched for '$(STDERR_EXP2)' NEGATE = $(NEGATE)' ;\
|
||||
@if [ ! -z $(stderr_exp2) ] ; then \
|
||||
if $(negate) grep -qF $(stderr_exp2) $(ROOT)/$*.stderr ; then true ; else \
|
||||
echo 'Searched for '$(stderr_exp2)' NEGATE = $(negate)' ;\
|
||||
tail --bytes=5000 $(ROOT)/$*.stderr ;\
|
||||
exit 1 ;\
|
||||
fi \
|
||||
fi
|
||||
@touch $@
|
||||
|
||||
$(ROOT)/rt_trap_exceptions_drt.done: STDERR_EXP="uncaught exception\nobject.Exception@rt_trap_exceptions_drt.d(4): exception"
|
||||
$(ROOT)/rt_trap_exceptions_drt.done: RUN_ARGS="--DRT-trapExceptions=0"
|
||||
$(ROOT)/rt_trap_exceptions_drt.done: NEGATE=!
|
||||
|
||||
$(ROOT)/rt_trap_exceptions_drt.done: stderr_exp="uncaught exception\nobject.Exception@rt_trap_exceptions_drt.d(4): exception"
|
||||
$(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$(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 \
|
||||
$(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
|
||||
cat $(ROOT)/rt_trap_exceptions_drt_gdb.output
|
||||
grep "\(D main\|_Dmain\) (args=...) at .*rt_trap_exceptions_drt.d:9" > /dev/null < $(ROOT)/rt_trap_exceptions_drt_gdb.output
|
||||
|
@ -127,23 +122,22 @@ $(ROOT)/rt_trap_exceptions_drt_gdb.done: $(ROOT)/rt_trap_exceptions_drt$(DOTEXE)
|
|||
@touch $@
|
||||
|
||||
$(ROOT)/refcounted.done: $(ROOT)/refcounted$(DOTEXE)
|
||||
$(QUIET) $<
|
||||
@echo Testing $(<F:$(DOTEXE)=)
|
||||
$<
|
||||
@touch $@
|
||||
|
||||
ifneq (,$(findstring ldmd,$(DMD)))
|
||||
# LDC: Make sure allocation intended to provoke exception is not elided.
|
||||
$(ROOT)/invalid_memory_operation$(DOTEXE): DFLAGS+=-disable-gc2stack
|
||||
$(ROOT)/invalid_memory_operation$(DOTEXE): extra_dflags+=-disable-gc2stack
|
||||
endif
|
||||
$(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)/%$(DOTEXE): $(SRC)/%.d $(DMD) $(DRUNTIME)
|
||||
$(QUIET)$(DMD) $(DFLAGS) -of$@ $<
|
||||
|
||||
clean:
|
||||
rm -rf $(ROOT)
|
||||
$(ROOT)/unittest_assert$(DOTEXE): extra_dflags += -unittest -version=CoreUnittest
|
||||
$(ROOT)/line_trace$(DOTEXE): extra_dflags += -g
|
||||
$(ROOT)/line_trace$(DOTEXE): extra_ldflags.d += $(line_trace_dflags)
|
||||
$(ROOT)/long_backtrace_trunc$(DOTEXE): extra_dflags += -g
|
||||
$(ROOT)/long_backtrace_trunc$(DOTEXE): extra_ldflags.d += $(line_trace_dflags)
|
||||
$(ROOT)/rt_trap_exceptions$(DOTEXE): extra_dflags += -g
|
||||
$(ROOT)/rt_trap_exceptions$(DOTEXE): extra_ldflags.d += $(line_trace_dflags)
|
||||
$(ROOT)/rt_trap_exceptions_drt$(DOTEXE): extra_dflags += -g
|
||||
$(ROOT)/refcounted$(DOTEXE): extra_dflags+=-dip1008
|
||||
$(ROOT)/cpp_demangle$(DOTEXE): extra_ldflags.d+=$(line_trace_dflags)
|
||||
$(ROOT)/cpp_demangle$(DOTEXE): extra_ldlibs.d+=-L-lstdc++
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
include ../common.mak
|
||||
|
||||
TESTS:=attributes sentinel printf memstomp invariant logging \
|
||||
precise precisegc \
|
||||
recoverfree nocollect
|
||||
|
@ -8,104 +6,90 @@ 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
|
||||
TESTS+=concurrent precise_concurrent hospital
|
||||
endif
|
||||
|
||||
ifeq ($(OS),linux)
|
||||
VALGRIND = valgrind
|
||||
has_valgrind != command -v $(VALGRIND) > /dev/null 2>&1 && echo 1
|
||||
|
||||
ifeq ($(has_valgrind),1)
|
||||
valgrind_new_enough != $(VALGRIND) --version | grep -E 'valgrind-3.([0-9]|1[012])\b' || echo 1
|
||||
endif
|
||||
|
||||
ifeq ($(valgrind_new_enough),1)
|
||||
TESTS += issue22843
|
||||
endif
|
||||
|
||||
SRC_GC=../../src/core/internal/gc/impl/conservative/gc.d
|
||||
SRC=$(SRC_GC) ../../src/rt/lifetime.d
|
||||
include ../common.mak
|
||||
vpath
|
||||
|
||||
src_gc := ../../src/core/internal/gc/impl/conservative/gc.d
|
||||
src_lifetime=$(src_gc) ../../src/rt/lifetime.d
|
||||
# ../../src/object.d causes duplicate symbols
|
||||
UDFLAGS=$(DFLAGS) -unittest -version=CoreUnittest
|
||||
|
||||
.PHONY: all clean
|
||||
all: $(addprefix $(ROOT)/,$(addsuffix .done,$(TESTS)))
|
||||
|
||||
$(ROOT)/%.done: $(ROOT)/%$(DOTEXE)
|
||||
@echo Testing $*
|
||||
$(QUIET)$(TIMELIMIT)$(ROOT)/$* $(RUN_ARGS)
|
||||
@touch $@
|
||||
core_ut = -unittest -version=CoreUnittest
|
||||
|
||||
# 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$(DOTEXE)
|
||||
@echo Testing issue22843
|
||||
$(QUIET)if ! command -v valgrind >/dev/null; then \
|
||||
echo valgrind not installed, skipping; \
|
||||
elif valgrind --version | grep -Eq 'valgrind-3.([0-9]|1[012])\b'; then \
|
||||
echo valgrind version too old, skipping; \
|
||||
else \
|
||||
$(TIMELIMIT)valgrind --quiet --tool=none $(ROOT)/issue22843 $(RUN_ARGS); \
|
||||
fi
|
||||
@echo Testing $(<F:$(DOTEXE)=)
|
||||
$(TIMELIMIT)$(VALGRIND) --quiet --tool=none $(ROOT)/issue22843 $(run_args)
|
||||
@touch $@
|
||||
|
||||
$(ROOT)/sentinel$(DOTEXE): $(SRC)
|
||||
$(DMD) -debug=SENTINEL $(UDFLAGS) -main -of$@ $(SRC)
|
||||
$(ROOT)/sentinel$(DOTEXE): $(src_lifetime)
|
||||
$(ROOT)/sentinel$(DOTEXE): private extra_sources = $(src_lifetime)
|
||||
$(ROOT)/sentinel$(DOTEXE): extra_dflags += -debug=SENTINEL $(core_ut) -main
|
||||
$(ROOT)/sentinel1$(DOTEXE): $(src_lifetime)
|
||||
$(ROOT)/sentinel1$(DOTEXE): private extra_sources = $(src_lifetime)
|
||||
$(ROOT)/sentinel1$(DOTEXE): extra_dflags += -debug=SENTINEL -debug=GC_RECURSIVE_LOCK
|
||||
$(ROOT)/sentinel2$(DOTEXE): $(src_lifetime)
|
||||
$(ROOT)/sentinel2$(DOTEXE): private extra_sources = $(src_lifetime)
|
||||
$(ROOT)/sentinel2$(DOTEXE): extra_dflags += -debug=SENTINEL -debug=GC_RECURSIVE_LOCK -gx
|
||||
|
||||
$(ROOT)/sentinel1$(DOTEXE): $(SRC) sentinel1.d
|
||||
$(DMD) -debug=SENTINEL -debug=GC_RECURSIVE_LOCK $(DFLAGS) sentinel1.d -of$@ $(SRC)
|
||||
$(ROOT)/printf$(DOTEXE): $(src_gc)
|
||||
$(ROOT)/printf$(DOTEXE): private extra_sources = $(src_gc)
|
||||
$(ROOT)/printf$(DOTEXE): extra_dflags += \
|
||||
-debug=PRINTF -debug=PRINTF_TO_FILE -debug=COLLECT_PRINTF $(core_ut) -main
|
||||
|
||||
$(ROOT)/sentinel2$(DOTEXE): $(SRC) sentinel2.d
|
||||
$(DMD) -debug=SENTINEL -debug=GC_RECURSIVE_LOCK $(DFLAGS) sentinel2.d -gx -of$@ $(SRC)
|
||||
$(ROOT)/memstomp$(DOTEXE): $(src_lifetime)
|
||||
$(ROOT)/memstomp$(DOTEXE): private extra_sources = $(src_lifetime)
|
||||
$(ROOT)/memstomp$(DOTEXE): extra_dflags += -debug=MEMSTOMP $(core_ut) -main
|
||||
|
||||
$(ROOT)/printf$(DOTEXE): $(SRC)
|
||||
$(DMD) -debug=PRINTF -debug=PRINTF_TO_FILE -debug=COLLECT_PRINTF $(UDFLAGS) -main -of$@ $(SRC_GC)
|
||||
$(ROOT)/invariant$(DOTEXE): $(src_lifetime)
|
||||
$(ROOT)/invariant$(DOTEXE): private extra_sources = $(src_lifetime)
|
||||
$(ROOT)/invariant$(DOTEXE): extra_dflags += $(core_ut) \
|
||||
-debug -debug=INVARIANT -check=invariant -debug=PTRCHECK -debug=PTRCHECK2 -main
|
||||
|
||||
$(ROOT)/memstomp$(DOTEXE): $(SRC)
|
||||
$(DMD) -debug=MEMSTOMP $(UDFLAGS) -main -of$@ $(SRC)
|
||||
$(ROOT)/logging$(DOTEXE): $(src_lifetime)
|
||||
$(ROOT)/logging$(DOTEXE): private extra_sources = $(src_lifetime)
|
||||
$(ROOT)/logging$(DOTEXE): extra_dflags += -debug=LOGGING -main $(core_ut)
|
||||
|
||||
$(ROOT)/invariant$(DOTEXE): $(SRC)
|
||||
$(DMD) -debug -debug=INVARIANT -debug=PTRCHECK -debug=PTRCHECK2 $(UDFLAGS) -main -of$@ $(SRC)
|
||||
$(ROOT)/precise$(DOTEXE): $(src_lifetime)
|
||||
$(ROOT)/precise$(DOTEXE): private extra_sources = $(src_lifetime)
|
||||
$(ROOT)/precise$(DOTEXE): extra_dflags += $(core_ut) \
|
||||
-debug -debug=INVARIANT -check=invariant -debug=MEMSTOMP -main
|
||||
$(ROOT)/precise.done: run_args += --DRT-gcopt=gc:precise
|
||||
|
||||
$(ROOT)/logging$(DOTEXE): $(SRC)
|
||||
$(DMD) -debug=LOGGING $(UDFLAGS) -main -of$@ $(SRC)
|
||||
$(ROOT)/precisegc$(DOTEXE): $(src_lifetime)
|
||||
$(ROOT)/precisegc$(DOTEXE): private extra_sources = $(src_lifetime)
|
||||
$(ROOT)/precisegc$(DOTEXE): extra_dflags += $(core_ut) -gx
|
||||
|
||||
$(ROOT)/precise$(DOTEXE): $(SRC)
|
||||
$(DMD) -debug -debug=INVARIANT -debug=MEMSTOMP $(UDFLAGS) -main -of$@ $(SRC)
|
||||
$(ROOT)/precise.done: RUN_ARGS+=--DRT-gcopt=gc:precise
|
||||
$(ROOT)/concurrent$(DOTEXE): $(src_lifetime)
|
||||
$(ROOT)/concurrent$(DOTEXE): private extra_sources = $(src_lifetime)
|
||||
$(ROOT)/concurrent$(DOTEXE): extra_dflags += $(core_ut) -main
|
||||
$(ROOT)/concurrent.done: run_args+=--DRT-gcopt=fork:1
|
||||
|
||||
$(ROOT)/precisegc$(DOTEXE): $(SRC) precisegc.d
|
||||
$(DMD) $(UDFLAGS) -gx -of$@ $(SRC) precisegc.d
|
||||
$(ROOT)/precise_concurrent$(DOTEXE): $(src_lifetime)
|
||||
$(ROOT)/precise_concurrent$(DOTEXE): private extra_sources = $(src_lifetime)
|
||||
$(ROOT)/precise_concurrent$(DOTEXE): extra_dflags += $(core_ut) -main
|
||||
$(ROOT)/precise_concurrent.done: run_args+="--DRT-gcopt=gc:precise fork:1"
|
||||
|
||||
$(ROOT)/concurrent$(DOTEXE): $(SRC)
|
||||
$(DMD) $(UDFLAGS) -main -of$@ $(SRC)
|
||||
$(ROOT)/concurrent.done: RUN_ARGS+=--DRT-gcopt=fork:1
|
||||
|
||||
$(ROOT)/precise_concurrent$(DOTEXE): $(SRC)
|
||||
$(DMD) $(UDFLAGS) -main -of$@ $(SRC)
|
||||
$(ROOT)/precise_concurrent.done: RUN_ARGS+="--DRT-gcopt=gc:precise fork:1"
|
||||
|
||||
$(ROOT)/attributes$(DOTEXE): attributes.d
|
||||
$(DMD) $(UDFLAGS) -of$@ attributes.d
|
||||
|
||||
$(ROOT)/forkgc$(DOTEXE): forkgc.d
|
||||
$(DMD) $(UDFLAGS) -of$@ forkgc.d
|
||||
|
||||
$(ROOT)/forkgc2$(DOTEXE): forkgc2.d
|
||||
$(DMD) $(UDFLAGS) -of$@ forkgc2.d
|
||||
|
||||
$(ROOT)/sigmaskgc$(DOTEXE): sigmaskgc.d
|
||||
$(DMD) $(UDFLAGS) -of$@ sigmaskgc.d
|
||||
|
||||
$(ROOT)/startbackgc$(DOTEXE): startbackgc.d
|
||||
$(DMD) $(UDFLAGS) -of$@ startbackgc.d
|
||||
|
||||
$(ROOT)/recoverfree$(DOTEXE): recoverfree.d
|
||||
$(DMD) $(DFLAGS) -of$@ recoverfree.d
|
||||
|
||||
$(ROOT)/nocollect$(DOTEXE): nocollect.d
|
||||
$(DMD) $(DFLAGS) -of$@ nocollect.d
|
||||
|
||||
$(ROOT)/hospital$(DOTEXE): hospital.d
|
||||
$(DMD) $(DFLAGS) -d -of$@ hospital.d
|
||||
$(ROOT)/hospital.done: RUN_ARGS+=--DRT-gcopt=fork:1
|
||||
|
||||
$(ROOT)/issue22843$(DOTEXE): issue22843.d
|
||||
$(DMD) $(UDFLAGS) -of$@ issue22843.d
|
||||
$(ROOT)/issue22843.done: RUN_ARGS+="--DRT-gcopt=fork:1 initReserve:0 minPoolSize:1"
|
||||
|
||||
clean:
|
||||
rm -rf $(ROOT)
|
||||
$(ROOT)/attributes$(DOTEXE): extra_dflags += $(core_ut)
|
||||
$(ROOT)/forkgc$(DOTEXE): extra_dflags += $(core_ut)
|
||||
$(ROOT)/forkgc2$(DOTEXE): extra_dflags += $(core_ut)
|
||||
$(ROOT)/sigmaskgc$(DOTEXE): extra_dflags += $(core_ut)
|
||||
$(ROOT)/startbackgc$(DOTEXE): extra_dflags += $(core_ut)
|
||||
$(ROOT)/hospital$(DOTEXE): extra_dflags += -d
|
||||
$(ROOT)/hospital.done: run_args+=--DRT-gcopt=fork:1
|
||||
$(ROOT)/issue22843$(DOTEXE): extra_dflags += $(core_ut)
|
||||
$(ROOT)/issue22843.done: run_args+="--DRT-gcopt=fork:1 initReserve:0 minPoolSize:1"
|
||||
|
|
0
druntime/test/gc/concurrent.d
Normal file
0
druntime/test/gc/concurrent.d
Normal file
0
druntime/test/gc/invariant.d
Normal file
0
druntime/test/gc/invariant.d
Normal file
0
druntime/test/gc/logging.d
Normal file
0
druntime/test/gc/logging.d
Normal file
0
druntime/test/gc/memstomp.d
Normal file
0
druntime/test/gc/memstomp.d
Normal file
0
druntime/test/gc/precise.d
Normal file
0
druntime/test/gc/precise.d
Normal file
0
druntime/test/gc/precise_concurrent.d
Normal file
0
druntime/test/gc/precise_concurrent.d
Normal file
0
druntime/test/gc/printf.d
Normal file
0
druntime/test/gc/printf.d
Normal file
0
druntime/test/gc/sentinel.d
Normal file
0
druntime/test/gc/sentinel.d
Normal file
|
@ -1,17 +1,3 @@
|
|||
include ../common.mak
|
||||
|
||||
TESTS:=test_hash
|
||||
|
||||
.PHONY: all clean
|
||||
all: $(addprefix $(ROOT)/,$(addsuffix .done,$(TESTS)))
|
||||
|
||||
$(ROOT)/%.done: $(ROOT)/%$(DOTEXE)
|
||||
@echo Testing $*
|
||||
$(QUIET)$(TIMELIMIT)$(ROOT)/$* $(RUN_ARGS)
|
||||
@touch $@
|
||||
|
||||
$(ROOT)/%$(DOTEXE): $(SRC)/%.d
|
||||
$(QUIET)$(DMD) $(DFLAGS) -of$@ $<
|
||||
|
||||
clean:
|
||||
rm -rf $(ROOT)
|
||||
include ../common.mak
|
||||
|
|
|
@ -1,19 +1,5 @@
|
|||
include ../common.mak
|
||||
|
||||
TESTS := importc_compare
|
||||
|
||||
.PHONY: all clean
|
||||
all: $(addprefix $(ROOT)/,$(addsuffix .done,$(TESTS)))
|
||||
include ../common.mak
|
||||
|
||||
DFLAGS+=-d
|
||||
|
||||
$(ROOT)/%.done: $(ROOT)/%$(DOTEXE)
|
||||
@echo Testing $*
|
||||
$(QUIET)$(TIMELIMIT)$(ROOT)/$* $(RUN_ARGS)
|
||||
@touch $@
|
||||
|
||||
$(ROOT)/%$(DOTEXE): $(SRC)/%.d
|
||||
$(QUIET)$(DMD) $(DFLAGS) -of$@ $<
|
||||
|
||||
clean:
|
||||
rm -rf $(ROOT)
|
||||
extra_dflags += -d
|
||||
|
|
|
@ -1,14 +1,7 @@
|
|||
include ../common.mak
|
||||
|
||||
TESTS := bug18193
|
||||
|
||||
.PHONY: all clean
|
||||
all: $(addprefix $(ROOT)/,$(addsuffix .done,$(TESTS)))
|
||||
include ../common.mak
|
||||
|
||||
$(ROOT)/%.done:
|
||||
$(ROOT)/%.done: %.d $(DMD_DEP)
|
||||
@echo Testing $*
|
||||
@mkdir -p $(basename $@)
|
||||
$(QUIET)$(DMD) -version=Shared -o- -deps=$@ -Isrc -I../../import src/$*.d
|
||||
|
||||
clean:
|
||||
rm -rf $(ROOT)
|
||||
$(COMPILE.d) -deps=$@ -version=Shared -o- $<
|
||||
|
|
|
@ -1,17 +1,3 @@
|
|||
include ../common.mak
|
||||
|
||||
TESTS := thread_join runtime_args test18996 custom_gc
|
||||
|
||||
.PHONY: all clean
|
||||
all: $(addprefix $(ROOT)/,$(addsuffix .done,$(TESTS)))
|
||||
|
||||
$(ROOT)/%.done: $(ROOT)/%$(DOTEXE)
|
||||
@echo Testing $*
|
||||
$(QUIET)$(TIMELIMIT)$(ROOT)/$* $(RUN_ARGS)
|
||||
@touch $@
|
||||
|
||||
$(ROOT)/%$(DOTEXE): $(SRC)/%.d
|
||||
$(QUIET)$(DMD) $(DFLAGS) -of$@ $<
|
||||
|
||||
clean:
|
||||
rm -rf $(ROOT)
|
||||
include ../common.mak
|
||||
|
|
|
@ -1,17 +1,3 @@
|
|||
include ../common.mak
|
||||
|
||||
TESTS := large_aggregate_destroy_21097
|
||||
|
||||
.PHONY: all clean
|
||||
all: $(addprefix $(ROOT)/,$(addsuffix .done,$(TESTS)))
|
||||
|
||||
$(ROOT)/%.done: $(ROOT)/%$(DOTEXE)
|
||||
@echo Testing $*
|
||||
$(QUIET)$(TIMELIMIT)$(ROOT)/$* $(RUN_ARGS)
|
||||
@touch $@
|
||||
|
||||
$(ROOT)/%$(DOTEXE): $(SRC)/%.d
|
||||
$(QUIET)$(DMD) $(DFLAGS) -of$@ $<
|
||||
|
||||
clean:
|
||||
rm -rf $(ROOT)
|
||||
include ../common.mak
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
extern(C) __gshared string[] rt_options = [ "gcopt=gc:non-existing" ];
|
||||
|
||||
void main() @nogc
|
||||
{
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
TESTS := profile profilegc both
|
||||
|
||||
include ../common.mak
|
||||
|
||||
TESTS:=profile profilegc both
|
||||
|
||||
DIFF:=diff --strip-trailing-cr
|
||||
GREP:=grep
|
||||
|
@ -18,54 +19,45 @@ else ifneq (windows,$(OS)) # already using a bash shell on Windows via common.ma
|
|||
SHELL=/bin/bash
|
||||
endif
|
||||
|
||||
.PHONY: all clean
|
||||
all: $(addprefix $(ROOT)/,$(addsuffix .done,$(TESTS)))
|
||||
|
||||
$(ROOT)/profile.done: DFLAGS+=-profile
|
||||
$(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
|
||||
$(QUIET)$(GREP) -q '1 .*_Dmain' $(ROOT)/mytrace.log
|
||||
$(QUIET)$(GREP) -q '1000 .*uint profile.foo(uint)' $(ROOT)/mytrace.log
|
||||
$(QUIET) cat $(ROOT)/mytrace.def
|
||||
$(QUIET) sort $(ROOT)/mytrace.def -o $(ROOT)/mytrace.def
|
||||
$(QUIET) (sort mytrace.def.exp | $(DIFF) - $(ROOT)/mytrace.def) || (sort mytrace.releaseopt.def.exp | $(DIFF) - $(ROOT)/mytrace.def)
|
||||
$(TIMELIMIT)$(ROOT)/$* $(ROOT)/mytrace.log $(ROOT)/mytrace.def
|
||||
$(GREP) -q '1 .*_Dmain' $(ROOT)/mytrace.log
|
||||
$(GREP) -q '1000 .*uint profile.foo(uint)' $(ROOT)/mytrace.log
|
||||
cat $(ROOT)/mytrace.def
|
||||
sort $(ROOT)/mytrace.def -o $(ROOT)/mytrace.def
|
||||
(sort mytrace.def.exp | $(DIFF) - $(ROOT)/mytrace.def) || (sort mytrace.releaseopt.def.exp | $(DIFF) - $(ROOT)/mytrace.def)
|
||||
@touch $@
|
||||
$(ROOT)/profile$(DOTEXE): extra_dflags += -profile
|
||||
|
||||
$(ROOT)/profilegc.done: DFLAGS+=-profile=gc
|
||||
$(ROOT)/profilegc.done: $(ROOT)/%.done: $(ROOT)/%$(DOTEXE)
|
||||
@echo Testing $*
|
||||
@rm -f $(ROOT)/myprofilegc.log
|
||||
$(QUIET)$(TIMELIMIT)$(ROOT)/$* $(ROOT)/myprofilegc.log
|
||||
$(QUIET)$(DIFF) \
|
||||
$(TIMELIMIT)$(ROOT)/$* $(ROOT)/myprofilegc.log
|
||||
$(DIFF) \
|
||||
<($(GREP) -vF 'core.' myprofilegc.log.$(OS).$(shell echo $(MODEL) | cut -c 1-2).exp) \
|
||||
<($(GREP) -vF 'core.' $(ROOT)/myprofilegc.log)
|
||||
@touch $@
|
||||
$(ROOT)/profilegc$(DOTEXE): extra_dflags += -profile=gc
|
||||
|
||||
$(ROOT)/both.done: DFLAGS+=-profile -profile=gc
|
||||
$(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
|
||||
$(QUIET)$(GREP) -q '1 .*_Dmain' $(ROOT)/both.log
|
||||
$(QUIET)$(GREP) -q '1000 .*both.Num\* both.foo(uint)' $(ROOT)/both.log
|
||||
$(QUIET) cat $(ROOT)/both.def
|
||||
$(QUIET) sort $(ROOT)/both.def -o $(ROOT)/both.def
|
||||
$(QUIET)(sort bothnew.def.exp | $(DIFF) - $(ROOT)/both.def)
|
||||
$(TIMELIMIT)$(ROOT)/$* $(ROOT)/both.log $(ROOT)/both.def $(ROOT)/bothgc.log
|
||||
$(GREP) -q '1 .*_Dmain' $(ROOT)/both.log
|
||||
$(GREP) -q '1000 .*both.Num\* both.foo(uint)' $(ROOT)/both.log
|
||||
cat $(ROOT)/both.def
|
||||
sort $(ROOT)/both.def -o $(ROOT)/both.def
|
||||
(sort bothnew.def.exp | $(DIFF) - $(ROOT)/both.def)
|
||||
ifeq (windows,$(OS))
|
||||
$(QUIET)$(DIFF) \
|
||||
$(DIFF) \
|
||||
<($(GREP) -vF 'core.' bothgc.log.exp) \
|
||||
<($(GREP) -vF 'core.' $(ROOT)/bothgc.log | $(SED) 's: src\\\\: src/:g')
|
||||
else
|
||||
$(QUIET)$(DIFF) \
|
||||
$(DIFF) \
|
||||
<($(GREP) -vF 'core.' bothgc.log.exp) \
|
||||
<($(GREP) -vF 'core.' $(ROOT)/bothgc.log)
|
||||
endif
|
||||
@touch $@
|
||||
|
||||
$(ROOT)/%$(DOTEXE): $(SRC)/%.d
|
||||
$(QUIET)$(DMD) $(DFLAGS) -of$(ROOT)/$* $<
|
||||
|
||||
clean:
|
||||
rm -rf $(ROOT) *.log *.def
|
||||
$(ROOT)/both$(DOTEXE): extra_dflags += -profile -profile=gc
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
# SHARED (from druntime/Makefile) is `1` for platforms supporting a shared druntime library, otherwise empty
|
||||
LINK_SHARED:=$(SHARED)
|
||||
|
||||
include ../common.mak # affected by LINK_SHARED!
|
||||
override LINK_SHARED := $(SHARED)
|
||||
|
||||
ifneq (,$(LINK_SHARED))
|
||||
# TODO: enable tests on Windows
|
||||
|
@ -12,110 +9,118 @@ ifneq (,$(LINK_SHARED))
|
|||
link_linkdep load_linkdep link_loaddep load_loaddep load_13414
|
||||
endif
|
||||
endif
|
||||
|
||||
# there are extra tests for Windows, not requiring a druntime DLL
|
||||
ifeq (windows,$(OS))
|
||||
TESTS+=loadlibwin dllrefcount dllgc dynamiccast
|
||||
endif
|
||||
|
||||
DOTIMPLIB:=$(if $(findstring $(OS),windows),.lib,$(DOTDLL))
|
||||
include ../common.mak
|
||||
|
||||
.PHONY: all clean
|
||||
all: $(addprefix $(ROOT)/,$(addsuffix .done,$(TESTS)))
|
||||
abs_root := $(abspath $(ROOT))
|
||||
# on posix we link directly to the .so
|
||||
# on windows you have to link the .lib which references the .dll
|
||||
for_linking := $(if $(filter windows,$(OS)),.lib,$(DOTDLL))
|
||||
|
||||
ifeq (windows,$(OS)) # extra tests on Windows
|
||||
|
||||
ifeq ($(SHARED),1)
|
||||
# dmd -shared does not (yet) imply -visibility=public
|
||||
$(ROOT)/%$(DOTDLL): DFLAGS += -visibility=public
|
||||
$(ROOT)/%$(DOTDLL): private extra_dflags += -visibility=public
|
||||
|
||||
DFLAGS+=-version=SharedRuntime
|
||||
extra_dflags += -version=SharedRuntime
|
||||
PATH := $(dir $(DRUNTIMESO));$(PATH)
|
||||
endif
|
||||
|
||||
$(ROOT)/dllrefcount$(DOTEXE): $(SRC)/dllrefcount.d
|
||||
$(QUIET)$(DMD) $(DFLAGS) -of$@ $<
|
||||
|
||||
$(ROOT)/loadlibwin$(DOTEXE): $(SRC)/loadlibwin.d
|
||||
$(QUIET)$(DMD) $(DFLAGS) -of$@ $<
|
||||
|
||||
$(ROOT)/dllgc$(DOTEXE): $(SRC)/dllgc.d
|
||||
$(QUIET)$(DMD) $(DFLAGS) -version=DLL -shared -of$(ROOT)/dllgc$(DOTDLL) $<
|
||||
$(QUIET)$(DMD) $(DFLAGS) -of$@ $<
|
||||
|
||||
$(ROOT)/dllgc.done: $(ROOT)/dllgc$(DOTDLL)
|
||||
$(ROOT)/dllgc$(DOTDLL): extra_dflags += -version=DLL
|
||||
endif # Windows
|
||||
|
||||
$(ROOT)/loadDR.done $(ROOT)/host.done: RUN_ARGS:=$(DRUNTIMESO:.lib=.dll)
|
||||
|
||||
$(ROOT)/%.done: $(ROOT)/%$(DOTEXE)
|
||||
$(ROOT)/dynamiccast.done: $(ROOT)/%.done: $(ROOT)/%$(DOTEXE) $(ROOT)/%$(DOTDLL)
|
||||
@echo Testing $*
|
||||
$(QUIET)$(TIMELIMIT)$< $(RUN_ARGS)
|
||||
$(RM) $(ROOT)/dynamiccast_end{bar,main}
|
||||
$(TIMELIMIT)$<
|
||||
test -f $(ROOT)/dynamiccast_endbar
|
||||
test -f $(ROOT)/dynamiccast_endmain
|
||||
@touch $@
|
||||
$(ROOT)/dynamiccast$(DOTEXE): private extra_ldlibs.d += $(LINKDL)
|
||||
$(ROOT)/dynamiccast$(DOTDLL): private extra_dflags += -version=DLL
|
||||
|
||||
$(ROOT)/dynamiccast.done: $(ROOT)/%.done: $(ROOT)/%$(DOTEXE)
|
||||
@echo Testing $*
|
||||
$(QUIET)rm -f $(ROOT)/dynamiccast_end{bar,main}
|
||||
$(QUIET)$(TIMELIMIT)$< $(RUN_ARGS)
|
||||
$(QUIET)test -f $(ROOT)/dynamiccast_endbar
|
||||
$(QUIET)test -f $(ROOT)/dynamiccast_endmain
|
||||
@touch $@
|
||||
# Avoid a race condition that I sometimes hit with make -j8.
|
||||
# Maybe temporary file collisions when invoking the linker?
|
||||
$(OBJDIR)/dynamiccast$(DOTEXE): $(OBJDIR)/dynamiccast$(DOTDLL)
|
||||
|
||||
$(ROOT)/link$(DOTEXE): $(SRC)/link.d $(ROOT)/lib$(DOTDLL) $(DRUNTIMESO)
|
||||
$(QUIET)$(DMD) $(DFLAGS) -of$@ $< -L$(ROOT)/lib$(DOTIMPLIB)
|
||||
$(OBJDIR)/link$(DOTEXE): $(OBJDIR)/lib$(for_linking) lib.d
|
||||
$(OBJDIR)/link$(DOTEXE): private extra_ldlibs.d += $(abs_root)/lib$(for_linking)
|
||||
|
||||
$(ROOT)/link_linkdep$(DOTEXE): $(SRC)/link_linkdep.d $(ROOT)/lib$(DOTDLL) $(ROOT)/liblinkdep$(DOTDLL) $(DRUNTIMESO)
|
||||
$(QUIET)$(DMD) $(DFLAGS) -of$@ $< $(LINKFLAGS) -L$(ROOT)/liblinkdep$(DOTIMPLIB) -L$(ROOT)/lib$(DOTIMPLIB)
|
||||
$(ROOT)/liblinkdep$(DOTDLL): $(OBJDIR)/lib$(for_linking) lib.d
|
||||
$(ROOT)/liblinkdep$(DOTDLL): private extra_ldlibs.d += $(abs_root)/lib$(for_linking)
|
||||
|
||||
$(ROOT)/load_linkdep$(DOTEXE): $(SRC)/load_linkdep.d $(ROOT)/lib$(DOTDLL) $(ROOT)/liblinkdep$(DOTDLL) $(DRUNTIMESO)
|
||||
$(QUIET)$(DMD) $(DFLAGS) -of$@ $< $(LINKFLAGS) $(LINKDL)
|
||||
$(ROOT)/libloaddep$(DOTDLL): private extra_ldlibs.d += $(LINKDL)
|
||||
|
||||
$(ROOT)/link_loaddep$(DOTEXE): $(SRC)/link_loaddep.d $(ROOT)/lib$(DOTDLL) $(ROOT)/libloaddep$(DOTDLL) $(DRUNTIMESO)
|
||||
$(QUIET)$(DMD) $(DFLAGS) -of$@ $< $(LINKFLAGS) -L$(ROOT)/libloaddep$(DOTIMPLIB)
|
||||
$(ROOT)/link_linkdep$(DOTEXE): $(ROOT)/liblinkdep$(for_linking) liblinkdep.d
|
||||
$(ROOT)/link_linkdep$(DOTEXE): private extra_ldlibs.d += $(abs_root)/liblinkdep$(for_linking)
|
||||
|
||||
$(ROOT)/load_loaddep$(DOTEXE): $(SRC)/load_loaddep.d $(ROOT)/lib$(DOTDLL) $(ROOT)/libloaddep$(DOTDLL) $(DRUNTIMESO)
|
||||
$(QUIET)$(DMD) $(DFLAGS) -of$@ $< $(LINKFLAGS) $(LINKDL)
|
||||
# dlopens lib.so through libloaddep
|
||||
$(ROOT)/link_loaddep.done: $(ROOT)/lib$(DOTDLL)
|
||||
$(ROOT)/link_loaddep$(DOTEXE): $(ROOT)/libloaddep$(for_linking) libloaddep.d utils.di
|
||||
$(ROOT)/link_loaddep$(DOTEXE): private extra_ldlibs.d += $(abs_root)/libloaddep$(for_linking)
|
||||
|
||||
$(ROOT)/load$(DOTEXE) $(ROOT)/finalize$(DOTEXE): $(ROOT)/%$(DOTEXE): $(SRC)/%.d $(ROOT)/lib$(DOTDLL) $(DRUNTIMESO)
|
||||
$(QUIET)$(DMD) $(DFLAGS) -of$@ $< $(LINKDL)
|
||||
# dlopens liblinkdep.so
|
||||
$(ROOT)/load_linkdep.done: $(ROOT)/liblinkdep$(DOTDLL)
|
||||
$(ROOT)/load_linkdep$(DOTEXE): utils.di
|
||||
$(ROOT)/load_linkdep$(DOTEXE): private extra_ldlibs.d += $(LINKDL)
|
||||
|
||||
$(ROOT)/load_13414$(DOTEXE): $(ROOT)/%$(DOTEXE): $(SRC)/%.d $(ROOT)/lib_13414$(DOTDLL) $(DRUNTIMESO)
|
||||
$(QUIET)$(DMD) $(DFLAGS) -of$@ $< $(LINKDL)
|
||||
# dlopens libloaddep.so and runs code that will dlopen lib.so
|
||||
$(ROOT)/load_loaddep.done: $(ROOT)/lib$(DOTDLL) $(ROOT)/libloaddep$(DOTDLL)
|
||||
$(ROOT)/load_loaddep$(DOTEXE): utils.di
|
||||
$(ROOT)/load_loaddep$(DOTEXE): private extra_ldlibs.d += $(LINKDL)
|
||||
|
||||
$(ROOT)/dynamiccast$(DOTEXE): $(SRC)/dynamiccast.d $(ROOT)/dynamiccast$(DOTDLL) $(if $(LINK_SHARED),$(DRUNTIMESO),$(DRUNTIME))
|
||||
$(QUIET)$(DMD) $(DFLAGS) -of$@ $(SRC)/dynamiccast.d $(LINKDL)
|
||||
$(ROOT)/load.done: $(ROOT)/lib$(DOTDLL)
|
||||
$(ROOT)/load$(DOTEXE): utils.di
|
||||
$(ROOT)/load$(DOTEXE): private extra_ldlibs.d += $(LINKDL)
|
||||
|
||||
$(ROOT)/dynamiccast$(DOTDLL): $(SRC)/dynamiccast.d $(if $(LINK_SHARED),$(DRUNTIMESO),$(DRUNTIME))
|
||||
$(QUIET)$(DMD) $(DFLAGS) -of$@ $< -version=DLL -shared $(LINKDL)
|
||||
$(ROOT)/finalize.done: $(ROOT)/lib$(DOTDLL)
|
||||
$(ROOT)/finalize$(DOTEXE): utils.di
|
||||
$(ROOT)/finalize$(DOTEXE): private extra_ldlibs.d += $(LINKDL)
|
||||
|
||||
$(ROOT)/load_13414.done: $(ROOT)/lib_13414$(DOTDLL)
|
||||
$(ROOT)/load_13414$(DOTEXE): utils.di
|
||||
$(ROOT)/load_13414$(DOTEXE): private extra_ldlibs.d += $(LINKDL)
|
||||
|
||||
ifeq (windows,$(OS))
|
||||
CC := cl
|
||||
CC_OUTFLAG:=/Fe
|
||||
OUTPUT_FLAG := /Fe
|
||||
# we additionally specify the .obj output path (/Fo) to prevent collisions
|
||||
CC_EXTRAS:=
|
||||
else
|
||||
CC_OUTFLAG:=-o
|
||||
CC_EXTRAS:=$(LDL) -pthread
|
||||
extra_cflags += /Fo$(OBJDIR)
|
||||
endif
|
||||
|
||||
$(ROOT)/linkD$(DOTEXE): $(SRC)/linkD.c $(ROOT)/lib$(DOTDLL) $(DRUNTIMESO)
|
||||
$(QUIET)$(CC) $(CFLAGS) $(CC_OUTFLAG)$@ $(if $(findstring $(OS),windows),/Fo$@.obj,) $< $(ROOT)/lib$(DOTIMPLIB) $(CC_EXTRAS)
|
||||
# $(LINKDL) == -L-ldl => $(ldl) == -ldl
|
||||
ldl := $(LINKDL:-L%=%)
|
||||
|
||||
$(ROOT)/linkDR$(DOTEXE): $(SRC)/linkDR.c $(ROOT)/lib$(DOTDLL) $(DRUNTIMESO)
|
||||
$(QUIET)$(CC) $(CFLAGS) $(CC_OUTFLAG)$@ $(if $(findstring $(OS),windows),/Fo$@.obj,) $< $(DRUNTIME_IMPLIB) $(CC_EXTRAS)
|
||||
$(ROOT)/linkD$(DOTEXE): $(ROOT)/lib$(for_linking)
|
||||
$(ROOT)/linkD$(DOTEXE): private extra_ldlibs += $(abs_root)/lib$(for_linking)
|
||||
|
||||
$(ROOT)/loadDR$(DOTEXE): $(SRC)/loadDR.c $(ROOT)/lib$(DOTDLL) $(DRUNTIMESO)
|
||||
$(QUIET)$(CC) $(CFLAGS) $(CC_OUTFLAG)$@ $(if $(findstring $(OS),windows),/Fo$@.obj,) $< $(CC_EXTRAS)
|
||||
$(ROOT)/linkDR.done: $(ROOT)/lib$(DOTDLL)
|
||||
$(ROOT)/linkDR$(DOTEXE): $(DRUNTIME_DEP) utils.h
|
||||
$(ROOT)/linkDR$(DOTEXE): private extra_ldlibs += $(ldl) $(druntime_for_linking)
|
||||
|
||||
$(ROOT)/host$(DOTEXE): $(SRC)/host.c $(ROOT)/plugin1$(DOTDLL) $(ROOT)/plugin2$(DOTDLL)
|
||||
$(QUIET)$(CC) $(CFLAGS) $(CC_OUTFLAG)$@ $(if $(findstring $(OS),windows),/Fo$@.obj,) $< $(CC_EXTRAS)
|
||||
$(ROOT)/loadDR.done: $(ROOT)/lib$(DOTDLL) $(DRUNTIMESO)
|
||||
$(ROOT)/loadDR.done: private run_args = $(DRUNTIMESO)
|
||||
$(ROOT)/loadDR$(DOTEXE): utils.h
|
||||
$(ROOT)/loadDR$(DOTEXE): private extra_ldlibs += $(ldl)
|
||||
|
||||
$(ROOT)/liblinkdep$(DOTDLL): $(ROOT)/lib$(DOTDLL)
|
||||
$(ROOT)/liblinkdep$(DOTDLL): DFLAGS+=-L$(ROOT)/lib$(DOTIMPLIB)
|
||||
$(ROOT)/host.done: $(DRUNTIMESO) $(ROOT)/plugin1$(DOTDLL) $(ROOT)/plugin2$(DOTDLL)
|
||||
$(ROOT)/host.done: private run_args = $(DRUNTIMESO)
|
||||
$(ROOT)/host$(DOTEXE): utils.h
|
||||
$(ROOT)/host$(DOTEXE): private extra_ldlibs += $(ldl)
|
||||
|
||||
$(ROOT)/plugin1$(DOTDLL) $(ROOT)/plugin2$(DOTDLL): $(SRC)/plugin.d $(DRUNTIMESO)
|
||||
$(QUIET)$(DMD) -shared $(DFLAGS) -of$@ $<
|
||||
$(ROOT)/plugin1$(DOTDLL) $(ROOT)/plugin2$(DOTDLL): $(ROOT)/plugin$(DOTDLL)
|
||||
cp $< $@
|
||||
|
||||
$(ROOT)/%$(DOTDLL): $(SRC)/%.d $(DRUNTIMESO)
|
||||
$(QUIET)$(DMD) -shared $(DFLAGS) -of$@ $< $(LINKDL)
|
||||
########## default rule for building a shared library ##########
|
||||
|
||||
clean:
|
||||
rm -rf $(ROOT)
|
||||
$(ROOT)/%$(DOTDLL): %.d $(DMD_DEP) $(DRUNTIME_DEP)
|
||||
$(LINK.d) -shared $< $(extra_ldlibs.d) $(LDLIBS.d) $(OUTPUT_OPTION.d)
|
||||
|
||||
$(ROOT)/%$(for_linking): $(ROOT)/%$(DOTDLL) ;
|
||||
|
|
78
druntime/test/stdcpp/GNUmakefile.posix
Normal file
78
druntime/test/stdcpp/GNUmakefile.posix
Normal file
|
@ -0,0 +1,78 @@
|
|||
hascpp17 != echo wow | $(CXX) -std=c++17 -E -xc++ - > /dev/null 2>&1 && echo yes
|
||||
|
||||
TESTS98:=allocator new utility
|
||||
TESTS11:=array
|
||||
TESTS17:=string_view
|
||||
TESTSOLDABI:=
|
||||
|
||||
ifeq (osx,$(OS))
|
||||
TESTS11+=memory
|
||||
# TESTS98+=string
|
||||
# TESTS98+=vector
|
||||
endif
|
||||
ifeq (linux,$(OS))
|
||||
TESTS11+=exception typeinfo
|
||||
TESTS98+=typeinfo
|
||||
# TESTS98+=string
|
||||
# TESTS98+=vector
|
||||
TESTSOLDABI+=string
|
||||
endif
|
||||
ifeq (freebsd,$(OS))
|
||||
TESTS11+=memory
|
||||
TESTS98+=string
|
||||
# TESTS98+=vector
|
||||
endif
|
||||
|
||||
# some build machines have ancient compilers, so we need to disable C++17 tests
|
||||
ifneq (yes,$(hascpp17))
|
||||
TESTS17:=
|
||||
endif
|
||||
|
||||
TESTS := $(TESTS98:=_98) $(TESTS11:=_11) $(TESTS17:=_17) $(TESTSOLDABI:=_oldabi)
|
||||
|
||||
include ../common.mak
|
||||
|
||||
# -L-lm -L-lpthread => -lm -lpthread
|
||||
d_platform_libs_cc_form := $(d_platform_libs:-L%=%)
|
||||
|
||||
$(OBJDIR)/%_98_d$(DOTOBJ): %_test.d $(DMD_DEP)
|
||||
$(COMPILE.d) $(OUTPUT_OPTION.d) $< $(extra_sources)
|
||||
$(OBJDIR)/%_98_d$(DOTOBJ): private extra_dflags += -extern-std=c++98
|
||||
|
||||
$(OBJDIR)/%_11_d$(DOTOBJ): %_test.d $(DMD_DEP)
|
||||
$(COMPILE.d) $(OUTPUT_OPTION.d) $< $(extra_sources)
|
||||
$(OBJDIR)/%_11_d$(DOTOBJ): private extra_dflags += -extern-std=c++11
|
||||
|
||||
$(OBJDIR)/%_17_d$(DOTOBJ): %_test.d $(DMD_DEP)
|
||||
$(COMPILE.d) $(OUTPUT_OPTION.d) $< $(extra_sources)
|
||||
$(OBJDIR)/%_17_d$(DOTOBJ): private extra_dflags += -extern-std=c++17
|
||||
|
||||
$(OBJDIR)/%_oldabi_d$(DOTOBJ): %_test.d $(DMD_DEP)
|
||||
$(COMPILE.d) $(OUTPUT_OPTION.d) $< $(extra_sources)
|
||||
$(OBJDIR)/%_oldabi_d$(DOTOBJ): private extra_dflags += -version=_GLIBCXX_USE_CXX98_ABI
|
||||
|
||||
$(OBJDIR)/%_d$(DOTOBJ): private extra_dflags += -main -unittest -version=CoreUnittest
|
||||
|
||||
$(OBJDIR)/%_98$(DOTEXE): %.cpp $(OBJDIR)/%_98_d$(DOTOBJ) $(DRUNTIME_DEP)
|
||||
$(LINK.cpp) $< $(OBJDIR)/$*_98_d$(DOTOBJ) $(extra_sources) $(extra_ldlibs) $(LDLIBS) $(OUTPUT_OPTION)
|
||||
$(OBJDIR)/%_98$(DOTEXE): private extra_cxxflags += -std=c++98
|
||||
|
||||
$(OBJDIR)/%_11$(DOTEXE): %.cpp $(OBJDIR)/%_11_d$(DOTOBJ) $(DRUNTIME_DEP)
|
||||
$(LINK.cpp) $< $(OBJDIR)/$*_11_d$(DOTOBJ) $(extra_sources) $(extra_ldlibs) $(LDLIBS) $(OUTPUT_OPTION)
|
||||
$(OBJDIR)/%_11$(DOTEXE): private extra_cxxflags += -std=c++11
|
||||
|
||||
$(OBJDIR)/%_17$(DOTEXE): %.cpp $(OBJDIR)/%_17_d$(DOTOBJ) $(DRUNTIME_DEP)
|
||||
$(LINK.cpp) $< $(OBJDIR)/$*_17_d$(DOTOBJ) $(extra_sources) $(extra_ldlibs) $(LDLIBS) $(OUTPUT_OPTION)
|
||||
$(OBJDIR)/%_17$(DOTEXE): private extra_cxxflags += -std=c++17
|
||||
|
||||
$(OBJDIR)/%_oldabi$(DOTEXE): %.cpp $(OBJDIR)/%_oldabi_d$(DOTOBJ) $(DRUNTIME_DEP)
|
||||
$(LINK.cpp) $< $(OBJDIR)/$*_oldabi_d$(DOTOBJ) $(extra_sources) $(extra_ldlibs) $(LDLIBS) $(OUTPUT_OPTION)
|
||||
$(OBJDIR)/%_oldabi$(DOTEXE): private extra_cppflags += -D_GLIBCXX_USE_CXX11_ABI=0
|
||||
|
||||
$(OBJDIR)/%$(DOTEXE): private extra_ldlibs += $(druntime_for_linking) $(d_platform_libs_cc_form)
|
||||
|
||||
short_test_names = 98 11 17 oldabi
|
||||
.NOTINTERMEDIATE: \
|
||||
$(short_test_names:%=$(OBJDIR)/\%_%_d$(DOTOBJ)) \
|
||||
$(short_test_names:%=$(OBJDIR)/\%_%$(DOTEXE))
|
||||
# .NOTINTERMEDIATE: $(OBJDIR)/%_98_d$(DOTOBJ) $(OBJDIR)/T_98$(DOTEXE) ...
|
56
druntime/test/stdcpp/GNUmakefile.windows
Normal file
56
druntime/test/stdcpp/GNUmakefile.windows
Normal file
|
@ -0,0 +1,56 @@
|
|||
TESTS:=allocator array memory new string utility vector
|
||||
|
||||
CC := cl
|
||||
|
||||
msc_ver:=$(strip $(shell $(CC) /nologo /EP msc_ver.c))
|
||||
ifeq (1,$(intcmp $(msc_ver),1900,0,1,1))
|
||||
extra_cxxflags += /std:c++17
|
||||
extra_dflags += -extern-std=c++17
|
||||
TESTS+=string_view
|
||||
endif
|
||||
|
||||
TESTS := $(TESTS:=_mt) $(TESTS:=_md) $(TESTS:=_mtd) $(TESTS:=_mdd)
|
||||
|
||||
include ../common.mak
|
||||
|
||||
CXX := cl
|
||||
OUTPUT_FLAG := /Fo
|
||||
TARGET_ARCH :=
|
||||
extra_cxxflags += /nologo /EHsc
|
||||
extra_dflags += -main -unittest -version=CoreUnittest -version=_MSC_VER_$(msc_ver)
|
||||
|
||||
$(OBJDIR)/%_mt_cpp$(DOTOBJ): %.cpp | $(OBJDIR)
|
||||
$(COMPILE.cpp) $(OUTPUT_OPTION) $< $(extra_sources)
|
||||
$(OBJDIR)/%_mt_cpp$(DOTOBJ): private extra_cxxflags += /MT
|
||||
$(OBJDIR)/%_md_cpp$(DOTOBJ): %.cpp | $(OBJDIR)
|
||||
$(COMPILE.cpp) $(OUTPUT_OPTION) $< $(extra_sources)
|
||||
$(OBJDIR)/%_md_cpp$(DOTOBJ): private extra_cxxflags += /MD
|
||||
$(OBJDIR)/%_mtd_cpp$(DOTOBJ): %.cpp | $(OBJDIR)
|
||||
$(COMPILE.cpp) $(OUTPUT_OPTION) $< $(extra_sources)
|
||||
$(OBJDIR)/%_mtd_cpp$(DOTOBJ): private extra_cxxflags += /MTd
|
||||
$(OBJDIR)/%_mdd_cpp$(DOTOBJ): %.cpp | $(OBJDIR)
|
||||
$(COMPILE.cpp) $(OUTPUT_OPTION) $< $(extra_sources)
|
||||
$(OBJDIR)/%_mdd_cpp$(DOTOBJ): private extra_cxxflags += /MDd
|
||||
|
||||
# Change the PDB file output to avoid collisions:
|
||||
# fatal error C1041: cannot open program database '...\test\stdcpp\vc140.pdb'; if multiple CL.EXE write to the same .PDB file, please use /FS.
|
||||
$(OBJDIR)/%_cpp$(DOTOBJ): private extra_cxxflags += /Fd$(@:$(DOTOBJ)=)
|
||||
|
||||
$(OBJDIR)/%_mt$(DOTEXE): %_test.d $(OBJDIR)/%_mt_cpp$(DOTOBJ) $(DMD_DEP) $(DRUNTIME_DEP)
|
||||
$(LINK.d) $< $(OBJDIR)/$*_mt_cpp$(DOTOBJ) $(extra_sources) $(extra_ldlibs.d) $(LDLIBS.d) $(OUTPUT_OPTION.d)
|
||||
$(OBJDIR)/%_mt$(DOTEXE): private extra_ldflags.d += -mscrtlib=libcmt
|
||||
$(OBJDIR)/%_md$(DOTEXE): %_test.d $(OBJDIR)/%_md_cpp$(DOTOBJ) $(DMD_DEP) $(DRUNTIME_DEP)
|
||||
$(LINK.d) $< $(OBJDIR)/$*_md_cpp$(DOTOBJ) $(extra_sources) $(extra_ldlibs.d) $(LDLIBS.d) $(OUTPUT_OPTION.d)
|
||||
$(OBJDIR)/%_md$(DOTEXE): private extra_ldflags.d += -mscrtlib=msvcrt
|
||||
$(OBJDIR)/%_mtd$(DOTEXE): %_test.d $(OBJDIR)/%_mtd_cpp$(DOTOBJ) $(DMD_DEP) $(DRUNTIME_DEP)
|
||||
$(LINK.d) $< $(OBJDIR)/$*_mtd_cpp$(DOTOBJ) $(extra_sources) $(extra_ldlibs.d) $(LDLIBS.d) $(OUTPUT_OPTION.d)
|
||||
$(OBJDIR)/%_mtd$(DOTEXE): private extra_ldflags.d += -mscrtlib=libcmtd
|
||||
$(OBJDIR)/%_mdd$(DOTEXE): %_test.d $(OBJDIR)/%_mdd_cpp$(DOTOBJ) $(DMD_DEP) $(DRUNTIME_DEP)
|
||||
$(LINK.d) $< $(OBJDIR)/$*_mdd_cpp$(DOTOBJ) $(extra_sources) $(extra_ldlibs.d) $(LDLIBS.d) $(OUTPUT_OPTION.d)
|
||||
$(OBJDIR)/%_mdd$(DOTEXE): private extra_ldflags.d += -mscrtlib=msvcrtd
|
||||
|
||||
short_test_names = mt md mtd mdd
|
||||
.NOTINTERMEDIATE: \
|
||||
$(short_test_names:%=$(OBJDIR)/\%_%_cpp$(DOTOBJ)) \
|
||||
$(short_test_names:%=$(OBJDIR)/\%_%$(DOTEXE))
|
||||
# .NOTINTERMEDIATE: $(OBJDIR)/%_mt_cpp$(DOTOBJ) $(OBJDIR)/%_$(DOTEXE) ...
|
|
@ -1,121 +1 @@
|
|||
include ../common.mak
|
||||
|
||||
.PHONY: all clean
|
||||
|
||||
ifeq (windows,$(OS))
|
||||
|
||||
CC:=cl
|
||||
EXTRA_CXXFLAGS:=/nologo /EHsc
|
||||
EXTRA_DFLAGS:=
|
||||
|
||||
TESTS:=allocator array memory new string utility vector
|
||||
|
||||
MSC_VER:=$(strip $(shell $(CC) /nologo /EP msc_ver.c))
|
||||
ifeq ($(shell test $(MSC_VER) -gt 1900; echo $$?),0)
|
||||
EXTRA_CXXFLAGS+=/std:c++17
|
||||
EXTRA_DFLAGS+=-extern-std=c++17
|
||||
TESTS+=string_view
|
||||
endif
|
||||
|
||||
all: $(addprefix $(ROOT)/,$(TESTS))
|
||||
|
||||
$(ROOT)/%: $(SRC)/%.cpp $(SRC)/%_test.d
|
||||
@echo Testing $*
|
||||
@mkdir -p $(dir $@)
|
||||
|
||||
$(QUIET)$(CC) /MT $(EXTRA_CXXFLAGS) -c /Fo$@_cpp$(DOTOBJ) $<
|
||||
$(QUIET)$(DMD) -mscrtlib=libcmt $(DFLAGS) $(EXTRA_DFLAGS) -main -unittest -version=CoreUnittest -version=_MSC_VER_$(MSC_VER) -of$@$(DOTEXE) $@_cpp$(DOTOBJ) $(SRC)/$*_test.d
|
||||
$(QUIET)$(TIMELIMIT)$@ $(RUN_ARGS)
|
||||
|
||||
$(QUIET)$(CC) /MD $(EXTRA_CXXFLAGS) -c /Fo$@_cpp$(DOTOBJ) $<
|
||||
$(QUIET)$(DMD) -mscrtlib=msvcrt $(DFLAGS) $(EXTRA_DFLAGS) -main -unittest -version=CoreUnittest -version=_MSC_VER_$(MSC_VER) -of$@$(DOTEXE) $@_cpp$(DOTOBJ) $(SRC)/$*_test.d
|
||||
$(QUIET)$(TIMELIMIT)$@ $(RUN_ARGS)
|
||||
|
||||
$(QUIET)$(CC) /MTd $(EXTRA_CXXFLAGS) -c /Fo$@_cpp$(DOTOBJ) $<
|
||||
$(QUIET)$(DMD) -mscrtlib=libcmtd $(DFLAGS) $(EXTRA_DFLAGS) -main -unittest -version=CoreUnittest -version=_MSC_VER_$(MSC_VER) -of$@$(DOTEXE) $@_cpp$(DOTOBJ) $(SRC)/$*_test.d
|
||||
$(QUIET)$(TIMELIMIT)$@ $(RUN_ARGS)
|
||||
|
||||
$(QUIET)$(CC) /MDd $(EXTRA_CXXFLAGS) -c /Fo$@_cpp$(DOTOBJ) $<
|
||||
$(QUIET)$(DMD) -mscrtlib=msvcrtd $(DFLAGS) $(EXTRA_DFLAGS) -main -unittest -version=CoreUnittest -version=_MSC_VER_$(MSC_VER) -of$@$(DOTEXE) $@_cpp$(DOTOBJ) $(SRC)/$*_test.d
|
||||
$(QUIET)$(TIMELIMIT)$@ $(RUN_ARGS)
|
||||
|
||||
else # Posix:
|
||||
|
||||
HASCPP17:=`echo wow | $(CXX) -std=c++17 -E -xc++ - > /dev/null 2>&1 && echo yes`
|
||||
|
||||
TESTS:=allocator new utility
|
||||
TESTS11:=array
|
||||
TESTS17:=string_view
|
||||
OLDABITESTS:=
|
||||
|
||||
ifeq (osx,$(OS))
|
||||
TESTS11+=memory
|
||||
# TESTS+=string
|
||||
# TESTS+=vector
|
||||
endif
|
||||
ifeq (linux,$(OS))
|
||||
TESTS11+=exception typeinfo
|
||||
TESTS+=typeinfo
|
||||
# TESTS+=string
|
||||
# TESTS+=vector
|
||||
OLDABITESTS+=string
|
||||
endif
|
||||
ifeq (freebsd,$(OS))
|
||||
TESTS11+=memory
|
||||
TESTS+=string
|
||||
# TESTS+=vector
|
||||
endif
|
||||
|
||||
# some build machines have ancient compilers, so we need to disable C++17 tests
|
||||
ifneq (yes,$(HASCPP17))
|
||||
TESTS17:=
|
||||
endif
|
||||
|
||||
all: $(addprefix $(ROOT)/,$(addsuffix .done,$(TESTS))) $(addprefix $(ROOT)/,$(addsuffix _11.done,$(TESTS11))) $(addprefix $(ROOT)/,$(addsuffix _17.done,$(TESTS17))) $(addprefix $(ROOT)/,$(addsuffix _old.done,$(OLDABITESTS)))
|
||||
|
||||
# run C++98 tests
|
||||
$(ROOT)/%.done: $(ROOT)/%$(DOTEXE)
|
||||
@echo Testing $*
|
||||
$(QUIET)$(TIMELIMIT)$(ROOT)/$* $(RUN_ARGS)
|
||||
@touch $@
|
||||
# run C++11 tests
|
||||
$(ROOT)/%_11.done: $(ROOT)/%_11$(DOTEXE)
|
||||
@echo Testing $*_11
|
||||
$(QUIET)$(TIMELIMIT)$(ROOT)/$*_11 $(RUN_ARGS)
|
||||
@touch $@
|
||||
# run C++17 tests
|
||||
$(ROOT)/%_17.done: $(ROOT)/%_17$(DOTEXE)
|
||||
@echo Testing $*_17
|
||||
$(QUIET)$(TIMELIMIT)$(ROOT)/$*_17 $(RUN_ARGS)
|
||||
@touch $@
|
||||
# run libstdc++ _GLIBCXX_USE_CXX11_ABI=0 tests
|
||||
$(ROOT)/%_old.done: $(ROOT)/%_old$(DOTEXE)
|
||||
@echo Testing $*_old
|
||||
$(QUIET)$(TIMELIMIT)$(ROOT)/$*_old $(RUN_ARGS)
|
||||
@touch $@
|
||||
|
||||
# build C++98 tests
|
||||
$(ROOT)/%$(DOTEXE): $(SRC)/%.cpp $(SRC)/%_test.d
|
||||
@mkdir -p $(dir $@)
|
||||
$(QUIET)$(DMD) $(DFLAGS) -extern-std=c++98 -main -unittest -version=CoreUnittest -c -of=$(ROOT)/$*_d$(DOTOBJ) $(SRC)/$*_test.d
|
||||
$(QUIET)$(CXX) $(CXXFLAGS_BASE) -std=c++98 -o $@ $< $(ROOT)/$*_d$(DOTOBJ) $(DRUNTIME) -lpthread $(LDL)
|
||||
# build C++11 tests
|
||||
$(ROOT)/%_11$(DOTEXE): $(SRC)/%.cpp $(SRC)/%_test.d
|
||||
@mkdir -p $(dir $@)
|
||||
$(QUIET)$(DMD) $(DFLAGS) -extern-std=c++11 -main -unittest -version=CoreUnittest -c -of=$(ROOT)/$*_11_d$(DOTOBJ) $(SRC)/$*_test.d
|
||||
$(QUIET)$(CXX) $(CXXFLAGS_BASE) -std=c++11 -o $@ $< $(ROOT)/$*_11_d$(DOTOBJ) $(DRUNTIME) -lpthread $(LDL)
|
||||
# build C++17 tests
|
||||
$(ROOT)/%_17$(DOTEXE): $(SRC)/%.cpp $(SRC)/%_test.d
|
||||
@mkdir -p $(dir $@)
|
||||
$(QUIET)$(DMD) $(DFLAGS) -extern-std=c++17 -main -unittest -version=CoreUnittest -c -of=$(ROOT)/$*_17_d$(DOTOBJ) $(SRC)/$*_test.d
|
||||
$(QUIET)$(CXX) $(CXXFLAGS_BASE) -std=c++17 -o $@ $< $(ROOT)/$*_17_d$(DOTOBJ) $(DRUNTIME) -lpthread $(LDL)
|
||||
# build libstdc++ _GLIBCXX_USE_CXX11_ABI=0 tests
|
||||
$(ROOT)/%_old$(DOTEXE): $(SRC)/%.cpp $(SRC)/%_test.d
|
||||
@mkdir -p $(dir $@)
|
||||
$(QUIET)$(DMD) $(DFLAGS) -version=_GLIBCXX_USE_CXX98_ABI -main -unittest -version=CoreUnittest -c -of=$(ROOT)/$*_old_d$(DOTOBJ) $(SRC)/$*_test.d
|
||||
$(QUIET)$(CXX) $(CXXFLAGS_BASE) -D_GLIBCXX_USE_CXX11_ABI=0 -o $@ $< $(ROOT)/$*_old_d$(DOTOBJ) $(DRUNTIME) -lpthread $(LDL)
|
||||
|
||||
endif # end Posix
|
||||
|
||||
clean:
|
||||
rm -rf $(ROOT)
|
||||
include GNUmakefile.$(if $(filter windows,$(OS)),windows,posix)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import core.stdcpp.array;
|
||||
|
||||
extern (C++) int test_array()
|
||||
unittest
|
||||
{
|
||||
array!(int, 5) arr;
|
||||
arr[] = [0, 2, 3, 4, 5];
|
||||
|
@ -12,7 +12,9 @@ extern (C++) int test_array()
|
|||
assert(arr.empty == false);
|
||||
assert(arr.front == 1);
|
||||
|
||||
assert(sumOfElements_val(arr)[0] == 160);
|
||||
assert(arrayMethodsTests(arr)[0] == 10);
|
||||
|
||||
assert(sumOfElements_val(arr)[0] == 465);
|
||||
assert(sumOfElements_ref(arr)[0] == 15);
|
||||
|
||||
array!(int, 0) arr2;
|
||||
|
@ -21,20 +23,9 @@ extern (C++) int test_array()
|
|||
assert(arr2.max_size == 0);
|
||||
assert(arr2.empty == true);
|
||||
assert(arr2[] == []);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
extern(C++):
|
||||
|
||||
// test the ABI for calls to C++
|
||||
array!(int, 5) sumOfElements_val(array!(int, 5) arr);
|
||||
ref array!(int, 5) sumOfElements_ref(return ref array!(int, 5) arr);
|
||||
|
||||
// test the ABI for calls from C++
|
||||
array!(int, 5) fromC_val(array!(int, 5) arr)
|
||||
{
|
||||
array!(int, 5) arrayMethodsTests(array!(int, 5) arr) {
|
||||
assert(arr[] == [1, 2, 3, 4, 5]);
|
||||
assert(arr.front == 1);
|
||||
assert(arr.back == 5);
|
||||
|
@ -52,6 +43,23 @@ array!(int, 5) fromC_val(array!(int, 5) arr)
|
|||
return arr;
|
||||
}
|
||||
|
||||
|
||||
extern(C++):
|
||||
|
||||
// test the ABI for calls to C++
|
||||
array!(int, 5) sumOfElements_val(array!(int, 5) arr);
|
||||
ref array!(int, 5) sumOfElements_ref(return ref array!(int, 5) arr);
|
||||
|
||||
// test the ABI for calls from C++
|
||||
array!(int, 5) fromC_val(array!(int, 5) arr)
|
||||
{
|
||||
int r;
|
||||
foreach (e; arr)
|
||||
r += e;
|
||||
arr[] = r;
|
||||
return arr;
|
||||
}
|
||||
|
||||
ref array!(int, 5) fromC_ref(return ref array!(int, 5) arr)
|
||||
{
|
||||
int r;
|
||||
|
|
|
@ -1,46 +1,16 @@
|
|||
include ../common.mak
|
||||
|
||||
TESTS:=tlsgc_sections test_import tlsstack join_detach
|
||||
TESTS := tlsgc_sections test_import tlsstack
|
||||
# join_detach is currently disabled
|
||||
#TESTS += join_detach
|
||||
|
||||
# some .d files support Posix only
|
||||
ifneq ($(OS),windows)
|
||||
TEST+=fiber_guard_page external_threads
|
||||
TESTS += fiber_guard_page external_threads
|
||||
endif
|
||||
|
||||
.PHONY: all clean
|
||||
all: $(addprefix $(ROOT)/,$(addsuffix .done,$(TESTS)))
|
||||
include ../common.mak
|
||||
|
||||
# segfault || bus error (OSX)
|
||||
$(ROOT)/fiber_guard_page.done: $(ROOT)/%.done : $(ROOT)/%$(DOTEXE)
|
||||
@echo Testing $*
|
||||
$(QUIET)$(TIMELIMIT)$(ROOT)/$* $(RUN_ARGS); rc=$$?; [ $$rc -eq 139 ] || [ $$rc -eq 138 ]
|
||||
$(TIMELIMIT)$<; rc=$$?; [ $$rc -eq 139 ] || [ $$rc -eq 138 ]
|
||||
@touch $@
|
||||
|
||||
$(ROOT)/external_threads.done: $(ROOT)/%.done : $(ROOT)/%$(DOTEXE)
|
||||
@echo Testing $*
|
||||
$(QUIET)$(TIMELIMIT)$(ROOT)/$*
|
||||
@touch $@
|
||||
|
||||
$(ROOT)/tlsgc_sections.done: $(ROOT)/%.done : $(ROOT)/%$(DOTEXE)
|
||||
@echo Testing $*
|
||||
$(QUIET)$(TIMELIMIT)$(ROOT)/$*
|
||||
@touch $@
|
||||
|
||||
$(ROOT)/test_import.done: $(ROOT)/%.done : $(ROOT)/%$(DOTEXE)
|
||||
@echo Testing $*
|
||||
$(QUIET)$(TIMELIMIT)$(ROOT)/$*
|
||||
@touch $@
|
||||
|
||||
$(ROOT)/tlsstack.done: $(ROOT)/%.done : $(ROOT)/%$(DOTEXE)
|
||||
@echo Testing $*
|
||||
$(QUIET)$(TIMELIMIT)$(ROOT)/$*
|
||||
@touch $@
|
||||
|
||||
$(ROOT)/join_detach.done: $(ROOT)/%.done : $(ROOT)/%$(DOTEXE)
|
||||
@echo Testing $* is currently disabled!
|
||||
|
||||
$(ROOT)/%$(DOTEXE): $(SRC)/%.d
|
||||
$(QUIET)$(DMD) $(DFLAGS) -of$@ $<
|
||||
|
||||
clean:
|
||||
rm -rf $(ROOT)
|
||||
|
|
|
@ -1,17 +1,3 @@
|
|||
include ../common.mak
|
||||
|
||||
TESTS := all_satisfy
|
||||
|
||||
.PHONY: all clean
|
||||
all: $(addprefix $(ROOT)/,$(addsuffix .done,$(TESTS)))
|
||||
|
||||
$(ROOT)/%.done: $(ROOT)/%$(DOTEXE)
|
||||
@echo Testing $*
|
||||
$(QUIET)$(TIMELIMIT)$(ROOT)/$* $(RUN_ARGS)
|
||||
@touch $@
|
||||
|
||||
$(ROOT)/%$(DOTEXE): $(SRC)/%.d
|
||||
$(QUIET)$(DMD) $(DFLAGS) -of$@ $<
|
||||
|
||||
clean:
|
||||
rm -rf $(ROOT)
|
||||
include ../common.mak
|
||||
|
|
|
@ -1,17 +1,3 @@
|
|||
include ../common.mak
|
||||
|
||||
TESTS := comparison isbaseof enum_
|
||||
|
||||
.PHONY: all clean
|
||||
all: $(addprefix $(ROOT)/,$(addsuffix .done,$(TESTS)))
|
||||
|
||||
$(ROOT)/%.done: $(ROOT)/%$(DOTEXE)
|
||||
@echo Testing $*
|
||||
$(QUIET)$(TIMELIMIT)$(ROOT)/$* $(RUN_ARGS)
|
||||
@touch $@
|
||||
|
||||
$(ROOT)/%$(DOTEXE): $(SRC)/%.d
|
||||
$(QUIET)$(DMD) $(DFLAGS) -of$@ $<
|
||||
|
||||
clean:
|
||||
rm -rf $(ROOT)
|
||||
include ../common.mak
|
||||
|
|
|
@ -1,45 +1,43 @@
|
|||
include ../common.mak
|
||||
|
||||
TESTS := good goodn bad badn na
|
||||
|
||||
DIFF:=diff
|
||||
SED:=sed
|
||||
include ../common.mak
|
||||
|
||||
.PHONY: all clean
|
||||
all: $(addprefix $(ROOT)/,$(addsuffix .done,$(TESTS)))
|
||||
$(ROOT)/good.done: hasmain=0
|
||||
$(ROOT)/goodn.done: hasmain=0
|
||||
$(ROOT)/bad.done: hasmain=0
|
||||
$(ROOT)/badn.done: hasmain=0
|
||||
$(ROOT)/na.done: hasmain=1
|
||||
|
||||
$(ROOT)/good.done: HASMAIN=0
|
||||
$(ROOT)/goodn.done: HASMAIN=0
|
||||
$(ROOT)/bad.done: HASMAIN=0
|
||||
$(ROOT)/badn.done: HASMAIN=0
|
||||
$(ROOT)/na.done: HASMAIN=1
|
||||
$(ROOT)/good.done: retcode=0
|
||||
$(ROOT)/goodn.done: retcode=0
|
||||
$(ROOT)/bad.done: retcode=1
|
||||
$(ROOT)/badn.done: retcode=1
|
||||
$(ROOT)/na.done: retcode=0
|
||||
|
||||
$(ROOT)/good.done: RETCODE=0
|
||||
$(ROOT)/goodn.done: RETCODE=0
|
||||
$(ROOT)/bad.done: RETCODE=1
|
||||
$(ROOT)/badn.done: RETCODE=1
|
||||
$(ROOT)/na.done: RETCODE=0
|
||||
$(ROOT)/good.done: testtext=
|
||||
$(ROOT)/goodn.done: testtext=passed
|
||||
$(ROOT)/bad.done: testtext=
|
||||
$(ROOT)/badn.done: testtext=FAILED
|
||||
$(ROOT)/na.done: testtext=
|
||||
|
||||
$(ROOT)/good.done: VER=PassNoPrintout
|
||||
$(ROOT)/goodn.done: VER=GoodTests
|
||||
$(ROOT)/bad.done: VER=FailNoPrintout
|
||||
$(ROOT)/badn.done: VER=FailedTests
|
||||
$(ROOT)/na.done: VER=NoTests
|
||||
$(ROOT)/good$(DOTEXE): private extra_dflags += -version=PassNoPrintout
|
||||
$(ROOT)/goodn$(DOTEXE): private extra_dflags += -version=GoodTests
|
||||
$(ROOT)/bad$(DOTEXE): private extra_dflags += -version=FailNoPrintout
|
||||
$(ROOT)/badn$(DOTEXE): private extra_dflags += -version=FailedTests
|
||||
$(ROOT)/na$(DOTEXE): private extra_dflags += -version=NoTests
|
||||
|
||||
$(ROOT)/good.done: TESTTEXT=
|
||||
$(ROOT)/goodn.done: TESTTEXT=passed
|
||||
$(ROOT)/bad.done: TESTTEXT=
|
||||
$(ROOT)/badn.done: TESTTEXT=FAILED
|
||||
$(ROOT)/na.done: TESTTEXT=
|
||||
|
||||
$(ROOT)/%.done: customhandler.d
|
||||
# $(OBJDIR)/good.done $(OBJDIR)/bad.done [...]: $(OBJDIR)/%.done: $(OBJDIR)/%$(DOTEXE):
|
||||
#
|
||||
# Forces the tests to be matched by this rule instead of being matched
|
||||
# by the `$(OBJDIR)/%$(DOTEXE)` (`$(OBJDIR)/%` on posix) rule at the
|
||||
# end:
|
||||
$(TESTS:%=$(OBJDIR)/%.done): $(OBJDIR)/%.done: $(OBJDIR)/%$(DOTEXE)
|
||||
@echo Testing $*
|
||||
$(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" $@
|
||||
$(TIMELIMIT)$< > $@ 2>&1; test $$? -eq $(retcode)
|
||||
test $(hasmain) -eq 0 || grep -q main $@
|
||||
test $(hasmain) -eq 1 || ! grep -q main $@
|
||||
test -z "$(testtext)" || grep -q "$(testtext) unittests" $@
|
||||
test -n "$(testtext)" || ! grep -q "unittests" $@
|
||||
|
||||
clean:
|
||||
rm -rf $(ROOT)
|
||||
$(OBJDIR)/%$(DOTEXE): customhandler.d
|
||||
$(LINK.d) $< $(extra_sources) $(extra_ldlibs.d) $(LDLIBS.d) $(OUTPUT_OPTION.d)
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
TESTS := test
|
||||
|
||||
include ../common.mak
|
||||
|
||||
.PHONY: all clean
|
||||
all: $(ROOT)/test$(DOTEXE)
|
||||
|
||||
$(ROOT)/%$(DOTEXE): %.d
|
||||
$(QUIET)$(DMD) $(DFLAGS) -of$@ $< uuid.lib
|
||||
|
||||
clean:
|
||||
rm -rf $(ROOT)
|
||||
$(OBJDIR)/test$(DOTEXE): private extra_ldlibs.d += uuid.lib
|
||||
|
|
|
@ -1,35 +1,25 @@
|
|||
VALGRIND = valgrind
|
||||
has_valgrind != command -v $(VALGRIND) > /dev/null 2>&1 && echo 1
|
||||
|
||||
ifeq ($(has_valgrind),1)
|
||||
TESTS := ok_append no_use_after_free no_oob no_oob_sentinel no_use_after_gc
|
||||
endif
|
||||
|
||||
include ../common.mak
|
||||
|
||||
TESTS:=ok_append no_use_after_free no_oob no_oob_sentinel no_use_after_gc
|
||||
$(OBJDIR)/ok_%.done: private negate :=
|
||||
$(OBJDIR)/no_%.done: private negate := !
|
||||
|
||||
GC_SRC:= \
|
||||
$(OBJDIR)/%.done: $(OBJDIR)/%$(DOTEXE)
|
||||
@echo Testing $<
|
||||
$(negate) $(TIMELIMIT)$(VALGRIND) --quiet --tool=memcheck --error-exitcode=8 $<
|
||||
@touch $@
|
||||
|
||||
gc_src := \
|
||||
../../src/core/internal/gc/impl/conservative/gc.d \
|
||||
../../src/etc/valgrind/valgrind.d \
|
||||
../../src/rt/lifetime.d
|
||||
|
||||
.PHONY: all clean
|
||||
all: $(addprefix $(ROOT)/,$(addsuffix .done,$(TESTS)))
|
||||
|
||||
$(ROOT)/ok_%.done: $(ROOT)/ok_%$(DOTEXE)
|
||||
@echo Testing ok_$*
|
||||
$(QUIET)if ! command -v valgrind >/dev/null; then \
|
||||
echo valgrind not installed, skipping; \
|
||||
else \
|
||||
$(TIMELIMIT)valgrind --quiet --tool=memcheck --error-exitcode=8 $(ROOT)/ok_$* $(RUN_ARGS); \
|
||||
fi
|
||||
$(QUIET)touch $@
|
||||
|
||||
$(ROOT)/no_%.done: $(ROOT)/no_%$(DOTEXE)
|
||||
@echo Testing no_$*
|
||||
$(QUIET)if ! command -v valgrind >/dev/null; then \
|
||||
echo valgrind not installed, skipping; \
|
||||
else \
|
||||
( ! $(TIMELIMIT)valgrind --quiet --tool=memcheck --error-exitcode=8 $(ROOT)/no_$* $(RUN_ARGS); ) \
|
||||
fi
|
||||
$(QUIET)touch $@
|
||||
|
||||
$(ROOT)/%$(DOTEXE): $(SRC)/%.d $(GC_SRC)
|
||||
$(QUIET)$(DMD) -debug=VALGRIND -debug=SENTINEL $(DFLAGS) -of$@ $< $(GC_SRC)
|
||||
|
||||
clean:
|
||||
rm -rf $(ROOT)
|
||||
$(OBJDIR)/%$(DOTEXE): $(gc_src)
|
||||
$(OBJDIR)/%$(DOTEXE): private extra_sources += $(gc_src)
|
||||
$(OBJDIR)/%$(DOTEXE): private extra_dflags += -debug=VALGRIND -debug=SENTINEL
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue