From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Christian Ohler Newsgroups: gmane.emacs.bugs Subject: bug#11218: with-demoted-errors use of condition-case-unless-debug; ert Date: Fri, 20 Apr 2012 14:02:39 -0700 Message-ID: <4F91CEEF.20305@gnu.org> References: <4F8DE112.5010106@gnu.org> <4F90D369.7070005@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1334955827 26378 80.91.229.3 (20 Apr 2012 21:03:47 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 20 Apr 2012 21:03:47 +0000 (UTC) Cc: 11218@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Apr 20 23:03:46 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1SLKzU-0004qL-P9 for geb-bug-gnu-emacs@m.gmane.org; Fri, 20 Apr 2012 23:03:41 +0200 Original-Received: from localhost ([::1]:36922 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SLKzU-0002nk-5p for geb-bug-gnu-emacs@m.gmane.org; Fri, 20 Apr 2012 17:03:40 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:35859) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SLKzR-0002nW-Sz for bug-gnu-emacs@gnu.org; Fri, 20 Apr 2012 17:03:39 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SLKzQ-0008Ii-1e for bug-gnu-emacs@gnu.org; Fri, 20 Apr 2012 17:03:37 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:43697) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SLKzP-0008Ie-UM for bug-gnu-emacs@gnu.org; Fri, 20 Apr 2012 17:03:35 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1SLKzp-0006Vh-No for bug-gnu-emacs@gnu.org; Fri, 20 Apr 2012 17:04:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Christian Ohler Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 20 Apr 2012 21:04:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 11218 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 11218-submit@debbugs.gnu.org id=B11218.133495579224965 (code B ref 11218); Fri, 20 Apr 2012 21:04:01 +0000 Original-Received: (at 11218) by debbugs.gnu.org; 20 Apr 2012 21:03:12 +0000 Original-Received: from localhost ([127.0.0.1]:44731 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SLKz2-0006Uc-1g for submit@debbugs.gnu.org; Fri, 20 Apr 2012 17:03:12 -0400 Original-Received: from fencepost.gnu.org ([208.118.235.10]:39783 ident=Debian-exim) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SLKyz-0006UV-VV for 11218@debbugs.gnu.org; Fri, 20 Apr 2012 17:03:10 -0400 Original-Received: from [2620:0:1002:1009:e2f8:47ff:fe38:3bc8] (port=52984 helo=dhcp-172-31-155-154.sfo.corp.google.com) by fencepost.gnu.org with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1SLKyY-0000AQ-5L; Fri, 20 Apr 2012 17:02:42 -0400 In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 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.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:59332 Archived-At: On 4/20/12 5:13 AM, Stefan Monnier wrote: >>> So the next question is: why does ERT record a backtrace and that extra >>> information provided by ert-info? >> To be able to show them to the user, together with the test failure. If you >> have one or more failing tests, it's much more useful to see the error >> messages and backtraces rather than just the error messages. > > I don't see the point of showing that info when running the tests. > If the user wants that info, he should be able to easily say "run this > test with debug-on-error" so he doesn't only get a backtrace but also > gets put in the debugger where he can inspect the state. ERT's keyboard shortcut for that is "d". But it's not a good solution if: * the test is nondeterministic (maybe due to subprocess interaction), * the test takes a long time to run, * you have multiple failing tests and want to quickly compare if they are crashing in the same place, * ERT is running in batch mode (e.g. make check). It's better to collect as much data as reasonably possible when the error first occurs. >> (ert-deftest foo () >> (with-demoted-errors (error "a")) >> (error "b")) > >> would normally fail with "b", but if we enable debugging to track down why, >> it will fail with "a" instead (with no way to continue execution to get to >> the error we are interested in). > > No: you'll be put in the debugger for the error "a" but if you hit `c' > it will continue and re-enter the debugger for error "b". My Emacs is a few months old, but that doesn't work for me. Has it changed recently? I'm using (defun foo () (with-demoted-errors (error "a")) (error "b")) and typing C-u C-x : ( f o o ) c c and all I find in *Messages* is error: "a" Continue... edebug-signal: a No mention of "b". If `debug-on-error' is t, `with-demoted-errors' becomes essentially equivalent to `progn', and (error "b") can ever be reached in (defun foo () (progn (error "a")) (error "b")) since `error' never returns (and I think that's an important guarantee that the debugger shouldn't violate, at least not without confirmation). Christian.