From a23b384f3f200c3771c8dfef0661f687fadda807 Mon Sep 17 00:00:00 2001 From: nixo Date: Mon, 18 Jan 2021 23:56:54 +0100 Subject: build-system/julia: Enable tests. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * guix/build-system/julia.scm (julia-build): Set tests? default to #t. * guix/build/julia-build-system.scm (check): Respect tests? and fix julia invocation. (%standard-phases): Add check phase after install. * doc/guix.texi (julia-build-system): Update accordingly. Signed-off-by: Ludovic Courtès --- guix/build/julia-build-system.scm | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) (limited to 'guix/build/julia-build-system.scm') diff --git a/guix/build/julia-build-system.scm b/guix/build/julia-build-system.scm index e8ebcf8ba0..61817e0b47 100644 --- a/guix/build/julia-build-system.scm +++ b/guix/build/julia-build-system.scm @@ -69,15 +69,22 @@ (define* (precompile #:key source inputs outputs #:allow-other-keys) (string-append "pushfirst!(DEPOT_PATH, pop!(DEPOT_PATH)); using " package))) #t) -(define* (check #:key source inputs outputs #:allow-other-keys) - (let* ((out (assoc-ref outputs "out")) - (package (strip-store-file-name source)) - (builddir (string-append out "/share/julia/"))) - ;; With a patch, SOURCE_DATE_EPOCH is honored - (setenv "SOURCE_DATE_EPOCH" "1") - (setenv "JULIA_DEPOT_PATH" builddir) - (setenv "JULIA_LOAD_PATH" (string-append builddir "packages/")) - (invoke-julia (string-append "using Pkg;Pkg.test(\"" package "\")"))) +(define* (check #:key tests? source inputs outputs #:allow-other-keys) + (when tests? + (let* ((out (assoc-ref outputs "out")) + (package (strip-store-file-name source)) + (builddir (string-append out "/share/julia/"))) + ;; With a patch, SOURCE_DATE_EPOCH is honored + (setenv "SOURCE_DATE_EPOCH" "1") + (setenv "JULIA_DEPOT_PATH" builddir) + (setenv "JULIA_LOAD_PATH" + (string-append builddir "packages/" ":" + (or (getenv "JULIA_LOAD_PATH") + ""))) + (setenv "HOME" "/tmp") + (invoke "julia" + (string-append builddir "packages/" + package "/test/runtests.jl")))) #t) (define (julia-create-package-toml outputs source @@ -112,7 +119,7 @@ (define %standard-phases (delete 'check) ; tests must be run after installation (replace 'install install) (add-after 'install 'precompile precompile) - ;; (add-after 'install 'check check) + (add-after 'install 'check check) ;; TODO: In the future we could add a "system-image-generation" phase ;; where we use PackageCompiler.jl to speed up package loading times (delete 'configure) -- cgit v1.2.3