|
6 | 6 | QUIET:= |
7 | 7 |
|
8 | 8 | DMD_DIR=../dmd |
| 9 | +DUB=dub |
| 10 | +TOOLS_DIR=../tools |
9 | 11 |
|
10 | 12 | include $(DMD_DIR)/src/osmodel.mak |
11 | 13 |
|
@@ -315,6 +317,9 @@ $(ROOT)/unittest/test_runner: $(UT_DRUNTIME) src/test_runner.d $(DMD) |
315 | 317 |
|
316 | 318 | endif |
317 | 319 |
|
| 320 | +TESTS_EXTRACTOR=$(ROOT)/tests_extractor |
| 321 | +BETTERCTESTS_DIR=$(ROOT)/betterctests |
| 322 | + |
318 | 323 | # macro that returns the module name given the src path |
319 | 324 | moduleName=$(subst rt.invariant,invariant,$(subst object_,object,$(subst /,.,$(1)))) |
320 | 325 |
|
@@ -385,6 +390,42 @@ clean: $(addsuffix /.clean,$(ADDITIONAL_TESTS)) |
385 | 390 | test/%/.clean: test/%/Makefile |
386 | 391 | $(MAKE) -C test/$* clean |
387 | 392 |
|
| 393 | +%/.directory : |
| 394 | + mkdir -p $* || exists $* |
| 395 | + touch $@ |
| 396 | + |
| 397 | +################################################################################ |
| 398 | +# Build the test extractor. |
| 399 | +# - extracts and runs public unittest examples to checks for missing imports |
| 400 | +# - extracts and runs @betterC unittests |
| 401 | +################################################################################ |
| 402 | + |
| 403 | +$(TESTS_EXTRACTOR): $(TOOLS_DIR)/tests_extractor.d | $(LIB) |
| 404 | + $(DUB) build --force --single $< |
| 405 | + mv $(TOOLS_DIR)/tests_extractor $@ |
| 406 | + |
| 407 | +test_extractor: $(TESTS_EXTRACTOR) |
| 408 | + |
| 409 | +################################################################################ |
| 410 | +# Check and run @betterC tests |
| 411 | +# ---------------------------- |
| 412 | +# |
| 413 | +# Extract @betterC tests of a module and run them in -betterC |
| 414 | +# |
| 415 | +# make -f betterc -j20 # all tests |
| 416 | +# make -f posix.mak src/core/memory.betterc # individual module |
| 417 | +################################################################################ |
| 418 | + |
| 419 | +betterc: | $(TESTS_EXTRACTOR) $(BETTERCTESTS_DIR)/.directory |
| 420 | + $(MAKE) -f posix.mak $$(find src -type f -name '*.d' | sed 's/[.]d/.betterc/') |
| 421 | + |
| 422 | +%.betterc: %.d | $(TESTS_EXTRACTOR) $(BETTERCTESTS_DIR)/.directory |
| 423 | + @$(TESTS_EXTRACTOR) --betterC --attributes betterC \ |
| 424 | + --inputdir $< --outputdir $(BETTERCTESTS_DIR) |
| 425 | + @$(DMD) $(NODEFAULTLIB) -betterC $(UDFLAGS) $(UTFLAGS) -od$(BETTERCTESTS_DIR) -run $(BETTERCTESTS_DIR)/$(subst /,_,$<) |
| 426 | + |
| 427 | +################################################################################ |
| 428 | + |
388 | 429 | # Submission to Druntime are required to conform to the DStyle |
389 | 430 | # The tests below automate some, but not all parts of the DStyle guidelines. |
390 | 431 | # See: http://dlang.org/dstyle.html |
|
0 commit comments