| 1 |
# Execute the dmd test suite |
|---|
| 2 |
# |
|---|
| 3 |
# Targets: |
|---|
| 4 |
# |
|---|
| 5 |
# default | all: run all unit tests that haven't been run yet |
|---|
| 6 |
# |
|---|
| 7 |
# run_tests: run all tests |
|---|
| 8 |
# run_runnable_tests: run just the runnable tests |
|---|
| 9 |
# run_compilable_tests: run just the runnable tests |
|---|
| 10 |
# run_fail_compilation_tests: run just the runnable tests |
|---|
| 11 |
# |
|---|
| 12 |
# quick: run all tests with no default permuted args |
|---|
| 13 |
# (individual test specified options still honored) |
|---|
| 14 |
# |
|---|
| 15 |
# clean: remove all temporary or result files from prevous runs |
|---|
| 16 |
# |
|---|
| 17 |
# |
|---|
| 18 |
# In-test variables: |
|---|
| 19 |
# |
|---|
| 20 |
# COMPILE_SEPARATELY: if present, forces each .d file to compile separately and linked |
|---|
| 21 |
# together in an extra setp. |
|---|
| 22 |
# default: (none, aka compile/link all in one step) |
|---|
| 23 |
# |
|---|
| 24 |
# EXECUTE_ARGS: parameters to add to the execution of the test |
|---|
| 25 |
# default: (none) |
|---|
| 26 |
# |
|---|
| 27 |
# EXTRA_SOURCES: list of extra files to build and link along with the test |
|---|
| 28 |
# default: (none) |
|---|
| 29 |
# |
|---|
| 30 |
# PERMUTE_ARGS: the set of arguments to permute in multiple $(DMD) invocations |
|---|
| 31 |
# default: the make variable ARGS (see below) |
|---|
| 32 |
# |
|---|
| 33 |
# POST_SCRIPT: name of script to execute after test run |
|---|
| 34 |
# default: (none) |
|---|
| 35 |
# |
|---|
| 36 |
# REQUIRED_ARGS: arguments to add to the $(DMD) command line |
|---|
| 37 |
# default: (none) |
|---|
| 38 |
|
|---|
| 39 |
ifeq (,$(OS)) |
|---|
| 40 |
OS:=$(shell uname) |
|---|
| 41 |
ifeq (Darwin,$(OS)) |
|---|
| 42 |
OS:=osx |
|---|
| 43 |
else |
|---|
| 44 |
ifeq (Linux,$(OS)) |
|---|
| 45 |
OS:=posix |
|---|
| 46 |
else |
|---|
| 47 |
ifeq (FreeBSD,$(OS)) |
|---|
| 48 |
OS:=freebsd |
|---|
| 49 |
else |
|---|
| 50 |
$(error Unrecognized or unsupported OS for uname: $(OS)) |
|---|
| 51 |
endif |
|---|
| 52 |
endif |
|---|
| 53 |
endif |
|---|
| 54 |
else |
|---|
| 55 |
ifeq (Windows_NT,$(OS)) |
|---|
| 56 |
OS:=win32 |
|---|
| 57 |
else |
|---|
| 58 |
ifeq (Win_32,$(OS)) |
|---|
| 59 |
OS:=win32 |
|---|
| 60 |
endif |
|---|
| 61 |
endif |
|---|
| 62 |
endif |
|---|
| 63 |
export OS |
|---|
| 64 |
|
|---|
| 65 |
SHELL=/bin/bash |
|---|
| 66 |
QUIET=@ |
|---|
| 67 |
export RESULTS_DIR=test_results |
|---|
| 68 |
export MODEL=32 |
|---|
| 69 |
|
|---|
| 70 |
ifeq ($(OS),win32) |
|---|
| 71 |
export ARGS=-inline -release -g -O -unittest |
|---|
| 72 |
export DMD=../src/dmd.exe |
|---|
| 73 |
export EXE=.exe |
|---|
| 74 |
export OBJ=.obj |
|---|
| 75 |
export DSEP=\\ |
|---|
| 76 |
export SEP=$(shell echo '\') |
|---|
| 77 |
# bug in vim syntax hilighting, needed to kick it back into life: ') |
|---|
| 78 |
else |
|---|
| 79 |
export ARGS=-inline -release -gc -O -unittest -fPIC |
|---|
| 80 |
export DMD=../src/dmd |
|---|
| 81 |
export EXE= |
|---|
| 82 |
export OBJ=.o |
|---|
| 83 |
export DSEP=/ |
|---|
| 84 |
export SEP=/ |
|---|
| 85 |
endif |
|---|
| 86 |
|
|---|
| 87 |
runnable_tests=$(wildcard runnable/*.d) $(wildcard runnable/*.html) $(wildcard runnable/*.sh) |
|---|
| 88 |
runnable_test_results=$(addsuffix .out,$(addprefix $(RESULTS_DIR)/,$(runnable_tests))) |
|---|
| 89 |
|
|---|
| 90 |
compilable_tests=$(wildcard compilable/*.d) |
|---|
| 91 |
compilable_test_results=$(addsuffix .out,$(addprefix $(RESULTS_DIR)/,$(compilable_tests))) |
|---|
| 92 |
|
|---|
| 93 |
fail_compilation_tests=$(wildcard fail_compilation/*.d) |
|---|
| 94 |
fail_compilation_test_results=$(addsuffix .out,$(addprefix $(RESULTS_DIR)/,$(fail_compilation_tests))) |
|---|
| 95 |
|
|---|
| 96 |
all: run_tests |
|---|
| 97 |
|
|---|
| 98 |
ifeq ($(MODEL),64) |
|---|
| 99 |
DISABLED_TESTS = arrayop |
|---|
| 100 |
# value isn't making it into the runtime library call for some reason |
|---|
| 101 |
|
|---|
| 102 |
DISABLED_TESTS += testmath |
|---|
| 103 |
# needs std.math |
|---|
| 104 |
|
|---|
| 105 |
DISABLED_TESTS += hospital |
|---|
| 106 |
# int vs long issues |
|---|
| 107 |
|
|---|
| 108 |
DISABLED_TESTS += s2ir |
|---|
| 109 |
DISABLED_TESTS += test16 |
|---|
| 110 |
DISABLED_TESTS += test20 |
|---|
| 111 |
DISABLED_TESTS += test28 |
|---|
| 112 |
# -fPIC: transition from R_X86_64_TLSGD to R_X86_64_GOTTPOFF against |
|---|
| 113 |
|
|---|
| 114 |
DISABLED_TESTS += test22 |
|---|
| 115 |
# has x86 specific asm code that needs translation |
|---|
| 116 |
|
|---|
| 117 |
DISABLED_TESTS += test34 |
|---|
| 118 |
# looks like lots of issues with std.format, at least array and aa formatting is borked.. |
|---|
| 119 |
|
|---|
| 120 |
DISABLED_TESTS += testarray |
|---|
| 121 |
# sensitive code checking a specific runtime bug |
|---|
| 122 |
|
|---|
| 123 |
DISABLED_TESTS += testconst |
|---|
| 124 |
# segv in a misleading place.. printfs around the functions in the backtrace |
|---|
| 125 |
# not firing. More research needed. |
|---|
| 126 |
|
|---|
| 127 |
DISABLED_TESTS += testgc2 |
|---|
| 128 |
# various gc related issues |
|---|
| 129 |
|
|---|
| 130 |
DISABLED_TESTS += testzip |
|---|
| 131 |
# zlib version error |
|---|
| 132 |
|
|---|
| 133 |
$(addsuffix .d.out,$(addprefix $(RESULTS_DIR)/runnable/,$(DISABLED_TESTS))): $(RESULTS_DIR)/.created |
|---|
| 134 |
$(QUIET) echo " ... $@ - disabled" |
|---|
| 135 |
|
|---|
| 136 |
$(RESULTS_DIR)/runnable/test2.sh.out: |
|---|
| 137 |
$(QUIET) echo " ... $@ - disabled" |
|---|
| 138 |
$(QUIET) touch $@ |
|---|
| 139 |
|
|---|
| 140 |
$(RESULTS_DIR)/runnable/%.d.out: runnable/%.d $(RESULTS_DIR)/.created $(RESULTS_DIR)/combinations $(DMD) |
|---|
| 141 |
$(QUIET) ./do_test.sh $(<D) $* d |
|---|
| 142 |
|
|---|
| 143 |
$(RESULTS_DIR)/runnable/%.html.out: runnable/%.html $(RESULTS_DIR)/.created $(RESULTS_DIR)/combinations $(DMD) |
|---|
| 144 |
$(QUIET) ./do_test.sh $(<D) $* html |
|---|
| 145 |
|
|---|
| 146 |
$(RESULTS_DIR)/runnable/%.sh.out: runnable/%.sh $(RESULTS_DIR)/.created $(RESULTS_DIR)/combinations $(DMD) |
|---|
| 147 |
$(QUIET) echo " ... $(<D)/$*.sh" |
|---|
| 148 |
$(QUIET) ./$(<D)/$*.sh |
|---|
| 149 |
|
|---|
| 150 |
$(RESULTS_DIR)/compilable/%.d.out: compilable/%.d $(RESULTS_DIR)/.created $(RESULTS_DIR)/combinations $(DMD) |
|---|
| 151 |
$(QUIET) ./do_test.sh $(<D) $* d |
|---|
| 152 |
|
|---|
| 153 |
$(RESULTS_DIR)/fail_compilation/%.d.out: fail_compilation/%.d $(RESULTS_DIR)/.created $(RESULTS_DIR)/combinations $(DMD) |
|---|
| 154 |
$(QUIET) ./do_test.sh $(<D) $* d |
|---|
| 155 |
else |
|---|
| 156 |
$(RESULTS_DIR)/runnable/%.d.out: runnable/%.d $(RESULTS_DIR)/.created $(RESULTS_DIR)/d_do_test $(DMD) |
|---|
| 157 |
$(QUIET) ./$(RESULTS_DIR)/d_do_test $(<D) $* d |
|---|
| 158 |
|
|---|
| 159 |
$(RESULTS_DIR)/runnable/%.html.out: runnable/%.html $(RESULTS_DIR)/.created $(RESULTS_DIR)/d_do_test $(DMD) |
|---|
| 160 |
$(QUIET) ./$(RESULTS_DIR)/d_do_test $(<D) $* html |
|---|
| 161 |
|
|---|
| 162 |
$(RESULTS_DIR)/runnable/%.sh.out: runnable/%.sh $(RESULTS_DIR)/.created $(RESULTS_DIR)/d_do_test $(DMD) |
|---|
| 163 |
$(QUIET) echo " ... $(<D)/$*.sh" |
|---|
| 164 |
$(QUIET) ./$(<D)/$*.sh |
|---|
| 165 |
|
|---|
| 166 |
$(RESULTS_DIR)/compilable/%.d.out: compilable/%.d $(RESULTS_DIR)/.created $(RESULTS_DIR)/d_do_test $(DMD) |
|---|
| 167 |
$(QUIET) ./$(RESULTS_DIR)/d_do_test $(<D) $* d |
|---|
| 168 |
|
|---|
| 169 |
$(RESULTS_DIR)/fail_compilation/%.d.out: fail_compilation/%.d $(RESULTS_DIR)/.created $(RESULTS_DIR)/d_do_test $(DMD) |
|---|
| 170 |
$(QUIET) ./$(RESULTS_DIR)/d_do_test $(<D) $* d |
|---|
| 171 |
endif |
|---|
| 172 |
|
|---|
| 173 |
quick: |
|---|
| 174 |
$(MAKE) ARGS="" run_tests |
|---|
| 175 |
|
|---|
| 176 |
clean: |
|---|
| 177 |
@echo "Removing output directory: $(RESULTS_DIR)" |
|---|
| 178 |
$(QUIET)if [ -e $(RESULTS_DIR) ]; then rm -rf $(RESULTS_DIR); fi |
|---|
| 179 |
|
|---|
| 180 |
$(RESULTS_DIR)/.created: |
|---|
| 181 |
@echo Creating output directory: $(RESULTS_DIR) |
|---|
| 182 |
$(QUIET)if [ ! -d $(RESULTS_DIR) ]; then mkdir $(RESULTS_DIR); fi |
|---|
| 183 |
$(QUIET)if [ ! -d $(RESULTS_DIR)/runnable ]; then mkdir $(RESULTS_DIR)/runnable; fi |
|---|
| 184 |
$(QUIET)if [ ! -d $(RESULTS_DIR)/compilable ]; then mkdir $(RESULTS_DIR)/compilable; fi |
|---|
| 185 |
$(QUIET)if [ ! -d $(RESULTS_DIR)/fail_compilation ]; then mkdir $(RESULTS_DIR)/fail_compilation; fi |
|---|
| 186 |
$(QUIET)touch $(RESULTS_DIR)/.created |
|---|
| 187 |
|
|---|
| 188 |
run_tests: start_runnable_tests start_compilable_tests start_fail_compilation_tests |
|---|
| 189 |
|
|---|
| 190 |
run_runnable_tests: $(runnable_test_results) |
|---|
| 191 |
|
|---|
| 192 |
start_runnable_tests: $(RESULTS_DIR)/.created $(RESULTS_DIR)/d_do_test |
|---|
| 193 |
@echo "Running runnable tests" |
|---|
| 194 |
$(QUIET)$(MAKE) --no-print-directory run_runnable_tests |
|---|
| 195 |
|
|---|
| 196 |
run_compilable_tests: $(compilable_test_results) |
|---|
| 197 |
|
|---|
| 198 |
start_compilable_tests: $(RESULTS_DIR)/.created $(RESULTS_DIR)/d_do_test |
|---|
| 199 |
@echo "Running compilable tests" |
|---|
| 200 |
$(QUIET)$(MAKE) --no-print-directory run_compilable_tests |
|---|
| 201 |
|
|---|
| 202 |
run_fail_compilation_tests: $(fail_compilation_test_results) |
|---|
| 203 |
|
|---|
| 204 |
start_fail_compilation_tests: $(RESULTS_DIR)/.created $(RESULTS_DIR)/d_do_test |
|---|
| 205 |
@echo "Running fail compilation tests" |
|---|
| 206 |
$(QUIET)$(MAKE) --no-print-directory run_fail_compilation_tests |
|---|
| 207 |
|
|---|
| 208 |
$(RESULTS_DIR)/d_do_test: d_do_test.d $(RESULTS_DIR)/.created |
|---|
| 209 |
@echo "Building d_do_test tool" |
|---|
| 210 |
$(QUIET)$(DMD) -m$(MODEL) -od$(RESULTS_DIR) -of$(RESULTS_DIR)$(DSEP)d_do_test d_do_test.d |
|---|
| 211 |
|
|---|
| 212 |
$(RESULTS_DIR)/combinations: combinations.d $(RESULTS_DIR)/.created |
|---|
| 213 |
@echo "Building combinations tool" |
|---|
| 214 |
$(QUIET)$(DMD) -m$(MODEL) -od$(RESULTS_DIR) -of$(RESULTS_DIR)$(DSEP)combinations combinations.d |
|---|