From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Gerd =?UTF-8?Q?M=C3=B6llmann?= Newsgroups: gmane.emacs.bugs Subject: bug#50629: 28.0.50; hard to debug an uncaught error with ert Date: Fri, 26 Aug 2022 15:52:47 +0200 Message-ID: References: <15445.1631834888@alto> <87pmgncjvg.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13024"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (darwin) Cc: 50629@debbugs.gnu.org, Mike Kupfer To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Aug 26 15:58:44 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oRZrA-0003BS-PT for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 26 Aug 2022 15:58:44 +0200 Original-Received: from localhost ([::1]:39910 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oRZr9-0003kc-TL for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 26 Aug 2022 09:58:43 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39856) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oRZle-0006jx-Sa for bug-gnu-emacs@gnu.org; Fri, 26 Aug 2022 09:53:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:34783) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oRZle-0000gU-Jz for bug-gnu-emacs@gnu.org; Fri, 26 Aug 2022 09:53:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oRZle-0003uo-G4 for bug-gnu-emacs@gnu.org; Fri, 26 Aug 2022 09:53:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Gerd =?UTF-8?Q?M=C3=B6llmann?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 26 Aug 2022 13:53:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50629 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: moreinfo Original-Received: via spool by 50629-submit@debbugs.gnu.org id=B50629.166152197815039 (code B ref 50629); Fri, 26 Aug 2022 13:53:02 +0000 Original-Received: (at 50629) by debbugs.gnu.org; 26 Aug 2022 13:52:58 +0000 Original-Received: from localhost ([127.0.0.1]:52765 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oRZlZ-0003uV-PA for submit@debbugs.gnu.org; Fri, 26 Aug 2022 09:52:58 -0400 Original-Received: from mail-ej1-f44.google.com ([209.85.218.44]:42939) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oRZlY-0003uD-8H for 50629@debbugs.gnu.org; Fri, 26 Aug 2022 09:52:56 -0400 Original-Received: by mail-ej1-f44.google.com with SMTP id p16so167516ejb.9 for <50629@debbugs.gnu.org>; Fri, 26 Aug 2022 06:52:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc; bh=R3/uPoiRFXFt/f2yiejOPgrOFngfL5Ktc64c0xH2HUo=; b=G9Gh1oeN8+H9k7P+WdQo7dCM7+IcnlyXLMbRlCkhRABFawEqAmbBC9kew4QtrUq361 VSCF9oh2IZ2m8tfflr17NU8ILqVBvloIIaV1AnrBiUdfPWIaZkHkpwuuFoGOMAcjTe5N tirh3sQPEya2oExwhWAYPEMJ3YF7RvUu0O0pe19vsJL4jh04FeBcyrtvBPVKnfgHoNcb AhVbc3Kjw8G28uo7LHTsYFS2lyQY9SL/YSKoUaptQr5Mi4hAiFGsbRcwzVq9lwBEkSRb 15P6cCQ6LYtvZCfUsxmDvWWIuK6ZQgyLerTvwokotzGAmOxm2DkfvadsP4K8tWYp6Ewd fvqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc; bh=R3/uPoiRFXFt/f2yiejOPgrOFngfL5Ktc64c0xH2HUo=; b=I8j5Q1KjkK1MgCDA4U9CqrHf+Uf/MBUgd9sLwL01zdKNBnVjKGdw97kDlcnAON0OPL McGBIBfBMb12ixZ48dNF2GLmBuRdcQ3QJfgh+1IFbUYYBXp0Ppl72I//b3AidqjQd13O Evb08J/AK/ufRJlV5ncpHcQhbXKC3bMc8iMoT1OrHTH2FXaGCYfSpFCsgqUfnIGCqVAh iRwpIfuiV1AtyLFtVXRfsq+sBHVgqS21L7QIZrUVV3b6mTZmOyQLVt2FBbQCSM1Jr63+ c/jybwGYWnoFzlBl8qL/GJTyM0Bq8w6O1jkOzPGLMPVqsL2pBBesMy7RHoBxS0VAcOaF PuEA== X-Gm-Message-State: ACgBeo0hzc1qGhdIdz086ZAvZX97Xm+Pwv3i/iUg9XOzH4i3wGSlV/yT AEvoq82xoVZP8SI+869bklV02vtdfmzKXw== X-Google-Smtp-Source: AA6agR735VRS9mTe7QQXG0aWECXxPIedXgSh7qwOLMeviat3+lSx2LOD1Jh8Ojz1EfILUtA8l/pEoQ== X-Received: by 2002:a17:906:d550:b0:733:8e1a:f7 with SMTP id cr16-20020a170906d55000b007338e1a00f7mr5769934ejc.580.1661521969734; Fri, 26 Aug 2022 06:52:49 -0700 (PDT) Original-Received: from Mini.fritz.box (pd9e36414.dip0.t-ipconnect.de. [217.227.100.20]) by smtp.gmail.com with ESMTPSA id w20-20020a05640234d400b00447c2c1b9a0sm1315776edc.91.2022.08.26.06.52.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Aug 2022 06:52:49 -0700 (PDT) In-Reply-To: <87pmgncjvg.fsf@gnus.org> (Lars Ingebrigtsen's message of "Fri, 26 Aug 2022 13:41:23 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:240839 Archived-At: Lars Ingebrigtsen writes: > Mike Kupfer writes: > >> Knowing that error "bar" was raised is helpful, but in a more realistic >> test scenario, it can take some time to figure out where the error was >> raised. Setting debug-on-error to t doesn't help (does ert hijack the >> normal error handling mechanisms?). > > (I'm going through old bug reports that unfortunately weren't resolved > at the time.) > > I'm not that familiar with ert internals, but yes, I think that's > basically what ert does -- it hijacks the error/debug reporting system > to implement the `should' macros. > > I've briefly poked at this now, but without any success in getting > better backtraces for actual errors (which would indeed be very nice to > have). > > Anybody more familiar with ert.el know how this can be achieved? Not exactly this, I guess, but maybe as source of an idea? diff --git a/lisp/emacs-lisp/ert.el b/lisp/emacs-lisp/ert.el index 047b0069bb..1ffa0b5929 100644 --- a/lisp/emacs-lisp/ert.el +++ b/lisp/emacs-lisp/ert.el @@ -1495,6 +1495,8 @@ ert-run-tests-batch (let ((print-escape-newlines t) (print-level ert-batch-print-level) (print-length ert-batch-print-length)) + (ert--pp-with-indentation-and-newline + (ert-test-result-with-condition-should-forms result)) (ert--pp-with-indentation-and-newline (ert-test-result-with-condition-condition result))) (goto-char (1- (point-max))) leads to output Test f condition: (((should (equal 42 (foo))) :form (signal void-function (bar)))) (void-function bar)