From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Gemini Lasswell Newsgroups: gmane.emacs.bugs Subject: bug#25316: 26.0.50; Bugs in testcover-reinstrument Date: Sat, 31 Dec 2016 16:39:38 -0800 Message-ID: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1483231277 2258 195.159.176.226 (1 Jan 2017 00:41:17 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 1 Jan 2017 00:41:17 +0000 (UTC) To: 25316@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Jan 01 01:41:09 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cNUCx-0007dE-GF for geb-bug-gnu-emacs@m.gmane.org; Sun, 01 Jan 2017 01:41:07 +0100 Original-Received: from localhost ([::1]:45770 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cNUD1-0005ZC-Ao for geb-bug-gnu-emacs@m.gmane.org; Sat, 31 Dec 2016 19:41:11 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37255) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cNUCv-0005Yv-1f for bug-gnu-emacs@gnu.org; Sat, 31 Dec 2016 19:41:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cNUCr-0007GQ-UI for bug-gnu-emacs@gnu.org; Sat, 31 Dec 2016 19:41:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:46394) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cNUCr-0007GA-Qx for bug-gnu-emacs@gnu.org; Sat, 31 Dec 2016 19:41:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cNUCs-0003yT-ER for bug-gnu-emacs@gnu.org; Sat, 31 Dec 2016 19:41:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Gemini Lasswell Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 01 Jan 2017 00:41:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 25316 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.148323121315209 (code B ref -1); Sun, 01 Jan 2017 00:41:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 1 Jan 2017 00:40:13 +0000 Original-Received: from localhost ([127.0.0.1]:33560 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cNUC5-0003xD-Hg for submit@debbugs.gnu.org; Sat, 31 Dec 2016 19:40:13 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:46233) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cNUC3-0003wz-V9 for submit@debbugs.gnu.org; Sat, 31 Dec 2016 19:40:12 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cNUBw-0006td-UM for submit@debbugs.gnu.org; Sat, 31 Dec 2016 19:40:05 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:59071) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cNUBw-0006tF-RC for submit@debbugs.gnu.org; Sat, 31 Dec 2016 19:40:04 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37204) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cNUBv-0005Sn-FT for bug-gnu-emacs@gnu.org; Sat, 31 Dec 2016 19:40:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cNUBs-0006rJ-Bw for bug-gnu-emacs@gnu.org; Sat, 31 Dec 2016 19:40:03 -0500 Original-Received: from aibo.runbox.com ([91.220.196.211]:58095) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cNUBs-0006qD-4b for bug-gnu-emacs@gnu.org; Sat, 31 Dec 2016 19:40:00 -0500 Original-Received: from [10.9.9.211] (helo=mailfront11.runbox.com) by bars.runbox.com with esmtp (Exim 4.71) (envelope-from ) id 1cNUBo-0007S2-Vz for bug-gnu-emacs@gnu.org; Sun, 01 Jan 2017 01:39:57 +0100 Original-Received: from c-24-22-244-161.hsd1.wa.comcast.net ([24.22.244.161] helo=rainbow.local) by mailfront11.runbox.com with esmtpsa (uid:179284 ) (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) id 1cNUBZ-00048I-OR for bug-gnu-emacs@gnu.org; Sun, 01 Jan 2017 01:39:42 +0100 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.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" Xref: news.gmane.org gmane.emacs.bugs:127649 Archived-At: I'm working on tests for testcover.el and a refactoring of testcover-reinstrument to use pcase. In the process I've found these bugs. The refactoring will fix these as well as make testcover-reinstrument easier to read and modify. Since testcover-start requires the code it works on to be saved in a file, the instructions to reproduce the bugs below all assume that you have saved the code snippet given in a file called bug.el. If you are running Emacs 25 and testcover-start doesn't work, load it with this: M-: (require 'testcover) RET I've reproduced all of these using emacs -Q. 1. Wrapping forms in 1value suppresses more splotches than it should. (defun my-bug (num) (1value (- num num (- num 3) (* num -1) 3))) To reproduce: M-x testcover-start RET bug.el RET M-: (my-bug 5) RET M-x testcover-mark-all RET RET Result: The form (- num 3) does not have the tan splotch that it should have. (* num -1) does get a splotch. 2. Testcover splotches backquoted expressions containing only constants. (defconst my-const "apples") (defun my-bug () `(,my-const "oranges")) To reproduce: M-x testcover-start RET bug.el RET M-: (my-bug) RET M-x testcover-mark-all RET RET Result: The form `(,my-const "oranges") has a tan splotch. But since it will always evaluate to ("apples" "oranges"), Testcover should mark it as 1value and not splotch it. 3. Testcover fails to reinstrument inside vectors and backquoted vectors. (defun my-bug (a b c) `[,a ,(list b c)]) (defmacro my-nth-case (arg vec) (declare (indent 1) (debug (form (vector &rest form)))) `(eval (aref ,vec ,arg))) (defun my-bug-2 (choice val) (my-nth-case choice [(+ 1 val) (- 1 val) (* 7 val) (/ 4 val)])) To reproduce: M-x testcover-start RET bug.el RET Followed by either one of these: M-: (my-bug 1 2 3) RET M-: (my-bug-2 2 6) RET Result in both cases: void-variable edebug-freq-count or wrong-type-argument consp nil depending on if you are running the current master or not. The errors happen in an edebug-after that did not get replaced by a testcover-after. 4. Testcover incorrectly parses quoted forms within backquotes. (defun my-make-list () (list 'defun 'defvar)) (defmacro my-bq-macro (fun) (declare (debug (symbolp))) `(memq ,fun '(defconst ,@(my-make-list)))) (defun my-use-bq-macro (fun) (my-bq-macro fun)) To reproduce: M-x testcover-start RET bug.el RET Result: void-variable edebug-freq-count or wrong-type-argument consp nil, another error from an edebug-after not replaced during reinstrumentation. C-h v testcover-module-constants RET will show that testcover was trying to reinstrument the list beginning with defconst as a top-level form. 5. Testcover doesn't correctly reinstrument code matching an Edebug spec containing a quote. See c-make-font-lock-search-function for an example of an Edebug spec containing a quote in the Emacs sources. (defun my-make-function (forms) `(lambda (flag) (if flag 0 ,@forms))) (def-edebug-spec my-make-function (("quote" (&rest def-form)))) (defun my-thing () (my-make-function '((+ 1 (+ 2 (+ 3 (+ 4 5))))))) (defun my-use-thing () (funcall (my-thing) nil)) To reproduce: M-x testcover-start RET bug.el RET M-: (my-use-thing) RET Result: Emacs will give you the debugger prompt inside the definition of my-thing, because an edebug-enter didn't get changed to a testcover-enter in the instrumentation.