From fa58c38371131db68f780c9f6f7e7d3f2e07256a Mon Sep 17 00:00:00 2001 From: Morgan Deters Date: Wed, 27 Jan 2010 22:48:03 +0000 Subject: [PATCH] support "make check" in src/ subdirs for unit-testing of just that module; also support synonyms for "make check" globally --- Makefile | 4 ++++ Makefile.subdir | 20 ++++++++++++++++++++ test/Makefile | 4 ++++ test/Makefile.am | 4 ++++ test/Makefile.in | 4 ++++ test/regress/Makefile | 4 ++++ test/regress/Makefile.am | 4 ++++ test/regress/Makefile.in | 4 ++++ test/system/Makefile | 8 ++++++++ test/system/Makefile.am | 4 ++++ test/system/Makefile.in | 4 ++++ test/unit/Makefile | 4 ++++ test/unit/Makefile.am | 4 ++++ test/unit/Makefile.in | 4 ++++ test/unit/Makefile.tests | 2 ++ 15 files changed, 78 insertions(+) create mode 100644 test/system/Makefile diff --git a/Makefile b/Makefile index 43fd2e3b1..061f3d8d1 100644 --- a/Makefile +++ b/Makefile @@ -13,3 +13,7 @@ all %: echo 'Run configure first, or type "make" in a configured build directory.'; \ echo; \ fi + +# synonyms for "check" +.PHONY: regress regress0 regress1 regress2 regress3 test +regress regress0 regress1 regress2 regress3 test: check diff --git a/Makefile.subdir b/Makefile.subdir index 6470510d9..1ac8357f6 100644 --- a/Makefile.subdir +++ b/Makefile.subdir @@ -1,6 +1,8 @@ # -*-makefile-*- include $(topdir)/builds/current builddir = $(topdir)/builds/$(CURRENT_BUILD)/$(srcdir) +unittestdir = $(topdir)/builds/$(CURRENT_BUILD)/test/unit +unittestprefix = $(srcdir:src/%=%) .PHONY: _default_build_ all _default_build_: all @@ -15,3 +17,21 @@ all %: echo 'Run configure first, or type "make" in a configured build directory.'; \ echo; \ fi + +.PHONY: check +check: + @if test -e $(unittestdir); then \ + echo cd $(unittestdir); \ + cd $(unittestdir); \ + echo $(MAKE) TEST_PREFIX=$(unittestprefix)/ $@; \ + $(MAKE) TEST_PREFIX=$(unittestprefix)/ $@; \ + else \ + echo; \ + echo "** ERROR: could not find unit testing dir \`$(unittestdir)'"; \ + echo; \ + exit 1; \ + fi + +# synonyms for "check" +.PHONY: regress regress0 regress1 regress2 regress3 test +regress regress0 regress1 regress2 regress3 test: check diff --git a/test/Makefile b/test/Makefile index ba9d12788..fa1dcec3a 100644 --- a/test/Makefile +++ b/test/Makefile @@ -2,3 +2,7 @@ topdir = .. srcdir = test include $(topdir)/Makefile.subdir + +# synonyms for "check" +.PHONY: regress regress0 regress1 regress2 regress3 test +regress regress0 regress1 regress2 regress3 test: check diff --git a/test/Makefile.am b/test/Makefile.am index 2be47b41b..13f12edf7 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1 +1,5 @@ SUBDIRS = unit system regress + +# synonyms for "check" +.PHONY: regress regress0 regress1 regress2 regress3 test +regress regress0 regress1 regress2 regress3 test: check diff --git a/test/Makefile.in b/test/Makefile.in index 6e8fff2a7..ceda17330 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -578,6 +578,10 @@ uninstall-am: uninstall uninstall-am +# synonyms for "check" +.PHONY: regress regress0 regress1 regress2 regress3 test +regress regress0 regress1 regress2 regress3 test: check + # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/test/regress/Makefile b/test/regress/Makefile index 2946f5217..06fe0f1fb 100644 --- a/test/regress/Makefile +++ b/test/regress/Makefile @@ -2,3 +2,7 @@ topdir = ../.. srcdir = test/regress include $(topdir)/Makefile.subdir + +# synonyms for "check" +.PHONY: regress regress0 regress1 regress2 regress3 test +regress regress0 regress1 regress2 regress3 test: check diff --git a/test/regress/Makefile.am b/test/regress/Makefile.am index c59885975..953db9bfd 100644 --- a/test/regress/Makefile.am +++ b/test/regress/Makefile.am @@ -35,3 +35,7 @@ TESTS = \ wiki.cvc \ logops.cvc \ comb2.shuffled-as.sat03-420.smt + +# synonyms for "check" +.PHONY: regress regress0 regress1 regress2 regress3 test +regress regress0 regress1 regress2 regress3 test: check diff --git a/test/regress/Makefile.in b/test/regress/Makefile.in index 0db9d0004..b194b219f 100644 --- a/test/regress/Makefile.in +++ b/test/regress/Makefile.in @@ -509,6 +509,10 @@ uninstall-am: uninstall uninstall-am +# synonyms for "check" +.PHONY: regress regress0 regress1 regress2 regress3 test +regress regress0 regress1 regress2 regress3 test: check + # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/test/system/Makefile b/test/system/Makefile new file mode 100644 index 000000000..c1dc3ef2f --- /dev/null +++ b/test/system/Makefile @@ -0,0 +1,8 @@ +topdir = ../.. +srcdir = test/system + +include $(topdir)/Makefile.subdir + +# synonyms for "check" +.PHONY: regress regress0 regress1 regress2 regress3 test +regress regress0 regress1 regress2 regress3 test: check diff --git a/test/system/Makefile.am b/test/system/Makefile.am index a12adc56b..5e9cca17a 100644 --- a/test/system/Makefile.am +++ b/test/system/Makefile.am @@ -24,3 +24,7 @@ EXTRA_DIST = \ # rebuild tests if a library changes $(TESTS):: $(TEST_DEPS) + +# synonyms for "check" +.PHONY: regress regress0 regress1 regress2 regress3 test +regress regress0 regress1 regress2 regress3 test: check diff --git a/test/system/Makefile.in b/test/system/Makefile.in index 2496a1849..82a1b6ef4 100644 --- a/test/system/Makefile.in +++ b/test/system/Makefile.in @@ -498,6 +498,10 @@ uninstall-am: # rebuild tests if a library changes $(TESTS):: $(TEST_DEPS) +# synonyms for "check" +.PHONY: regress regress0 regress1 regress2 regress3 test +regress regress0 regress1 regress2 regress3 test: check + # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/test/unit/Makefile b/test/unit/Makefile index 190a41bb0..b8a801378 100644 --- a/test/unit/Makefile +++ b/test/unit/Makefile @@ -2,3 +2,7 @@ topdir = ../.. srcdir = test/unit include $(topdir)/Makefile.subdir + +# synonyms for "check" +.PHONY: regress regress0 regress1 regress2 regress3 test +regress regress0 regress1 regress2 regress3 test: check diff --git a/test/unit/Makefile.am b/test/unit/Makefile.am index f2fb9be92..dfe345afe 100644 --- a/test/unit/Makefile.am +++ b/test/unit/Makefile.am @@ -80,3 +80,7 @@ EXTRA_DIST = \ $(TEST_DEPS_DIST) endif + +# synonyms for "check" +.PHONY: regress regress0 regress1 regress2 regress3 test +regress regress0 regress1 regress2 regress3 test: check diff --git a/test/unit/Makefile.in b/test/unit/Makefile.in index 948663478..bc7928b3b 100644 --- a/test/unit/Makefile.in +++ b/test/unit/Makefile.in @@ -675,6 +675,10 @@ uninstall-am: @HAVE_CXXTESTGEN_TRUE@ $(LTCXXCOMPILE) $(AM_CXXFLAGS_PUBLIC) -c -o $@.lo $< @HAVE_CXXTESTGEN_TRUE@ $(CXXLINK) $(AM_LDFLAGS_PUBLIC) $@.lo +# synonyms for "check" +.PHONY: regress regress0 regress1 regress2 regress3 test +regress regress0 regress1 regress2 regress3 test: check + # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/test/unit/Makefile.tests b/test/unit/Makefile.tests index fcd748d0d..c542259b1 100644 --- a/test/unit/Makefile.tests +++ b/test/unit/Makefile.tests @@ -1,3 +1,5 @@ +TESTS := $(filter $(TEST_PREFIX)%,$(TESTS)) + WHITE_TESTS = $(filter %_white,$(TESTS)) BLACK_TESTS = $(filter %_black,$(TESTS)) PUBLIC_TESTS = $(filter %_public,$(TESTS)) -- 2.30.2