unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] test: make it possible to have multiple corpora
@ 2016-09-11 16:03 Jani Nikula
  2016-09-11 17:29 ` David Bremner
  0 siblings, 1 reply; 4+ messages in thread
From: Jani Nikula @ 2016-09-11 16:03 UTC (permalink / raw)
  To: notmuch

We largely use the corpus under test/corpus for
testing. Unfortunately, many of our tests have grown to depend on
having exactly this set of messages, making it hard to add new message
files for testing specific cases.

Move the basic corpus under tests/corpora/default, and make it
possible to add new, independent corpora along its side. This means
tons of renames with a few tweaks to add_email_corpus function in
test-lib.sh to let tests specify which corpus to use.

---

This is to address id:87pooc1t4s.fsf@zancas.localnet
---
 test/{corpus => corpora/default}/01:2,             |  0
 test/{corpus => corpora/default}/02:2,             |  0
 test/{corpus => corpora/default}/bar/17:2,         |  0
 test/{corpus => corpora/default}/bar/18:2,         |  0
 test/{corpus => corpora/default}/bar/baz/05:2,     |  0
 test/{corpus => corpora/default}/bar/baz/23:2,     |  0
 test/{corpus => corpora/default}/bar/baz/24:2,     |  0
 test/{corpus => corpora/default}/bar/baz/cur/25:2, |  0
 test/{corpus => corpora/default}/bar/baz/cur/26:2, |  0
 test/{corpus => corpora/default}/bar/baz/new/27:2, |  0
 test/{corpus => corpora/default}/bar/baz/new/28:2, |  0
 test/{corpus => corpora/default}/bar/cur/19:2,     |  0
 test/{corpus => corpora/default}/bar/cur/20:2,     |  0
 test/{corpus => corpora/default}/bar/new/21:2,     |  0
 test/{corpus => corpora/default}/bar/new/22:2,     |  0
 test/{corpus => corpora/default}/cur/29:2,         |  0
 test/{corpus => corpora/default}/cur/30:2,         |  0
 test/{corpus => corpora/default}/cur/31:2,         |  0
 test/{corpus => corpora/default}/cur/32:2,         |  0
 test/{corpus => corpora/default}/cur/33:2,         |  0
 test/{corpus => corpora/default}/cur/34:2,         |  0
 test/{corpus => corpora/default}/cur/35:2,         |  0
 test/{corpus => corpora/default}/cur/36:2,         |  0
 test/{corpus => corpora/default}/cur/37:2,         |  0
 test/{corpus => corpora/default}/cur/38:2,         |  0
 test/{corpus => corpora/default}/cur/39:2,         |  0
 test/{corpus => corpora/default}/cur/40:2,         |  0
 test/{corpus => corpora/default}/cur/41:2,         |  0
 test/{corpus => corpora/default}/cur/42:2,         |  0
 test/{corpus => corpora/default}/cur/43:2,         |  0
 test/{corpus => corpora/default}/cur/44:2,         |  0
 test/{corpus => corpora/default}/cur/45:2,         |  0
 test/{corpus => corpora/default}/cur/46:2,         |  0
 test/{corpus => corpora/default}/cur/47:2,         |  0
 test/{corpus => corpora/default}/cur/48:2,         |  0
 test/{corpus => corpora/default}/cur/49:2,         |  0
 test/{corpus => corpora/default}/cur/50:2,         |  0
 test/{corpus => corpora/default}/cur/51:2,         |  0
 test/{corpus => corpora/default}/cur/52:2,         |  0
 test/{corpus => corpora/default}/cur/53:2,         |  0
 test/{corpus => corpora/default}/foo/06:2,         |  0
 test/{corpus => corpora/default}/foo/baz/11:2,     |  0
 test/{corpus => corpora/default}/foo/baz/12:2,     |  0
 test/{corpus => corpora/default}/foo/baz/cur/13:2, |  0
 test/{corpus => corpora/default}/foo/baz/cur/14:2, |  0
 test/{corpus => corpora/default}/foo/baz/new/15:2, |  0
 test/{corpus => corpora/default}/foo/baz/new/16:2, |  0
 test/{corpus => corpora/default}/foo/cur/07:2,     |  0
 test/{corpus => corpora/default}/foo/cur/08:2,     |  0
 test/{corpus => corpora/default}/foo/new/03:2,     |  0
 test/{corpus => corpora/default}/foo/new/09:2,     |  0
 test/{corpus => corpora/default}/foo/new/10:2,     |  0
 test/{corpus => corpora/default}/new/04:2,         |  0
 test/test-lib.sh                                   | 19 ++++++++++++-------
 54 files changed, 12 insertions(+), 7 deletions(-)
 rename test/{corpus => corpora/default}/01:2, (100%)
 rename test/{corpus => corpora/default}/02:2, (100%)
 rename test/{corpus => corpora/default}/bar/17:2, (100%)
 rename test/{corpus => corpora/default}/bar/18:2, (100%)
 rename test/{corpus => corpora/default}/bar/baz/05:2, (100%)
 rename test/{corpus => corpora/default}/bar/baz/23:2, (100%)
 rename test/{corpus => corpora/default}/bar/baz/24:2, (100%)
 rename test/{corpus => corpora/default}/bar/baz/cur/25:2, (100%)
 rename test/{corpus => corpora/default}/bar/baz/cur/26:2, (100%)
 rename test/{corpus => corpora/default}/bar/baz/new/27:2, (100%)
 rename test/{corpus => corpora/default}/bar/baz/new/28:2, (100%)
 rename test/{corpus => corpora/default}/bar/cur/19:2, (100%)
 rename test/{corpus => corpora/default}/bar/cur/20:2, (100%)
 rename test/{corpus => corpora/default}/bar/new/21:2, (100%)
 rename test/{corpus => corpora/default}/bar/new/22:2, (100%)
 rename test/{corpus => corpora/default}/cur/29:2, (100%)
 rename test/{corpus => corpora/default}/cur/30:2, (100%)
 rename test/{corpus => corpora/default}/cur/31:2, (100%)
 rename test/{corpus => corpora/default}/cur/32:2, (100%)
 rename test/{corpus => corpora/default}/cur/33:2, (100%)
 rename test/{corpus => corpora/default}/cur/34:2, (100%)
 rename test/{corpus => corpora/default}/cur/35:2, (100%)
 rename test/{corpus => corpora/default}/cur/36:2, (100%)
 rename test/{corpus => corpora/default}/cur/37:2, (100%)
 rename test/{corpus => corpora/default}/cur/38:2, (100%)
 rename test/{corpus => corpora/default}/cur/39:2, (100%)
 rename test/{corpus => corpora/default}/cur/40:2, (100%)
 rename test/{corpus => corpora/default}/cur/41:2, (100%)
 rename test/{corpus => corpora/default}/cur/42:2, (100%)
 rename test/{corpus => corpora/default}/cur/43:2, (100%)
 rename test/{corpus => corpora/default}/cur/44:2, (100%)
 rename test/{corpus => corpora/default}/cur/45:2, (100%)
 rename test/{corpus => corpora/default}/cur/46:2, (100%)
 rename test/{corpus => corpora/default}/cur/47:2, (100%)
 rename test/{corpus => corpora/default}/cur/48:2, (100%)
 rename test/{corpus => corpora/default}/cur/49:2, (100%)
 rename test/{corpus => corpora/default}/cur/50:2, (100%)
 rename test/{corpus => corpora/default}/cur/51:2, (100%)
 rename test/{corpus => corpora/default}/cur/52:2, (100%)
 rename test/{corpus => corpora/default}/cur/53:2, (100%)
 rename test/{corpus => corpora/default}/foo/06:2, (100%)
 rename test/{corpus => corpora/default}/foo/baz/11:2, (100%)
 rename test/{corpus => corpora/default}/foo/baz/12:2, (100%)
 rename test/{corpus => corpora/default}/foo/baz/cur/13:2, (100%)
 rename test/{corpus => corpora/default}/foo/baz/cur/14:2, (100%)
 rename test/{corpus => corpora/default}/foo/baz/new/15:2, (100%)
 rename test/{corpus => corpora/default}/foo/baz/new/16:2, (100%)
 rename test/{corpus => corpora/default}/foo/cur/07:2, (100%)
 rename test/{corpus => corpora/default}/foo/cur/08:2, (100%)
 rename test/{corpus => corpora/default}/foo/new/03:2, (100%)
 rename test/{corpus => corpora/default}/foo/new/09:2, (100%)
 rename test/{corpus => corpora/default}/foo/new/10:2, (100%)
 rename test/{corpus => corpora/default}/new/04:2, (100%)

diff --git a/test/corpus/01:2, b/test/corpora/default/01:2,
similarity index 100%
rename from test/corpus/01:2,
rename to test/corpora/default/01:2,
diff --git a/test/corpus/02:2, b/test/corpora/default/02:2,
similarity index 100%
rename from test/corpus/02:2,
rename to test/corpora/default/02:2,
diff --git a/test/corpus/bar/17:2, b/test/corpora/default/bar/17:2,
similarity index 100%
rename from test/corpus/bar/17:2,
rename to test/corpora/default/bar/17:2,
diff --git a/test/corpus/bar/18:2, b/test/corpora/default/bar/18:2,
similarity index 100%
rename from test/corpus/bar/18:2,
rename to test/corpora/default/bar/18:2,
diff --git a/test/corpus/bar/baz/05:2, b/test/corpora/default/bar/baz/05:2,
similarity index 100%
rename from test/corpus/bar/baz/05:2,
rename to test/corpora/default/bar/baz/05:2,
diff --git a/test/corpus/bar/baz/23:2, b/test/corpora/default/bar/baz/23:2,
similarity index 100%
rename from test/corpus/bar/baz/23:2,
rename to test/corpora/default/bar/baz/23:2,
diff --git a/test/corpus/bar/baz/24:2, b/test/corpora/default/bar/baz/24:2,
similarity index 100%
rename from test/corpus/bar/baz/24:2,
rename to test/corpora/default/bar/baz/24:2,
diff --git a/test/corpus/bar/baz/cur/25:2, b/test/corpora/default/bar/baz/cur/25:2,
similarity index 100%
rename from test/corpus/bar/baz/cur/25:2,
rename to test/corpora/default/bar/baz/cur/25:2,
diff --git a/test/corpus/bar/baz/cur/26:2, b/test/corpora/default/bar/baz/cur/26:2,
similarity index 100%
rename from test/corpus/bar/baz/cur/26:2,
rename to test/corpora/default/bar/baz/cur/26:2,
diff --git a/test/corpus/bar/baz/new/27:2, b/test/corpora/default/bar/baz/new/27:2,
similarity index 100%
rename from test/corpus/bar/baz/new/27:2,
rename to test/corpora/default/bar/baz/new/27:2,
diff --git a/test/corpus/bar/baz/new/28:2, b/test/corpora/default/bar/baz/new/28:2,
similarity index 100%
rename from test/corpus/bar/baz/new/28:2,
rename to test/corpora/default/bar/baz/new/28:2,
diff --git a/test/corpus/bar/cur/19:2, b/test/corpora/default/bar/cur/19:2,
similarity index 100%
rename from test/corpus/bar/cur/19:2,
rename to test/corpora/default/bar/cur/19:2,
diff --git a/test/corpus/bar/cur/20:2, b/test/corpora/default/bar/cur/20:2,
similarity index 100%
rename from test/corpus/bar/cur/20:2,
rename to test/corpora/default/bar/cur/20:2,
diff --git a/test/corpus/bar/new/21:2, b/test/corpora/default/bar/new/21:2,
similarity index 100%
rename from test/corpus/bar/new/21:2,
rename to test/corpora/default/bar/new/21:2,
diff --git a/test/corpus/bar/new/22:2, b/test/corpora/default/bar/new/22:2,
similarity index 100%
rename from test/corpus/bar/new/22:2,
rename to test/corpora/default/bar/new/22:2,
diff --git a/test/corpus/cur/29:2, b/test/corpora/default/cur/29:2,
similarity index 100%
rename from test/corpus/cur/29:2,
rename to test/corpora/default/cur/29:2,
diff --git a/test/corpus/cur/30:2, b/test/corpora/default/cur/30:2,
similarity index 100%
rename from test/corpus/cur/30:2,
rename to test/corpora/default/cur/30:2,
diff --git a/test/corpus/cur/31:2, b/test/corpora/default/cur/31:2,
similarity index 100%
rename from test/corpus/cur/31:2,
rename to test/corpora/default/cur/31:2,
diff --git a/test/corpus/cur/32:2, b/test/corpora/default/cur/32:2,
similarity index 100%
rename from test/corpus/cur/32:2,
rename to test/corpora/default/cur/32:2,
diff --git a/test/corpus/cur/33:2, b/test/corpora/default/cur/33:2,
similarity index 100%
rename from test/corpus/cur/33:2,
rename to test/corpora/default/cur/33:2,
diff --git a/test/corpus/cur/34:2, b/test/corpora/default/cur/34:2,
similarity index 100%
rename from test/corpus/cur/34:2,
rename to test/corpora/default/cur/34:2,
diff --git a/test/corpus/cur/35:2, b/test/corpora/default/cur/35:2,
similarity index 100%
rename from test/corpus/cur/35:2,
rename to test/corpora/default/cur/35:2,
diff --git a/test/corpus/cur/36:2, b/test/corpora/default/cur/36:2,
similarity index 100%
rename from test/corpus/cur/36:2,
rename to test/corpora/default/cur/36:2,
diff --git a/test/corpus/cur/37:2, b/test/corpora/default/cur/37:2,
similarity index 100%
rename from test/corpus/cur/37:2,
rename to test/corpora/default/cur/37:2,
diff --git a/test/corpus/cur/38:2, b/test/corpora/default/cur/38:2,
similarity index 100%
rename from test/corpus/cur/38:2,
rename to test/corpora/default/cur/38:2,
diff --git a/test/corpus/cur/39:2, b/test/corpora/default/cur/39:2,
similarity index 100%
rename from test/corpus/cur/39:2,
rename to test/corpora/default/cur/39:2,
diff --git a/test/corpus/cur/40:2, b/test/corpora/default/cur/40:2,
similarity index 100%
rename from test/corpus/cur/40:2,
rename to test/corpora/default/cur/40:2,
diff --git a/test/corpus/cur/41:2, b/test/corpora/default/cur/41:2,
similarity index 100%
rename from test/corpus/cur/41:2,
rename to test/corpora/default/cur/41:2,
diff --git a/test/corpus/cur/42:2, b/test/corpora/default/cur/42:2,
similarity index 100%
rename from test/corpus/cur/42:2,
rename to test/corpora/default/cur/42:2,
diff --git a/test/corpus/cur/43:2, b/test/corpora/default/cur/43:2,
similarity index 100%
rename from test/corpus/cur/43:2,
rename to test/corpora/default/cur/43:2,
diff --git a/test/corpus/cur/44:2, b/test/corpora/default/cur/44:2,
similarity index 100%
rename from test/corpus/cur/44:2,
rename to test/corpora/default/cur/44:2,
diff --git a/test/corpus/cur/45:2, b/test/corpora/default/cur/45:2,
similarity index 100%
rename from test/corpus/cur/45:2,
rename to test/corpora/default/cur/45:2,
diff --git a/test/corpus/cur/46:2, b/test/corpora/default/cur/46:2,
similarity index 100%
rename from test/corpus/cur/46:2,
rename to test/corpora/default/cur/46:2,
diff --git a/test/corpus/cur/47:2, b/test/corpora/default/cur/47:2,
similarity index 100%
rename from test/corpus/cur/47:2,
rename to test/corpora/default/cur/47:2,
diff --git a/test/corpus/cur/48:2, b/test/corpora/default/cur/48:2,
similarity index 100%
rename from test/corpus/cur/48:2,
rename to test/corpora/default/cur/48:2,
diff --git a/test/corpus/cur/49:2, b/test/corpora/default/cur/49:2,
similarity index 100%
rename from test/corpus/cur/49:2,
rename to test/corpora/default/cur/49:2,
diff --git a/test/corpus/cur/50:2, b/test/corpora/default/cur/50:2,
similarity index 100%
rename from test/corpus/cur/50:2,
rename to test/corpora/default/cur/50:2,
diff --git a/test/corpus/cur/51:2, b/test/corpora/default/cur/51:2,
similarity index 100%
rename from test/corpus/cur/51:2,
rename to test/corpora/default/cur/51:2,
diff --git a/test/corpus/cur/52:2, b/test/corpora/default/cur/52:2,
similarity index 100%
rename from test/corpus/cur/52:2,
rename to test/corpora/default/cur/52:2,
diff --git a/test/corpus/cur/53:2, b/test/corpora/default/cur/53:2,
similarity index 100%
rename from test/corpus/cur/53:2,
rename to test/corpora/default/cur/53:2,
diff --git a/test/corpus/foo/06:2, b/test/corpora/default/foo/06:2,
similarity index 100%
rename from test/corpus/foo/06:2,
rename to test/corpora/default/foo/06:2,
diff --git a/test/corpus/foo/baz/11:2, b/test/corpora/default/foo/baz/11:2,
similarity index 100%
rename from test/corpus/foo/baz/11:2,
rename to test/corpora/default/foo/baz/11:2,
diff --git a/test/corpus/foo/baz/12:2, b/test/corpora/default/foo/baz/12:2,
similarity index 100%
rename from test/corpus/foo/baz/12:2,
rename to test/corpora/default/foo/baz/12:2,
diff --git a/test/corpus/foo/baz/cur/13:2, b/test/corpora/default/foo/baz/cur/13:2,
similarity index 100%
rename from test/corpus/foo/baz/cur/13:2,
rename to test/corpora/default/foo/baz/cur/13:2,
diff --git a/test/corpus/foo/baz/cur/14:2, b/test/corpora/default/foo/baz/cur/14:2,
similarity index 100%
rename from test/corpus/foo/baz/cur/14:2,
rename to test/corpora/default/foo/baz/cur/14:2,
diff --git a/test/corpus/foo/baz/new/15:2, b/test/corpora/default/foo/baz/new/15:2,
similarity index 100%
rename from test/corpus/foo/baz/new/15:2,
rename to test/corpora/default/foo/baz/new/15:2,
diff --git a/test/corpus/foo/baz/new/16:2, b/test/corpora/default/foo/baz/new/16:2,
similarity index 100%
rename from test/corpus/foo/baz/new/16:2,
rename to test/corpora/default/foo/baz/new/16:2,
diff --git a/test/corpus/foo/cur/07:2, b/test/corpora/default/foo/cur/07:2,
similarity index 100%
rename from test/corpus/foo/cur/07:2,
rename to test/corpora/default/foo/cur/07:2,
diff --git a/test/corpus/foo/cur/08:2, b/test/corpora/default/foo/cur/08:2,
similarity index 100%
rename from test/corpus/foo/cur/08:2,
rename to test/corpora/default/foo/cur/08:2,
diff --git a/test/corpus/foo/new/03:2, b/test/corpora/default/foo/new/03:2,
similarity index 100%
rename from test/corpus/foo/new/03:2,
rename to test/corpora/default/foo/new/03:2,
diff --git a/test/corpus/foo/new/09:2, b/test/corpora/default/foo/new/09:2,
similarity index 100%
rename from test/corpus/foo/new/09:2,
rename to test/corpora/default/foo/new/09:2,
diff --git a/test/corpus/foo/new/10:2, b/test/corpora/default/foo/new/10:2,
similarity index 100%
rename from test/corpus/foo/new/10:2,
rename to test/corpora/default/foo/new/10:2,
diff --git a/test/corpus/new/04:2, b/test/corpora/default/new/04:2,
similarity index 100%
rename from test/corpus/new/04:2,
rename to test/corpora/default/new/04:2,
diff --git a/test/test-lib.sh b/test/test-lib.sh
index aac0343ba7bf..e2e26e6f274a 100644
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -541,21 +541,26 @@ emacs_fcc_message ()
     notmuch new >/dev/null
 }
 
-# Generate a corpus of email and add it to the database.
+# Add an existing, fixed corpus of email to the database.
 #
-# This corpus is fixed, (it happens to be 50 messages from early in
-# the history of the notmuch mailing list), which allows for reliably
+# $1 is the corpus dir under corpora to add, using "default" if unset.
+#
+# The default corpus is based on about 50 messages from early in the
+# history of the notmuch mailing list, which allows for reliably
 # testing commands that need to operate on a not-totally-trivial
 # number of messages.
 add_email_corpus ()
 {
+    corpus=${1:-default}
+
     rm -rf ${MAIL_DIR}
-    if [ -d $TEST_DIRECTORY/corpus.mail ]; then
-	cp -a $TEST_DIRECTORY/corpus.mail ${MAIL_DIR}
+    if [ -d $TEST_DIRECTORY/corpora.mail/$corpus ]; then
+	cp -a $TEST_DIRECTORY/corpora.mail/$corpus ${MAIL_DIR}
     else
-	cp -a $TEST_DIRECTORY/corpus ${MAIL_DIR}
+	cp -a $TEST_DIRECTORY/corpora/$corpus ${MAIL_DIR}
 	notmuch new >/dev/null || die "'notmuch new' failed while adding email corpus"
-	cp -a ${MAIL_DIR} $TEST_DIRECTORY/corpus.mail
+	mkdir -p $TEST_DIRECTORY/corpora.mail
+	cp -a ${MAIL_DIR} $TEST_DIRECTORY/corpora.mail/$corpus
     fi
 }
 
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-09-11 18:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-11 16:03 [PATCH] test: make it possible to have multiple corpora Jani Nikula
2016-09-11 17:29 ` David Bremner
2016-09-11 18:29   ` Jani Nikula
2016-09-11 18:37     ` David Bremner

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).