[PATCH 06/10] test: move backup_database and restore_database to library
authorDavid Bremner <david@tethera.net>
Sun, 7 Jun 2015 15:01:59 +0000 (17:01 +0200)
committerW. Trevor King <wking@tremily.us>
Sat, 20 Aug 2016 21:48:59 +0000 (14:48 -0700)
4c/5efbb97603445bb29df98bda70265b9971b7fc [new file with mode: 0644]

diff --git a/4c/5efbb97603445bb29df98bda70265b9971b7fc b/4c/5efbb97603445bb29df98bda70265b9971b7fc
new file mode 100644 (file)
index 0000000..1042b73
--- /dev/null
@@ -0,0 +1,103 @@
+Return-Path: <bremner@tesseract.cs.unb.ca>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by arlo.cworth.org (Postfix) with ESMTP id 3B4E66DE15BE\r
+ for <notmuch@notmuchmail.org>; Sun,  7 Jun 2015 08:06:17 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.215\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.215 tagged_above=-999 required=5 tests=[AWL=0.205, \r
+ T_HEADER_FROM_DIFFERENT_DOMAINS=0.01] autolearn=disabled\r
+Received: from arlo.cworth.org ([127.0.0.1])\r
+ by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id eWyP7qt5e6JP for <notmuch@notmuchmail.org>;\r
+ Sun,  7 Jun 2015 08:06:15 -0700 (PDT)\r
+Received: from mx.xen14.node3324.gplhost.com (gitolite.debian.net\r
+ [87.98.215.224])\r
+ by arlo.cworth.org (Postfix) with ESMTPS id 6ABE76DE1512\r
+ for <notmuch@notmuchmail.org>; Sun,  7 Jun 2015 08:06:15 -0700 (PDT)\r
+Received: from remotemail by mx.xen14.node3324.gplhost.com with local (Exim\r
+ 4.80) (envelope-from <bremner@tesseract.cs.unb.ca>)\r
+ id 1Z1c8j-0004r7-U6; Sun, 07 Jun 2015 15:05:33 +0000\r
+Received: (nullmailer pid 7860 invoked by uid 1000); Sun, 07 Jun 2015\r
+ 15:02:11 -0000\r
+From: David Bremner <david@tethera.net>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 06/10] test: move backup_database and restore_database to\r
+ library\r
+Date: Sun,  7 Jun 2015 17:01:59 +0200\r
+Message-Id: <1433689323-7520-7-git-send-email-david@tethera.net>\r
+X-Mailer: git-send-email 2.1.4\r
+In-Reply-To: <1433689323-7520-1-git-send-email-david@tethera.net>\r
+References: <1433689323-7520-1-git-send-email-david@tethera.net>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.18\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sun, 07 Jun 2015 15:06:17 -0000\r
+\r
+The plan is to re-use them in testing the same errors from the CLI\r
+---\r
+ test/T560-lib-error.sh  | 10 ----------\r
+ test/test-lib-common.sh | 14 ++++++++++++++\r
+ 2 files changed, 14 insertions(+), 10 deletions(-)\r
+\r
+diff --git a/test/T560-lib-error.sh b/test/T560-lib-error.sh\r
+index c99b17e..36607c3 100755\r
+--- a/test/T560-lib-error.sh\r
++++ b/test/T560-lib-error.sh\r
+@@ -3,16 +3,6 @@ test_description="error reporting for library"\r
\r
+ . ./test-lib.sh\r
\r
+-backup_database () {\r
+-    rm -rf notmuch-dir-backup\r
+-    cp -pR ${MAIL_DIR}/.notmuch notmuch-dir-backup\r
+-}\r
+-restore_database () {\r
+-    rm -rf ${MAIL_DIR}/.notmuch\r
+-    cp -pR notmuch-dir-backup ${MAIL_DIR}/.notmuch\r
+-}\r
+-\r
+-\r
+ add_email_corpus\r
\r
+ test_expect_success "building database" "NOTMUCH_NEW"\r
+diff --git a/test/test-lib-common.sh b/test/test-lib-common.sh\r
+index f99ed11..0d9c839 100644\r
+--- a/test/test-lib-common.sh\r
++++ b/test/test-lib-common.sh\r
+@@ -34,6 +34,20 @@ find_notmuch_path ()\r
+     done\r
+ }\r
\r
++backup_database () {\r
++    test_name=$(basename $0 .sh)\r
++    rm -rf notmuch-dir-backup."$test_name"\r
++    cp -pR ${MAIL_DIR}/.notmuch notmuch-dir-backup."${test_name}"\r
++}\r
++\r
++restore_database () {\r
++    test_name=$(basename $0 .sh)\r
++    rm -rf ${MAIL_DIR}/.notmuch\r
++    cp -pR notmuch-dir-backup."${test_name}" ${MAIL_DIR}/.notmuch\r
++}\r
++\r
++\r
++\r
+ # Test the binaries we have just built.  The tests are kept in\r
+ # test/ subdirectory and are run in 'trash directory' subdirectory.\r
+ TEST_DIRECTORY=$(pwd)\r
+-- \r
+2.1.4\r
+\r