diff options
| author | Stefan Kangas | 2023-08-28 22:05:16 +0200 |
|---|---|---|
| committer | Stefan Kangas | 2023-08-28 22:07:23 +0200 |
| commit | a5339933d08b3c827e81bdaa302a337028b22360 (patch) | |
| tree | 8f2e73563231d08f2f17300db673c100d0014180 | |
| parent | 3fb2a3c240afa3bf5f574c45ed99be3f56a997ac (diff) | |
| download | emacs-a5339933d08b3c827e81bdaa302a337028b22360.tar.gz emacs-a5339933d08b3c827e81bdaa302a337028b22360.zip | |
Split up tests in bovine/gcc-tests.el
* test/lisp/cedet/semantic/bovine/gcc-tests.el
(semantic-gcc-test): New macro.
(semantic-gcc-test/1, semantic-gcc-test/2, semantic-gcc-test/3)
(semantic-gcc-test/4, semantic-gcc-test/5, semantic-gcc-test/6)
(semantic-gcc-test/7, semantic-gcc-test/8, semantic-gcc-test/9)
(semantic-gcc-test-output-parser/fail): New tests.
| -rw-r--r-- | test/lisp/cedet/semantic/bovine/gcc-tests.el | 109 |
1 files changed, 60 insertions, 49 deletions
diff --git a/test/lisp/cedet/semantic/bovine/gcc-tests.el b/test/lisp/cedet/semantic/bovine/gcc-tests.el index 5437d65d139..0b703fcaa2f 100644 --- a/test/lisp/cedet/semantic/bovine/gcc-tests.el +++ b/test/lisp/cedet/semantic/bovine/gcc-tests.el | |||
| @@ -31,62 +31,88 @@ | |||
| 31 | 31 | ||
| 32 | ;;; From bovine-gcc: | 32 | ;;; From bovine-gcc: |
| 33 | 33 | ||
| 34 | ;; Example output of "gcc -v" | 34 | (defmacro semantic-gcc-test (str) |
| 35 | (defvar semantic-gcc-test-strings | 35 | `(let ((fields (semantic-gcc-fields ,str))) |
| 36 | '(;; My old box: | 36 | (let-alist fields |
| 37 | "Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/specs | 37 | (message "%S" fields) |
| 38 | ;; No longer test for prefixes. | ||
| 39 | ;; (should .--prefix) | ||
| 40 | (should .version) | ||
| 41 | (should (or .target | ||
| 42 | .--target | ||
| 43 | .--host))))) | ||
| 44 | |||
| 45 | ;; A bunch of sample gcc -v outputs from different machines. | ||
| 46 | |||
| 47 | (ert-deftest semantic-gcc-test/1 () | ||
| 48 | ;; My old box: | ||
| 49 | (semantic-gcc-test "Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/specs | ||
| 38 | Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --host=i386-redhat-linux | 50 | Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --host=i386-redhat-linux |
| 39 | Thread model: posix | 51 | Thread model: posix |
| 40 | gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5)" | 52 | gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5)")) |
| 41 | ;; Alex Ott: | 53 | |
| 42 | "Using built-in specs. | 54 | (ert-deftest semantic-gcc-test/2 () |
| 55 | ;; Alex Ott: | ||
| 56 | (semantic-gcc-test "Using built-in specs. | ||
| 43 | Target: i486-linux-gnu | 57 | Target: i486-linux-gnu |
| 44 | Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.3.1-9ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-4.3/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.3 --program-suffix=-4.3 --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-mpfr --enable-targets=all --enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu | 58 | Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.3.1-9ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-4.3/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.3 --program-suffix=-4.3 --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-mpfr --enable-targets=all --enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu |
| 45 | Thread model: posix | 59 | Thread model: posix |
| 46 | gcc version 4.3.1 (Ubuntu 4.3.1-9ubuntu1)" | 60 | gcc version 4.3.1 (Ubuntu 4.3.1-9ubuntu1)")) |
| 47 | ;; My debian box: | 61 | |
| 48 | "Using built-in specs. | 62 | (ert-deftest semantic-gcc-test/3 () |
| 63 | ;; My Debian box: | ||
| 64 | (semantic-gcc-test "Using built-in specs. | ||
| 49 | Target: x86_64-unknown-linux-gnu | 65 | Target: x86_64-unknown-linux-gnu |
| 50 | Configured with: ../../../sources/gcc/configure --prefix=/usr/local/glibc-2.3.6/x86_64/apps/gcc-4.2.3 --with-gmp=/usr/local/gcc/gmp --with-mpfr=/usr/local/gcc/mpfr --enable-languages=c,c++,fortran --with-as=/usr/local/glibc-2.3.6/x86_64/apps/gcc-4.2.3/bin/as --with-ld=/usr/local/glibc-2.3.6/x86_64/apps/gcc-4.2.3/bin/ld --disable-multilib | 66 | Configured with: ../../../sources/gcc/configure --prefix=/usr/local/glibc-2.3.6/x86_64/apps/gcc-4.2.3 --with-gmp=/usr/local/gcc/gmp --with-mpfr=/usr/local/gcc/mpfr --enable-languages=c,c++,fortran --with-as=/usr/local/glibc-2.3.6/x86_64/apps/gcc-4.2.3/bin/as --with-ld=/usr/local/glibc-2.3.6/x86_64/apps/gcc-4.2.3/bin/ld --disable-multilib |
| 51 | Thread model: posix | 67 | Thread model: posix |
| 52 | gcc version 4.2.3" | 68 | gcc version 4.2.3")) |
| 53 | ;; My mac: | 69 | |
| 54 | "Using built-in specs. | 70 | (ert-deftest semantic-gcc-test/4 () |
| 71 | ;; My mac: | ||
| 72 | (semantic-gcc-test "Using built-in specs. | ||
| 55 | Target: i686-apple-darwin8 | 73 | Target: i686-apple-darwin8 |
| 56 | Configured with: /private/var/tmp/gcc/gcc-5341.obj~1/src/configure --disable-checking -enable-werror --prefix=/usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/s/$/-4.0/ --with-gxx-include-dir=/include/c++/4.0.0 --with-slibdir=/usr/lib --build=powerpc-apple-darwin8 --with-arch=pentium-m --with-tune=prescott --program-prefix= --host=i686-apple-darwin8 --target=i686-apple-darwin8 | 74 | Configured with: /private/var/tmp/gcc/gcc-5341.obj~1/src/configure --disable-checking -enable-werror --prefix=/usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/s/$/-4.0/ --with-gxx-include-dir=/include/c++/4.0.0 --with-slibdir=/usr/lib --build=powerpc-apple-darwin8 --with-arch=pentium-m --with-tune=prescott --program-prefix= --host=i686-apple-darwin8 --target=i686-apple-darwin8 |
| 57 | Thread model: posix | 75 | Thread model: posix |
| 58 | gcc version 4.0.1 (Apple Computer, Inc. build 5341)" | 76 | gcc version 4.0.1 (Apple Computer, Inc. build 5341)")) |
| 59 | ;; Ubuntu Intrepid | 77 | |
| 60 | "Using built-in specs. | 78 | (ert-deftest semantic-gcc-test/5 () |
| 79 | ;; Ubuntu Intrepid | ||
| 80 | (semantic-gcc-test "Using built-in specs. | ||
| 61 | Target: x86_64-linux-gnu | 81 | Target: x86_64-linux-gnu |
| 62 | Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.3.2-1ubuntu12' --with-bugurl=file:///usr/share/doc/gcc-4.3/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.3 --program-suffix=-4.3 --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-mpfr --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu | 82 | Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.3.2-1ubuntu12' --with-bugurl=file:///usr/share/doc/gcc-4.3/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.3 --program-suffix=-4.3 --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-mpfr --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu |
| 63 | Thread model: posix | 83 | Thread model: posix |
| 64 | gcc version 4.3.2 (Ubuntu 4.3.2-1ubuntu12)" | 84 | gcc version 4.3.2 (Ubuntu 4.3.2-1ubuntu12)")) |
| 65 | ;; Red Hat EL4 | 85 | |
| 66 | "Reading specs from /usr/lib/gcc/x86_64-redhat-linux/3.4.6/specs | 86 | (ert-deftest semantic-gcc-test/6 () |
| 87 | ;; Red Hat EL4 | ||
| 88 | (semantic-gcc-test "Reading specs from /usr/lib/gcc/x86_64-redhat-linux/3.4.6/specs | ||
| 67 | Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-java-awt=gtk --host=x86_64-redhat-linux | 89 | Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-java-awt=gtk --host=x86_64-redhat-linux |
| 68 | Thread model: posix | 90 | Thread model: posix |
| 69 | gcc version 3.4.6 20060404 (Red Hat 3.4.6-10)" | 91 | gcc version 3.4.6 20060404 (Red Hat 3.4.6-10)")) |
| 70 | ;; Red Hat EL5 | 92 | |
| 71 | "Using built-in specs. | 93 | (ert-deftest semantic-gcc-test/7 () |
| 94 | ;; Red Hat EL5 | ||
| 95 | (semantic-gcc-test "Using built-in specs. | ||
| 72 | Target: x86_64-redhat-linux | 96 | Target: x86_64-redhat-linux |
| 73 | Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --enable-plugin --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic --host=x86_64-redhat-linux | 97 | Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --enable-plugin --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic --host=x86_64-redhat-linux |
| 74 | Thread model: posix | 98 | Thread model: posix |
| 75 | gcc version 4.1.2 20080704 (Red Hat 4.1.2-44)" | 99 | gcc version 4.1.2 20080704 (Red Hat 4.1.2-44)")) |
| 76 | ;; David Engster's german gcc on ubuntu 4.3 | 100 | |
| 77 | "Es werden eingebaute Spezifikationen verwendet. | 101 | (ert-deftest semantic-gcc-test/8 () |
| 102 | ;; David Engster's german gcc on ubuntu 4.3 | ||
| 103 | (semantic-gcc-test "Es werden eingebaute Spezifikationen verwendet. | ||
| 78 | Ziel: i486-linux-gnu | 104 | Ziel: i486-linux-gnu |
| 79 | Konfiguriert mit: ../src/configure -v --with-pkgversion='Ubuntu 4.3.2-1ubuntu12' --with-bugurl=file:///usr/share/doc/gcc-4.3/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.3 --program-suffix=-4.3 --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-mpfr --enable-targets=all --enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu | 105 | Konfiguriert mit: ../src/configure -v --with-pkgversion='Ubuntu 4.3.2-1ubuntu12' --with-bugurl=file:///usr/share/doc/gcc-4.3/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.3 --program-suffix=-4.3 --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-mpfr --enable-targets=all --enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu |
| 80 | Thread-Modell: posix | 106 | Thread-Modell: posix |
| 81 | gcc-Version 4.3.2 (Ubuntu 4.3.2-1ubuntu12)" | 107 | gcc-Version 4.3.2 (Ubuntu 4.3.2-1ubuntu12)")) |
| 82 | ;; Damien Deville bsd | 108 | |
| 83 | "Using built-in specs. | 109 | (ert-deftest semantic-gcc-test/9 () |
| 110 | ;; Damien Deville bsd | ||
| 111 | (semantic-gcc-test "Using built-in specs. | ||
| 84 | Target: i386-undermydesk-freebsd | 112 | Target: i386-undermydesk-freebsd |
| 85 | Configured with: FreeBSD/i386 system compiler | 113 | Configured with: FreeBSD/i386 system compiler |
| 86 | Thread model: posix | 114 | Thread model: posix |
| 87 | gcc version 4.2.1 20070719 [FreeBSD]" | 115 | gcc version 4.2.1 20070719 [FreeBSD]")) |
| 88 | ) | ||
| 89 | "A bunch of sample gcc -v outputs from different machines.") | ||
| 90 | 116 | ||
| 91 | (defvar semantic-gcc-test-strings-fail | 117 | (defvar semantic-gcc-test-strings-fail |
| 92 | '(;; A really old solaris box I found | 118 | '(;; A really old solaris box I found |
| @@ -95,19 +121,8 @@ gcc version 2.95.2 19991024 (release)" | |||
| 95 | ) | 121 | ) |
| 96 | "A bunch of sample gcc -v outputs that fail to provide the info we want.") | 122 | "A bunch of sample gcc -v outputs that fail to provide the info we want.") |
| 97 | 123 | ||
| 98 | (defun semantic-gcc-test-output-parser () | 124 | (ert-deftest semantic-gcc-test-output-parser/fail () |
| 99 | "Test the output parser against some collected strings." | 125 | "Test the output parser against some collected strings." |
| 100 | (dolist (S semantic-gcc-test-strings) | ||
| 101 | (let* ((fields (semantic-gcc-fields S)) | ||
| 102 | (v (cdr (assoc 'version fields))) | ||
| 103 | (h (or (cdr (assoc 'target fields)) | ||
| 104 | (cdr (assoc '--target fields)) | ||
| 105 | (cdr (assoc '--host fields)))) | ||
| 106 | (p (cdr (assoc '--prefix fields)))) | ||
| 107 | ;; No longer test for prefixes. | ||
| 108 | (when (not (and v h)) | ||
| 109 | (let ((strs (split-string S "\n"))) | ||
| 110 | (error "Test failed on %S\nV H P:\n%S %S %S" (car strs) v h p))))) | ||
| 111 | (dolist (S semantic-gcc-test-strings-fail) | 126 | (dolist (S semantic-gcc-test-strings-fail) |
| 112 | (let* ((fields (semantic-gcc-fields S)) | 127 | (let* ((fields (semantic-gcc-fields S)) |
| 113 | (v (cdr (assoc 'version fields))) | 128 | (v (cdr (assoc 'version fields))) |
| @@ -118,14 +133,10 @@ gcc version 2.95.2 19991024 (release)" | |||
| 118 | (when (and v h p) | 133 | (when (and v h p) |
| 119 | (error "Negative test failed on %S" S))))) | 134 | (error "Negative test failed on %S" S))))) |
| 120 | 135 | ||
| 121 | (ert-deftest semantic-gcc-test-output-parser () | 136 | (ert-deftest semantic-gcc-test-output-parser/this-machine () |
| 122 | (semantic-gcc-test-output-parser)) | ||
| 123 | |||
| 124 | (ert-deftest semantic-gcc-test-output-parser-this-machine () | ||
| 125 | "Test the output parser against the machine currently running Emacs." | 137 | "Test the output parser against the machine currently running Emacs." |
| 126 | (skip-unless (and (executable-find "gcc") | 138 | (skip-unless (and (executable-find "gcc") |
| 127 | (not (ert-gcc-is-clang-p)))) | 139 | (not (ert-gcc-is-clang-p)))) |
| 128 | (let ((semantic-gcc-test-strings (list (semantic-gcc-query "gcc" "-v")))) | 140 | (semantic-gcc-test (semantic-gcc-query "gcc" "-v"))) |
| 129 | (semantic-gcc-test-output-parser))) | ||
| 130 | 141 | ||
| 131 | ;;; gcc-tests.el ends here | 142 | ;;; gcc-tests.el ends here |