From: David Bremner Date: Sat, 9 Apr 2016 01:49:50 +0000 (+2100) Subject: [PATCH 4/4] test: cope with glass backend file naming variations X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=287b2af5c16ac761d9dc3bc5a63c44082ed40daa;p=notmuch-archives.git [PATCH 4/4] test: cope with glass backend file naming variations --- diff --git a/4a/03c12c78c580ac450e8697a42e0b8f98193d73 b/4a/03c12c78c580ac450e8697a42e0b8f98193d73 new file mode 100644 index 000000000..25d1dc42c --- /dev/null +++ b/4a/03c12c78c580ac450e8697a42e0b8f98193d73 @@ -0,0 +1,153 @@ +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 611E86DE034D + for ; Fri, 8 Apr 2016 18:50:15 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at cworth.org +X-Spam-Flag: NO +X-Spam-Score: -0.02 +X-Spam-Level: +X-Spam-Status: No, score=-0.02 tagged_above=-999 required=5 tests=[AWL=-0.009, + SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-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 7UyyUTitiDCC for ; + Fri, 8 Apr 2016 18:50:07 -0700 (PDT) +Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) + by arlo.cworth.org (Postfix) with ESMTPS id E99806DE02C6 + for ; Fri, 8 Apr 2016 18:49:59 -0700 (PDT) +Received: from remotemail by fethera.tethera.net with local (Exim 4.84) + (envelope-from ) + id 1aoi2K-00022S-S3; Fri, 08 Apr 2016 21:50:08 -0400 +Received: (nullmailer pid 6638 invoked by uid 1000); + Sat, 09 Apr 2016 01:49:55 -0000 +From: David Bremner +To: notmuch@notmuchmail.org +Subject: [PATCH 4/4] test: cope with glass backend file naming variations +Date: Fri, 8 Apr 2016 22:49:50 -0300 +Message-Id: <1460166590-6526-5-git-send-email-david@tethera.net> +X-Mailer: git-send-email 2.8.0.rc3 +In-Reply-To: <1460166590-6526-1-git-send-email-david@tethera.net> +References: <1460166590-6526-1-git-send-email-david@tethera.net> +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.20 +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: Sat, 09 Apr 2016 01:50:15 -0000 + +In several places in the test suite we intentionally corrupt the Xapian +database in order to test error handling. This corruption is specific to +the on-disk organization of the database, and that changed with the +glass backend. We use the previously computed default backend to make +the tests adapt to changing names. +--- + test/T050-new.sh | 2 +- + test/T060-count.sh | 4 ++-- + test/T150-tagging.sh | 4 ++-- + test/T360-symbol-hiding.sh | 4 ++-- + test/T560-lib-error.sh | 4 ++-- + 5 files changed, 9 insertions(+), 9 deletions(-) + +diff --git a/test/T050-new.sh b/test/T050-new.sh +index 93a6fa9..df9e89a 100755 +--- a/test/T050-new.sh ++++ b/test/T050-new.sh +@@ -284,7 +284,7 @@ notmuch config set new.tags $OLDCONFIG + + + test_begin_subtest "Xapian exception: read only files" +-chmod u-w ${MAIL_DIR}/.notmuch/xapian/*.DB ++chmod u-w ${MAIL_DIR}/.notmuch/xapian/*.${db_ending} + output=$(NOTMUCH_NEW --debug 2>&1 | sed 's/: .*$//' ) + chmod u+w ${MAIL_DIR}/.notmuch/xapian/*.DB + test_expect_equal "$output" "A Xapian exception occurred opening database" +diff --git a/test/T060-count.sh b/test/T060-count.sh +index 3fec94e..0ac8314 100755 +--- a/test/T060-count.sh ++++ b/test/T060-count.sh +@@ -95,7 +95,7 @@ test_expect_equal_file EXPECTED OUTPUT + + backup_database + test_begin_subtest "error message for database open" +-dd if=/dev/zero of="${MAIL_DIR}/.notmuch/xapian/postlist.DB" count=3 ++dd if=/dev/zero of="${MAIL_DIR}/.notmuch/xapian/postlist.${db_ending}" count=3 + notmuch count '*' 2>OUTPUT 1>/dev/null + output=$(sed 's/^\(A Xapian exception [^:]*\):.*$/\1/' OUTPUT) + test_expect_equal "${output}" "A Xapian exception occurred opening database" +@@ -105,7 +105,7 @@ cat < count-files.gdb + set breakpoint pending on + break count_files + commands +-shell cp /dev/null ${MAIL_DIR}/.notmuch/xapian/postlist.DB ++shell cp /dev/null ${MAIL_DIR}/.notmuch/xapian/postlist.${db_ending} + continue + end + run +diff --git a/test/T150-tagging.sh b/test/T150-tagging.sh +index 8adcabc..6fd6a18 100755 +--- a/test/T150-tagging.sh ++++ b/test/T150-tagging.sh +@@ -287,9 +287,9 @@ test_expect_code 1 "Empty tag names" 'notmuch tag + One' + test_expect_code 1 "Tag name beginning with -" 'notmuch tag +- One' + + test_begin_subtest "Xapian exception: read only files" +-chmod u-w ${MAIL_DIR}/.notmuch/xapian/*.DB ++chmod u-w ${MAIL_DIR}/.notmuch/xapian/*.${db_ending} + output=$(notmuch tag +something '*' 2>&1 | sed 's/: .*$//' ) +-chmod u+w ${MAIL_DIR}/.notmuch/xapian/*.DB ++chmod u+w ${MAIL_DIR}/.notmuch/xapian/{*.DB,*.glass} + test_expect_equal "$output" "A Xapian exception occurred opening database" + + test_done +diff --git a/test/T360-symbol-hiding.sh b/test/T360-symbol-hiding.sh +index 89e7f16..3f18ec1 100755 +--- a/test/T360-symbol-hiding.sh ++++ b/test/T360-symbol-hiding.sh +@@ -15,11 +15,11 @@ test_begin_subtest 'running test' run_test + mkdir -p ${PWD}/fakedb/.notmuch + ( LD_LIBRARY_PATH="$TEST_DIRECTORY/../lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" \ + $TEST_DIRECTORY/symbol-test ${PWD}/fakedb ${PWD}/nonexistent \ +- 2>&1 | notmuch_dir_sanitize | sed "s,\`,\',g") > OUTPUT ++ 2>&1 | notmuch_dir_sanitize | sed -e "s,\`,\',g" -e "s,${NOTMUCH_DEFAULT_XAPIAN_BACKEND},backend,g") > OUTPUT + + cat < EXPECTED + A Xapian exception occurred opening database: Couldn't stat 'CWD/fakedb/.notmuch/xapian' +-caught No chert database found at path 'CWD/nonexistent' ++caught No backend database found at path 'CWD/nonexistent' + EOF + test_expect_equal_file EXPECTED OUTPUT + +diff --git a/test/T560-lib-error.sh b/test/T560-lib-error.sh +index 49d3674..087c6bd 100755 +--- a/test/T560-lib-error.sh ++++ b/test/T560-lib-error.sh +@@ -189,7 +189,7 @@ Path already exists: MAIL_DIR + EOF + test_expect_equal_file EXPECTED OUTPUT + +-cat <<'EOF' > c_head ++cat < c_head + #include + #include + #include +@@ -210,7 +210,7 @@ int main (int argc, char** argv) + fprintf (stderr, "error opening database: %d %s\n", stat, msg ? msg : ""); + exit (1); + } +- path = talloc_asprintf (db, "%s/.notmuch/xapian/postlist.DB", argv[1]); ++ path = talloc_asprintf (db, "%s/.notmuch/xapian/postlist.${db_ending}", argv[1]); + fd = open(path,O_WRONLY|O_TRUNC); + if (fd < 0) { + fprintf (stderr, "error opening %s\n", argv[1]); +-- +2.8.0.rc3 +