Jelajahi Sumber

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.
Achim Gratz 13 tahun lalu
induk
melakukan
3bbd458780
2 mengubah file dengan 19 tambahan dan 5 penghapusan
  1. 4 0
      default.mk
  2. 15 5
      targets.mk

+ 4 - 0
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
 ##----------------------------------------------------------------------

+ 15 - 5
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)