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