From 3bbd458780926ea398d8b32400a858de79ccdf8b Mon Sep 17 00:00:00 2001 From: Achim Gratz Date: Thu, 16 Feb 2012 21:24:51 +0100 Subject: [PATCH] add cleaning of temporary test files (with option to keep them) default.mk: add $(testdir) definition based on $(TMPDIR), which defaults to "/tmp" if not already defined targets.mk(check): call test suite with TMPDIR=$(testdir) and remove direactory after successful run of testsuite. Do not remove temporary test files if $(TEST_NO_AUTOCLEAN) is set to a non-empty value. targets.mk(cleandirs): refactor the first part of what cleanall had been doing. targets.mk(cleanall): run cleantest and cleandirs, then remove backup files. targets.mk(cleanlisp): remove backup files. targets.mk(cleandoc): remove backup files. targets.mk(cleanall): run cleantest and cleandirs, then remove backup files. targets.mk(cleantest): removal of temporary test files. --- default.mk | 4 ++++ targets.mk | 20 +++++++++++++++----- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/default.mk b/default.mk index 0835938a5..961e659da 100644 --- a/default.mk +++ b/default.mk @@ -19,6 +19,10 @@ datadir = $(prefix)/emacs/etc/org # Where info files go. infodir = $(prefix)/info +# where to create temporary files for the testsuite +TMPDIR ?= /tmp +testdir = $(TMPDIR)/tmp-orgtest + ##---------------------------------------------------------------------- ## YOU MAY NEED TO ADAPT THESE DEFINITIONS ##---------------------------------------------------------------------- diff --git a/targets.mk b/targets.mk index fe283a5a5..da24ae21e 100644 --- a/targets.mk +++ b/targets.mk @@ -23,7 +23,7 @@ endif .PHONY: default all up2 update compile lisp doc etc \ check test install info html pdf card docs $(INSTSUB) \ autoloads cleanall clean cleancontrib cleanrel clean-install \ - cleanelc cleanlisp cleandoc cleandocs + cleanelc cleandirs cleanlisp cleandoc cleandocs cleantest all \ compile:: lisp @@ -41,7 +41,11 @@ check test:: all check test \ test-dirty:: - $(BTEST) + -$(MKDIR) $(testdir) + TMPDIR=$(testdir) $(BTEST) +ifeq ($(TEST_NO_AUTOCLEAN),) # define this variable to leave $(testdir) around for inspection + $(MAKE) cleantest +endif up2: update $(SUDO) $(MAKE) install @@ -66,13 +70,14 @@ $(INSTSUB): autoloads: lisp $(MAKE) -C $< $@ -cleanall: $(SUBDIRS) - $(foreach dir, $?, $(MAKE) -C $(dir) $@;) - -$(FIND) . -name \*~ -exec $(RM) {} \; +cleandirs: $(SUBDIRS) + $(foreach dir, $?, $(MAKE) -C $(dir) cleanall;) clean: cleanrel $(MAKE) -C lisp clean $(MAKE) -C doc clean + +cleanall: cleandirs cleantest -$(FIND) . -name \*~ -exec $(RM) {} \; cleancontrib: @@ -85,6 +90,11 @@ cleanrel: cleanelc cleanlisp: $(MAKE) -C lisp clean + -$(FIND) lisp -name \*~ -exec $(RM) {} \; cleandoc cleandocs: $(MAKE) -C doc clean + -$(FIND) doc -name \*~ -exec $(RM) {} \; + +cleantest: + $(RMR) $(testdir)