GNU bug report logs - #25471
26.0.50; Edebug and Testcover give incorrect code coverage results for code that uses 'unknown

Previous Next

Package: emacs;

Reported by: Gemini Lasswell <gazally <at> runbox.com>

Date: Tue, 17 Jan 2017 21:26:02 UTC

Severity: normal

Tags: fixed

Found in version 26.0.50

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Gemini Lasswell <gazally <at> runbox.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 26.0.50;
 Edebug and Testcover give incorrect code coverage results for code
 that uses 'unknown
Date: Tue, 17 Jan 2017 13:24:11 -0800
If you use Edebug or Testcover to gather code coverage information on
code which uses the symbol `unknown', you will get incorrect code
coverage results, because Edebug uses `unknown' internally to represent
forms which have never been evaluated under Edebug.

`unknown' is an obvious name for a Lisp symbol and is used in the Emacs
sources in cedet, calc, cus-edit, elint, erc, gnus and several other
places.

For an example of incorrect code coverage, save this function definition
in a file called bug.el:

(defun how-do-i-know-you (name)
  (let ((val 'unknown))
    (when (equal name "Bob")
      (setq val 'known))
    val))

And then use:

M-x testcover-start RET bug.el RET
M-: (how-do-i-know-you "Liz") RET
M-x testcover-mark-all RET RET

The result will be red splotches on the last line of how-do-i-know-you
indicating that Testcover thinks it was never executed.

This could be very simply fixed by changing Edebug to use
`edebug-unknown' instead. The other symbols currently used to record
code coverage are `1value' and `ok-coverage', and they could be changed
respectively to `testcover-1value' and `edebug-ok-coverage'. edebug.el
and testcover.el still wouldn't be able to do code coverage on
themselves, but they should then work for everybody else.




This bug report was last modified 4 years and 109 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.