diff options
| author | Glenn Morris | 2017-05-20 17:00:02 -0700 |
|---|---|---|
| committer | Glenn Morris | 2017-05-20 17:00:02 -0700 |
| commit | ed8b4e0c0c5da838e639d1505bdd090a7e2d735f (patch) | |
| tree | 89f220ad76134c55f35d95325df3445930de21ee | |
| parent | abd098200bfba2577dfff800f27d5474f13cc1f3 (diff) | |
| download | emacs-ed8b4e0c0c5da838e639d1505bdd090a7e2d735f.tar.gz emacs-ed8b4e0c0c5da838e639d1505bdd090a7e2d735f.zip | |
Prevent running vc-tests writing to ~/.bzr.log
* test/lisp/vc/vc-tests.el (vc-test--create-repo)
(vc-test--register, vc-test--working-revision)
(vc-test--checkout-model): Set temporary BZR_HOME, to disable logging.
| -rw-r--r-- | test/lisp/vc/vc-tests.el | 45 |
1 files changed, 38 insertions, 7 deletions
diff --git a/test/lisp/vc/vc-tests.el b/test/lisp/vc/vc-tests.el index 656f673b201..1104085a2e1 100644 --- a/test/lisp/vc/vc-tests.el +++ b/test/lisp/vc/vc-tests.el | |||
| @@ -115,7 +115,7 @@ | |||
| 115 | 115 | ||
| 116 | (defvar vc-test--cleanup-hook nil | 116 | (defvar vc-test--cleanup-hook nil |
| 117 | "Functions for cleanup at the end of an ert test. | 117 | "Functions for cleanup at the end of an ert test. |
| 118 | Don't set it globally, the functions shall be let-bound.") | 118 | Don't set it globally, the functions should be let-bound.") |
| 119 | 119 | ||
| 120 | (defun vc-test--revision-granularity-function (backend) | 120 | (defun vc-test--revision-granularity-function (backend) |
| 121 | "Run the `vc-revision-granularity' backend function." | 121 | "Run the `vc-revision-granularity' backend function." |
| @@ -181,7 +181,13 @@ For backends which dont support it, it is emulated." | |||
| 181 | (file-name-as-directory | 181 | (file-name-as-directory |
| 182 | (expand-file-name | 182 | (expand-file-name |
| 183 | (make-temp-name "vc-test") temporary-file-directory))) | 183 | (make-temp-name "vc-test") temporary-file-directory))) |
| 184 | (process-environment process-environment) | ||
| 185 | tempdir | ||
| 184 | vc-test--cleanup-hook) | 186 | vc-test--cleanup-hook) |
| 187 | (when (eq backend 'Bzr) | ||
| 188 | (setq tempdir (make-temp-file "vc-test--create-repo" t) | ||
| 189 | process-environment (cons (format "BZR_HOME=%s" tempdir) | ||
| 190 | process-environment))) | ||
| 185 | 191 | ||
| 186 | (unwind-protect | 192 | (unwind-protect |
| 187 | (progn | 193 | (progn |
| @@ -201,7 +207,9 @@ For backends which dont support it, it is emulated." | |||
| 201 | (should (eq (vc-responsible-backend default-directory) backend))) | 207 | (should (eq (vc-responsible-backend default-directory) backend))) |
| 202 | 208 | ||
| 203 | ;; Save exit. | 209 | ;; Save exit. |
| 204 | (ignore-errors (run-hooks 'vc-test--cleanup-hook))))) | 210 | (ignore-errors |
| 211 | (if tempdir (delete-directory tempdir t)) | ||
| 212 | (run-hooks 'vc-test--cleanup-hook))))) | ||
| 205 | 213 | ||
| 206 | ;; FIXME: Why isn't there `vc-unregister'? | 214 | ;; FIXME: Why isn't there `vc-unregister'? |
| 207 | (defun vc-test--unregister-function (backend file) | 215 | (defun vc-test--unregister-function (backend file) |
| @@ -231,8 +239,13 @@ This checks also `vc-backend' and `vc-responsible-backend'." | |||
| 231 | (file-name-as-directory | 239 | (file-name-as-directory |
| 232 | (expand-file-name | 240 | (expand-file-name |
| 233 | (make-temp-name "vc-test") temporary-file-directory))) | 241 | (make-temp-name "vc-test") temporary-file-directory))) |
| 242 | (process-environment process-environment) | ||
| 243 | tempdir | ||
| 234 | vc-test--cleanup-hook) | 244 | vc-test--cleanup-hook) |
| 235 | 245 | (when (eq backend 'Bzr) | |
| 246 | (setq tempdir (make-temp-file "vc-test--register" t) | ||
| 247 | process-environment (cons (format "BZR_HOME=%s" tempdir) | ||
| 248 | process-environment))) | ||
| 236 | (unwind-protect | 249 | (unwind-protect |
| 237 | (progn | 250 | (progn |
| 238 | ;; Cleanup. | 251 | ;; Cleanup. |
| @@ -292,12 +305,14 @@ This checks also `vc-backend' and `vc-responsible-backend'." | |||
| 292 | (should-not (vc-backend tmp-name2)) | 305 | (should-not (vc-backend tmp-name2)) |
| 293 | (should-not (vc-registered tmp-name2))) | 306 | (should-not (vc-registered tmp-name2))) |
| 294 | 307 | ||
| 295 | ;; The files shall still exist. | 308 | ;; The files should still exist. |
| 296 | (should (file-exists-p tmp-name1)) | 309 | (should (file-exists-p tmp-name1)) |
| 297 | (should (file-exists-p tmp-name2)))) | 310 | (should (file-exists-p tmp-name2)))) |
| 298 | 311 | ||
| 299 | ;; Save exit. | 312 | ;; Save exit. |
| 300 | (ignore-errors (run-hooks 'vc-test--cleanup-hook))))) | 313 | (ignore-errors |
| 314 | (if tempdir (delete-directory tempdir t)) | ||
| 315 | (run-hooks 'vc-test--cleanup-hook))))) | ||
| 301 | 316 | ||
| 302 | (defun vc-test--state (backend) | 317 | (defun vc-test--state (backend) |
| 303 | "Check the different states of a file." | 318 | "Check the different states of a file." |
| @@ -374,7 +389,13 @@ This checks also `vc-backend' and `vc-responsible-backend'." | |||
| 374 | (file-name-as-directory | 389 | (file-name-as-directory |
| 375 | (expand-file-name | 390 | (expand-file-name |
| 376 | (make-temp-name "vc-test") temporary-file-directory))) | 391 | (make-temp-name "vc-test") temporary-file-directory))) |
| 392 | (process-environment process-environment) | ||
| 393 | tempdir | ||
| 377 | vc-test--cleanup-hook) | 394 | vc-test--cleanup-hook) |
| 395 | (when (eq backend 'Bzr) | ||
| 396 | (setq tempdir (make-temp-file "vc-test--working-revision" t) | ||
| 397 | process-environment (cons (format "BZR_HOME=%s" tempdir) | ||
| 398 | process-environment))) | ||
| 378 | 399 | ||
| 379 | (unwind-protect | 400 | (unwind-protect |
| 380 | (progn | 401 | (progn |
| @@ -435,7 +456,9 @@ This checks also `vc-backend' and `vc-responsible-backend'." | |||
| 435 | (should-not (vc-working-revision tmp-name))))) | 456 | (should-not (vc-working-revision tmp-name))))) |
| 436 | 457 | ||
| 437 | ;; Save exit. | 458 | ;; Save exit. |
| 438 | (ignore-errors (run-hooks 'vc-test--cleanup-hook))))) | 459 | (ignore-errors |
| 460 | (if tempdir (delete-directory tempdir t)) | ||
| 461 | (run-hooks 'vc-test--cleanup-hook))))) | ||
| 439 | 462 | ||
| 440 | (defun vc-test--checkout-model (backend) | 463 | (defun vc-test--checkout-model (backend) |
| 441 | "Check the checkout model of a repository." | 464 | "Check the checkout model of a repository." |
| @@ -445,7 +468,13 @@ This checks also `vc-backend' and `vc-responsible-backend'." | |||
| 445 | (file-name-as-directory | 468 | (file-name-as-directory |
| 446 | (expand-file-name | 469 | (expand-file-name |
| 447 | (make-temp-name "vc-test") temporary-file-directory))) | 470 | (make-temp-name "vc-test") temporary-file-directory))) |
| 471 | (process-environment process-environment) | ||
| 472 | tempdir | ||
| 448 | vc-test--cleanup-hook) | 473 | vc-test--cleanup-hook) |
| 474 | (when (eq backend 'Bzr) | ||
| 475 | (setq tempdir (make-temp-file "vc-test--checkout-model" t) | ||
| 476 | process-environment (cons (format "BZR_HOME=%s" tempdir) | ||
| 477 | process-environment))) | ||
| 449 | 478 | ||
| 450 | (unwind-protect | 479 | (unwind-protect |
| 451 | (progn | 480 | (progn |
| @@ -512,7 +541,9 @@ This checks also `vc-backend' and `vc-responsible-backend'." | |||
| 512 | '(announce implicit locking)))))) | 541 | '(announce implicit locking)))))) |
| 513 | 542 | ||
| 514 | ;; Save exit. | 543 | ;; Save exit. |
| 515 | (ignore-errors (run-hooks 'vc-test--cleanup-hook))))) | 544 | (ignore-errors |
| 545 | (if tempdir (delete-directory tempdir t)) | ||
| 546 | (run-hooks 'vc-test--cleanup-hook))))) | ||
| 516 | 547 | ||
| 517 | ;; Create the test cases. | 548 | ;; Create the test cases. |
| 518 | 549 | ||