On Sunday, 11 June 2017 at 19:17:36 UTC, Andrei Alexandrescu wrote:
Instead of an error, I get a no-op result that looks like success. How can that situation be converted to an error?

That makefile target is poorly written.

It was probably intended to have a dependency on the directory itself, so by adding "%/" to the pattern it correctly produces an error (since std.algorithm.d doesn't exist):

%.test : $(LIB) %/
        ...

To allow for your case, just add this line:

std.%.test : std/%.test


While that should work (at least for the first level), it still is very poorly written. It doesn't use the white-listed modules/packages despite the rest of the makefile seems to use that fairly consistently.

I would replace all the ".test" targets with the following code:

# Target for quickly running a single unittest (using static phobos library).
# For example: "make std/algorithm/mutation.test"
# The mktemp business is needed so .o files don't clash in concurrent unittesting.
$(addsuffix .test,$(D_MODULES)): %.test : %.d $(LIB)
T=`mktemp -d /tmp/.dmd-run-test.XXXXXX` && \ ( \ $(DMD) -od$$T $(DFLAGS) -main -unittest $(LIB) -defaultlib= -debuglib= $(LINKDL) -cov -run $< ; \ RET=$$? ; rm -rf $$T ; exit $$RET \
          )

# Target for quickly unittesting all modules and packages within a package,
# transitively. For example: "make std/algorithm.test"
define PACKAGETEST_template
$(1).test: $$(patsubst %,$(1)/%.test,$$(PACKAGE_$(subst /,_,$(1))))
endef
$(foreach package,$(STD_PACKAGES),$(eval $(call PACKAGETEST_template,$(package))))

# Target for quickly unittesting all modules and packages by using dot as a separator.
# For example: "make std.algorithm.sorting.test"
define MODULESYNTAXTEST_template
$(subst /,.,$(1)).test : $(1).test
endef
$(foreach module,$(STD_PACKAGES) $(D_MODULES),$(eval $(call MODULESYNTAXTEST_template,$(module))))


(I'm not going to make a pull request though.)

Reply via email to