From: David Bremner <[email protected]>

It's a bit annoying to call tar twice, but we cache the results so it
isn't as bad as it could be.
---
 performance-test/Makefile.local   |    1 +
 performance-test/perf-test-lib.sh |   25 +++++++++++++++++++------
 2 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/performance-test/Makefile.local b/performance-test/Makefile.local
index b136a88..cdd7f19 100644
--- a/performance-test/Makefile.local
+++ b/performance-test/Makefile.local
@@ -30,3 +30,4 @@ download-corpus:
        wget -O ${TXZFILE} ${DEFAULT_URL}

 CLEAN := $(CLEAN) $(dir)/tmp.* $(dir)/corpus.mail.* $(dir)/notmuch.cache.*
+CLEAN := $(CLEAN) $(dir)/corpus.tags
diff --git a/performance-test/perf-test-lib.sh 
b/performance-test/perf-test-lib.sh
index 08e2ebd..40c88c9 100644
--- a/performance-test/perf-test-lib.sh
+++ b/performance-test/perf-test-lib.sh
@@ -41,6 +41,13 @@ DB_CACHE_DIR=${TEST_DIRECTORY}/notmuch.cache.$corpus_size
 add_email_corpus ()
 {
     rm -rf ${MAIL_DIR}
+
+    if command -v pixz > /dev/null; then
+       XZ=pixz
+    else
+       XZ=xz
+    fi
+
     if [ ! -d $CORPUS_DIR ]; then
        case "$corpus_size" in
            small)
@@ -53,12 +60,6 @@ add_email_corpus ()
                arg=mail
        esac

-       if command -v pixz > /dev/null; then
-           XZ=pixz
-       else
-           XZ=xz
-       fi
-
        printf "Unpacking corpus\n"
        mkdir $CORPUS_DIR

@@ -72,6 +73,18 @@ add_email_corpus ()

     fi

+    if [ ! -d $TEST_DIRECTORY/corpus.tags ]; then
+
+       mkdir $TEST_DIRECTORY/corpus.tags
+
+       tar --extract --strip-components=2 \
+           --directory $TEST_DIRECTORY/corpus.tags \
+           --use-compress-program ${XZ} \
+           --file ../download/notmuch-email-corpus-${PERFTEST_VERSION}.tar.xz \
+           notmuch-email-corpus/tags
+    fi
+
+    cp -lr $TEST_DIRECTORY/corpus.tags $TMP_DIRECTORY
     cp -lr $CORPUS_DIR $MAIL_DIR

     if [ -d $DB_CACHE_DIR ]; then
-- 
1.7.10.4

Reply via email to