[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] elpa-admin cc33931 222/357: Add test capability to ELPA
From: |
Stefan Monnier |
Subject: |
[elpa] elpa-admin cc33931 222/357: Add test capability to ELPA |
Date: |
Thu, 10 Dec 2020 18:06:47 -0500 (EST) |
branch: elpa-admin
commit cc33931fded4db25115282fd745186d0ecc3dbbe
Author: Phillip Lord <phillip.lord@russet.org.uk>
Commit: Phillip Lord <phillip.lord@russet.org.uk>
Add test capability to ELPA
make check now attempts to run tests in all packages.
---
GNUmakefile | 29 ++++++++++++++++++++++++++++
admin/ert-support.el | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 83 insertions(+)
diff --git a/GNUmakefile b/GNUmakefile
index ad86a7f..d23d523 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -1,4 +1,5 @@
# Makefile for GNU Emacs Lisp Package Archive.
+#
EMACS=emacs --batch
@@ -190,3 +191,31 @@ all-in-place: $(extra_elcs) $(autoloads) $(pkg_descs)
externals:
$(EMACS) -l admin/archive-contents.el \
-f archive-add/remove/update-externals
+
+
+
+
+################### Testing ###############
+
+PACKAGE_DIRS = $(shell find packages -maxdepth 1 -type d)
+PACKAGES=$(subst /,,$(subst packages,,$(PACKAGE_DIRS)))
+
+TOP =$(shell pwd)
+
+define test_template
+$(1)-test:
+ cd packages/$(1);\
+ $(EMACS) -l $(TOP)/admin/ert-support.el \
+ --eval "(ert-support-test-package \"$(TOP)\" '$(1))" \
+
+$(1)-test-log:
+ $(MAKE) $(1)-test > packages/$(1)/$(1).log 2>&1 || { stat=ERROR; }
+endef
+
+$(foreach package,$(PACKAGES),$(eval $(call test_template,$(package))))
+
+PACKAGES_TESTS=$(addsuffix -test-log,$(PACKAGES))
+PACKAGES_LOG=$(foreach package,$(PACKAGES),packages/$(package)/$(package).log)
+
+check: $(PACKAGES_TESTS)
+ $(EMACS) -l ert -f ert-summarize-tests-batch-and-exit $(PACKAGES_LOG)
diff --git a/admin/ert-support.el b/admin/ert-support.el
new file mode 100644
index 0000000..93d1af8
--- /dev/null
+++ b/admin/ert-support.el
@@ -0,0 +1,54 @@
+;; The contents of this file are subject to the GPL License, Version 3.0.
+
+;; Copyright (C) 2016, Free Software Foundation, Inc.
+
+;; This program is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+(defun ert-support-package-install (top-directory package)
+ ;; blitz default value and set up from elpa.
+ (setq package-archives
+ `(("local-elpa" . ,(concat top-directory "/archive/packages"))))
+ (setq package-user-dir
+ (make-temp-file "elpa-test" t))
+ (package-initialize)
+ (package-refresh-contents)
+ (package-install package))
+
+(defun ert-support-test-find-tests (package-directory package)
+ (or
+ (directory-files package-directory nil ".*-test.el$")
+ (directory-files package-directory nil ".*-tests.el$")
+ (let ((dir-test
+ (concat package-directory "/test")))
+ (when (file-exists-p dir-test)
+ (directory-files dir-test)))
+ (let ((dir-tests
+ (concat package-directory "/tests")))
+ (when (file-exists-p dir-tests)
+ (directory-files dir-tests)))))
+
+(defun ert-support-load-tests (package-directory package)
+ (mapc
+ (lambda(file)
+ (message "Loading test file... %s" (concat package-directory file))
+ (load-file (concat package-directory file)))
+ (ert-support-test-find-tests package-directory package)))
+
+(defun ert-support-test-package (top-directory package)
+ (ert-support-package-install top-directory package)
+ (ert-support-load-tests
+ (concat top-directory "/packages/" (symbol-name package) "/")
+ package)
+
+ (ert-run-tests-batch-and-exit t))
- [elpa] elpa-admin 81a6a01 088/357: Fix up scripts to build archive from Git, (continued)
- [elpa] elpa-admin 81a6a01 088/357: Fix up scripts to build archive from Git, Stefan Monnier, 2020/12/10
- [elpa] elpa-admin daf3553 099/357: Sync from ack/master, Stefan Monnier, 2020/12/10
- [elpa] elpa-admin 96a8283 129/357: Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs/elpa, Stefan Monnier, 2020/12/10
- [elpa] elpa-admin adc1e5b 146/357: Merge branch 'master' of git+ssh://git.sv.gnu.org/srv/git/emacs/elpa, Stefan Monnier, 2020/12/10
- [elpa] elpa-admin 88fb267 150/357: Update README to tell how to checkout a single external package., Stefan Monnier, 2020/12/10
- [elpa] elpa-admin 779c1d2 165/357: Add 'packages/loc-changes/' from commit '8447baff7cb4839ef8d1d747a14e5da85d0cee5b', Stefan Monnier, 2020/12/10
- [elpa] elpa-admin 84f4eb7 153/357: * wcheck-mode: New package., Stefan Monnier, 2020/12/10
- [elpa] elpa-admin 97cad46 171/357: Merge commit '3fa56d7925d5b24c5cd11c61bd6b3235e753a055', Stefan Monnier, 2020/12/10
- [elpa] elpa-admin f936e1e 180/357: Merge dummy commit to add the gnorb subtree metadata., Stefan Monnier, 2020/12/10
- [elpa] elpa-admin 5a1a2bc 184/357: Merge commit '32b1944d5f0a65aa10c6768f4865f7ed1de8eb49' as 'packages/pinentry', Stefan Monnier, 2020/12/10
- [elpa] elpa-admin cc33931 222/357: Add test capability to ELPA,
Stefan Monnier <=
- [elpa] elpa-admin 864099f 232/357: packages/yasnippet: pull from external (0.10.0), Stefan Monnier, 2020/12/10
- [elpa] elpa-admin 60ab286 213/357: Squashed 'packages/gnome-c-style/' content from commit e84487c, Stefan Monnier, 2020/12/10
- [elpa] elpa-admin 2ba4dc8 215/357: Merge commit '6bf96861b98e91ca9c3bd146697580b42d30f5d9', Stefan Monnier, 2020/12/10
- [elpa] elpa-admin 73a80fc 227/357: Update packages/yasnippet by subtree-merging from its github-based upstream, Stefan Monnier, 2020/12/10
- [elpa] elpa-admin 3fc8681 221/357: Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs/elpa, Stefan Monnier, 2020/12/10
- [elpa] elpa-admin 2307841 196/357: * README: Expand instructions, Stefan Monnier, 2020/12/10
- [elpa] elpa-admin 5b91341 226/357: Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs/elpa, Stefan Monnier, 2020/12/10
- [elpa] elpa-admin 0b918e3 191/357: Merge ack master from github.com:leoliu/ack-el, Stefan Monnier, 2020/12/10
- [elpa] elpa-admin 8730258 240/357: Merge commit 'ab69dbcccb4d0ed5ec2a7bd6bc7b3cff7e7adbac', Stefan Monnier, 2020/12/10
- [elpa] elpa-admin 858666e 250/357: * admin/archive-contents.el: Use cl-lib, Stefan Monnier, 2020/12/10