[RFC PATCH 09/14] Fix atomicity test to work without relocatable mailstores
authorEthan Glasser-Camp <ethan.glasser.camp@gmail.com>
Mon, 25 Jun 2012 20:51:52 +0000 (16:51 +2000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:47:49 +0000 (09:47 -0800)
d2/d42054a23d2a31adf1b245dcc58719cbf56ce2 [new file with mode: 0644]

diff --git a/d2/d42054a23d2a31adf1b245dcc58719cbf56ce2 b/d2/d42054a23d2a31adf1b245dcc58719cbf56ce2
new file mode 100644 (file)
index 0000000..e7fbfb1
--- /dev/null
@@ -0,0 +1,126 @@
+Return-Path: <ethan.glasser.camp@gmail.com>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 121AD431FB6\r
+       for <notmuch@notmuchmail.org>; Mon, 25 Jun 2012 13:53:23 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 1.061\r
+X-Spam-Level: *\r
+X-Spam-Status: No, score=1.061 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+       FREEMAIL_FROM=0.001, RCVD_IN_BL_SPAMCOP_NET=1.246,\r
+       RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_SORBS_WEB=0.614] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id C2rviQ85wJK1 for <notmuch@notmuchmail.org>;\r
+       Mon, 25 Jun 2012 13:53:22 -0700 (PDT)\r
+Received: from mail-wi0-f179.google.com (mail-wi0-f179.google.com\r
+       [209.85.212.179]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 27178431FAF\r
+       for <notmuch@notmuchmail.org>; Mon, 25 Jun 2012 13:53:22 -0700 (PDT)\r
+Received: by wibhq4 with SMTP id hq4so1725340wib.2\r
+       for <notmuch@notmuchmail.org>; Mon, 25 Jun 2012 13:53:21 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+       h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;\r
+       bh=a6vjekbSfsjNdw++Q8neMKznNl7AUCOjhsmZTB7+e84=;\r
+       b=tvA/kOUU3XwHBLfX6yo6Nly5+g6/K6WZ0i/00ZNm0Rp6RitlTc7WPZ46b0osfl9PQW\r
+       wwXuM4z3crA4KQZmp4e+aXrPUns9eeAYZbgYouFv1dPalXN7bDJJUV7gH/w9TNNk4y0C\r
+       IDoTOZdzwYLrVHr0dxlJF/LMrvDVn4MMw7zhTJSkOwOS58UM90cys9Dh3VtG+6hfEblY\r
+       PAUkFYBIrpFLOtQn9GftZ5cjZ3UUTa6hsfv/Y8/RWiUDXdKjqQUipQsz7U7XkwaOX01A\r
+       SXLYA9z7L8xg4Vj0+Darj25sikxBV0tpKOu/qqh5YuAGC/1q+dWnB4oy+NaTZzr8DzQq\r
+       nO9Q==\r
+Received: by 10.180.98.69 with SMTP id eg5mr27657338wib.3.1340657600933;\r
+       Mon, 25 Jun 2012 13:53:20 -0700 (PDT)\r
+Received: from localhost ([195.24.209.21])\r
+       by mx.google.com with ESMTPS id z8sm91329wiy.1.2012.06.25.13.53.16\r
+       (version=TLSv1/SSLv3 cipher=OTHER);\r
+       Mon, 25 Jun 2012 13:53:20 -0700 (PDT)\r
+From: Ethan Glasser-Camp <ethan.glasser.camp@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [RFC PATCH 09/14] Fix atomicity test to work without relocatable\r
+       mailstores\r
+Date: Mon, 25 Jun 2012 16:51:52 -0400\r
+Message-Id: <1340657517-6539-5-git-send-email-ethan@betacantrips.com>\r
+X-Mailer: git-send-email 1.7.9.5\r
+In-Reply-To: <1340657517-6539-1-git-send-email-ethan@betacantrips.com>\r
+References: <1340657517-6539-1-git-send-email-ethan@betacantrips.com>\r
+X-Mailman-Approved-At: Tue, 26 Jun 2012 03:51:54 -0700\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\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: Mon, 25 Jun 2012 20:53:23 -0000\r
+\r
+Instead of assuming that the mailstore doesn't store its absolute\r
+filenames, we use a symlink that can change back and forth. As long as\r
+filenames contain this symlink, they can work in either the real\r
+database, or the current snapshot.\r
+\r
+Signed-off-by: Ethan Glasser-Camp <ethan@betacantrips.com>\r
+---\r
+ test/atomicity     |   10 +++++-----\r
+ test/atomicity.gdb |   11 ++++++++---\r
+ 2 files changed, 13 insertions(+), 8 deletions(-)\r
+\r
+diff --git a/test/atomicity b/test/atomicity\r
+index 6df0a00..7b62ec7 100755\r
+--- a/test/atomicity\r
++++ b/test/atomicity\r
+@@ -49,13 +49,13 @@ if test_require_external_prereq gdb; then\r
+     rm $MAIL_DIR/.remove-dir/remove-directory-duplicate:2,\r
+     rmdir $MAIL_DIR/.remove-dir\r
+ \r
+-    # Prepare a snapshot of the updated maildir.  The gdb script will\r
+-    # update the database in this snapshot as it goes.\r
++    # Copy the mail database. We will run on this database concurrently.\r
+     cp -ra $MAIL_DIR $MAIL_DIR.snap\r
+-    cp ${NOTMUCH_CONFIG} ${NOTMUCH_CONFIG}.snap\r
+-    NOTMUCH_CONFIG=${NOTMUCH_CONFIG}.snap notmuch config set database.path $MAIL_DIR.snap\r
+-\r
+ \r
++    # Use a symlink instead of the real path. This way, we can change the symlink,\r
++    # without filenames having to change.\r
++    mv $MAIL_DIR $MAIL_DIR.real\r
++    ln -s $MAIL_DIR.real $MAIL_DIR\r
+ \r
+     # Execute notmuch new and, at every call to rename, snapshot the\r
+     # database, run notmuch new again on the snapshot, and capture the\r
+diff --git a/test/atomicity.gdb b/test/atomicity.gdb\r
+index fd67525..3d4e210 100644\r
+--- a/test/atomicity.gdb\r
++++ b/test/atomicity.gdb\r
+@@ -38,12 +38,17 @@ shell mv backtrace backtrace.`cat outcount`\r
+ # Snapshot the database\r
+ shell rm -r $MAIL_DIR.snap/.notmuch\r
+ shell cp -r $MAIL_DIR/.notmuch $MAIL_DIR.snap/.notmuch\r
++shell rm $MAIL_DIR\r
++shell ln -s $MAIL_DIR.snap $MAIL_DIR\r
+ # Restore the mtime of $MAIL_DIR.snap, which we just changed\r
+-shell touch -r $MAIL_DIR $MAIL_DIR.snap\r
++shell touch -r $MAIL_DIR.real $MAIL_DIR.snap\r
+ # Run notmuch new to completion on the snapshot\r
+-shell NOTMUCH_CONFIG=${NOTMUCH_CONFIG}.snap XAPIAN_FLUSH_THRESHOLD=1000 notmuch new > /dev/null\r
+-shell NOTMUCH_CONFIG=${NOTMUCH_CONFIG}.snap notmuch search '*' > search.`cat outcount` 2>&1\r
++shell NOTMUCH_CONFIG=${NOTMUCH_CONFIG} XAPIAN_FLUSH_THRESHOLD=1000 notmuch new > /dev/null\r
++shell NOTMUCH_CONFIG=${NOTMUCH_CONFIG} notmuch search '*' > search.`cat outcount` 2>&1\r
+ shell echo $(expr $(cat outcount) + 1) > outcount\r
++# restore symlink to correct database before resuming\r
++shell rm $MAIL_DIR\r
++shell ln -s $MAIL_DIR.real $MAIL_DIR\r
+ cont\r
+ end\r
+ \r
+-- \r
+1.7.9.5\r
+\r