mistty icon indicating copy to clipboard operation
mistty copied to clipboard

Test suite failures with Emacs 31

Open dcolascione opened this issue 10 months ago • 2 comments

Various tests fail for me on macOS with Emacs 31. mistty itself seems fine.

One failure mode is mitty tests that look at the buffer list, e.g. mistty-command-create-then-cycle, choking on the native compilation buffers Emacs stubbornly creates as a side effect (I think?) of installing native-comp trampolines for native functions the tests shim

Another failure mode is oddly mismatched outputs:

 apply(turtles-io--dispatch (#s(turtles-io-conn :proc (turtles-proces
  timer-event-handler([t 26685 44686 199384 nil turtles-io--dispatch (
Test mistty-test-min-terminal-size condition:
    Buffer: *Test buffer (mistty-test-min-terminal-size)*
    Buffer: *Test buffer (mistty-test-min-terminal-size): grab*
    (ert-test-failed
     ((should
       (equal "$ for i in $(seq 0 10); do echo hello, world; done"
	     (buffer-string)))
      :form
      (equal "$ for i in $(seq 0 10); do echo hello, world; done"
	    #("\n-UUU:--- F1  *scratch*      All   L4     (Lisp Interaction ElDoc) --------------\n\n$ for i in $(seq 0 10); do echo hello, world; done"
	      0 1 (face default) 1 14
	      (face ((:foreground "#333333" :background "#E5E5E5"))) 14
	      26
	      (face
		((:foreground "#333333" :background "#E5E5E5") term-bold))
	      26 81
	      (face ((:foreground "#333333" :background "#E5E5E5"))) 81
	      83 (face default) 83 133 (face (nil))))
      :value nil :explanation
      (string-match "$ for i in $(seq 0 10); do echo hello, world; done"
		   #("\n-UUU:--- F1  *scratch*      All   L4     (Lisp Interaction ElDoc) --------------\n\n$ for i in $(seq 0 10); do echo hello, world; done"
		     0 1 (face default) 1 14
		     (face
		      ((:foreground "#333333" :background "#E5E5E5")))
		     14 26
		     (face
		      ((:foreground "#333333" :background "#E5E5E5")
			term-bold))
		     26 81
		     (face
		      ((:foreground "#333333" :background "#E5E5E5")))
		     81 83 (face default) 83 133 (face (nil))))))
   FAILED  1/1  mistty-test-min-terminal-size (0.720654 sec) at test/mistty-test.el:4824
Ran 1 tests, 0 results as expected, 1 unexpected (2025-06-02 10:00:47-0400, 1.439459 sec)

No idea why Emacs modeline output would appear unexpectedly.

Some failing test cases (after I fixed the buffer name ones locally):

   FAILED  mistty-disable-jit-lock-mode-in-term-buf
   FAILED  mistty-osc133-zsh-right-prompt-no-bracketed-paste
   FAILED  mistty-test-bash-kill-line-delete-real-trailing
   FAILED  mistty-test-bash-no-nl-before-prompt
   FAILED  mistty-test-bash-reverse-i-search-and-nl
   FAILED  mistty-test-cursor-skip
   FAILED  mistty-test-detect-zsh-multiline-prompt-start
   FAILED  mistty-test-display-long-prompt
   FAILED  mistty-test-enter-fullscreen
   FAILED  mistty-test-fish-no-nl-before-prompt
   FAILED  mistty-test-fish-right-prompt-kill-multiple-lines
   FAILED  mistty-test-kill-fullscreen-buffer-kills-scrollback
   FAILED  mistty-test-kill-line-after-ws
   FAILED  mistty-test-kill-long-line
   FAILED  mistty-test-min-terminal-size
   FAILED  mistty-test-reconcile-delete-last-word
   FAILED  mistty-test-reconcile-delete-nobracketed-paste
   FAILED  mistty-test-reconcile-delete-on-long-prompt
   FAILED  mistty-test-revert-insert-after-prompt
   FAILED  mistty-test-scroll-window-up
   FAILED  mistty-test-scrolls-window-after-clear
   FAILED  mistty-test-scrolls-window-after-reset
   FAILED  mistty-test-set-terminal-size
   FAILED  mistty-test-set-terminal-size-and-fullscreen
   FAILED  mistty-test-undo-insert
   FAILED  mistty-test-window-size
   FAILED  mistty-test-window-size-resize-other-window
   FAILED  mistty-test-window-width
   FAILED  mistty-test-zsh-cut-existing-line
   FAILED  mistty-test-zsh-dead-spaces
   FAILED  mistty-test-zsh-multiline-movements-after-insert-newline
   FAILED  mistty-test-zsh-multiline-movements-after-kill-line
   FAILED  mistty-test-zsh-multiline-prompt-empty
   FAILED  mistty-test-zsh-multiline-prompt-extract-output
   FAILED  mistty-test-zsh-no-nl-before-prompt
   FAILED  mistty-test-zsh-right-prompt-command-for-output
   FAILED  mistty-test-zsh-right-prompt-insert-newlines
   FAILED  mistty-test-zsh-right-prompt-kill-line-and-yank
   FAILED  mistty-test-zsh-right-prompt-kill-multiple-lines
   FAILED  mistty-test-zsh-right-prompt-mark-mistty-skip
   FAILED  mistty-test-zsh-right-prompt-reconcile
   FAILED  mistty-test-zsh-right-prompt-skip-empty-spaces
   FAILED  mistty-test-zsh-right-prompt-skip-empty-spaces-empty-prompt

dcolascione avatar Jun 02 '25 17:06 dcolascione

Yeah, I long gave up on running tests on unstable Emacs, but this one's scary. I haven't had time to really look into it.

My guess is that replace-buffer-contents is behaving widely differently. It's at the core of MisTTY buffer syncing. It relies heavily on this function preserving point position and markers and that's not working properly anymore. Someone must be doing refactorings.

I haven't had time to look into it enough to provide details for anyone currently fiddling with that function.

szermatt avatar Jun 02 '25 17:06 szermatt

replace-buffer-contents seems to have stabilized since I first tried it. I still needed a fix to deal with the change to the way the point is handled, but it's otherwise OK.

The tests now pass under Emacs 31. There are some unfortunate flakiness still in the tests, so it's worth doing eldev test || eldev test :failed

There are still errors when running under Emacs 31 due to missing newlines, but this is due to a bug in Emacs 31. It seems that term-erase-in-linedelete newline at the end of the line when it shouldn't.

For example, the final \33[K erases the newline that comes after "ls file" so it merges with the following line.

eldev test --enable-test-log mistty-test-zsh-completion-and-previous-input

[...]
[*Test buffer (mistty-test-zsh-completion-and-previous-input)*] 0.010  RECV "\7\15\15\n\33[Jfile0  file1  file2  file3  file4  file5  file6  file7  file8  file9\33[A\33[m\33[27m\33[24m\15\33[2Cls file\33[K"
[*Test buffer (mistty-test-zsh-completion-and-previous-input)*] 0.010  refresh (complete)
[*Test buffer (mistty-test-zsh-completion-and-previous-input)*] 0.011  Log enabled.
Test mistty-test-zsh-completion-and-previous-input backtrace:
    [omitted]
Test mistty-test-zsh-completion-and-previous-input condition:
    Buffer: *Test buffer (mistty-test-zsh-completion-and-previous-input)*
    (ert-test-failed
     ((should
       (equal
	(concat "$ ls file<>\n"
		"file0  file1  file2  file3  file4  file5  file6  file7  file8  file9")
	(mistty-test-content :start ls-start :show ...)))
      :form
      (equal
       "$ ls file<>\nfile0  file1  file2  file3  file4  file5  file6  file7  file8  file9"
       "$ ls file<>file0  file1  file2  file3  file4  file5  file6  file7  file8  file9")
      :value nil :explanation
      (string-match
       "$ ls file<>\nfile0  file1  file2  file3  file4  file5  file6  file7  file8  file9"
       "$ ls file<>file0  file1  file2  file3  file4  file5  file6  file7  file8  file9")))
   FAILED  1/1  mistty-test-zsh-completion-and-previous-input (0.014114 sec) at test/mistty-test.el:2105

szermatt avatar Jun 27 '25 21:06 szermatt