diff options
| author | Andrea Corallo | 2019-11-16 09:58:05 +0100 |
|---|---|---|
| committer | Andrea Corallo | 2020-01-01 11:38:05 +0100 |
| commit | b91cbf80aeb4487ad3e1fa0e64e3cb5549ec663c (patch) | |
| tree | 2ba9e4e19dfa4664838186e11d5a683a9f754830 | |
| parent | 787444c7690d97d8702db059cb51ac506cb8a5e4 (diff) | |
| download | emacs-b91cbf80aeb4487ad3e1fa0e64e3cb5549ec663c.tar.gz emacs-b91cbf80aeb4487ad3e1fa0e64e3cb5549ec663c.zip | |
add comp-tests-bootstrap
| -rw-r--r-- | test/src/comp-tests.el | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/test/src/comp-tests.el b/test/src/comp-tests.el index 2e388b9f148..1f43a91d49c 100644 --- a/test/src/comp-tests.el +++ b/test/src/comp-tests.el | |||
| @@ -32,13 +32,37 @@ | |||
| 32 | (setq comp-speed 3) | 32 | (setq comp-speed 3) |
| 33 | (setq comp-debug 1) | 33 | (setq comp-debug 1) |
| 34 | 34 | ||
| 35 | (defconst comp-test-directory (file-name-directory (or load-file-name | ||
| 36 | buffer-file-name))) | ||
| 35 | (defconst comp-test-src | 37 | (defconst comp-test-src |
| 36 | (concat (file-name-directory (or load-file-name buffer-file-name)) | 38 | (concat comp-test-directory "comp-test-funcs.el")) |
| 37 | "comp-test-funcs.el")) | ||
| 38 | 39 | ||
| 39 | (message "Compiling %s" comp-test-src) | 40 | (message "Compiling %s" comp-test-src) |
| 40 | (load (native-compile comp-test-src)) | 41 | (load (native-compile comp-test-src)) |
| 41 | 42 | ||
| 43 | (ert-deftest comp-tests-bootstrap () | ||
| 44 | "Compile the compiler and load it to compile it-self. | ||
| 45 | Check that the resulting binaries do not differ." | ||
| 46 | (let ((comp-file (concat comp-test-directory | ||
| 47 | "../../lisp/emacs-lisp/comp.el")) | ||
| 48 | (comp1-file (concat temporary-file-directory | ||
| 49 | (make-temp-name "stage1-") | ||
| 50 | ".el")) | ||
| 51 | (comp2-file (concat temporary-file-directory | ||
| 52 | (make-temp-name "stage2-") | ||
| 53 | ".el"))) | ||
| 54 | (copy-file comp-file comp1-file) | ||
| 55 | (copy-file comp-file comp2-file) | ||
| 56 | (load (concat comp-file "c") nil nil t t) | ||
| 57 | (should (null (subr-native-elisp-p (symbol-function #'native-compile)))) | ||
| 58 | (message "Compiling stage1...") | ||
| 59 | (load (native-compile comp1-file) nil nil t t) | ||
| 60 | (should (subr-native-elisp-p (symbol-function 'native-compile))) | ||
| 61 | (message "Compiling stage2...") | ||
| 62 | (native-compile comp2-file) | ||
| 63 | (message "Comparing %s %s" comp1-file comp2-file) | ||
| 64 | (should (= (call-process "cmp" nil nil nil comp1-file comp2-file) 0)))) | ||
| 65 | |||
| 42 | (ert-deftest comp-tests-provide () | 66 | (ert-deftest comp-tests-provide () |
| 43 | "Testing top level provide." | 67 | "Testing top level provide." |
| 44 | (should (featurep 'comp-test-funcs))) | 68 | (should (featurep 'comp-test-funcs))) |