aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPrzemysław Kryger2025-12-08 15:47:03 +0000
committerMichael Albinus2025-12-08 18:48:09 +0100
commit777622682f5db092560d6bdde040f65aa4671ba3 (patch)
tree97e341e898caccbe8ec0a159bd1404c736ee8963
parent70d24d0dd5742a6e0ffb77c9134a5970627ae849 (diff)
downloademacs-777622682f5db092560d6bdde040f65aa4671ba3.tar.gz
emacs-777622682f5db092560d6bdde040f65aa4671ba3.zip
Fix package-vc-tests
* lisp/emacs-lisp/package-vc.el (package-vc--make): Use same format for buffer as `package-vc--build-documentation'. * test/lisp/emacs-lisp/package-vc-tests.el (message-auto-save-directory): Silence byte compiler. (package-vc-with-tests-environment): Initialize package archives after setting a temporary `package-user-dir'. Set up `package-gnupghome-dir'. Remove `default-directory' binding. (package-vc-tests-environment-tear-down): Fix argument order in `package-vc-tests-log-buffer-name' call. (package-vc-tests-with-installed): Rename from `package-vc-with-installed-tests'. (package-vc-test-deftest): Use `package-vc-tests-with-installed'. (prepare-patch): Bind `message-auto-save-directory' to `package-vc-tests-dir'. * test/lisp/package-vc-tests.el: Rename to test/lisp/emacs-lisp/package-vc-tests.el * test/lisp/package-vc-resources/Makefile.in: Rename to test/lisp/emacs-lisp/package-vc-resources/Makefile.in * test/lisp/package-vc-resources/test-package-SUFFIX-inc.texi.in: Rename to test/lisp/emacs-lisp/package-vc-resources/test-package-SUFFIX-inc.texi.in * test/lisp/package-vc-resources/test-package-SUFFIX-lib-v0.1.el.in: Rename to test/lisp/emacs-lisp/package-vc-resources/test-package-SUFFIX-lib-v0.1.el.in * test/lisp/package-vc-resources/test-package-SUFFIX-lib-v0.2.el.in: Rename to test/lisp/emacs-lisp/package-vc-resources/test-package-SUFFIX-lib-v0.2.el.in * test/lisp/package-vc-resources/test-package-SUFFIX-v0.1.el.in: Rename to test/lisp/emacs-lisp/package-vc-resources/test-package-SUFFIX-v0.1.el.in * test/lisp/package-vc-resources/test-package-SUFFIX-v0.2.el.in: Rename to test/lisp/emacs-lisp/package-vc-resources/test-package-SUFFIX-v0.2.el.in * test/lisp/package-vc-resources/test-package-SUFFIX.texi.in: Rename to test/lisp/emacs-lisp/package-vc-resources/test-package-SUFFIX.texi.in
-rw-r--r--lisp/emacs-lisp/package-vc.el2
-rw-r--r--test/lisp/emacs-lisp/package-vc-resources/Makefile.in (renamed from test/lisp/package-vc-resources/Makefile.in)0
-rw-r--r--test/lisp/emacs-lisp/package-vc-resources/test-package-SUFFIX-inc.texi.in (renamed from test/lisp/package-vc-resources/test-package-SUFFIX-inc.texi.in)0
-rw-r--r--test/lisp/emacs-lisp/package-vc-resources/test-package-SUFFIX-lib-v0.1.el.in (renamed from test/lisp/package-vc-resources/test-package-SUFFIX-lib-v0.1.el.in)0
-rw-r--r--test/lisp/emacs-lisp/package-vc-resources/test-package-SUFFIX-lib-v0.2.el.in (renamed from test/lisp/package-vc-resources/test-package-SUFFIX-lib-v0.2.el.in)0
-rw-r--r--test/lisp/emacs-lisp/package-vc-resources/test-package-SUFFIX-v0.1.el.in (renamed from test/lisp/package-vc-resources/test-package-SUFFIX-v0.1.el.in)0
-rw-r--r--test/lisp/emacs-lisp/package-vc-resources/test-package-SUFFIX-v0.2.el.in (renamed from test/lisp/package-vc-resources/test-package-SUFFIX-v0.2.el.in)0
-rw-r--r--test/lisp/emacs-lisp/package-vc-resources/test-package-SUFFIX.texi.in (renamed from test/lisp/package-vc-resources/test-package-SUFFIX.texi.in)0
-rw-r--r--test/lisp/emacs-lisp/package-vc-tests.el (renamed from test/lisp/package-vc-tests.el)43
9 files changed, 23 insertions, 22 deletions
diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el
index c6e69c64a80..c536bdd642b 100644
--- a/lisp/emacs-lisp/package-vc.el
+++ b/lisp/emacs-lisp/package-vc.el
@@ -407,7 +407,7 @@ prepared."
407 (let ((default-directory (package-vc--checkout-dir pkg-desc)) 407 (let ((default-directory (package-vc--checkout-dir pkg-desc))
408 (target (plist-get pkg-spec :make)) 408 (target (plist-get pkg-spec :make))
409 (cmd (plist-get pkg-spec :shell-command)) 409 (cmd (plist-get pkg-spec :shell-command))
410 (buf (format " *package-vc make %s*" (package-desc-name pkg-desc))) 410 (buf (format " *package-vc make: %s*" (package-desc-name pkg-desc)))
411 (makexe (or package-vc-make-program 411 (makexe (or package-vc-make-program
412 (seq-find #'executable-find '("gmake" "make"))))) 412 (seq-find #'executable-find '("gmake" "make")))))
413 (when (or cmd target) 413 (when (or cmd target)
diff --git a/test/lisp/package-vc-resources/Makefile.in b/test/lisp/emacs-lisp/package-vc-resources/Makefile.in
index 8618ae8f2f4..8618ae8f2f4 100644
--- a/test/lisp/package-vc-resources/Makefile.in
+++ b/test/lisp/emacs-lisp/package-vc-resources/Makefile.in
diff --git a/test/lisp/package-vc-resources/test-package-SUFFIX-inc.texi.in b/test/lisp/emacs-lisp/package-vc-resources/test-package-SUFFIX-inc.texi.in
index 9e4e38b74a4..9e4e38b74a4 100644
--- a/test/lisp/package-vc-resources/test-package-SUFFIX-inc.texi.in
+++ b/test/lisp/emacs-lisp/package-vc-resources/test-package-SUFFIX-inc.texi.in
diff --git a/test/lisp/package-vc-resources/test-package-SUFFIX-lib-v0.1.el.in b/test/lisp/emacs-lisp/package-vc-resources/test-package-SUFFIX-lib-v0.1.el.in
index c8bfce3e8ab..c8bfce3e8ab 100644
--- a/test/lisp/package-vc-resources/test-package-SUFFIX-lib-v0.1.el.in
+++ b/test/lisp/emacs-lisp/package-vc-resources/test-package-SUFFIX-lib-v0.1.el.in
diff --git a/test/lisp/package-vc-resources/test-package-SUFFIX-lib-v0.2.el.in b/test/lisp/emacs-lisp/package-vc-resources/test-package-SUFFIX-lib-v0.2.el.in
index bfa4c35f014..bfa4c35f014 100644
--- a/test/lisp/package-vc-resources/test-package-SUFFIX-lib-v0.2.el.in
+++ b/test/lisp/emacs-lisp/package-vc-resources/test-package-SUFFIX-lib-v0.2.el.in
diff --git a/test/lisp/package-vc-resources/test-package-SUFFIX-v0.1.el.in b/test/lisp/emacs-lisp/package-vc-resources/test-package-SUFFIX-v0.1.el.in
index ddecc88e1c5..ddecc88e1c5 100644
--- a/test/lisp/package-vc-resources/test-package-SUFFIX-v0.1.el.in
+++ b/test/lisp/emacs-lisp/package-vc-resources/test-package-SUFFIX-v0.1.el.in
diff --git a/test/lisp/package-vc-resources/test-package-SUFFIX-v0.2.el.in b/test/lisp/emacs-lisp/package-vc-resources/test-package-SUFFIX-v0.2.el.in
index 902066d787d..902066d787d 100644
--- a/test/lisp/package-vc-resources/test-package-SUFFIX-v0.2.el.in
+++ b/test/lisp/emacs-lisp/package-vc-resources/test-package-SUFFIX-v0.2.el.in
diff --git a/test/lisp/package-vc-resources/test-package-SUFFIX.texi.in b/test/lisp/emacs-lisp/package-vc-resources/test-package-SUFFIX.texi.in
index 0fc4fc3653d..0fc4fc3653d 100644
--- a/test/lisp/package-vc-resources/test-package-SUFFIX.texi.in
+++ b/test/lisp/emacs-lisp/package-vc-resources/test-package-SUFFIX.texi.in
diff --git a/test/lisp/package-vc-tests.el b/test/lisp/emacs-lisp/package-vc-tests.el
index 74235da7ec5..6430848b094 100644
--- a/test/lisp/package-vc-tests.el
+++ b/test/lisp/emacs-lisp/package-vc-tests.el
@@ -43,6 +43,9 @@
43(require 'ert-x) 43(require 'ert-x)
44(require 'ert) 44(require 'ert)
45 45
46;; Silence byte-compiler
47(defvar message-auto-save-directory)
48
46(defvar package-vc-tests-preserve-artefacts nil 49(defvar package-vc-tests-preserve-artefacts nil
47 "When non-nil preserve temporary files and buffers produced by tests. 50 "When non-nil preserve temporary files and buffers produced by tests.
48Each test produces a new temporary directory for each package under 51Each test produces a new temporary directory for each package under
@@ -391,22 +394,24 @@ names."
391 ;; in directory package-vc-resources. Before executing body make sure 394 ;; in directory package-vc-resources. Before executing body make sure
392 ;; that: 395 ;; that:
393 ;; 396 ;;
394 ;; - `package' has been initialised, and there are no 397 (let* ((package-vc-tests-dir
395 ;; `package-archives' defined
396 (let* ((package-archives (unless package--initialized
397 (let (package-archives)
398 (package-initialize)
399 (package-vc--archives-initialize))
400 nil))
401 ;; - create a temporary location for packages and test files
402 (package-vc-tests-dir
403 (expand-file-name 398 (expand-file-name
404 (make-temp-file "package-vc-tests-" 399 (make-temp-file "package-vc-tests-"
405 t 400 t
406 (format-time-string "-%Y%m%d.%H%M%S.%3N")))) 401 (format-time-string "-%Y%m%d.%H%M%S.%3N"))))
407 ;; - packages are installed into a test directory 402 ;; - packages are installed into test directory
408 (package-user-dir (expand-file-name "elpa" 403 (package-user-dir (expand-file-name "elpa"
409 package-vc-tests-dir)) 404 package-vc-tests-dir))
405 ;; - keyring is saved in test directory
406 (package-gnupghome-dir (expand-file-name "gnupg"
407 package-user-dir))
408 ;; - `package' has been initialised, and there are no
409 ;; `package-archives' defined
410 (package-archives (unless package--initialized
411 (let (package-archives)
412 (package-initialize)
413 (package-vc--archives-initialize))
414 nil))
410 ;; - define test packages, their checkout locations, lisp 415 ;; - define test packages, their checkout locations, lisp
411 ;; directories, and install functions 416 ;; directories, and install functions
412 (package-vc-tests-packages (package-vc-tests-packages)) 417 (package-vc-tests-packages (package-vc-tests-packages))
@@ -476,12 +481,7 @@ names."
476 ;; - don't register projects 481 ;; - don't register projects
477 (package-vc-register-as-project nil) 482 (package-vc-register-as-project nil)
478 ;; - allow build commands 483 ;; - allow build commands
479 (package-vc-allow-build-commands t) 484 (package-vc-allow-build-commands t))
480 ;; - FIXME: something sets `default-directory' to last
481 ;; checkout directory after `package-vc-checkout', which
482 ;; causes problems when this function deletes the temporary
483 ;; directory after body execution.
484 (default-directory package-vc-tests-dir))
485 (funcall function))) 485 (funcall function)))
486 486
487(defun package-vc-tests-environment-tear-down (pkg) 487(defun package-vc-tests-environment-tear-down (pkg)
@@ -524,8 +524,8 @@ when PKG matches `package-vc-tests-preserve-artefacts'."
524 (delq nil 524 (delq nil
525 (mapcar (lambda (type) 525 (mapcar (lambda (type)
526 (get-buffer 526 (get-buffer
527 (package-vc-tests-log-buffer-name type 527 (package-vc-tests-log-buffer-name pkg
528 pkg))) 528 type)))
529 '(doc make))))) 529 '(doc make)))))
530 (if (or (memq package-vc-tests-preserve-artefacts `(t ,pkg)) 530 (if (or (memq package-vc-tests-preserve-artefacts `(t ,pkg))
531 (and (listp package-vc-tests-preserve-artefacts) 531 (and (listp package-vc-tests-preserve-artefacts)
@@ -538,7 +538,7 @@ when PKG matches `package-vc-tests-preserve-artefacts'."
538 (dolist (buffer buffers) 538 (dolist (buffer buffers)
539 (kill-buffer buffer))))) 539 (kill-buffer buffer)))))
540 540
541(defun package-vc-with-installed-tests (pkg function) 541(defun package-vc-tests-with-installed (pkg function)
542 "Call FUNCTION with PKG installed in a test environment. 542 "Call FUNCTION with PKG installed in a test environment.
543FUNCTION should have no arguments." 543FUNCTION should have no arguments."
544 (package-vc-with-tests-environment 544 (package-vc-with-tests-environment
@@ -670,7 +670,7 @@ car of ARGS (a symbol) to name of the package."
670 :file-name ,file 670 :file-name ,file
671 :body 671 :body
672 (lambda () 672 (lambda ()
673 (package-vc-with-installed-tests 673 (package-vc-tests-with-installed
674 ',pkg (funcall ,fn ',pkg)) 674 ',pkg (funcall ,fn ',pkg))
675 nil))) 675 nil)))
676 tests))) 676 tests)))
@@ -932,7 +932,8 @@ car of ARGS (a symbol) to name of the package."
932 932
933(package-vc-test-deftest prepare-patch (pkg) 933(package-vc-test-deftest prepare-patch (pkg)
934 ;; Ensure `vc-prepare-patch' respects subject from function argument 934 ;; Ensure `vc-prepare-patch' respects subject from function argument
935 (let ((vc-prepare-patches-separately nil)) 935 (let ((message-auto-save-directory package-vc-tests-dir)
936 (vc-prepare-patches-separately nil))
936 (package-vc-prepare-patch (package-vc-tests-package-desc pkg t) 937 (package-vc-prepare-patch (package-vc-tests-package-desc pkg t)
937 "test-subject" 938 "test-subject"
938 (cdr package-vc-tests-repository)) 939 (cdr package-vc-tests-repository))