1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-15 09:47:20 +00:00

fix comp-tests-bootstrap

This commit is contained in:
Andrea Corallo 2019-11-19 21:26:45 +01:00
parent ab5611c25b
commit 0c60b3bae7

View File

@ -29,6 +29,9 @@
(require 'cl-lib)
(require 'comp)
;; (setq comp-debug 1)
(setq comp-speed 3)
(defconst comp-test-directory (file-name-directory (or load-file-name
buffer-file-name)))
(defconst comp-test-src
@ -40,25 +43,27 @@
(ert-deftest comp-tests-bootstrap ()
"Compile the compiler and load it to compile it-self.
Check that the resulting binaries do not differ."
(let ((comp-file (concat comp-test-directory
(let* ((comp-src (concat comp-test-directory
"../../lisp/emacs-lisp/comp.el"))
(comp1-file (concat temporary-file-directory
(comp1-src (concat temporary-file-directory
(make-temp-name "stage1-")
".el"))
(comp2-file (concat temporary-file-directory
(comp2-src (concat temporary-file-directory
(make-temp-name "stage2-")
".el")))
(copy-file comp-file comp1-file)
(copy-file comp-file comp2-file)
(load (concat comp-file "c") nil nil t t)
".el"))
(comp1 (concat comp1-src "n"))
(comp2 (concat comp2-src "n")))
(copy-file comp-src comp1-src)
(copy-file comp-src comp2-src)
(load (concat comp-src "c") nil nil t t)
(should (null (subr-native-elisp-p (symbol-function #'native-compile))))
(message "Compiling stage1...")
(load (native-compile comp1-file) nil nil t t)
(load (native-compile comp1-src) nil nil t t)
(should (subr-native-elisp-p (symbol-function 'native-compile)))
(message "Compiling stage2...")
(native-compile comp2-file)
(message "Comparing %s %s" comp1-file comp2-file)
(should (= (call-process "cmp" nil nil nil comp1-file comp2-file) 0))))
(native-compile comp2-src)
(message "Comparing %s %s" comp1 comp2)
(should (= (call-process "cmp" nil nil nil comp1 comp2) 0))))
(ert-deftest comp-tests-provide ()
"Testing top level provide."