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 CA8EF429E27 for ; Mon, 9 May 2011 22:59:02 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.799 X-Spam-Level: X-Spam-Status: No, score=-0.799 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_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 MyoZ4PuZPFGr for ; Mon, 9 May 2011 22:59:01 -0700 (PDT) Received: from mail-fx0-f53.google.com (mail-fx0-f53.google.com [209.85.161.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 72BC5429E26 for ; Mon, 9 May 2011 22:59:01 -0700 (PDT) Received: by fxm8 with SMTP id 8so4396316fxm.26 for ; Mon, 09 May 2011 22:59:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:cc:subject:in-reply-to:references :user-agent:date:message-id:mime-version:content-type :content-transfer-encoding; bh=pMdRAwsy/sjc0B44OZT/Uf7RiyvPr26JbtcF1rpahug=; b=a2pg/OsrMYPbixwHVugFpnVBUallsinUXPy5cIliOlkY2mlUluC0bt1cJ1w+LKFYgH XRjZ2IcaQXlu6F2shnJqNH1SpWV6AAmXKrCH1KiqYDFIZ4pxwmC9bY6O8G3n/I2yhUlE zjOX4y9xo7jI13E4pFJUDx32cNVkf5Nia+vvk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:in-reply-to:references:user-agent:date :message-id:mime-version:content-type:content-transfer-encoding; b=jFeyRhA+UtWxcqjMnzRWuWmikaKhN5el9vi9xKtN6nKJJRMWkluLojKvHFeGr6HElZ CyKywRhDsit12NxwI1CTd4uIZzgkxeiQ8OC+gO603cPKxuTOyfH4Lk0hOExp7NTwFpYQ bXuP0fsI73LTSoErOdeD28byIeZwLkNxX8Y2w= Received: by 10.223.134.68 with SMTP id i4mr2880933fat.87.1305007139175; Mon, 09 May 2011 22:58:59 -0700 (PDT) Received: from localhost ([91.144.186.21]) by mx.google.com with ESMTPS id s17sm734916fau.37.2011.05.09.22.58.57 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 09 May 2011 22:58:58 -0700 (PDT) From: Dmitry Kurochkin To: Austin Clements Subject: Re: [PATCH] test: add "%s" format string to all `message' calls in emacs tests In-Reply-To: References: <1305006007-26445-1-git-send-email-dmitry.kurochkin@gmail.com> User-Agent: Notmuch/ (http://notmuchmail.org) Emacs/23.3.1 (x86_64-pc-linux-gnu) Date: Tue, 10 May 2011 09:59:17 +0400 Message-ID: <87y62fxfii.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 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:59:02 -0000 On Tue, 10 May 2011 01:47:17 -0400, Austin Clements wrot= e: > 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))? >=20 Thanks, Austin! I am, unfortunately, not an Emacs Lisp expert. I did not know about princ, so I improved what we had :) Princ seems to work fine. And certainly looks cleaner than using message and capturing stderr. It also fixes the segfault. I will send another patch that uses princ instead of message. Regards, Dmitry > 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)). =C2=A0This works around an > > Emacs (23.3+1-1 on current Debian Unstable) segfault in "Ensure > > that emacs doesn't drop results" test. =C2=A0Note: the segfault does > > not happen on every test run. =C2=A0Though, it seems to be > > consistently reproducible if the test uses 300 messages instead > > of 30. =C2=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, > > =C2=A0Dmitry > > > > > > =C2=A0test/emacs =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 | =C2=A0 18 +++++++++--------- > > =C2=A0test/emacs-large-search-buffer | =C2=A0 =C2=A05 +++-- > > =C2=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 > > =C2=A0add_email_corpus > > > > =C2=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) > > =C2=A0expected=3D$(cat $EXPECTED/notmuch-hello) > > =C2=A0test_expect_equal "$output" "$expected" > > > > =C2=A0test_begin_subtest "Saved search with 0 results" > > -output=3D$(test_emacs '(setq notmuch-show-empty-saved-searches t) (set= q notmuch-saved-searches '\''(("inbox" . "tag:inbox") ("unread" . "tag:unre= ad") ("empty" . "tag:doesnotexist"))) (notmuch-hello) (message (buffer-stri= ng))' 2>&1) > > +output=3D$(test_emacs '(setq notmuch-show-empty-saved-searches t) (set= q notmuch-saved-searches '\''(("inbox" . "tag:inbox") ("unread" . "tag:unre= ad") ("empty" . "tag:doesnotexist"))) (notmuch-hello) (message "%s" (buffer= -string))' 2>&1) > > =C2=A0expected=3D$(cat $EXPECTED/notmuch-hello-with-empty) > > =C2=A0test_expect_equal "$output" "$expected" > > > > =C2=A0test_begin_subtest "No saved searches displayed (all with 0 resul= ts)" > > -output=3D$(test_emacs '(setq notmuch-saved-searches '\''(("empty" . "t= ag:doesnotexist"))) (notmuch-hello) (message (buffer-string))' 2>&1) > > +output=3D$(test_emacs '(setq notmuch-saved-searches '\''(("empty" . "t= ag:doesnotexist"))) (notmuch-hello) (message "%s" (buffer-string))' 2>&1) > > =C2=A0expected=3D$(cat $EXPECTED/notmuch-hello-no-saved-searches) > > =C2=A0test_expect_equal "$output" "$expected" > > > > =C2=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) > > =C2=A0expected=3D$(cat $EXPECTED/notmuch-search-tag-inbox) > > =C2=A0test_expect_equal "$output" "$expected" > > > > =C2=A0test_begin_subtest "Navigation of notmuch-hello to search results" > > -output=3D$(test_emacs '(notmuch-hello) (goto-char (point-min)) (re-sea= rch-forward "inbox") (widget-button-press (point)) (notmuch-test-wait) (mes= sage (buffer-string))' 2>&1) > > +output=3D$(test_emacs '(notmuch-hello) (goto-char (point-min)) (re-sea= rch-forward "inbox") (widget-button-press (point)) (notmuch-test-wait) (mes= sage "%s" (buffer-string))' 2>&1) > > =C2=A0expected=3D$(cat $EXPECTED/notmuch-hello-view-inbox) > > =C2=A0test_expect_equal "$output" "$expected" > > > > =C2=A0test_begin_subtest "Basic notmuch-show view in emacs" > > =C2=A0maildir_storage_thread=3D$(notmuch search --output=3Dthreads id:2= 0091117190054.GU3165@dottiness.seas.harvard.edu) > > -output=3D$(test_emacs "(notmuch-show \"$maildir_storage_thread\") (mes= sage (buffer-string))" 2>&1) > > +output=3D$(test_emacs "(notmuch-show \"$maildir_storage_thread\") (mes= sage \"%s\" (buffer-string))" 2>&1) > > =C2=A0expected=3D$(cat $EXPECTED/notmuch-show-thread-maildir-storage) > > =C2=A0test_expect_equal "$output" "$expected" > > > > =C2=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") (notmu= ch-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") (notmu= ch-search-show-thread) (notmuch-test-wait) (message "%s" (buffer-string))' = 2>&1) > > =C2=A0test_expect_equal "$output" "$expected" > > > > =C2=A0test_begin_subtest "Add tag from search view" > > @@ -102,7 +102,7 @@ test_expect_equal "$output" "thread:XXX =C2=A0 1974= -03-29 [1/1] Notmuch Test Suite; T > > =C2=A0test_begin_subtest "Reply within emacs" > > =C2=A0# We sed away everything before the ^From in the output to avoid = getting > > =C2=A0# confused by messages such as "Parsing /home/cworth/.mailrc... d= one" > > -output=3D$(test_emacs '(notmuch-search "subject:\"testing message sent= via 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= via 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: /') > > =C2=A0test_expect_equal "$output" "From: Notmuch Test Suite > > =C2=A0To: user@example.com > > =C2=A0Subject: Re: Testing message sent via SMTP > > @@ -125,7 +125,7 @@ test_expect_equal_file "$EXPECTED/attachment" attac= hment2.gz > > =C2=A0test_begin_subtest "View raw message within emacs" > > =C2=A0expected=3D$(cat $EXPECTED/raw-message-cf0c4d-52ad0a) > > =C2=A0first_line=3D$(echo "$expected" | head -n1) > > -output=3D$(test_emacs '(notmuch-show "id:cf0c4d610911171136h1713aa59w9= cf9aa31f052ad0a@mail.gmail.com") (notmuch-show-view-raw-message) (message (= buffer-string))' 2>&1 | sed -ne "/$first_line/,\$ p") > > +output=3D$(test_emacs '(notmuch-show "id:cf0c4d610911171136h1713aa59w9= cf9aa31f052ad0a@mail.gmail.com") (notmuch-show-view-raw-message) (message "= %s" (buffer-string))' 2>&1 | sed -ne "/$first_line/,\$ p") > > =C2=A0test_expect_equal "$output" "$expected" > > > > =C2=A0test_done > > diff --git a/test/emacs-large-search-buffer b/test/emacs-large-search-b= uffer > > index a3b5c79..77878b5 100755 > > --- a/test/emacs-large-search-buffer > > +++ b/test/emacs-large-search-buffer > > @@ -21,11 +21,12 @@ notmuch new > /dev/null > > =C2=A0test_begin_subtest "Ensure that emacs doesn't drop results" > > =C2=A0expected=3D"$(notmuch search '*' | sed -e 's/^thread:[0-9a-f]* = =C2=A0//' -e 's/;//' -e =C2=A0's/xx*/[BLOB]/') > > =C2=A0End of search results." > > -output=3D$(test_emacs '(notmuch-search "*") (notmuch-test-wait) (messa= ge (buffer-string))' 2>&1 | sed -e s', =C2=A0*, ,g' -e 's/xxx*/[BLOB]/g') > > + > > +output=3D$(test_emacs '(notmuch-search "*") (notmuch-test-wait) (messa= ge "%s" (buffer-string))' 2>&1 | sed -e s', =C2=A0*, ,g' -e 's/xxx*/[BLOB]/= g') > > =C2=A0test_expect_equal "$output" "$expected" > > > > =C2=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) > > =C2=A0test_expect_equal "$output" "Error: Unexpected output from notmuc= h search: > > =C2=A0Unrecognized option: --this-option-does-not-exist > > =C2=A0End of search results. (process returned 1)" > > -- > > 1.7.5.1 > > > > _______________________________________________ > > notmuch mailing list > > notmuch@notmuchmail.org > > http://notmuchmail.org/mailman/listinfo/notmuch > >