emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 84e122dc96: Make files-tests.el more robust


From: Michael Albinus
Subject: master 84e122dc96: Make files-tests.el more robust
Date: Wed, 1 Jun 2022 12:36:46 -0400 (EDT)

branch: master
commit 84e122dc9676f1bcf36db62f313b0343a073982b
Author: Michael Albinus <michael.albinus@gmx.de>
Commit: Michael Albinus <michael.albinus@gmx.de>

    Make files-tests.el more robust
    
    * test/lisp/files-tests.el (files-tests--with-temp-non-special)
    (files-tests--with-temp-non-special-and-file-name-handler): Make
    it more robust wrt parallel test jobs.  (Bug#55706)
---
 test/lisp/files-tests.el | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/test/lisp/files-tests.el b/test/lisp/files-tests.el
index 978f96912f..c7ce03cc9b 100644
--- a/test/lisp/files-tests.el
+++ b/test/lisp/files-tests.el
@@ -393,6 +393,8 @@ After evaluating BODY, the temporary file or directory is 
deleted."
   (cl-check-type name symbol)
   (cl-check-type non-special-name symbol)
   `(let* ((temporary-file-directory (file-truename temporary-file-directory))
+          (temporary-file-directory
+           (file-name-as-directory (make-temp-file "files-tests" t)))
           (,name (make-temp-file "files-tests" ,dir-flag))
           (,non-special-name (file-name-quote ,name)))
      (unwind-protect
@@ -402,7 +404,9 @@ After evaluating BODY, the temporary file or directory is 
deleted."
            (delete-file ,name)))
        (when (file-exists-p ,non-special-name)
          (if ,dir-flag (delete-directory ,non-special-name t)
-           (delete-file ,non-special-name))))))
+           (delete-file ,non-special-name)))
+       (when (file-exists-p temporary-file-directory)
+         (delete-directory temporary-file-directory t)))))
 
 (defconst files-tests--special-file-name-extension ".special"
   "Trailing string for test file name handler.")
@@ -444,14 +448,16 @@ unquoted file names."
   (cl-check-type name symbol)
   (cl-check-type non-special-name symbol)
   `(let* ((temporary-file-directory (file-truename temporary-file-directory))
+          (temporary-file-directory
+           (file-name-as-directory (make-temp-file "files-tests" t)))
           (file-name-handler-alist
            `((,files-tests--special-file-name-regexp
               . files-tests--special-file-name-handler)
              . ,file-name-handler-alist))
-           (,name (concat
+          (,name (concat
                   (make-temp-file "files-tests" ,dir-flag)
                   files-tests--special-file-name-extension))
-           (,non-special-name (file-name-quote ,name)))
+          (,non-special-name (file-name-quote ,name)))
      (unwind-protect
          (progn ,@body)
        (when (file-exists-p ,name)
@@ -459,7 +465,9 @@ unquoted file names."
            (delete-file ,name)))
        (when (file-exists-p ,non-special-name)
          (if ,dir-flag (delete-directory ,non-special-name t)
-           (delete-file ,non-special-name))))))
+           (delete-file ,non-special-name)))
+       (when (file-exists-p temporary-file-directory)
+         (delete-directory temporary-file-directory t)))))
 
 (defun files-tests--new-name (name part)
   (let (file-name-handler-alist)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]