diff options
| author | Stefan Kangas | 2022-01-31 07:42:50 +0100 |
|---|---|---|
| committer | Stefan Kangas | 2022-01-31 07:42:50 +0100 |
| commit | 9a56b4e6864c4e0815bb67805cfa67910ab3eeb5 (patch) | |
| tree | b0b8eaf28fada595580503937122ee27765f341e /test | |
| parent | d464454f4502e337d4114e7b818aad11c9506497 (diff) | |
| download | emacs-9a56b4e6864c4e0815bb67805cfa67910ab3eeb5.tar.gz emacs-9a56b4e6864c4e0815bb67805cfa67910ab3eeb5.zip | |
Factor out function to check for clang in tests
This also stops a flymake test from failing on my machine.
* lisp/emacs-lisp/ert-x.el (ert-gcc-is-clang-p): New function
factored out from ...
* test/lisp/progmodes/flymake-tests.el (flymake-tests--gcc-is-clang):
* test/lisp/cedet/semantic/bovine/gcc-tests.el
(semantic-gcc-test-output-parser-this-machine): ... here.
* test/lisp/progmodes/flymake-tests.el (different-diagnostic-types)
(included-c-header-files):
* test/lisp/cedet/semantic/bovine/gcc-tests.el
(semantic-gcc-test-output-parser-this-machine): Use above new function.
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/cedet/semantic/bovine/gcc-tests.el | 11 | ||||
| -rw-r--r-- | test/lisp/progmodes/flymake-tests.el | 9 |
2 files changed, 5 insertions, 15 deletions
diff --git a/test/lisp/cedet/semantic/bovine/gcc-tests.el b/test/lisp/cedet/semantic/bovine/gcc-tests.el index 2e61f91e58c..525843d9960 100644 --- a/test/lisp/cedet/semantic/bovine/gcc-tests.el +++ b/test/lisp/cedet/semantic/bovine/gcc-tests.el | |||
| @@ -122,14 +122,9 @@ gcc version 2.95.2 19991024 (release)" | |||
| 122 | 122 | ||
| 123 | (ert-deftest semantic-gcc-test-output-parser-this-machine () | 123 | (ert-deftest semantic-gcc-test-output-parser-this-machine () |
| 124 | "Test the output parser against the machine currently running Emacs." | 124 | "Test the output parser against the machine currently running Emacs." |
| 125 | (skip-unless (executable-find "gcc")) | 125 | (skip-unless (and (executable-find "gcc") |
| 126 | (not (ert-gcc-is-clang-p)))) | ||
| 126 | (let ((semantic-gcc-test-strings (list (semantic-gcc-query "gcc" "-v")))) | 127 | (let ((semantic-gcc-test-strings (list (semantic-gcc-query "gcc" "-v")))) |
| 127 | ;; Some macOS machines run llvm when you type gcc. (!) | 128 | (semantic-gcc-test-output-parser))) |
| 128 | ;; We can't even check if it's a symlink; it's a binary placed in | ||
| 129 | ;; "/usr/bin/gcc". So check the output and just skip this test if | ||
| 130 | ;; it looks like that's the case. | ||
| 131 | (unless (string-match "Apple \\(LLVM\\|clang\\)\\|Xcode\\.app" | ||
| 132 | (car semantic-gcc-test-strings)) | ||
| 133 | (semantic-gcc-test-output-parser)))) | ||
| 134 | 129 | ||
| 135 | ;;; gcc-tests.el ends here | 130 | ;;; gcc-tests.el ends here |
diff --git a/test/lisp/progmodes/flymake-tests.el b/test/lisp/progmodes/flymake-tests.el index ced7b5aaced..71b03b21e5c 100644 --- a/test/lisp/progmodes/flymake-tests.el +++ b/test/lisp/progmodes/flymake-tests.el | |||
| @@ -140,15 +140,10 @@ SEVERITY-PREDICATE is used to setup | |||
| 140 | (flymake-goto-next-error) | 140 | (flymake-goto-next-error) |
| 141 | (should (eq 'flymake-error (face-at-point))))))) | 141 | (should (eq 'flymake-error (face-at-point))))))) |
| 142 | 142 | ||
| 143 | (defun flymake-tests--gcc-is-clang () | ||
| 144 | "Whether the `gcc' command actually runs the Clang compiler." | ||
| 145 | (string-match "[Cc]lang version " | ||
| 146 | (shell-command-to-string "gcc --version"))) | ||
| 147 | |||
| 148 | (ert-deftest different-diagnostic-types () | 143 | (ert-deftest different-diagnostic-types () |
| 149 | "Test GCC warning via function predicate." | 144 | "Test GCC warning via function predicate." |
| 150 | (skip-unless (and (executable-find "gcc") | 145 | (skip-unless (and (executable-find "gcc") |
| 151 | (not (flymake-tests--gcc-is-clang)) | 146 | (not (ert-gcc-is-clang-p)) |
| 152 | (version<= | 147 | (version<= |
| 153 | "5" (string-trim | 148 | "5" (string-trim |
| 154 | (shell-command-to-string "gcc -dumpversion"))) | 149 | (shell-command-to-string "gcc -dumpversion"))) |
| @@ -173,7 +168,7 @@ SEVERITY-PREDICATE is used to setup | |||
| 173 | (ert-deftest included-c-header-files () | 168 | (ert-deftest included-c-header-files () |
| 174 | "Test inclusion of .h header files." | 169 | "Test inclusion of .h header files." |
| 175 | (skip-unless (and (executable-find "gcc") | 170 | (skip-unless (and (executable-find "gcc") |
| 176 | (not (flymake-tests--gcc-is-clang)) | 171 | (not (ert-gcc-is-clang-p)) |
| 177 | (executable-find "make"))) | 172 | (executable-find "make"))) |
| 178 | (let ((flymake-wrap-around nil)) | 173 | (let ((flymake-wrap-around nil)) |
| 179 | (flymake-tests--with-flymake | 174 | (flymake-tests--with-flymake |