bug#24743: 26.0.50; Testcover does not correctly instrument a macro that uses defun

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

bug#24743: 26.0.50; Testcover does not correctly instrument a macro that uses defun

Gemini Lasswell
Testcover doesn't work on lisp/isearch.el in the Emacs source tree. It
fails on the first use of isearch-define-mode-toggle. I've created a
much simpler example which produces the same error message:

(defmacro my-defun (name &rest body)
  (declare (debug (symbolp def-body)))
  `(defun ,name () ,@body))

(my-defun foo (+ 1 2))

To reproduce the bug:
1. Save the above code as bug.el
2. emacs -Q
3. C-x C-f bug.el RET
4. M-: (require 'testcover) RET
5. M-x testcover-start RET bug.el RET

Result: "Wrong type argument: consp, nil" and foo does not get defined.
(symbol-function #'my-defun) reveals that there is a call to
edebug-after in the definition that did not get replaced by testcover-after.

In GNU Emacs 26.0.50.2 (x86_64-apple-darwin15.6.0, NS appkit-1404.47 Version 10.11.6 (Build 15G1004))
 of 2016-10-19 built on rainbow.local
Repository revision: 911ade134058c633ab9bec75f664d44aa1faaac3
Windowing system distributor 'Apple', version 10.3.1404
Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
testcover
Edebug: my-defun
Eager macro-expansion failure: (wrong-type-argument consp nil) [2 times]
cons: Wrong type argument: consp, nil
Configured using:
 'configure --with-ns --disable-ns-self-contained'

Configured features:
JPEG RSVG IMAGEMAGICK NOTIFY ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS
NS

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Emacs-Lisp

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message subr-x puny seq byte-opt gv
bytecomp byte-compile cl-extra help-mode cconv dired dired-loaddefs
format-spec rfc822 mml mml-sec password-cache epa derived epg epg-config
gnus-util rmail rmail-loaddefs mm-decode mm-bodies mm-encode mail-parse
rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045
ietf-drums mm-util mail-prsvr mail-utils ielm pp comint ansi-color ring
testcover edebug easymenu cl-loaddefs pcase cl-lib time-date mule-util
tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type
mwheel term/ns-win ns-win ucs-normalize term/common-win tool-bar dnd
fontset image regexp-opt fringe tabulated-list newcomment elisp-mode
lisp-mode prog-mode register page menu-bar rfn-eshadow timer select
scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame cl-generic cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932
hebrew greek romanian slovak czech european ethiopic indian cyrillic
chinese charscript case-table epa-hook jka-cmpr-hook help simple abbrev
obarray minibuffer cl-preloaded nadvice loaddefs button faces cus-face
macroexp files text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget hashtable-print-readable backquote kqueue
cocoa ns multi-tty make-network-process emacs)

Memory information:
((conses 16 212236 12367)
 (symbols 48 20872 0)
 (miscs 40 58 213)
 (strings 32 20332 5553)
 (string-bytes 1 648497)
 (vectors 16 35663)
 (vector-slots 8 676706 4164)
 (floats 8 180 171)
 (intervals 56 257 0)
 (buffers 976 13))



Reply | Threaded
Open this post in threaded view
|

bug#24743: 26.0.50; Testcover does not correctly instrument a macro that uses defun

Gemini Lasswell
I've found several other macros in Emacs that cause the "Wrong type
argument: consp, nil" error after you use testcover-start on the files
they are defined in, because testcover is leaving edebug-before and
edebug-after in the definition:

let-alist
mail-source-bind
mail-source-bind-common
hfy-save-buffer-state
menu-bar-make-toggle
math-defcache
viper-test-com-defun

All of these are macros but not all of them use defun.




Reply | Threaded
Open this post in threaded view
|

bug#24743: 26.0.50; Testcover does not correctly instrument a macro that uses defun

Gemini Lasswell
In reply to this post by Gemini Lasswell
Fixed in master, by the patch applied for bug#25316.