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