>From 8528dc2f91d5a890694565b0daea290a96747d76 Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer Date: Sun, 11 Feb 2018 00:51:26 -0500 Subject: [PATCH 04/30] emacs-build-system: Add improved check phase. * guix/build-system/emacs.scm (emacs-build): Remove `test-target' and 'configure-flags' arguments. Add `test-command' argument. (check): New procedure. (%standard-phases)[check]: Register after the `build' phase. --- guix/build-system/emacs.scm | 6 ++---- guix/build/emacs-build-system.scm | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/guix/build-system/emacs.scm b/guix/build-system/emacs.scm index d9f1a8d28..ef6d1b339 100644 --- a/guix/build-system/emacs.scm +++ b/guix/build-system/emacs.scm @@ -84,8 +84,7 @@ #:key source (tests? #f) (parallel-tests? #t) - (test-target "test") - (configure-flags ''()) + (test-command ''("make" "check")) (phases '(@ (guix build emacs-build-system) %standard-phases)) (outputs '("out")) @@ -110,9 +109,8 @@ source) (source source)) - #:configure-flags ,configure-flags #:system ,system - #:test-target ,test-target + #:test-command ,test-command #:tests? ,tests? #:phases ,phases #:outputs %outputs diff --git a/guix/build/emacs-build-system.scm b/guix/build/emacs-build-system.scm index dc404f04f..5662b8af4 100644 --- a/guix/build/emacs-build-system.scm +++ b/guix/build/emacs-build-system.scm @@ -135,6 +135,28 @@ store in '.el' files." (substitute-program-names)))) #t)) +(define* (check #:key target (tests? (not target)) + (test-command '("make" "check")) (parallel-tests? #t) + #:allow-other-keys) + "Run the tests. + +By default, it runs \"make check\", but the target can be changed using the +TARGET argument. When \"make\" is used, the tests are run in parallel unless +PARALLEL-TESTS?. To run a custom test program or script, TEST-COMMAND can be +specified, as a list of arguments. PARALLEL-TESTS? and TARGET don't have an +effect when using a TEST-COMMAND." + (match-let (((test-program . args) test-command)) + (let ((using-make? (string=? test-program "make"))) + (if tests? + (apply invoke test-program + `(,@args + ,@(if (and using-make? parallel-tests?) + `("-j" ,(number->string (parallel-job-count))) + '()))) + (begin + (format #t "test suite not run~%") + #t))))) + (define* (install #:key outputs (include %default-include) (exclude %default-exclude) @@ -253,6 +275,7 @@ second hyphen. This corresponds to 'name-version' as used in ELPA packages." ;; Move the build phase after install: the .el files are byte ;; compiled directly in the store. (delete 'build) + (replace 'check check) (replace 'install install) (add-after 'install 'build build) (add-after 'install 'make-autoloads make-autoloads) -- 2.16.1