GNU bug report logs -
#25351
26.0.50; Testcover doesn't work on code that creates simple lists and modifies them
Previous Next
Reported by: Gemini Lasswell <gazally <at> runbox.com>
Date: Wed, 4 Jan 2017 03:07:01 UTC
Severity: normal
Tags: patch
Found in version 26.0.50
Done: Gemini Lasswell <gazally <at> runbox.com>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 25351 in the body.
You can then email your comments to 25351 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#25351
; Package
emacs
.
(Wed, 04 Jan 2017 03:07:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Gemini Lasswell <gazally <at> runbox.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Wed, 04 Jan 2017 03:07:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Testcover marks forms which have only returned a single value while under
code coverage with a tan splotch to indicate insufficient test coverage,
It also identifies forms which will only ever return a single value and
suppresses the splotch on those. During the coverage run, it saves a
reference to the return value of those single value forms, and the next
time the form is evaluated, it uses `equal' to determine if the value
has changed, and if it has, Testcover reports an error.
The problem with this is that it is a common idiom to create a data
structure using an expression that always returns the same thing, and
then modify it later. Since Testcover keeps a reference not a copy, it
ends up with a reference to a modified object, which fails the
comparison with the next return value of the same expression.
For example:
(defun my-blank-record ()
(list (list 'name) (list 'age)))
(defun my-make-record (name age)
(let ((rec (my-blank-record)))
(setf (cdr (assq 'name rec)) name)
(setf (cdr (assq 'age rec)) age)
rec))
(my-make-record "Jack" 10)
(my-make-record "Jill" 12)
To reproduce this problem, save the above code in a file called bug.el,
and then:
M-x testcover-start RET bug.el RET
The result will be testcover-1value's "Value of form marked with
‘1value’ does vary" error.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#25351
; Package
emacs
.
(Tue, 26 Sep 2017 21:06:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 25351 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Here is a patch which fixes this bug by making a copy of the result of
the first evaluation of a form to compare with the results of
subsequent evaluations.
This patch is based on the two patches I sent yesterday to bug#25316.
Because Testcover may encounter circular structures in the code it
instruments, I wrote a modified version of copy-tree which can handle
circular structures. It's possibly generally useful enough to belong
in subr.el alongside copy-tree instead of being an internal Testcover
function, but I will submit that idea as a separate wishlist item.
There isn't currently a version of `equal' which works for circular
structures, so Testcover's handling of them is not fully implemented,
but it now avoids stopping the code under coverage with an error
message.
[0001-Stop-Testcover-from-producing-spurious-1value-errors.patch (text/plain, attachment)]
Added tag(s) patch.
Request was from
Gemini Lasswell <gazally <at> runbox.com>
to
control <at> debbugs.gnu.org
.
(Tue, 26 Sep 2017 21:11:02 GMT)
Full text and
rfc822 format available.
Reply sent
to
Gemini Lasswell <gazally <at> runbox.com>
:
You have taken responsibility.
(Sun, 08 Oct 2017 23:54:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Gemini Lasswell <gazally <at> runbox.com>
:
bug acknowledged by developer.
(Sun, 08 Oct 2017 23:54:02 GMT)
Full text and
rfc822 format available.
Message #15 received at 25351-done <at> debbugs.gnu.org (full text, mbox):
I've pushed this patch to master.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Mon, 06 Nov 2017 12:24:05 GMT)
Full text and
rfc822 format available.
This bug report was last modified 7 years and 228 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.