1 ;;; cedet-utests.el --- Run all unit tests in the CEDET suite.
3 ;; Copyright (C) 2008, 2009, 2010, 2012, 2013, 2014, 2015 Eric M. Ludlam
5 ;; Author: Eric M. Ludlam <eric@siege-engine.com>
7 ;; This program is free software; you can redistribute it and/or
8 ;; modify it under the terms of the GNU General Public License as
9 ;; published by the Free Software Foundation; either version 2, or (at
10 ;; your option) any later version.
12 ;; This program is distributed in the hope that it will be useful, but
13 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 ;; General Public License for more details.
17 ;; You should have received a copy of the GNU General Public License
18 ;; along with this program; see the file COPYING. If not, write to
19 ;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 ;; Boston, MA 02110-1301, USA.
24 ;; Remembering to run all the unit tests available in CEDET one at a
25 ;; time is a bit time consuming. This links all the tests together
29 (require 'cedet-uutil
)
30 (require 'inversion-utest
)
31 (require 'pulse-utest
)
32 (require 'cedet-files-utests
)
33 (require 'cedet-compat
)
34 (require 'cedet
/ede
/detect-utest
)
35 (require 'cedet
/ede
/compdb-utest
)
36 (require 'cedet
/ede
/secure-utest
)
37 (require 'cedet
/semantic
/lex-utest
)
38 (require 'cedet
/semantic
/lex-spp-utest
)
39 (require 'cedet
/semantic
/utest-parse
)
40 (require 'cedet
/semantic
/ert
/test-c-parser
)
41 (require 'cedet
/semantic
/utest-c
)
42 (require 'cedet
/semantic
/ia-utest
)
43 (require 'cedet
/semantic
/utest-fw
)
44 (require 'cedet
/semantic
/gcc-utest
)
45 (require 'cedet
/semantic
/fmt-utest
)
46 (require 'semantic
/wisent
/calc
)
47 (require 'cedet
/srecode
/test
)
48 (require 'cedet
/srecode
/fields-utest
)
49 (require 'cedet
/srecode
/test-getset
)
50 (require 'cedet
/cogre
/utest
)
51 (require 'cedet
/cogre
/periodic-utest
)
52 (require 'cedet
/cogre
/convert-utest
)
56 (defvar cedet-utest-test-alist
58 ("cedet versions" . cedet-version
)
64 ("inversion" . inversion-unit-test
)
67 ("ezimage associations" . ezimage-image-association-dump
)
68 ("ezimage images" . ezimage-image-dump
)
70 ;; Workging interactive tests.
71 ("working: wait-for-keypress" .
73 (if (cedet-utest-noninteractive)
74 (message " ** Skipping test in noninteractive mode.")
75 (working-wait-for-keypress))))
76 ;("working: sleep" . working-verify-sleep)
79 ("pulse interactive test" .
(lambda () (pulse-test t
)))
82 ("cedet file conversion" . cedet-files-utest
)
87 ("ede: project detection tests" . ede-detect-utest
) ;; NOTE: must be before other EDE tests.
88 ("ede: project detect linux extra" . ede-detect-linux-utest
)
89 ("ede: security tests" . ede-security-utest
)
90 ("ede: compdb project tests" . compdb-utest
)
95 ("semantic: lex spp table write" . semantic-lex-spp-write-utest
)
96 ("semantic: multi-lang parsing" . semantic-utest-main
)
97 ("semantic: C parser (ERT)" . semantic-c-parser-test-ert
)
98 ("semantic: C preprocessor" . semantic-utest-c
)
99 ("semantic: format tests" . semantic-fmt-utest
)
100 ("semantic: analyzer tests" . semantic-ia-utest
)
101 ("semanticdb: data cache" . semantic-test-data-cache
)
102 ("semantic: throw-on-input" .
104 (if (cedet-utest-noninteractive)
105 (message " ** Skipping test in noninteractive mode.")
106 (semantic-test-throw-on-input))))
108 ("semantic: gcc: output parse test" . semantic-gcc-test-output-parser
)
109 ("wisent calculator" . wisent-calc-utest
)
113 ("srecode: show maps" . srecode-utest-map-reset
)
114 ("srecode: templates" . srecode-utest-template-output
)
115 ("srecode: fields" . srecode-field-utest
)
116 ("srecode: project" . srecode-utest-project
)
117 ("srecode: getset" . srecode-utest-getset-output
)
122 ("cogre: graph" . cogre-utest
)
123 ("cogre: periodic & ascii" . cogre-periodic-utest
)
124 ("cogre: conversion/export tests" . cogre-export-utest
)
125 ("cogre: uml-quick-class" . cogre-utest-quick-class
)
127 "Alist of all the tests in CEDET we should run.")
130 (defun cedet-utest (&optional exit-on-error
)
131 "Run the CEDET unittests.
132 EXIT-ON-ERROR causes the test suite to exit on an error, instead
133 of just logging the error."
135 (if (or (not (featurep 'semantic
/db-mode
))
136 (not (semanticdb-minor-mode-p)))
137 (error "CEDET Tests require: M-x semantic-mode"))
138 (cedet-utest-log-setup "ALL TESTS")
139 (let ((tl cedet-utest-test-alist
)
142 (start (current-time))
144 (cedet-running-master-tests t
)
147 (cedet-utest-add-log-item-start (car T
))
148 (setq notes nil err nil
)
154 (setq err
(format "ERROR: %S" Cerr
))
155 ;;(message "Error caught: %s" Cerr)
158 ;; Cleanup stray input and events that are in the way.
159 ;; Not doing this causes sit-for to not refresh the screen.
160 ;; Doing this causes the user to need to press keys more frequently.
161 (when (and (called-interactively-p 'any
) (input-pending-p))
162 (if (fboundp 'read-event
)
166 (cedet-utest-add-log-item-done notes err
)
167 (when (and exit-on-error err
)
168 (message "to debug this test point, execute:")
169 (message "%S" (cdr T
))
170 (message "\n ** Exiting Test Suite. ** \n")
171 (throw 'cedet-utest-exit-on-error t
)
174 (setq end
(current-time))
175 ;; Run consistency checks.
176 (cedet-utest-add-log-item-start "Sanity Checks.")
177 (ede-global-list-sanity-check)
178 (cedet-utest-add-log-item-done nil nil
)
180 (cedet-utest-log-shutdown-msg "ALL TESTS" start end
)
184 (defun cedet-utest-batch ()
185 "Run the CEDET unit test in BATCH mode."
186 (unless (cedet-utest-noninteractive)
187 (error "`cedet-utest-batch' is to be used only with -batch"))
189 (when (catch 'cedet-utest-exit-on-error
190 ;; Get basic semantic features up.
191 ;; OLD (semantic-load-enable-minimum-features)
194 ;(global-semanticdb-minor-mode 1)
195 ;; Disables all caches related to semantic DB so all
196 ;; tests run as if we have bootstrapped CEDET for the
198 (setq-default semanticdb-new-database-class
'semanticdb-project-database
)
199 (message "Disabling existing Semantic Database Caches.")
201 ;; Disabling the srecoder map, we won't load a pre-existing one
202 ;; and will be forced to bootstrap a new one.
203 (setq srecode-map-save-file nil
)
205 ;; Disable saving EDE's cache file.
206 (setq ede-project-placeholder-cache-file nil
)
213 (error "Error in unit test harness:\n %S" err
))
217 (provide 'cedet-utests
)
218 ;;; cedet-utests.el ends here