diff options
author | Glenn Morris <rgm@gnu.org> | 2017-05-20 17:00:02 -0700 |
---|---|---|
committer | Glenn Morris <rgm@gnu.org> | 2017-05-20 17:00:02 -0700 |
commit | ed8b4e0c0c5da838e639d1505bdd090a7e2d735f (patch) | |
tree | 89f220ad76134c55f35d95325df3445930de21ee /test/lisp/vc/vc-tests.el | |
parent | abd098200bfba2577dfff800f27d5474f13cc1f3 (diff) | |
download | emacs-ed8b4e0c0c5da838e639d1505bdd090a7e2d735f.tar.gz |
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.
Diffstat (limited to 'test/lisp/vc/vc-tests.el')
-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 @@ (defvar vc-test--cleanup-hook nil "Functions for cleanup at the end of an ert test. -Don't set it globally, the functions shall be let-bound.") +Don't set it globally, the functions should be let-bound.") (defun vc-test--revision-granularity-function (backend) "Run the `vc-revision-granularity' backend function." @@ -181,7 +181,13 @@ For backends which dont support it, it is emulated." (file-name-as-directory (expand-file-name (make-temp-name "vc-test") temporary-file-directory))) + (process-environment process-environment) + tempdir vc-test--cleanup-hook) + (when (eq backend 'Bzr) + (setq tempdir (make-temp-file "vc-test--create-repo" t) + process-environment (cons (format "BZR_HOME=%s" tempdir) + process-environment))) (unwind-protect (progn @@ -201,7 +207,9 @@ For backends which dont support it, it is emulated." (should (eq (vc-responsible-backend default-directory) backend))) ;; Save exit. - (ignore-errors (run-hooks 'vc-test--cleanup-hook))))) + (ignore-errors + (if tempdir (delete-directory tempdir t)) + (run-hooks 'vc-test--cleanup-hook))))) ;; FIXME: Why isn't there `vc-unregister'? (defun vc-test--unregister-function (backend file) @@ -231,8 +239,13 @@ This checks also `vc-backend' and `vc-responsible-backend'." (file-name-as-directory (expand-file-name (make-temp-name "vc-test") temporary-file-directory))) + (process-environment process-environment) + tempdir vc-test--cleanup-hook) - + (when (eq backend 'Bzr) + (setq tempdir (make-temp-file "vc-test--register" t) + process-environment (cons (format "BZR_HOME=%s" tempdir) + process-environment))) (unwind-protect (progn ;; Cleanup. @@ -292,12 +305,14 @@ This checks also `vc-backend' and `vc-responsible-backend'." (should-not (vc-backend tmp-name2)) (should-not (vc-registered tmp-name2))) - ;; The files shall still exist. + ;; The files should still exist. (should (file-exists-p tmp-name1)) (should (file-exists-p tmp-name2)))) ;; Save exit. - (ignore-errors (run-hooks 'vc-test--cleanup-hook))))) + (ignore-errors + (if tempdir (delete-directory tempdir t)) + (run-hooks 'vc-test--cleanup-hook))))) (defun vc-test--state (backend) "Check the different states of a file." @@ -374,7 +389,13 @@ This checks also `vc-backend' and `vc-responsible-backend'." (file-name-as-directory (expand-file-name (make-temp-name "vc-test") temporary-file-directory))) + (process-environment process-environment) + tempdir vc-test--cleanup-hook) + (when (eq backend 'Bzr) + (setq tempdir (make-temp-file "vc-test--working-revision" t) + process-environment (cons (format "BZR_HOME=%s" tempdir) + process-environment))) (unwind-protect (progn @@ -435,7 +456,9 @@ This checks also `vc-backend' and `vc-responsible-backend'." (should-not (vc-working-revision tmp-name))))) ;; Save exit. - (ignore-errors (run-hooks 'vc-test--cleanup-hook))))) + (ignore-errors + (if tempdir (delete-directory tempdir t)) + (run-hooks 'vc-test--cleanup-hook))))) (defun vc-test--checkout-model (backend) "Check the checkout model of a repository." @@ -445,7 +468,13 @@ This checks also `vc-backend' and `vc-responsible-backend'." (file-name-as-directory (expand-file-name (make-temp-name "vc-test") temporary-file-directory))) + (process-environment process-environment) + tempdir vc-test--cleanup-hook) + (when (eq backend 'Bzr) + (setq tempdir (make-temp-file "vc-test--checkout-model" t) + process-environment (cons (format "BZR_HOME=%s" tempdir) + process-environment))) (unwind-protect (progn @@ -512,7 +541,9 @@ This checks also `vc-backend' and `vc-responsible-backend'." '(announce implicit locking)))))) ;; Save exit. - (ignore-errors (run-hooks 'vc-test--cleanup-hook))))) + (ignore-errors + (if tempdir (delete-directory tempdir t)) + (run-hooks 'vc-test--cleanup-hook))))) ;; Create the test cases. |