emacs-diffs
[Top][All Lists]
Advanced

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

emacs-29 bd58dcedfb: Fix and expand tests broken by commit 2772ebe366 of


From: Juanma Barranquero
Subject: emacs-29 bd58dcedfb: Fix and expand tests broken by commit 2772ebe366 of 2022-11-28
Date: Sat, 3 Dec 2022 06:24:10 -0500 (EST)

branch: emacs-29
commit bd58dcedfb95d25b8d9832fa7ca386d75e35d4ce
Author: Juanma Barranquero <lekktu@gmail.com>
Commit: Juanma Barranquero <lekktu@gmail.com>

    Fix and expand tests broken by commit 2772ebe366 of 2022-11-28
    
    * test/lisp/emacs-lisp/comp-tests.el
    (with-test-native-compile-prune-cache)
    (test-native-compile-prune-cache)
    (test-native-compile-prune-cache/delete-only-eln)
    (test-native-compile-prune-cache/dont-delete-in-parent-of-cache):
    Check that the last directory in `native-comp-eln-load-path' is
    not affected by `native-compile-prune-cache'.
---
 test/lisp/emacs-lisp/comp-tests.el | 55 +++++++++++++++++++++-----------------
 1 file changed, 31 insertions(+), 24 deletions(-)

diff --git a/test/lisp/emacs-lisp/comp-tests.el 
b/test/lisp/emacs-lisp/comp-tests.el
index 082b641fe3..418c729694 100644
--- a/test/lisp/emacs-lisp/comp-tests.el
+++ b/test/lisp/emacs-lisp/comp-tests.el
@@ -31,25 +31,30 @@
 (defmacro with-test-native-compile-prune-cache (&rest body)
   (declare (indent 0) (debug t))
   `(ert-with-temp-directory testdir
-     (setq testdir (expand-file-name "eln-cache" testdir))
-     (make-directory testdir)
-     (let* ((c1 (expand-file-name "29.0.50-cur" testdir))
-            (c2 (expand-file-name "29.0.50-old" testdir))
-            (native-comp-eln-load-path (list testdir))
-            (comp-native-version-dir "29.0.50-cur"))
-       (dolist (d (list c1 c2))
-         (make-directory d)
-         (with-temp-file (expand-file-name "some.eln" d) (insert "foo"))
-         (with-temp-file (expand-file-name "some.eln.tmp" d) (insert "foo")))
-       ,@body)))
+     (let ((usr-cache (expand-file-name "eln-usr-cache" testdir))
+          (sys-cache (expand-file-name "eln-sys-cache" testdir)))
+       (make-directory usr-cache)
+       (make-directory sys-cache)
+       (let* ((c1 (expand-file-name "29.0.50-cur" usr-cache))
+              (c2 (expand-file-name "29.0.50-old" usr-cache))
+             (s1 (expand-file-name "29.0.50-cur" sys-cache))
+             (s2 (expand-file-name "preloaded" s1))
+              (native-comp-eln-load-path (list usr-cache sys-cache))
+              (comp-native-version-dir "29.0.50-cur"))
+        (dolist (d (list c1 c2 s1 s2))
+           (make-directory d)
+           (with-temp-file (expand-file-name "some.eln" d) (insert "foo"))
+           (with-temp-file (expand-file-name "some.eln.tmp" d) (insert "foo")))
+        ,@body))))
 
 (ert-deftest test-native-compile-prune-cache ()
   (skip-unless (featurep 'native-compile))
   (with-test-native-compile-prune-cache
     (native-compile-prune-cache)
-    (should (file-directory-p c1))
-    (should (file-regular-p (expand-file-name "some.eln" c1)))
-    (should (file-regular-p (expand-file-name "some.eln.tmp" c1)))
+    (dolist (d (list c1 s1 s2))
+      (should (file-directory-p d))
+      (should (file-regular-p (expand-file-name "some.eln" d)))
+      (should (file-regular-p (expand-file-name "some.eln.tmp" d))))
     (should-not (file-directory-p c2))
     (should-not (file-regular-p (expand-file-name "some.eln" c2)))
     (should-not (file-regular-p (expand-file-name "some.eln.tmp" c2)))))
@@ -57,21 +62,23 @@
 (ert-deftest test-native-compile-prune-cache/delete-only-eln ()
   (skip-unless (featurep 'native-compile))
   (with-test-native-compile-prune-cache
-    (with-temp-file (expand-file-name "keep1.txt" c1) (insert "foo"))
-    (with-temp-file (expand-file-name "keep2.txt" c2) (insert "foo"))
+    (dolist (d (list c1 c2 s1 s2))
+      (with-temp-file (expand-file-name "keep.txt" d) (insert "foo")))
     (native-compile-prune-cache)
-    (should (file-regular-p (expand-file-name "keep1.txt" c1)))
-    (should (file-regular-p (expand-file-name "keep2.txt" c2)))))
+    (dolist (d (list c1 c2 s1 s2))
+      (should (file-regular-p (expand-file-name "keep.txt" d))))))
 
 (ert-deftest test-native-compile-prune-cache/dont-delete-in-parent-of-cache ()
   (skip-unless (featurep 'native-compile))
   (with-test-native-compile-prune-cache
-    (let ((f1 (expand-file-name "../some.eln" testdir))
-          (f2 (expand-file-name "some.eln" testdir)))
-      (with-temp-file f1 (insert "foo"))
-      (with-temp-file f2 (insert "foo"))
+    (let ((f1 (expand-file-name "../some.eln" usr-cache))
+          (f2 (expand-file-name "some.eln" usr-cache))
+         (f3 (expand-file-name "../some.eln" sys-cache))
+         (f4 (expand-file-name "some.eln" sys-cache)))
+      (dolist (f (list f1 f2 f3 f4))
+       (with-temp-file f (insert "foo")))
       (native-compile-prune-cache)
-      (should (file-regular-p f1))
-      (should (file-regular-p f2)))))
+      (dolist (f (list f1 f2 f3 f4))
+       (should (file-regular-p f))))))
 
 ;;; comp-tests.el ends here



reply via email to

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