diff options
| author | Markus Rost | 2002-10-13 02:47:54 +0000 |
|---|---|---|
| committer | Markus Rost | 2002-10-13 02:47:54 +0000 |
| commit | 6be19e602822a4ec1b3fb128f9ca0fedd821017c (patch) | |
| tree | 25f8abde4cfc1f0d8e39fa8fd81fb46cb44633bf /admin | |
| parent | 6a3f6d373eeaf33b7a50f083678167a9aba29165 (diff) | |
| download | emacs-6be19e602822a4ec1b3fb128f9ca0fedd821017c.tar.gz emacs-6be19e602822a4ec1b3fb128f9ca0fedd821017c.zip | |
Further changes. Improve the reports from batch runs.
(cus-test-libs): Run load tests in external processes.
Diffstat (limited to 'admin')
| -rw-r--r-- | admin/cus-test.el | 341 |
1 files changed, 198 insertions, 143 deletions
diff --git a/admin/cus-test.el b/admin/cus-test.el index 78e7ad2260e..7d7717de5aa 100644 --- a/admin/cus-test.el +++ b/admin/cus-test.el | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | ;;; cus-test.el --- functions for testing custom variable definitions | 1 | ;;; cus-test.el --- tests for custom types and load problems |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1998, 2000, 2002 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1998, 2000, 2002 Free Software Foundation, Inc. |
| 4 | 4 | ||
| @@ -26,13 +26,21 @@ | |||
| 26 | 26 | ||
| 27 | ;;; Commentary: | 27 | ;;; Commentary: |
| 28 | 28 | ||
| 29 | ;; Some user options in GNU Emacs have been defined with incorrect | 29 | ;; This file provides simple tests to detect custom options with |
| 30 | ;; customization types. As a result the customization of these | 30 | ;; incorrect customization types and load problems for custom and |
| 31 | ;; options is disabled. This file provides functions to detect such | 31 | ;; autoload dependencies. |
| 32 | ;; options. It contains also simple tests for loading libraries and | ||
| 33 | ;; custom dependencies. | ||
| 34 | ;; | 32 | ;; |
| 35 | ;; Usage: Load this file. Then | 33 | ;; The basic tests can be run in batch mode. Invoke them with |
| 34 | ;; | ||
| 35 | ;; src/emacs -batch -l admin/cus-test.el -f cus-test-opts | ||
| 36 | ;; | ||
| 37 | ;; src/emacs -batch -l admin/cus-test.el -f cus-test-deps | ||
| 38 | ;; | ||
| 39 | ;; src/emacs -batch -l admin/cus-test.el -f cus-test-libs | ||
| 40 | ;; | ||
| 41 | ;; in the emacs source directory. | ||
| 42 | ;; | ||
| 43 | ;; For interactive use: Load this file. Then | ||
| 36 | ;; | 44 | ;; |
| 37 | ;; M-x cus-test-apropos REGEXP RET | 45 | ;; M-x cus-test-apropos REGEXP RET |
| 38 | ;; | 46 | ;; |
| @@ -47,9 +55,13 @@ | |||
| 47 | ;; Therefore `cus-test-apropos' is more efficient after loading many | 55 | ;; Therefore `cus-test-apropos' is more efficient after loading many |
| 48 | ;; libraries. | 56 | ;; libraries. |
| 49 | ;; | 57 | ;; |
| 50 | ;; M-x cus-test-load-custom-loads RET | 58 | ;; M-x cus-test-load-custom-loads |
| 59 | ;; | ||
| 60 | ;; loads all (!) custom dependencies and | ||
| 51 | ;; | 61 | ;; |
| 52 | ;; loads all (!) custom dependencies. | 62 | ;; M-x cus-test-load-libs |
| 63 | ;; | ||
| 64 | ;; loads all (!) libraries with autoloads. | ||
| 53 | ;; | 65 | ;; |
| 54 | ;; Options with a custom-get property, usually defined by a :get | 66 | ;; Options with a custom-get property, usually defined by a :get |
| 55 | ;; declaration, are stored in the variable | 67 | ;; declaration, are stored in the variable |
| @@ -64,52 +76,57 @@ | |||
| 64 | ;; These lists are prepared just in case one wants to investigate | 76 | ;; These lists are prepared just in case one wants to investigate |
| 65 | ;; those options further. | 77 | ;; those options further. |
| 66 | ;; | 78 | ;; |
| 67 | ;; For a maximal test of custom options invoke | 79 | ;; The command `cus-test-opts' tests many (all?) custom options. |
| 68 | ;; | 80 | ;; |
| 69 | ;; M-x cus-test-opts | 81 | ;; The command `cus-test-deps' is like `cus-test-load-custom-loads' |
| 82 | ;; but reports about load errors. | ||
| 70 | ;; | 83 | ;; |
| 71 | ;; Other test routines are `cus-test-deps' and `cus-test-libs'. | 84 | ;; The command `cus-test-libs' runs for all libraries with autoloads |
| 72 | ;; These functions are suitable for batch mode. Invoke them with | 85 | ;; separate emacs processes of the form "emacs -batch -l LIB". |
| 73 | ;; | 86 | ;; |
| 74 | ;; src/emacs -batch -l admin/cus-test.el -f cus-test-opts | 87 | ;; Some results from October 2002: |
| 75 | ;; | 88 | ;; |
| 76 | ;; src/emacs -batch -l admin/cus-test.el -f cus-test-deps | 89 | ;; 4523 options tested |
| 77 | ;; | 90 | ;; The following variables might have problems: |
| 78 | ;; src/emacs -batch -l admin/cus-test.el -f cus-test-libs | 91 | ;; ps-mule-font-info-database-default |
| 79 | ;; | ||
| 80 | ;; in the emacs source directory. | ||
| 81 | ;; | ||
| 82 | ;; To make cus-test work one has usually to work-around some existing | ||
| 83 | ;; bugs/problems. Therefore this file contains "Fixme" and | ||
| 84 | ;; "Workarounds" sections, to be edited once in a while. | ||
| 85 | ;; | 92 | ;; |
| 86 | ;; Results from Oct 10, 2002: | 93 | ;; 288 features required |
| 94 | ;; 10 files loaded | ||
| 95 | ;; The following load problems appeared: | ||
| 96 | ;; (killing x-win (file-error Cannot open load file x-win)) | ||
| 97 | ;; Symbol faces has loaddefs as custom dependency | ||
| 98 | ;; ... | ||
| 87 | ;; | 99 | ;; |
| 88 | ;; Cus Test tested 4514 options. | 100 | ;; 422 libraries had no load errors |
| 89 | ;; The following variables might have problems: | ||
| 90 | ;; (ps-mule-font-info-database-default) | ||
| 91 | |||
| 92 | ;; Cus Test Deps loaded 332 files. | ||
| 93 | ;; The following load problems appeared: | 101 | ;; The following load problems appeared: |
| 94 | ;; ((killing x-win (file-error Cannot open load file x-win))) | 102 | ;; (eudc-export error 255) |
| 95 | 103 | ;; ... | |
| 96 | ;; Cus Test Libs loaded 424 files. | ||
| 97 | ;; No load problems encountered by Cus Test Libs | ||
| 98 | 104 | ||
| 99 | ;;; Code: | 105 | ;;; Code: |
| 100 | 106 | ||
| 101 | ;;; Variables for workarounds: | 107 | ;;; Workarounds. For a smooth run and to avoid some side effects. |
| 102 | 108 | ||
| 103 | (defvar cus-test-after-load-libs-hook nil | 109 | (defvar cus-test-after-load-libs-hook nil |
| 104 | "Hook to repair the worst side effects of loading buggy libraries.") | 110 | "Used to switch off undesired side effects of loading libraries.") |
| 111 | |||
| 112 | (defvar cus-test-skip-list nil | ||
| 113 | "List of variables to disregard by `cus-test-apropos'.") | ||
| 105 | 114 | ||
| 106 | (defvar cus-test-libs-noloads nil | 115 | (defvar cus-test-noloads nil |
| 107 | "List of libraries not to load by `cus-test-libs'.") | 116 | "List of libraries not to load by `cus-test-load-libs'.") |
| 117 | |||
| 118 | ;; The file eudc-export.el loads libraries "bbdb" and "bbdb-com" which | ||
| 119 | ;; are not part of GNU Emacs: (locate-library "bbdb") => nil | ||
| 120 | ;; We avoid the resulting errors from loading eudc-export.el: | ||
| 121 | (provide 'bbdb) | ||
| 122 | (provide 'bbdb-com) | ||
| 108 | 123 | ||
| 109 | ;;; Fixme: | 124 | ;; This avoids a hang of `cus-test-apropos' in 21.2. |
| 125 | ;; (add-to-list 'cus-test-skip-list 'sh-alias-alist) | ||
| 110 | 126 | ||
| 111 | ;; Loading filesets.el currently disables mini-buffer echoes. | 127 | ;; Don't create a file `filesets-menu-cache-file'. |
| 112 | ;; (add-to-list 'cus-test-libs-noloads "filesets") | 128 | (setq filesets-menu-cache-file "") |
| 129 | ;; Disable filesets hooks. | ||
| 113 | (add-hook | 130 | (add-hook |
| 114 | 'cus-test-after-load-libs-hook | 131 | 'cus-test-after-load-libs-hook |
| 115 | (lambda nil | 132 | (lambda nil |
| @@ -118,33 +135,13 @@ | |||
| 118 | (remove-hook 'kill-buffer-hook 'filesets-remove-from-ubl) | 135 | (remove-hook 'kill-buffer-hook 'filesets-remove-from-ubl) |
| 119 | (remove-hook 'first-change-hook 'filesets-reset-filename-on-change) | 136 | (remove-hook 'first-change-hook 'filesets-reset-filename-on-change) |
| 120 | )) | 137 | )) |
| 121 | ;; (setq cus-test-after-load-libs-hook nil) | ||
| 122 | |||
| 123 | ;; eshell must be loaded before em-script. eshell loads esh-util, | ||
| 124 | ;; which must be loaded before em-cmpl, em-dirs and similar libraries. | ||
| 125 | (load "eshell") | ||
| 126 | |||
| 127 | ;; reftex must be loaded before reftex-vars. | ||
| 128 | (load "reftex") | ||
| 129 | |||
| 130 | ;;; Workarounds: | ||
| 131 | |||
| 132 | ;; The file eudc-export.el loads libraries "bbdb" and "bbdb-com" which | ||
| 133 | ;; are not part of GNU Emacs: (locate-library "bbdb") => nil | ||
| 134 | |||
| 135 | ;; This avoids the resulting errors from loading eudc-export.el. | ||
| 136 | (provide 'bbdb) | ||
| 137 | (provide 'bbdb-com) | ||
| 138 | 138 | ||
| 139 | ;; Loading dunnet in batch mode leads to a Dead end. | 139 | ;; Loading dunnet in batch mode leads to a Dead end. |
| 140 | (let (noninteractive) | 140 | (let (noninteractive) (load "dunnet")) |
| 141 | (load "dunnet")) | 141 | (add-to-list 'cus-test-noloads "dunnet") |
| 142 | (add-to-list 'cus-test-libs-noloads "dunnet") | ||
| 143 | 142 | ||
| 144 | ;;; Silencing: | 143 | ;; Never Viperize. |
| 145 | 144 | (setq viper-mode nil) | |
| 146 | ;; Don't create a file `filesets-menu-cache-file'. | ||
| 147 | (setq filesets-menu-cache-file "") | ||
| 148 | 145 | ||
| 149 | ;; Don't create a file `save-place-file'. | 146 | ;; Don't create a file `save-place-file'. |
| 150 | (eval-after-load "saveplace" | 147 | (eval-after-load "saveplace" |
| @@ -157,36 +154,39 @@ | |||
| 157 | (eval-after-load "bytecomp" | 154 | (eval-after-load "bytecomp" |
| 158 | '(setq ad-default-compilation-action 'never)) | 155 | '(setq ad-default-compilation-action 'never)) |
| 159 | 156 | ||
| 157 | |||
| 158 | ;;; Main code: | ||
| 159 | |||
| 160 | ;; We want to log all messages. | 160 | ;; We want to log all messages. |
| 161 | (setq message-log-max t) | 161 | (setq message-log-max t) |
| 162 | 162 | ||
| 163 | |||
| 164 | ;;; Main Code: | ||
| 165 | |||
| 166 | (require 'cus-edit) | 163 | (require 'cus-edit) |
| 167 | (require 'cus-load) | 164 | (require 'cus-load) |
| 168 | 165 | ||
| 169 | (defvar cus-test-tested-variables nil | ||
| 170 | "Options tested by last call of `cus-test-apropos'.") | ||
| 171 | |||
| 172 | (defvar cus-test-errors nil | 166 | (defvar cus-test-errors nil |
| 173 | "List of problematic variables found by `cus-test-apropos'.") | 167 | "List of problematic variables found by `cus-test-apropos'.") |
| 174 | 168 | ||
| 169 | (defvar cus-test-tested-variables nil | ||
| 170 | "List of options tested by last call of `cus-test-apropos'.") | ||
| 171 | |||
| 175 | (defvar cus-test-deps-errors nil | 172 | (defvar cus-test-deps-errors nil |
| 176 | "List of require/load problems found by `cus-test-deps'.") | 173 | "List of require/load problems found by `cus-test-deps'.") |
| 177 | 174 | ||
| 175 | (defvar cus-test-deps-required nil | ||
| 176 | "List of dependencies required by `cus-test-deps'. | ||
| 177 | Only unloaded features will be require'd.") | ||
| 178 | |||
| 178 | (defvar cus-test-deps-loaded nil | 179 | (defvar cus-test-deps-loaded nil |
| 179 | "Dependencies loaded by `cus-test-deps'.") | 180 | "List of dependencies loaded by `cus-test-deps'.") |
| 180 | 181 | ||
| 181 | (defvar cus-test-libs-errors nil | 182 | (defvar cus-test-libs-errors nil |
| 182 | "List of load problems found by `cus-test-libs'.") | 183 | "List of load problems found by `cus-test-load-libs' or `cus-test-libs'.") |
| 183 | 184 | ||
| 184 | (defvar cus-test-libs-loaded nil | 185 | (defvar cus-test-libs-loaded nil |
| 185 | "Files loaded by `cus-test-libs'.") | 186 | "List of files loaded by `cus-test-load-libs' or `cus-test-libs'.") |
| 186 | 187 | ||
| 187 | ;; I haven't understood this :get stuff. However, there are only very | 188 | ;; I haven't understood this :get stuff. The symbols with a |
| 188 | ;; few variables with a custom-get property. Such symbols are stored | 189 | ;; custom-get property are stored here. |
| 189 | ;; in `cus-test-vars-with-custom-get'. | ||
| 190 | (defvar cus-test-vars-with-custom-get nil | 190 | (defvar cus-test-vars-with-custom-get nil |
| 191 | "Set by `cus-test-apropos' to a list of options with :get property.") | 191 | "Set by `cus-test-apropos' to a list of options with :get property.") |
| 192 | 192 | ||
| @@ -199,12 +199,12 @@ The detected problematic options are stored in `cus-test-errors'." | |||
| 199 | (interactive "sVariable regexp: ") | 199 | (interactive "sVariable regexp: ") |
| 200 | (setq cus-test-errors nil) | 200 | (setq cus-test-errors nil) |
| 201 | (setq cus-test-tested-variables nil) | 201 | (setq cus-test-tested-variables nil) |
| 202 | (mapcar | 202 | (mapc |
| 203 | (lambda (symbol) | 203 | (lambda (symbol) |
| 204 | (push symbol cus-test-tested-variables) | 204 | (push symbol cus-test-tested-variables) |
| 205 | (unless noninteractive | 205 | ;; Be verbose in case we hang. |
| 206 | (message "Cus Test Running...[%s]" | 206 | (message "Cus Test running...%s %s" |
| 207 | (length cus-test-tested-variables))) | 207 | (length cus-test-tested-variables) symbol) |
| 208 | (condition-case alpha | 208 | (condition-case alpha |
| 209 | (let* ((type (custom-variable-type symbol)) | 209 | (let* ((type (custom-variable-type symbol)) |
| 210 | (conv (widget-convert type)) | 210 | (conv (widget-convert type)) |
| @@ -220,14 +220,15 @@ The detected problematic options are stored in `cus-test-errors'." | |||
| 220 | ;; (push (widget-get conv :value) values) | 220 | ;; (push (widget-get conv :value) values) |
| 221 | 221 | ||
| 222 | ;; Check the values | 222 | ;; Check the values |
| 223 | (mapcar (lambda (value) | 223 | (mapc (lambda (value) |
| 224 | (unless (widget-apply conv :match value) | 224 | (unless (widget-apply conv :match value) |
| 225 | (setq mismatch 'mismatch))) | 225 | (setq mismatch 'mismatch))) |
| 226 | values) | 226 | values) |
| 227 | 227 | ||
| 228 | ;; Store symbols with a custom-get property. | 228 | ;; Store symbols with a custom-get property. |
| 229 | (when (get symbol 'custom-get) | 229 | (when (get symbol 'custom-get) |
| 230 | (push symbol cus-test-vars-with-custom-get)) | 230 | (add-to-list 'cus-test-vars-with-custom-get |
| 231 | symbol 'append)) | ||
| 231 | 232 | ||
| 232 | ;; Changed outside the customize buffer? | 233 | ;; Changed outside the customize buffer? |
| 233 | ;; This routine is not very much tested. | 234 | ;; This routine is not very much tested. |
| @@ -238,7 +239,8 @@ The detected problematic options are stored in `cus-test-errors'." | |||
| 238 | (and (consp c-value) | 239 | (and (consp c-value) |
| 239 | (boundp symbol) | 240 | (boundp symbol) |
| 240 | (not (equal (eval (car c-value)) (symbol-value symbol))) | 241 | (not (equal (eval (car c-value)) (symbol-value symbol))) |
| 241 | (push symbol cus-test-vars-with-changed-state))) | 242 | (add-to-list 'cus-test-vars-with-changed-state |
| 243 | symbol 'append))) | ||
| 242 | 244 | ||
| 243 | (if mismatch | 245 | (if mismatch |
| 244 | (push symbol cus-test-errors))) | 246 | (push symbol cus-test-errors))) |
| @@ -247,7 +249,7 @@ The detected problematic options are stored in `cus-test-errors'." | |||
| 247 | (push symbol cus-test-errors) | 249 | (push symbol cus-test-errors) |
| 248 | (message "Error for %s: %s" symbol alpha)))) | 250 | (message "Error for %s: %s" symbol alpha)))) |
| 249 | (cus-test-get-options regexp)) | 251 | (cus-test-get-options regexp)) |
| 250 | (message "Cus Test tested %s options." | 252 | (message "%s options tested" |
| 251 | (length cus-test-tested-variables)) | 253 | (length cus-test-tested-variables)) |
| 252 | (cus-test-errors-display)) | 254 | (cus-test-errors-display)) |
| 253 | 255 | ||
| @@ -263,7 +265,7 @@ The detected problematic options are stored in `cus-test-errors'." | |||
| 263 | ;; (get symbol 'saved-value) | 265 | ;; (get symbol 'saved-value) |
| 264 | (get symbol 'custom-type)) | 266 | (get symbol 'custom-type)) |
| 265 | (string-match regexp (symbol-name symbol)) | 267 | (string-match regexp (symbol-name symbol)) |
| 266 | ;; (not (member symbol cus-test-strange-vars)) | 268 | (not (member symbol cus-test-skip-list)) |
| 267 | (push symbol found)))) | 269 | (push symbol found)))) |
| 268 | found)) | 270 | found)) |
| 269 | 271 | ||
| @@ -274,22 +276,67 @@ The detected problematic options are stored in `cus-test-errors'." | |||
| 274 | (insert (format "Cus Test tested %s variables.\ | 276 | (insert (format "Cus Test tested %s variables.\ |
| 275 | See `cus-test-tested-variables'.\n\n" | 277 | See `cus-test-tested-variables'.\n\n" |
| 276 | (length cus-test-tested-variables))) | 278 | (length cus-test-tested-variables))) |
| 277 | (if cus-test-errors | 279 | (if (not cus-test-errors) |
| 278 | (let ((L cus-test-errors)) | 280 | (insert "No errors found by cus-test.") |
| 279 | (insert "The following variables seem to have problems:\n\n") | 281 | (insert "The following variables seem to have problems:\n\n") |
| 280 | (while L (insert (symbol-name (car L))) (insert "\n") | 282 | (dolist (E cus-test-errors) |
| 281 | (setq L (cdr L)))) | 283 | (insert (symbol-name E) "\n"))))) |
| 282 | (insert "No errors found by cus-test.")))) | 284 | |
| 283 | 285 | (defun cus-test-load-custom-loads () | |
| 284 | (defun cus-test-load-custom-loads nil | ||
| 285 | "Call `custom-load-symbol' on all atoms." | 286 | "Call `custom-load-symbol' on all atoms." |
| 286 | (interactive) | 287 | (interactive) |
| 287 | (mapatoms 'custom-load-symbol) | 288 | (mapatoms 'custom-load-symbol) |
| 288 | (run-hooks 'cus-test-after-load-libs-hook)) | 289 | (run-hooks 'cus-test-after-load-libs-hook)) |
| 289 | 290 | ||
| 291 | (defun cus-test-load-libs () | ||
| 292 | "Load the libraries with autoloads. | ||
| 293 | Don't load libraries in `cus-test-noloads'." | ||
| 294 | (interactive) | ||
| 295 | (setq cus-test-libs-errors nil) | ||
| 296 | (setq cus-test-libs-loaded nil) | ||
| 297 | (mapc | ||
| 298 | (lambda (file) | ||
| 299 | (condition-case alpha | ||
| 300 | (unless (member file cus-test-noloads) | ||
| 301 | (load file) | ||
| 302 | (push file cus-test-libs-loaded)) | ||
| 303 | (error | ||
| 304 | (push (cons file alpha) cus-test-libs-errors) | ||
| 305 | (message "Error for %s: %s" file alpha)))) | ||
| 306 | (cus-test-get-autoload-deps)) | ||
| 307 | (message "%s libraries loaded successfully" | ||
| 308 | (length cus-test-libs-loaded)) | ||
| 309 | (if (not cus-test-libs-errors) | ||
| 310 | (message "No load problems encountered") | ||
| 311 | (message "The following load problems appeared:") | ||
| 312 | (cus-test-message cus-test-libs-errors)) | ||
| 313 | (run-hooks 'cus-test-after-load-libs-hook)) | ||
| 314 | |||
| 315 | (defun cus-test-get-autoload-deps () | ||
| 316 | "Return the list of libraries with autoloads." | ||
| 317 | (with-temp-buffer | ||
| 318 | (insert-file-contents (locate-library "loaddefs")) | ||
| 319 | ;; This is from `customize-option'. | ||
| 320 | (let (deps file) | ||
| 321 | (while | ||
| 322 | (search-forward "\n;;; Generated autoloads from " nil t) | ||
| 323 | (goto-char (match-end 0)) | ||
| 324 | (setq file (buffer-substring (point) | ||
| 325 | (progn (end-of-line) (point)))) | ||
| 326 | (setq file (file-name-nondirectory file)) | ||
| 327 | (string-match "\\.el\\'" file) | ||
| 328 | (setq file (substring file 0 (match-beginning 0))) | ||
| 329 | (setq deps (nconc deps (list file)))) | ||
| 330 | deps))) | ||
| 331 | |||
| 332 | (defun cus-test-message (list) | ||
| 333 | "Print the members of LIST line by line." | ||
| 334 | (dolist (m list) (message "%s" m))) | ||
| 335 | |||
| 336 | |||
| 290 | ;;; The routines for batch mode: | 337 | ;;; The routines for batch mode: |
| 291 | 338 | ||
| 292 | (defun cus-test-opts nil | 339 | (defun cus-test-opts () |
| 293 | "Test custom options. | 340 | "Test custom options. |
| 294 | This function is suitable for batch mode. E.g., invoke | 341 | This function is suitable for batch mode. E.g., invoke |
| 295 | 342 | ||
| @@ -301,12 +348,12 @@ in the emacs source directory." | |||
| 301 | (cus-test-load-custom-loads) | 348 | (cus-test-load-custom-loads) |
| 302 | (message "Running %s" 'cus-test-apropos) | 349 | (message "Running %s" 'cus-test-apropos) |
| 303 | (cus-test-apropos "") | 350 | (cus-test-apropos "") |
| 304 | (if cus-test-errors | 351 | (if (not cus-test-errors) |
| 305 | (message "The following options might have problems:\n%s" | 352 | (message "No problems found") |
| 306 | cus-test-errors) | 353 | (message "The following options might have problems:") |
| 307 | (message "No problems found by Cus Test Opts"))) | 354 | (cus-test-message cus-test-errors))) |
| 308 | 355 | ||
| 309 | (defun cus-test-deps nil | 356 | (defun cus-test-deps () |
| 310 | "Run a verbose version of `custom-load-symbol' on all atoms. | 357 | "Run a verbose version of `custom-load-symbol' on all atoms. |
| 311 | This function is suitable for batch mode. E.g., invoke | 358 | This function is suitable for batch mode. E.g., invoke |
| 312 | 359 | ||
| @@ -315,6 +362,7 @@ This function is suitable for batch mode. E.g., invoke | |||
| 315 | in the emacs source directory." | 362 | in the emacs source directory." |
| 316 | (interactive) | 363 | (interactive) |
| 317 | (setq cus-test-deps-errors nil) | 364 | (setq cus-test-deps-errors nil) |
| 365 | (setq cus-test-deps-required nil) | ||
| 318 | (setq cus-test-deps-loaded nil) | 366 | (setq cus-test-deps-loaded nil) |
| 319 | (mapatoms | 367 | (mapatoms |
| 320 | ;; This code is mainly from `custom-load-symbol'. | 368 | ;; This code is mainly from `custom-load-symbol'. |
| @@ -326,12 +374,16 @@ in the emacs source directory." | |||
| 326 | ((symbolp load) | 374 | ((symbolp load) |
| 327 | ;; (condition-case nil (require load) (error nil)) | 375 | ;; (condition-case nil (require load) (error nil)) |
| 328 | (condition-case alpha | 376 | (condition-case alpha |
| 329 | (progn | 377 | (unless (featurep load) |
| 330 | (require load) | 378 | (require load) |
| 331 | (push (list symbol load) cus-test-deps-loaded)) | 379 | (push (list symbol load) cus-test-deps-required)) |
| 332 | (error | 380 | (error |
| 333 | (push (list symbol load alpha) cus-test-deps-errors) | 381 | (push (list symbol load alpha) cus-test-deps-errors) |
| 334 | (message "Require problem: %s %s: %s" symbol load alpha)))) | 382 | (message "Require problem: %s %s %s" symbol load alpha)))) |
| 383 | ((equal load "loaddefs") | ||
| 384 | (push | ||
| 385 | (message "Symbol %s has loaddefs as custom dependency" symbol) | ||
| 386 | cus-test-deps-errors)) | ||
| 335 | ;; This is subsumed by the test below, but it's much | 387 | ;; This is subsumed by the test below, but it's much |
| 336 | ;; faster. | 388 | ;; faster. |
| 337 | ((assoc load load-history)) | 389 | ((assoc load load-history)) |
| @@ -359,20 +411,20 @@ in the emacs source directory." | |||
| 359 | (push (list symbol load) cus-test-deps-loaded)) | 411 | (push (list symbol load) cus-test-deps-loaded)) |
| 360 | (error | 412 | (error |
| 361 | (push (list symbol load alpha) cus-test-deps-errors) | 413 | (push (list symbol load alpha) cus-test-deps-errors) |
| 362 | (message "Load Problem: %s %s: %s" symbol load alpha)))) | 414 | (message "Load Problem: %s %s %s" symbol load alpha)))) |
| 363 | )))))) | 415 | )))))) |
| 364 | (message "Cus Test Deps loaded %s files." | 416 | (message "%s features required" |
| 417 | (length cus-test-deps-required)) | ||
| 418 | (message "%s files loaded" | ||
| 365 | (length cus-test-deps-loaded)) | 419 | (length cus-test-deps-loaded)) |
| 366 | (if cus-test-deps-errors | 420 | (if (not cus-test-deps-errors) |
| 367 | (message "The following load problems appeared:\n%s" | 421 | (message "No load problems encountered") |
| 368 | cus-test-deps-errors) | 422 | (message "The following load problems appeared:") |
| 369 | (message "No load problems encountered by Cus Test Deps")) | 423 | (cus-test-message cus-test-deps-errors)) |
| 370 | (run-hooks 'cus-test-after-load-libs-hook)) | 424 | (run-hooks 'cus-test-after-load-libs-hook)) |
| 371 | 425 | ||
| 372 | (defun cus-test-libs () | 426 | (defun cus-test-libs () |
| 373 | "Load the libraries with autoloads in loaddefs.el. | 427 | "Load the libraries with autoloads in separate processes. |
| 374 | Don't load libraries in `cus-test-libs-noloads'. | ||
| 375 | |||
| 376 | This function is useful to detect load problems of libraries. | 428 | This function is useful to detect load problems of libraries. |
| 377 | It is suitable for batch mode. E.g., invoke | 429 | It is suitable for batch mode. E.g., invoke |
| 378 | 430 | ||
| @@ -380,35 +432,38 @@ It is suitable for batch mode. E.g., invoke | |||
| 380 | 432 | ||
| 381 | in the emacs source directory." | 433 | in the emacs source directory." |
| 382 | (interactive) | 434 | (interactive) |
| 383 | (setq cus-test-libs-errors nil) | 435 | (with-temp-buffer |
| 384 | (setq cus-test-libs-loaded nil) | 436 | (setq cus-test-libs-errors nil) |
| 385 | (set-buffer (find-file-noselect (locate-library "loaddefs"))) | 437 | (setq cus-test-libs-loaded nil) |
| 386 | (goto-char (point-min)) | 438 | (cd source-directory) |
| 387 | (let (file) | 439 | (if (not (file-executable-p "src/emacs")) |
| 388 | (while | 440 | (error "No Emacs executable in %ssrc" default-directory)) |
| 389 | (search-forward "\n;;; Generated autoloads from " nil t) | 441 | (mapc |
| 390 | (goto-char (match-end 0)) | 442 | (lambda (file) |
| 391 | (setq file (buffer-substring (point) | 443 | (condition-case alpha |
| 392 | (progn (end-of-line) (point)))) | 444 | (let (fn cmd status) |
| 393 | ;; If it is, load that library. | 445 | (setq fn (locate-library file)) |
| 394 | (when file | 446 | (if (not fn) |
| 395 | (setq file (file-name-nondirectory file)) | 447 | (error "Library %s not found" file)) |
| 396 | (when (string-match "\\.el\\'" file) | 448 | (setq cmd (concat "src/emacs -batch -l " fn)) |
| 397 | (setq file (substring file 0 (match-beginning 0))))) | 449 | (setq status (call-process shell-file-name nil nil nil |
| 398 | (condition-case alpha | 450 | shell-command-switch cmd)) |
| 399 | (unless (member file cus-test-libs-noloads) | 451 | (if (= status 0) |
| 400 | (load-library file) | 452 | (message "%s" file) |
| 401 | (push file cus-test-libs-loaded)) | 453 | (error "%s" status)) |
| 402 | (error | 454 | (push file cus-test-libs-loaded)) |
| 403 | (push (cons file alpha) cus-test-libs-errors) | 455 | (error |
| 404 | (message "Error for %s: %s" file alpha))))) | 456 | (push (cons file alpha) cus-test-libs-errors) |
| 405 | (message "Cus Test Libs loaded %s files." | 457 | (message "Error for %s: %s" file alpha)))) |
| 406 | (length cus-test-libs-loaded)) | 458 | (cus-test-get-autoload-deps)) |
| 407 | (if cus-test-libs-errors | 459 | (message "Default Directory: %s" default-directory) |
| 408 | (message "The following load problems appeared:\n%s" | 460 | (message "%s libraries had no load errors" |
| 409 | cus-test-libs-errors) | 461 | (length cus-test-libs-loaded)) |
| 410 | (message "No load problems encountered by Cus Test Libs")) | 462 | (if (not cus-test-libs-errors) |
| 411 | (run-hooks 'cus-test-after-load-libs-hook)) | 463 | (message "No load problems encountered") |
| 464 | (message "The following load problems appeared:") | ||
| 465 | (cus-test-message cus-test-libs-errors)) | ||
| 466 | (run-hooks 'cus-test-after-load-libs-hook))) | ||
| 412 | 467 | ||
| 413 | (provide 'cus-test) | 468 | (provide 'cus-test) |
| 414 | 469 | ||