Subject: bug#40434: 27.0.90; Can't run ERT tests for edebugged generator functions

From: Philipp Stephani <[email-masked]>
Date: Sat, 04 Apr 2020 18:57:37 +0200

Insert into *scratch*:

(require 'generator)
(require 'ert)
(iter-defun foo () (iter-yield 123))
(ert-deftest foo () (should (equal (iter-next (foo)) 123)))

Evaluate the first two forms.  Edebug the third form (C-u C-M-x).
Evaluate the fourth form.  Then run the test using M-x ert RET RET.
The test will reach `foo', then just hit space to continue.  The test
will then fail with

F foo
    (void-function cps-internal-yield)

Backtrace:

Backtrace for test ‘foo’:
  signal(void-function (cps-internal-yield))
  apply(signal (void-function (cps-internal-yield)))
  (setq value-18 (apply fn-16 args-17))
  (unwind-protect (setq value-18 (apply fn-16 args-17)) (setq form-description-20 (nconc (list '(should (equal (iter-next ...) 123))) (list :form (cons fn-16 args-17)) (if (eql value-18 'ert-form-evaluation-aborted-19) nil (list :value value-18)) (let ((-explainer- (and (symbolp ...) (get ... ...)))) (if -explainer- (progn (list :explanation (apply -explainer- args-17))))))) (ert--signal-should-execution form-description-20))
  (if (unwind-protect (setq value-18 (apply fn-16 args-17)) (setq form-description-20 (nconc (list '(should (equal ... 123))) (list :form (cons fn-16 args-17)) (if (eql value-18 'ert-form-evaluation-aborted-19) nil (list :value value-18)) (let ((-explainer- (and ... ...))) (if -explainer- (progn (list :explanation ...)))))) (ert--signal-should-execution form-description-20)) nil (ert-fail form-description-20))
  (let (form-description-20) (if (unwind-protect (setq value-18 (apply fn-16 args-17)) (setq form-description-20 (nconc (list '(should ...)) (list :form (cons fn-16 args-17)) (if (eql value-18 'ert-form-evaluation-aborted-19) nil (list :value value-18)) (let ((-explainer- ...)) (if -explainer- (progn ...))))) (ert--signal-should-execution form-description-20)) nil (ert-fail form-description-20)))
  (let ((value-18 'ert-form-evaluation-aborted-19)) (let (form-description-20) (if (unwind-protect (setq value-18 (apply fn-16 args-17)) (setq form-description-20 (nconc (list '...) (list :form (cons fn-16 args-17)) (if (eql value-18 ...) nil (list :value value-18)) (let (...) (if -explainer- ...)))) (ert--signal-should-execution form-description-20)) nil (ert-fail form-description-20))) value-18)
  (let* ((fn-16 #'equal) (args-17 (condition-case err (let ((signal-hook-function #'ert--should-signal-hook)) (list (iter-next (foo)) 123)) (error (progn (setq fn-16 #'signal) (list (car err) (cdr err))))))) (let ((value-18 'ert-form-evaluation-aborted-19)) (let (form-description-20) (if (unwind-protect (setq value-18 (apply fn-16 args-17)) (setq form-description-20 (nconc (list ...) (list :form ...) (if ... nil ...) (let ... ...))) (ert--signal-should-execution form-description-20)) nil (ert-fail form-description-20))) value-18))
  (closure (t) nil (let* ((fn-16 #'equal) (args-17 (condition-case err (let ((signal-hook-function ...)) (list (iter-next ...) 123)) (error (progn (setq fn-16 ...) (list ... ...)))))) (let ((value-18 'ert-form-evaluation-aborted-19)) (let (form-description-20) (if (unwind-protect (setq value-18 (apply fn-16 args-17)) (setq form-description-20 (nconc ... ... ... ...)) (ert--signal-should-execution form-description-20)) nil (ert-fail form-description-20))) value-18)))()
  ert--run-test-internal(#s(ert--test-execution-info :test #s(ert-test :name foo :documentation nil :body (closure (t) nil (let* ... ...)) :most-recent-result #s(ert-test-failed :messages "\n" :should-forms (...) :duration 1.045761238 :condition (void-function cps-internal-yield) :backtrace (... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...) :infos nil) :expected-result-type :passed :tags nil) :result #s(ert-test-failed :messages "\n" :should-forms ((... :form ... :explanation ...)) :duration 1.045761238 :condition (void-function cps-internal-yield) :backtrace (#s(backtrace-frame :evald t :fun signal :args ... :flags nil :locals ... :buffer nil :pos nil) #s(backtrace-frame :evald t :fun apply :args ... :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald nil :fun setq :args ... :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald nil :fun unwind-protect :args ... :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald nil :fun if :args ... :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald nil :fun let :args ... :flags nil :locals ... :buffer nil :pos nil) #s(backtrace-frame :evald nil :fun let :args ... :flags nil :locals ... :buffer nil :pos nil) #s(backtrace-frame :evald nil :fun let* :args ... :flags nil :locals ... :buffer nil :pos nil) #s(backtrace-frame :evald t :fun ... :args nil :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald t :fun ert--run-test-internal :args #0 :flags nil :locals ... :buffer nil :pos nil) #s(backtrace-frame :evald t :fun ert-run-test :args ... :flags nil :locals ... :buffer nil :pos nil) #s(backtrace-frame :evald t :fun ert-run-or-rerun-test :args ... :flags nil :locals ... :buffer nil :pos nil) #s(backtrace-frame :evald t :fun ert-run-tests :args ... :flags nil :locals ... :buffer nil :pos nil) #s(backtrace-frame :evald t :fun ert :args ... :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald t :fun funcall-interactively :args ... :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald t :fun call-interactively :args ... :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald t :fun command-execute :args ... :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald t :fun execute-extended-command :args ... :flags nil :locals ... :buffer nil :pos nil) #s(backtrace-frame :evald t :fun funcall-interactively :args ... :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald t :fun call-interactively :args ... :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald t :fun command-execute :args ... :flags nil :locals nil :buffer nil :pos nil)) :infos nil) :exit-continuation #f(compiled-function () #<bytecode 0x15560c3e9c8d>) :next-debugger debug :ert-debug-on-error nil))
  ert-run-test(#s(ert-test :name foo :documentation nil :body (closure (t) nil (let* ((fn-16 #'equal) (args-17 (condition-case err ... ...))) (let ((value-18 ...)) (let (form-description-20) (if ... nil ...)) value-18))) :most-recent-result #s(ert-test-failed :messages "\n" :should-forms (((should (equal ... 123)) :form (signal void-function (cps-internal-yield)) :explanation (different-types void-function (cps-internal-yield)))) :duration 1.045761238 :condition (void-function cps-internal-yield) :backtrace (#s(backtrace-frame :evald t :fun signal :args (void-function (cps-internal-yield)) :flags nil :locals ((debugger-may-continue . t) (inhibit-redisplay) (inhibit-debugger . t) (inhibit-changing-match-data)) :buffer nil :pos nil) #s(backtrace-frame :evald t :fun apply :args (signal (void-function ...)) :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald nil :fun setq :args (value-18 (apply fn-16 args-17)) :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald nil :fun unwind-protect :args ((setq value-18 ...) (setq form-description-20 ...) (ert--signal-should-execution form-description-20)) :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald nil :fun if :args ((unwind-protect ... ... ...) nil (ert-fail form-description-20)) :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald nil :fun let :args ((form-description-20) (if ... nil ...)) :flags nil :locals ((fn-16 . signal) (args-17 void-function ...) (value-18 . ert-form-evaluation-aborted-19) (form-description-20)) :buffer nil :pos nil) #s(backtrace-frame :evald nil :fun let :args ((...) (let ... ...) value-18) :flags nil :locals ((fn-16 . signal) (args-17 void-function ...) (value-18 . ert-form-evaluation-aborted-19)) :buffer nil :pos nil) #s(backtrace-frame :evald nil :fun let* :args ((... ...) (let ... ... value-18)) :flags nil :locals ((fn-16 . signal) (args-17 void-function ...)) :buffer nil :pos nil) #s(backtrace-frame :evald t :fun (closure (t) nil (let* ... ...)) :args nil :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald t :fun ert--run-test-internal :args (#s(ert--test-execution-info :test #1 :result #2 :exit-continuation #f(compiled-function () #<bytecode 0x15560c3e9c8d>) :next-debugger debug :ert-debug-on-error nil)) :flags nil :locals ((ert--infos) (debug-ignored-errors) (debug-on-quit . t) (debug-on-error . t) (debugger . #f(compiled-function (&rest args) #<bytecode 0x15560c24f14d>))) :buffer nil :pos nil) #s(backtrace-frame :evald t :fun ert-run-test :args #0 :flags nil :locals ((ert--running-tests #1) (message-log-max . t) (ert--should-execution-observer . #f(compiled-function (form-description) #<bytecode 0x15560c2547f1>))) :buffer nil :pos nil) #s(backtrace-frame :evald t :fun ert-run-or-rerun-test :args (#s(ert--stats :selector t :tests ... :test-map #<hash-table eql 1/1 0x15560c4f68ad> :test-results ... :test-start-times ... :test-end-times ... :passed-expected 0 :passed-unexpected 0 :failed-expected 0 :failed-unexpected 1 :skipped 0 :start-time ... :end-time ... :aborted-p nil :current-test nil :next-redisplay 1586019421.4940612) #1 #f(compiled-function (event-type &rest event-args) #<bytecode 0x15560c4f68a1>)) :flags nil :locals ((ert--current-run-stats . ...)) :buffer nil :pos nil) #s(backtrace-frame :evald t :fun ert-run-tests :args (t #f(compiled-function (event-type &rest event-args) #<bytecode 0x15560c4f68a1>) t) :flags nil :locals ((ert--current-run-stats . ...)) :buffer nil :pos nil) #s(backtrace-frame :evald t :fun ert :args (t nil) :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald t :fun funcall-interactively :args (ert t nil) :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald t :fun call-interactively :args (ert record nil) :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald t :fun command-execute :args (ert record) :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald t :fun execute-extended-command :args (nil "ert" "ert") :flags nil :locals ((prefix-arg)) :buffer nil :pos nil) #s(backtrace-frame :evald t :fun funcall-interactively :args (execute-extended-command nil "ert" "ert") :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald t :fun call-interactively :args (execute-extended-command nil nil) :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald t :fun command-execute :args (execute-extended-command) :flags nil :locals nil :buffer nil :pos nil)) :infos nil) :expected-result-type :passed :tags nil))
  ert-run-or-rerun-test(#s(ert--stats :selector t :tests [#s(ert-test :name foo :documentation nil :body (closure ... nil ...) :most-recent-result #s(ert-test-failed :messages "\n" :should-forms ... :duration 1.045761238 :condition ... :backtrace ... :infos nil) :expected-result-type :passed :tags nil)] :test-map #<hash-table eql 1/1 0x15560c4f68ad> :test-results [#s(ert-test-failed :messages "\n" :should-forms (...) :duration 1.045761238 :condition (void-function cps-internal-yield) :backtrace (... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...) :infos nil)] :test-start-times [(24200 48220 301586 645000)] :test-end-times [(24200 48221 347347 883000)] :passed-expected 0 :passed-unexpected 0 :failed-expected 0 :failed-unexpected 1 :skipped 0 :start-time (24200 48220 161306 299000) :end-time (24200 48221 385475 311000) :aborted-p nil :current-test nil :next-redisplay 1586019421.4940612) #s(ert-test :name foo :documentation nil :body (closure (t) nil (let* (... ...) (let ... ... value-18))) :most-recent-result #s(ert-test-failed :messages "\n" :should-forms ((... :form ... :explanation ...)) :duration 1.045761238 :condition (void-function cps-internal-yield) :backtrace (#s(backtrace-frame :evald t :fun signal :args ... :flags nil :locals ... :buffer nil :pos nil) #s(backtrace-frame :evald t :fun apply :args ... :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald nil :fun setq :args ... :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald nil :fun unwind-protect :args ... :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald nil :fun if :args ... :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald nil :fun let :args ... :flags nil :locals ... :buffer nil :pos nil) #s(backtrace-frame :evald nil :fun let :args ... :flags nil :locals ... :buffer nil :pos nil) #s(backtrace-frame :evald nil :fun let* :args ... :flags nil :locals ... :buffer nil :pos nil) #s(backtrace-frame :evald t :fun ... :args nil :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald t :fun ert--run-test-internal :args ... :flags nil :locals ... :buffer nil :pos nil) #s(backtrace-frame :evald t :fun ert-run-test :args ... :flags nil :locals ... :buffer nil :pos nil) #s(backtrace-frame :evald t :fun ert-run-or-rerun-test :args #0 :flags nil :locals ... :buffer nil :pos nil) #s(backtrace-frame :evald t :fun ert-run-tests :args ... :flags nil :locals ... :buffer nil :pos nil) #s(backtrace-frame :evald t :fun ert :args ... :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald t :fun funcall-interactively :args ... :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald t :fun call-interactively :args ... :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald t :fun command-execute :args ... :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald t :fun execute-extended-command :args ... :flags nil :locals ... :buffer nil :pos nil) #s(backtrace-frame :evald t :fun funcall-interactively :args ... :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald t :fun call-interactively :args ... :flags nil :locals nil :buffer nil :pos nil) #s(backtrace-frame :evald t :fun command-execute :args ... :flags nil :locals nil :buffer nil :pos nil)) :infos nil) :expected-result-type :passed :tags nil) #f(compiled-function (event-type &rest event-args) #<bytecode 0x15560c4f68a1>))
  ert-run-tests(t #f(compiled-function (event-type &rest event-args) #<bytecode 0x15560c4f68a1>) t)
  ert(t nil)
  funcall-interactively(ert t nil)
  call-interactively(ert record nil)
  command-execute(ert record)
  execute-extended-command(nil "ert" "ert")
  funcall-interactively(execute-extended-command nil "ert" "ert")
  call-interactively(execute-extended-command nil nil)
  command-execute(execute-extended-command)

In GNU Emacs 27.0.90 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.12)
 of 2020-04-03
Repository revision: fa823653ffb0e3e893d30daa5abf68e909934e2e
Repository branch: emacs-27
Windowing system distributor 'The X.Org Foundation', version 11.0.12004000
System Description: Debian GNU/Linux rodete

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.

Configured using:
 'configure --enable-gcc-warnings=warn-only
 --enable-gtk-deprecation-warnings --without-pop --with-mailutils
 --enable-checking --enable-check-lisp-object-type --with-modules
 'CFLAGS=-O0 -ggdb3''

Configured features:
XPM JPEG TIFF GIF PNG SOUND DBUS GSETTINGS GLIB NOTIFY INOTIFY
LIBSELINUX GNUTLS FREETYPE HARFBUZZ XFT ZLIB TOOLKIT_SCROLL_BARS GTK3
X11 XDBE XIM MODULES THREADS PDUMPER GMP

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

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  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 rmc dired dired-loaddefs
format-spec rfc822 mml easymenu mml-sec epa epg epg-config gnus-util
rmail rmail-loaddefs text-property-search time-date mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail
rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils phst skeleton
derived edmacro kmacro pcase ffap thingatpt url-parse auth-source cl-seq
eieio eieio-core cl-macs eieio-loaddefs password-cache json map url-vars
subr-x rx gnutls puny seq byte-opt gv bytecomp byte-compile cconv dbus
xml cl-loaddefs cl-lib tooltip eldoc electric uniquify ediff-hook
vc-hooks lisp-float-type mwheel term/x-win x-win term/common-win x-dnd
tool-bar dnd fontset image regexp-opt fringe tabulated-list replace
newcomment text-mode elisp-mode lisp-mode prog-mode register page
tab-bar menu-bar rfn-eshadow isearch timer select scroll-bar mouse
jit-lock font-lock syntax facemenu font-core term/tty-colors frame
minibuffer 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
composite charscript charprop case-table epa-hook jka-cmpr-hook help
simple abbrev obarray 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
threads dbusbind inotify dynamic-setting system-font-setting
font-render-setting move-toolbar gtk x-toolkit x multi-tty
make-network-process emacs)

Memory information:
((conses 16 60656 8398)
 (symbols 48 8240 1)
 (strings 32 21019 1859)
 (string-bytes 1 684594)
 (vectors 16 12144)
 (vector-slots 8 169116 5888)
 (floats 8 25 25)
 (intervals 56 202 0)
 (buffers 1000 12))

-- 
Google Germany GmbH
Erika-Mann-Straße 33
80636 München

Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg
Geschäftsführer: Paul Manicle, Halimah DeLaine Prado

If you received this communication by mistake, please don’t forward it to
anyone else (it may contain confidential or privileged information), please
erase all copies of it, including all attachments, and please let the sender
know it went to the wrong person.  Thanks.