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 29AA8429E27 for ; Mon, 9 May 2011 22:47:20 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.699 X-Spam-Level: X-Spam-Status: No, score=-0.699 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] 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 G47S4kgzV9cb for ; Mon, 9 May 2011 22:47:19 -0700 (PDT) Received: from mail-qw0-f53.google.com (mail-qw0-f53.google.com [209.85.216.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id D301B429E26 for ; Mon, 9 May 2011 22:47:18 -0700 (PDT) Received: by qwb7 with SMTP id 7so4136803qwb.26 for ; Mon, 09 May 2011 22:47:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=jIJ7If+HR7xaDjInsUZ4VGn7CII/JHwQrTVUwzEMg7s=; b=pk4bt+fLeL6bSbquAqa2KqIza+QPOI1B4cA4cbXZB1ILOqUmZZ5wK7jM/VSKZOMBio 3PMpHJKVPld0peG3lDHHJYRQZcy4VoxCBIzJZw276vEjZ2l8XzVqDpons94p8feoYD6u I17w4XzRvwn6EgIa1PCpMDD5F1iWhC6+1I5ps= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=j4iCYNnEzUKSDT9qy2KVpLWRsWw8I09opxTiJKWNX0Sp9i3EK3TAAMp5XQZEwB+5Jf gjOL4YFd8IHLtPqZkR1ZYckmbWJsTCWH2MGyaSSn2CLVijp4XF7yvUamMbAsoSYjz5Vr z/m6l1KbRgxWb8W86ZPH/uPGf4tVozfOP24HQ= MIME-Version: 1.0 Received: by 10.229.101.36 with SMTP id a36mr5752079qco.74.1305006437952; Mon, 09 May 2011 22:47:17 -0700 (PDT) Sender: amdragon@gmail.com Received: by 10.229.233.17 with HTTP; Mon, 9 May 2011 22:47:17 -0700 (PDT) In-Reply-To: <1305006007-26445-1-git-send-email-dmitry.kurochkin@gmail.com> References: <1305006007-26445-1-git-send-email-dmitry.kurochkin@gmail.com> Date: Tue, 10 May 2011 01:47:17 -0400 X-Google-Sender-Auth: s3MMDTE-j05QE4MGA4BQQlFLp1k Message-ID: Subject: Re: [PATCH] test: add "%s" format string to all `message' calls in emacs tests From: Austin Clements To: Dmitry Kurochkin Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: Notmuch Mail 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: Tue, 10 May 2011 05:47:20 -0000 This looks good to me (and is certainly more correct), but seems rather roundabout. Is there a reason this code doesn't simply (princ (buffer-string))? On Tue, May 10, 2011 at 1:40 AM, Dmitry Kurochkin wrote: > The patch replaces all (message (buffer-string)) calls in emacs > tests with (message "%s" (buffer-string)). =A0This works around an > Emacs (23.3+1-1 on current Debian Unstable) segfault in "Ensure > that emacs doesn't drop results" test. =A0Note: the segfault does > not happen on every test run. =A0Though, it seems to be > consistently reproducible if the test uses 300 messages instead > of 30. =A0Hopefully, it is the crash described in Emacs bug #8545 > [1] which is already fixed. > > Also, the patch makes the code more correct - we want to avoid > accidentally interpreting '%' as format specifiers. > > [1] http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D8545 > --- > > The patch applies to the release-candidate/0.6 branch. > > Regards, > =A0Dmitry > > > =A0test/emacs =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 | =A0 18 +++++++++-= -------- > =A0test/emacs-large-search-buffer | =A0 =A05 +++-- > =A02 files changed, 12 insertions(+), 11 deletions(-) > > diff --git a/test/emacs b/test/emacs > index b376033..5b39423 100755 > --- a/test/emacs > +++ b/test/emacs > @@ -7,38 +7,38 @@ EXPECTED=3D../emacs.expected-output > =A0add_email_corpus > > =A0test_begin_subtest "Basic notmuch-hello view in emacs" > -output=3D$(test_emacs '(notmuch-hello) (message (buffer-string))' 2>&1) > +output=3D$(test_emacs '(notmuch-hello) (message "%s" (buffer-string))' 2= >&1) > =A0expected=3D$(cat $EXPECTED/notmuch-hello) > =A0test_expect_equal "$output" "$expected" > > =A0test_begin_subtest "Saved search with 0 results" > -output=3D$(test_emacs '(setq notmuch-show-empty-saved-searches t) (setq = notmuch-saved-searches '\''(("inbox" . "tag:inbox") ("unread" . "tag:unread= ") ("empty" . "tag:doesnotexist"))) (notmuch-hello) (message (buffer-string= ))' 2>&1) > +output=3D$(test_emacs '(setq notmuch-show-empty-saved-searches t) (setq = notmuch-saved-searches '\''(("inbox" . "tag:inbox") ("unread" . "tag:unread= ") ("empty" . "tag:doesnotexist"))) (notmuch-hello) (message "%s" (buffer-s= tring))' 2>&1) > =A0expected=3D$(cat $EXPECTED/notmuch-hello-with-empty) > =A0test_expect_equal "$output" "$expected" > > =A0test_begin_subtest "No saved searches displayed (all with 0 results)" > -output=3D$(test_emacs '(setq notmuch-saved-searches '\''(("empty" . "tag= :doesnotexist"))) (notmuch-hello) (message (buffer-string))' 2>&1) > +output=3D$(test_emacs '(setq notmuch-saved-searches '\''(("empty" . "tag= :doesnotexist"))) (notmuch-hello) (message "%s" (buffer-string))' 2>&1) > =A0expected=3D$(cat $EXPECTED/notmuch-hello-no-saved-searches) > =A0test_expect_equal "$output" "$expected" > > =A0test_begin_subtest "Basic notmuch-search view in emacs" > -output=3D$(test_emacs '(notmuch-search "tag:inbox") (notmuch-test-wait) = (message (buffer-string))' 2>&1) > +output=3D$(test_emacs '(notmuch-search "tag:inbox") (notmuch-test-wait) = (message "%s" (buffer-string))' 2>&1) > =A0expected=3D$(cat $EXPECTED/notmuch-search-tag-inbox) > =A0test_expect_equal "$output" "$expected" > > =A0test_begin_subtest "Navigation of notmuch-hello to search results" > -output=3D$(test_emacs '(notmuch-hello) (goto-char (point-min)) (re-searc= h-forward "inbox") (widget-button-press (point)) (notmuch-test-wait) (messa= ge (buffer-string))' 2>&1) > +output=3D$(test_emacs '(notmuch-hello) (goto-char (point-min)) (re-searc= h-forward "inbox") (widget-button-press (point)) (notmuch-test-wait) (messa= ge "%s" (buffer-string))' 2>&1) > =A0expected=3D$(cat $EXPECTED/notmuch-hello-view-inbox) > =A0test_expect_equal "$output" "$expected" > > =A0test_begin_subtest "Basic notmuch-show view in emacs" > =A0maildir_storage_thread=3D$(notmuch search --output=3Dthreads id:200911= 17190054.GU3165@dottiness.seas.harvard.edu) > -output=3D$(test_emacs "(notmuch-show \"$maildir_storage_thread\") (messa= ge (buffer-string))" 2>&1) > +output=3D$(test_emacs "(notmuch-show \"$maildir_storage_thread\") (messa= ge \"%s\" (buffer-string))" 2>&1) > =A0expected=3D$(cat $EXPECTED/notmuch-show-thread-maildir-storage) > =A0test_expect_equal "$output" "$expected" > > =A0test_begin_subtest "Navigation of notmuch-search to thread view" > -output=3D$(test_emacs '(notmuch-search "tag:inbox") (notmuch-test-wait) = (goto-char (point-min)) (re-search-forward "Working with Maildir") (notmuch= -search-show-thread) (notmuch-test-wait) (message (buffer-string))' 2>&1) > +output=3D$(test_emacs '(notmuch-search "tag:inbox") (notmuch-test-wait) = (goto-char (point-min)) (re-search-forward "Working with Maildir") (notmuch= -search-show-thread) (notmuch-test-wait) (message "%s" (buffer-string))' 2>= &1) > =A0test_expect_equal "$output" "$expected" > > =A0test_begin_subtest "Add tag from search view" > @@ -102,7 +102,7 @@ test_expect_equal "$output" "thread:XXX =A0 1974-03-2= 9 [1/1] Notmuch Test Suite; T > =A0test_begin_subtest "Reply within emacs" > =A0# We sed away everything before the ^From in the output to avoid getti= ng > =A0# confused by messages such as "Parsing /home/cworth/.mailrc... done" > -output=3D$(test_emacs '(notmuch-search "subject:\"testing message sent v= ia SMTP\"") (notmuch-test-wait) (notmuch-search-reply-to-thread) (message (= buffer-string))' 2>&1 | sed -ne '/^From/,$ p' | sed -e 's/^In-Reply-To: <.*= >$/In-Reply-To: /') > +output=3D$(test_emacs '(notmuch-search "subject:\"testing message sent v= ia SMTP\"") (notmuch-test-wait) (notmuch-search-reply-to-thread) (message "= %s" (buffer-string))' 2>&1 | sed -ne '/^From/,$ p' | sed -e 's/^In-Reply-To= : <.*>$/In-Reply-To: /') > =A0test_expect_equal "$output" "From: Notmuch Test Suite > =A0To: user@example.com > =A0Subject: Re: Testing message sent via SMTP > @@ -125,7 +125,7 @@ test_expect_equal_file "$EXPECTED/attachment" attachm= ent2.gz > =A0test_begin_subtest "View raw message within emacs" > =A0expected=3D$(cat $EXPECTED/raw-message-cf0c4d-52ad0a) > =A0first_line=3D$(echo "$expected" | head -n1) > -output=3D$(test_emacs '(notmuch-show "id:cf0c4d610911171136h1713aa59w9cf= 9aa31f052ad0a@mail.gmail.com") (notmuch-show-view-raw-message) (message (bu= ffer-string))' 2>&1 | sed -ne "/$first_line/,\$ p") > +output=3D$(test_emacs '(notmuch-show "id:cf0c4d610911171136h1713aa59w9cf= 9aa31f052ad0a@mail.gmail.com") (notmuch-show-view-raw-message) (message "%s= " (buffer-string))' 2>&1 | sed -ne "/$first_line/,\$ p") > =A0test_expect_equal "$output" "$expected" > > =A0test_done > diff --git a/test/emacs-large-search-buffer b/test/emacs-large-search-buf= fer > index a3b5c79..77878b5 100755 > --- a/test/emacs-large-search-buffer > +++ b/test/emacs-large-search-buffer > @@ -21,11 +21,12 @@ notmuch new > /dev/null > =A0test_begin_subtest "Ensure that emacs doesn't drop results" > =A0expected=3D"$(notmuch search '*' | sed -e 's/^thread:[0-9a-f]* =A0//' = -e 's/;//' -e =A0's/xx*/[BLOB]/') > =A0End of search results." > -output=3D$(test_emacs '(notmuch-search "*") (notmuch-test-wait) (message= (buffer-string))' 2>&1 | sed -e s', =A0*, ,g' -e 's/xxx*/[BLOB]/g') > + > +output=3D$(test_emacs '(notmuch-search "*") (notmuch-test-wait) (message= "%s" (buffer-string))' 2>&1 | sed -e s', =A0*, ,g' -e 's/xxx*/[BLOB]/g') > =A0test_expect_equal "$output" "$expected" > > =A0test_begin_subtest "Ensure that emacs doesn't drop error messages" > -output=3D$(test_emacs '(notmuch-search "--this-option-does-not-exist") (= notmuch-test-wait) (message (buffer-string))' 2>&1) > +output=3D$(test_emacs '(notmuch-search "--this-option-does-not-exist") (= notmuch-test-wait) (message "%s" (buffer-string))' 2>&1) > =A0test_expect_equal "$output" "Error: Unexpected output from notmuch sea= rch: > =A0Unrecognized option: --this-option-does-not-exist > =A0End of search results. (process returned 1)" > -- > 1.7.5.1 > > _______________________________________________ > notmuch mailing list > notmuch@notmuchmail.org > http://notmuchmail.org/mailman/listinfo/notmuch >