Subject: 28.0.60; mh-utils-tests fail with native compilation

From: Ken Brown <[email-masked]>
Date: Sat, 2 Oct 2021 14:49:04 -0400

Most of the tests in mh-utils-tests fail if I build the emacs-28 branch on 
Cygwin with native compilation:

$ make -C test mh-utils-tests
make: Entering directory '/home/kbrown/src/emacs/x86_64-emacs-28-native-lisp/test'
make[1]: Entering directory 
'/home/kbrown/src/emacs/x86_64-emacs-28-native-lisp/test'
   GEN      lisp/mh-e/mh-utils-tests.log
Running 16 tests (2021-10-02 14:13:13-0400, selector ‘(not (tag :unstable))’)
No MH variant found on the system
call-process mock unexpected arglist (emacs --batch -l 
/tmp/emacs-int-comp-subr--trampoline-66696c652d6469726563746f72792d70_file_directory_p_0-rg5Ucy.el)
call-process mock unexpected arglist (emacs --batch -l 
/tmp/emacs-int-comp-subr--trampoline-66696c652d6469726563746f72792d70_file_directory_p_0-f6P2ZU.el)
Test mh-folder-completion-function-02-empty backtrace:
   signal(native-compiler-error ((lambda (arg538 &optional) (let ((f #'
   comp--native-compile((lambda (arg538 &optional) (let ((f #'file-dire
   comp-trampoline-compile(file-directory-p)
   comp-subr-trampoline-install(file-directory-p)
   fset(file-directory-p #<subr file-directory-p>)
   (unwind-protect (progn (if mh-test-variant-logged-already nil (mh-va
   (let* ((vnew (make-hash-table :test #'equal)) (vnew (getenv "MH")) (
   (let ((lexical-binding t)) (let* ((vnew (make-hash-table :test #'equ
   (closure (t) nil (let ((lexical-binding t)) (let* ((vnew (make-hash-
   ert--run-test-internal(#s(ert--test-execution-info :test #s(ert-test
   ert-run-test(#s(ert-test :name mh-folder-completion-function-02-empt
   ert-run-or-rerun-test(#s(ert--stats :selector (not (tag :unstable))
   ert-run-tests((not (tag :unstable)) #f(compiled-function (event-type
   ert-run-tests-batch((not (tag :unstable)))
   ert-run-tests-batch-and-exit((not (tag :unstable)))
   command-line-1(("-L" ":../../emacs-28-x86_64/test" "-l" "ert" "-l" "
   command-line()
   normal-top-level()
Test mh-folder-completion-function-02-empty condition:
     (native-compiler-error
      (lambda
        (arg538 &optional)
        (let
            ((f ...))
          (funcall f arg538)))
      "")
    FAILED   1/16  mh-folder-completion-function-02-empty (1.860486 sec)
[...]
Ran 16 tests, 4 results as expected, 12 unexpected (2021-10-02 14:13:21-0400, 
7.807508 sec)
2 expected failures

12 unexpected results:
    FAILED  mh-folder-completion-function-02-empty
    FAILED  mh-folder-completion-function-03-plus
    FAILED  mh-folder-completion-function-04-rel-folder
    FAILED  mh-folder-completion-function-05-rel-folder-slash
    FAILED  mh-folder-completion-function-06-rel-folder-slash-foo
    FAILED  mh-folder-completion-function-07-rel-folder-slash-foo-slash
    FAILED  mh-folder-completion-function-10-plus-slash-abs-folder
    FAILED  mh-folder-completion-function-11-plus-slash-abs-folder-slash-foo
    FAILED  mh-folder-completion-function-12-plus-nosuchfolder
    FAILED  mh-folder-completion-function-13-plus-slash-nosuchfolder
    FAILED  mh-sub-folders
    FAILED  mh-sub-folders-actual

This doesn't happen in a build without native compilation:

$ make -C test mh-utils-tests
make: Entering directory '/home/kbrown/src/emacs/x86_64-emacs-28/test'
make[1]: Entering directory '/home/kbrown/src/emacs/x86_64-emacs-28/test'
   GEN      lisp/mh-e/mh-utils-tests.log
Running 16 tests (2021-10-02 14:18:12-0400, selector ‘(not (or (tag :unstable) 
(tag :nativecomp)))’)
No MH variant found on the system
[...]
Ran 16 tests, 16 results as expected, 0 unexpected (2021-10-02 14:18:12-0400, 
0.081313 sec)
2 expected failures