test-guard.mk: Add file #70
4 changed files with 28 additions and 3 deletions
|
|
@ -2,6 +2,7 @@ include $(JWBDIR)/make/defs.mk
|
|||
include $(JWBDIR)/make/py-defs.mk
|
||||
include $(JWBDIR)/make/dirs.mk
|
||||
include $(JWBDIR)/make/dev-utils.mk
|
||||
include $(JWBDIR)/make/test-guard.mk
|
||||
|
||||
PY_INIT_TMPL = $(wildcard __init__.py.tmpl)
|
||||
PY_SED_EXTRACT_EXPORT_DEF := /\(\(class\|def\)\s\+[a-zA-Z_].*\|^ *\S\+\s*=.*\|^\s\+\"\S\+\",\)\s*\#\s*export/!d;
|
||||
|
|
@ -24,7 +25,7 @@ endif
|
|||
|
||||
all: $(PY_PYC)
|
||||
install: install-dirs.done install-reg.done
|
||||
clean: py.clean
|
||||
clean: invalidate-testability py.clean
|
||||
distclean:
|
||||
|
||||
include $(JWBDIR)/make/py-rules.mk
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
include $(JWBDIR)/make/defs.mk
|
||||
include $(JWBDIR)/make/py-defs.mk
|
||||
include $(JWBDIR)/make/test-guard.mk
|
||||
|
||||
EXE ?= $(firstword $(wildcard main.py runme.py test.py *.py))
|
||||
EXE_ARGS ?=
|
||||
|
|
@ -9,7 +10,7 @@ all:
|
|||
install:
|
||||
clean:
|
||||
distclean:
|
||||
test: all
|
||||
test: all testability
|
||||
|
||||
run:
|
||||
$(PYTHON_RUNNER) $(EXE) $(EXE_ARGS)
|
||||
|
|
|
|||
21
make/test-guard.mk
Normal file
21
make/test-guard.mk
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
# Testability guard
|
||||
#
|
||||
# Tree testability is a single top-level property tracked by
|
||||
# $(TOPDIR)/dirs-all.done: created by a full `make all` from the topdir,
|
||||
# removed by `make clean`. A per-dir `make test` only makes sense when the tree
|
||||
# is importable, i.e. testable. So `test` requires testability, and a `make
|
||||
# clean` that drops artifacts crucial for testing (a Python module's
|
||||
# __init__.py, ...) invalidates it.
|
||||
|
||||
.PHONY: testability invalidate-testability
|
||||
|
||||
TEST_GUARD = $(TOPDIR)/dirs-all.done
|
||||
|
||||
all:
|
||||
|
||||
testability:
|
||||
@test -f "$(TEST_GUARD)" || \
|
||||
{ echo 'Error: Tree not testable -- run "make all" (or "make test") from project root to fix that!' >&2; exit 1; }
|
||||
|
||||
invalidate-testability:
|
||||
$(RM) -f "$(TEST_GUARD)"
|
||||
|
|
@ -14,6 +14,8 @@ all:
|
|||
include $(JWBDIR)/make/defs.mk
|
||||
include $(JWBDIR)/make/py-defs.mk
|
||||
include $(JWBDIR)/make/dev-utils.mk
|
||||
include $(JWBDIR)/make/test-guard.mk
|
||||
|
||||
test-default:
|
||||
test: testability
|
||||
test-default: testability
|
||||
$(TEST_CMD_LINE)
|
||||
|
|
|
|||
Loading…
Reference in a new issue