diff options
Diffstat (limited to 'Rules')
-rw-r--r-- | Rules | 44 |
1 files changed, 41 insertions, 3 deletions
@@ -108,17 +108,28 @@ endif .PHONY: others tests bench bench-build +# Test programs for the pretty printers. +tests-printers-programs := $(addprefix $(objpfx),$(tests-printers)) + +# .out files with the output of running the pretty printer tests. +tests-printers-out := $(patsubst %,$(objpfx)%.out,$(tests-printers)) + ifeq ($(build-programs),yes) others: $(addprefix $(objpfx),$(others) $(sysdep-others) $(extra-objs)) else others: $(addprefix $(objpfx),$(extra-objs)) endif + +# Generate constant files for Python pretty printers if required. +others: $(py-const) + ifeq ($(run-built-tests),no) tests: $(addprefix $(objpfx),$(filter-out $(tests-unsupported),$(tests)) \ - $(test-srcs)) $(tests-special) + $(test-srcs)) $(tests-special) \ + $(tests-printers-programs) xtests: tests $(xtests-special) else -tests: $(tests:%=$(objpfx)%.out) $(tests-special) +tests: $(tests:%=$(objpfx)%.out) $(tests-special) $(tests-printers-out) xtests: tests $(xtests:%=$(objpfx)%.out) $(xtests-special) endif @@ -131,7 +142,8 @@ tests-expected = $(tests) endif tests: $(..)scripts/merge-test-results.sh -s $(objpfx) $(subdir) \ - $(sort $(tests-expected) $(tests-special-notdir:.out=)) \ + $(sort $(tests-expected) $(tests-special-notdir:.out=) \ + $(tests-printers)) \ > $(objpfx)subdir-tests.sum xtests: $(..)scripts/merge-test-results.sh -s $(objpfx) $(subdir) \ @@ -241,6 +253,32 @@ endif endif # tests +ifneq "$(strip $(tests-printers))" "" +# We're defining this here for now; later it'll be defined at configure time +# inside Makeconfig. +PYTHON := python + +# Static pattern rule for building the test programs for the pretty printers. +$(tests-printers-programs): %: %.o $(tests-printers-libs) \ + $(sort $(filter $(common-objpfx)lib%,$(link-libc-static-tests))) \ + $(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit) + $(+link-printers-tests) + +# Add the paths to the generated constants file and test_common_printers.py +# to PYTHONPATH so the test scripts can find them. +py-env := PYTHONPATH=$(py-const-dir):$(..)scripts:$${PYTHONPATH} + +# Static pattern rule that matches the test-* targets to their .c and .py +# prerequisites. It'll run the corresponding test script for each test program +# we compiled and place its output in the corresponding .out file. +# The pretty printer files and test_common_printers.py must be present for all. +$(tests-printers-out): $(objpfx)%.out: $(objpfx)% %.py %.c $(pretty-printers) \ + $(..)scripts/test_printers_common.py + $(test-wrapper-env) $(py-env) \ + $(PYTHON) $*.py $*.c $(objpfx)$* $(pretty-printers) > $@; \ + $(evaluate-test) +endif + .PHONY: distclean realclean subdir_distclean subdir_realclean \ subdir_clean subdir_mostlyclean subdir_testclean |