aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuanma Barranquero2022-12-03 12:01:10 +0100
committerJuanma Barranquero2022-12-03 12:23:02 +0100
commitbd58dcedfb95d25b8d9832fa7ca386d75e35d4ce (patch)
treea7bf22e94c33617a2541b8fa260d25b04940667e
parenta0dd9fdebe3baaccdbda428df428f696ee38356d (diff)
downloademacs-bd58dcedfb95d25b8d9832fa7ca386d75e35d4ce.tar.gz
emacs-bd58dcedfb95d25b8d9832fa7ca386d75e35d4ce.zip
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'.
-rw-r--r--test/lisp/emacs-lisp/comp-tests.el55
1 files changed, 31 insertions, 24 deletions
diff --git a/test/lisp/emacs-lisp/comp-tests.el b/test/lisp/emacs-lisp/comp-tests.el
index 082b641fe30..418c7296948 100644
--- a/test/lisp/emacs-lisp/comp-tests.el
+++ b/test/lisp/emacs-lisp/comp-tests.el
@@ -31,25 +31,30 @@
31(defmacro with-test-native-compile-prune-cache (&rest body) 31(defmacro with-test-native-compile-prune-cache (&rest body)
32 (declare (indent 0) (debug t)) 32 (declare (indent 0) (debug t))
33 `(ert-with-temp-directory testdir 33 `(ert-with-temp-directory testdir
34 (setq testdir (expand-file-name "eln-cache" testdir)) 34 (let ((usr-cache (expand-file-name "eln-usr-cache" testdir))
35 (make-directory testdir) 35 (sys-cache (expand-file-name "eln-sys-cache" testdir)))
36 (let* ((c1 (expand-file-name "29.0.50-cur" testdir)) 36 (make-directory usr-cache)
37 (c2 (expand-file-name "29.0.50-old" testdir)) 37 (make-directory sys-cache)
38 (native-comp-eln-load-path (list testdir)) 38 (let* ((c1 (expand-file-name "29.0.50-cur" usr-cache))
39 (comp-native-version-dir "29.0.50-cur")) 39 (c2 (expand-file-name "29.0.50-old" usr-cache))
40 (dolist (d (list c1 c2)) 40 (s1 (expand-file-name "29.0.50-cur" sys-cache))
41 (make-directory d) 41 (s2 (expand-file-name "preloaded" s1))
42 (with-temp-file (expand-file-name "some.eln" d) (insert "foo")) 42 (native-comp-eln-load-path (list usr-cache sys-cache))
43 (with-temp-file (expand-file-name "some.eln.tmp" d) (insert "foo"))) 43 (comp-native-version-dir "29.0.50-cur"))
44 ,@body))) 44 (dolist (d (list c1 c2 s1 s2))
45 (make-directory d)
46 (with-temp-file (expand-file-name "some.eln" d) (insert "foo"))
47 (with-temp-file (expand-file-name "some.eln.tmp" d) (insert "foo")))
48 ,@body))))
45 49
46(ert-deftest test-native-compile-prune-cache () 50(ert-deftest test-native-compile-prune-cache ()
47 (skip-unless (featurep 'native-compile)) 51 (skip-unless (featurep 'native-compile))
48 (with-test-native-compile-prune-cache 52 (with-test-native-compile-prune-cache
49 (native-compile-prune-cache) 53 (native-compile-prune-cache)
50 (should (file-directory-p c1)) 54 (dolist (d (list c1 s1 s2))
51 (should (file-regular-p (expand-file-name "some.eln" c1))) 55 (should (file-directory-p d))
52 (should (file-regular-p (expand-file-name "some.eln.tmp" c1))) 56 (should (file-regular-p (expand-file-name "some.eln" d)))
57 (should (file-regular-p (expand-file-name "some.eln.tmp" d))))
53 (should-not (file-directory-p c2)) 58 (should-not (file-directory-p c2))
54 (should-not (file-regular-p (expand-file-name "some.eln" c2))) 59 (should-not (file-regular-p (expand-file-name "some.eln" c2)))
55 (should-not (file-regular-p (expand-file-name "some.eln.tmp" c2))))) 60 (should-not (file-regular-p (expand-file-name "some.eln.tmp" c2)))))
@@ -57,21 +62,23 @@
57(ert-deftest test-native-compile-prune-cache/delete-only-eln () 62(ert-deftest test-native-compile-prune-cache/delete-only-eln ()
58 (skip-unless (featurep 'native-compile)) 63 (skip-unless (featurep 'native-compile))
59 (with-test-native-compile-prune-cache 64 (with-test-native-compile-prune-cache
60 (with-temp-file (expand-file-name "keep1.txt" c1) (insert "foo")) 65 (dolist (d (list c1 c2 s1 s2))
61 (with-temp-file (expand-file-name "keep2.txt" c2) (insert "foo")) 66 (with-temp-file (expand-file-name "keep.txt" d) (insert "foo")))
62 (native-compile-prune-cache) 67 (native-compile-prune-cache)
63 (should (file-regular-p (expand-file-name "keep1.txt" c1))) 68 (dolist (d (list c1 c2 s1 s2))
64 (should (file-regular-p (expand-file-name "keep2.txt" c2))))) 69 (should (file-regular-p (expand-file-name "keep.txt" d))))))
65 70
66(ert-deftest test-native-compile-prune-cache/dont-delete-in-parent-of-cache () 71(ert-deftest test-native-compile-prune-cache/dont-delete-in-parent-of-cache ()
67 (skip-unless (featurep 'native-compile)) 72 (skip-unless (featurep 'native-compile))
68 (with-test-native-compile-prune-cache 73 (with-test-native-compile-prune-cache
69 (let ((f1 (expand-file-name "../some.eln" testdir)) 74 (let ((f1 (expand-file-name "../some.eln" usr-cache))
70 (f2 (expand-file-name "some.eln" testdir))) 75 (f2 (expand-file-name "some.eln" usr-cache))
71 (with-temp-file f1 (insert "foo")) 76 (f3 (expand-file-name "../some.eln" sys-cache))
72 (with-temp-file f2 (insert "foo")) 77 (f4 (expand-file-name "some.eln" sys-cache)))
78 (dolist (f (list f1 f2 f3 f4))
79 (with-temp-file f (insert "foo")))
73 (native-compile-prune-cache) 80 (native-compile-prune-cache)
74 (should (file-regular-p f1)) 81 (dolist (f (list f1 f2 f3 f4))
75 (should (file-regular-p f2))))) 82 (should (file-regular-p f))))))
76 83
77;;; comp-tests.el ends here 84;;; comp-tests.el ends here