[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#973393: truncate less of the backtrace during failing ert tests



Sean Whitton <spwhitton@spwhitton.name> writes:

> Hello,
>
> On Mon 26 Feb 2024 at 06:16pm -08, Xiyue Deng wrote:
>
>> Recently when debugging an ERT failure I found that enabling larger
>> backtrace margin by default would be very help.
>
> Hmm, interesting.  Can you show an example where it helps, so I can get
> an idea of what you have in mind?
>

Sure!  As an example, by default ERT output will truncate at 70, which
gives something like:
,----
| Select project: Test test-markdown-ext/wiki-link-rules backtrace:
|   completing-read-default("Select project: " #f(compiled-function (str
|   completing-read("Select project: " #f(compiled-function (string pred
|   project-prompt-project-dir()
|   project-current(t)
|   ...
`----

With the suggested wider margin, this becomes:
,----
| Select project: Test test-markdown-ext/wiki-link-rules backtrace:
|   completing-read-default("Select project: " #f(compiled-function (string pred action) #<bytecode -0x1029a5d55d366b81>) nil t nil nil nil nil)
|   completing-read("Select project: " #f(compiled-function (string pred action) #<bytecode -0x1029a5d55d366b81>) nil t)
|   project-prompt-project-dir()
|   project-current(t)
|   ...
`----

So that you can see the actual arguments to the calls.

(In my patch I took the liberty to set the new margin as 512 (2**9)
instead of 500 as suggested in the wiki, for pure personal hygiene.)

>> I have tested [1] in my fork to be working.  As dh-elpa doesn't enable
>> merge requests, I'd like to gather some reviews/comments here before
>> merging.  TIA!
>
> I'd be grateful if you'd attach patches to BTS mail in the future, for
> inline review.

Ah indeed.  Attached the patch at EOM as an extra reference.

>
> Thanks for looking into this.

:)

-- 
Xiyue Deng

From f9b87fc4857348b327e09513a2286f25b5389f72 Mon Sep 17 00:00:00 2001
From: Xiyue Deng <manphiz@gmail.com>
Date: Mon, 26 Feb 2024 17:23:05 -0800
Subject: [PATCH] Use larger margin in backtrace when ERT tests fail (Closes:
 #973393.)

---
 debian/changelog | 8 ++++++++
 dh_elpa_test     | 1 +
 2 files changed, 9 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 9f30538..ae45ff6 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+dh-elpa (2.1.2) UNRELEASED; urgency=medium
+
+  * Team upload.
+  * Set ert-batch-backtrace-right-margin to 512 to allow meaningful
+    backtrace info when ERT tests fail (Closes: #973393.)
+
+ -- Xiyue Deng <manphiz@gmail.com>  Mon, 26 Feb 2024 17:15:53 -0800
+
 dh-elpa (2.1.1) experimental; urgency=medium
 
   * Remove /usr/share/$flavor/site-lisp/elpa (from emacsen-remove)
diff --git a/dh_elpa_test b/dh_elpa_test
index c2504bf..847cf80 100755
--- a/dh_elpa_test
+++ b/dh_elpa_test
@@ -367,6 +367,7 @@ if (@ert_files) {
     my @args = qw{ emacs -batch -Q -l package };
     push @args, ("--eval", "(add-to-list 'package-directory-list \"$dhelpadir\")");
     push @args, ("--eval", "(add-to-list 'package-directory-list \"$elpadir\")");
+    push @args, ("--eval", "(setq ert-batch-backtrace-right-margin 512)");
     push @args, ("-f", "package-initialize");
 
     # add the user's load-path entries
-- 
2.39.2

Attachment: signature.asc
Description: PGP signature


Reply to: