[PATCH 2/3] tests: remove entangling corpus index optimization

Subject: [PATCH 2/3] tests: remove entangling corpus index optimization

Date: Sat, 4 May 2019 20:57:43 +0000

To: Notmuch Mail

Cc:

From: Rollins, Jameson


From: Jameson Graef Rollins <jrollins@finestructure.net>

The add_email_corpus test utility includes logic that tries to re-use
an index of the corpus if available.  This was seemingly done as an
optimization, so that every test that uses the corpus didn't have to
create it's own index of the corpus.  However, this has the perverse
side effect of entangling tests together, and breaks parallelization.

Forcing each test to do it's own index does increase the overall time
of the test slightly (~6%), but this will be more than made up for in
the next patch that introduces paraellization.
---
 test/.gitignore     |  1 -
 test/Makefile.local |  2 +-
 test/notmuch-test   |  2 +-
 test/test-lib.sh    | 10 ++--------
 4 files changed, 4 insertions(+), 11 deletions(-)

diff --git a/test/.gitignore b/test/.gitignore
index 69080e5e..f5968404 100644
--- a/test/.gitignore
+++ b/test/.gitignore
@@ -1,5 +1,4 @@
 /arg-test
-/corpora.mail
 /hex-xcode
 /parse-time
 /random-corpus
diff --git a/test/Makefile.local b/test/Makefile.local
index 1cf09778..47244e8f 100644
--- a/test/Makefile.local
+++ b/test/Makefile.local
@@ -81,4 +81,4 @@ check: test
 SRCS := $(SRCS) $(test_srcs)
 CLEAN += $(TEST_BINARIES) $(addsuffix .o,$(TEST_BINARIES)) \
 	 $(dir)/database-test.o \
-	 $(dir)/corpora.mail $(dir)/test-results $(dir)/tmp.*
+	 $(dir)/test-results $(dir)/tmp.*
diff --git a/test/notmuch-test b/test/notmuch-test
index ca68dd41..1a1ae811 100755
--- a/test/notmuch-test
+++ b/test/notmuch-test
@@ -59,6 +59,6 @@ $NOTMUCH_SRCDIR/test/aggregate-results.sh $NOTMUCH_BUILDDIR/test/test-results/*
 ev=$?
 
 # Clean up
-rm -rf $NOTMUCH_BUILDDIR/test/test-results $NOTMUCH_BUILDDIR/test/corpora.mail
+rm -rf $NOTMUCH_BUILDDIR/test/test-results
 
 exit $ev
diff --git a/test/test-lib.sh b/test/test-lib.sh
index 04d93f7d..43339902 100644
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -394,14 +394,8 @@ add_email_corpus ()
     corpus=${1:-default}
 
     rm -rf ${MAIL_DIR}
-    if [ -d $TEST_DIRECTORY/corpora.mail/$corpus ]; then
-	cp -a $TEST_DIRECTORY/corpora.mail/$corpus ${MAIL_DIR}
-    else
-	cp -a $NOTMUCH_SRCDIR/test/corpora/$corpus ${MAIL_DIR}
-	notmuch new >/dev/null || die "'notmuch new' failed while adding email corpus"
-	mkdir -p $TEST_DIRECTORY/corpora.mail
-	cp -a ${MAIL_DIR} $TEST_DIRECTORY/corpora.mail/$corpus
-    fi
+    cp -a $NOTMUCH_SRCDIR/test/corpora/$corpus ${MAIL_DIR}
+    notmuch new >/dev/null || die "'notmuch new' failed while adding email corpus"
 }
 
 test_begin_subtest ()
-- 
2.20.1

_______________________________________________
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch

Thread: