From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id QLJzCOveK2EXRgEAgWs5BA (envelope-from ) for ; Sun, 29 Aug 2021 21:24:27 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id UFLmA+veK2E4HAAAbx9fmQ (envelope-from ) for ; Sun, 29 Aug 2021 19:24:27 +0000 Received: from mail.notmuchmail.org (nmbug.tethera.net [IPv6:2607:5300:201:3100::1657]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id B3C511922B for ; Sun, 29 Aug 2021 21:24:26 +0200 (CEST) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 0809220500; Sun, 29 Aug 2021 15:24:04 -0400 (EDT) Received: from fethera.tethera.net (fethera.tethera.net [IPv6:2607:5300:60:c5::1]) by mail.notmuchmail.org (Postfix) with ESMTP id 2EC151FB7C for ; Sun, 29 Aug 2021 15:23:58 -0400 (EDT) Received: by fethera.tethera.net (Postfix, from userid 1001) id 266165FD5C; Sun, 29 Aug 2021 15:23:58 -0400 (EDT) Received: (nullmailer pid 4192479 invoked by uid 1000); Sun, 29 Aug 2021 19:23:39 -0000 From: David Bremner To: David Bremner , Tomi Ollila , Matt Armstrong , notmuch@notmuchmail.org Subject: [PATCH 1/9] test/emacs: provide macro test-log-error Date: Sun, 29 Aug 2021 12:23:27 -0700 Message-Id: <20210829192335.4192305-2-david@tethera.net> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210829192335.4192305-1-david@tethera.net> References: <87tvgqzq1o.fsf@tethera.net> <20210829192335.4192305-1-david@tethera.net> MIME-Version: 1.0 Message-ID-Hash: 2Q2MZUZ44IWO7METRE2VW5DJQWJP3JZV X-Message-ID-Hash: 2Q2MZUZ44IWO7METRE2VW5DJQWJP3JZV X-MailFrom: bremner@tethera.net X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.1 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1630265066; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=tEpyxaZvmjASvUMcmz6LvjFsD+IrcQ6e9KniVccLZt0=; b=fqWOSl8KV8N53VB4/OHW6/VXOOnC0/P8DV4pFsEkk6q6dSZZJ6toW3xP9wmvBfn1cAlAh3 JULV1XQzUI9RABnX9k2fxuxNpljmkGZLuaA02GQPsW0Q5oubL1ENumlPrWDiAtUr3FYah9 LaYETDKXuA+cyZMQhLq9Gxn/pAbpwXWK/4zyI4WWCDHTnb60QMdvaXV3vKz7bKAEDfCGlp 2RngH/vcpNiN/ouE1bu5IEMovvvgfKU+qO4aKTR4Zzceatc3wnLuMKAvy8l7Ra4Gl5KkAy c3ejOJFg1Z8cfCAbPOcrPcFNZX6IIHN5zfFNxWC9XezPFi3tPCUUv9UXM/4VSA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1630265066; a=rsa-sha256; cv=none; b=iNsrg35wnULR8mmIdK52540+Yc8s4w1kBw8boLXgehUb8gugAUQZg4zVugvIJQBI48TzuH S/1Xbs/15nr+AgsuHjA6BUnAKNqGKQSmnhvExxeNDLBIV9A/C6fg6isbrH03jDEiLPNHAl EkuixW3L3FvwIvSz6scHo287OFSXpDZOStrnawktGBaCE89TftQGqXSxUk+HIYYMWhyAAU cmM0p9FujRPl2ZEb+YYRX+sKlcyOs5pfDZlnNedszjQZ3QLvfsm6jtV+fLHQP5ApwTLK8p gFeUGEzAPBttF6zNniv/v6yNONmvRZPT2HW0VGeWBXW7bqsAX2Vf2JvO84PseA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2607:5300:201:3100::1657 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Spam-Score: -0.99 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2607:5300:201:3100::1657 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: B3C511922B X-Spam-Score: -0.99 X-Migadu-Scanner: scn0.migadu.com X-TUID: umMloa3xJ9A5 Because of the way emacs reports errors, a test form can crash and not change the main buffer. To work around this, capture both signalled errors and any other messages. --- test/test-lib.el | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/test-lib.el b/test/test-lib.el index 32d53736..e12034c3 100644 --- a/test/test-lib.el +++ b/test/test-lib.el @@ -159,6 +159,18 @@ running, quit if it terminated." (lambda (x) `(prog1 ,x (notmuch-post-command))) body))) +;; Log any signalled error (and other messages) to MESSAGES +;; Log "COMPLETE" if forms complete without error. +(defmacro test-log-error (&rest body) + `(progn + (with-current-buffer "*Messages*" + (let ((inhibit-read-only t)) (erase-buffer))) + (condition-case err + (progn ,@body + (message "COMPLETE")) + (t (message "%s" err))) + (with-current-buffer "*Messages*" (test-output "MESSAGES")))) + ;; For historical reasons, we hide deleted tags by default in the test ;; suite (setq notmuch-tag-deleted-formats -- 2.33.0