test: add machinery to download and verify databases
authorDavid Bremner <david@tethera.net>
Sat, 1 Mar 2014 20:12:44 +0000 (16:12 -0400)
committerDavid Bremner <david@tethera.net>
Tue, 11 Mar 2014 22:51:22 +0000 (19:51 -0300)
Note that it is intentional that the checksum file is not
downloaded. The intent is to check those into git.

Makefile
test/README
test/T530-upgrade.sh
test/test-databases/Makefile [new file with mode: 0644]
test/test-databases/Makefile.local [new file with mode: 0644]

index f53bec0ea401a4b110f7e1c5d5e26c1896bcaf79..061c55a1948aa821da17e1537c7da36c866606bb 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -5,7 +5,8 @@ all:
 # List all subdirectories here. Each contains its own Makefile.local.
 # Use of '=', without '+=', seems to be required for out-of-tree
 # builds to work.
-subdirs = compat completion doc emacs lib parse-time-string performance-test util test
+subdirs = compat completion doc emacs lib parse-time-string    \
+       performance-test util test test/test-databases
 
 # We make all targets depend on the Makefiles themselves.
 global_deps = Makefile Makefile.config Makefile.local \
index 79a9b1b2f9a15aba7466e4e5b1b308663dd1296c..81a1c82dcdbdb9487cdbc701f7db5aa6bd9c43f0 100644 (file)
@@ -64,6 +64,14 @@ The following command-line options are available when running tests:
        Pointing this argument at a tmpfs filesystem can improve the
        speed of the test suite for some users.
 
+Certain tests require precomputed databases to complete. You can fetch these
+databases with
+
+       make download-test-databases
+
+If you do not download the test databases, the relevant tests will be
+skipped.
+
 When invoking the test suite via "make test" any of the above options
 can be specified as follows:
 
index 2139618c00c5151c91b14adae0fda7237d533ffc..67bbf319a1b7b271212fa6e0d7b74794d293ac07 100755 (executable)
@@ -7,7 +7,7 @@ dbtarball=database-v1.tar.xz
 
 # XXX: Accomplish the same with test lib helpers
 if [ ! -e ${TEST_DIRECTORY}/test-databases/${dbtarball} ]; then
-    test_subtest_missing_external_prereq_["${dbtarball}"]=t
+    test_subtest_missing_external_prereq_["${dbtarball} - fetch with 'make download-test-databases'"]=t
 fi
 
 test_expect_success \
diff --git a/test/test-databases/Makefile b/test/test-databases/Makefile
new file mode 100644 (file)
index 0000000..b250a8b
--- /dev/null
@@ -0,0 +1,7 @@
+# See Makefile.local for the list of files to be compiled in this
+# directory.
+all:
+       $(MAKE) -C ../.. all
+
+.DEFAULT:
+       $(MAKE) -C ../.. $@
diff --git a/test/test-databases/Makefile.local b/test/test-databases/Makefile.local
new file mode 100644 (file)
index 0000000..0572e78
--- /dev/null
@@ -0,0 +1,14 @@
+# -*- makefile -*-
+
+TEST_DATABASE_MIRROR=http://notmuchmail.org/releases/test-databases
+
+dir := test/test-databases
+
+test_databases := $(dir)/database-v1.tar.xz
+
+%.tar.xz:
+       wget -nv -O $@ ${TEST_DATABASE_MIRROR}/$(notdir $@);
+
+download-test-databases: ${test_databases}
+
+DISTCLEAN := $(DISTCLEAN) ${test_databases}