guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

01/13: build-system/julia: Enable tests.


From: guix-commits
Subject: 01/13: build-system/julia: Enable tests.
Date: Sat, 30 Jan 2021 09:38:24 -0500 (EST)

civodul pushed a commit to branch master
in repository guix.

commit a23b384f3f200c3771c8dfef0661f687fadda807
Author: nixo <nicolo@nixo.xyz>
AuthorDate: Mon Jan 18 23:56:54 2021 +0100

    build-system/julia: Enable tests.
    
    * 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 <ludo@gnu.org>
---
 doc/guix.texi                     |  2 +-
 guix/build-system/julia.scm       |  2 +-
 guix/build/julia-build-system.scm | 27 +++++++++++++++++----------
 3 files changed, 19 insertions(+), 12 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index ff9e8da..219617e 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -7616,7 +7616,7 @@ implements the build procedure used by 
@uref{https://julialang.org/,
 julia} packages, which essentially is similar to running @samp{julia -e
 'using Pkg; Pkg.add(package)'} in an environment where
 @env{JULIA_LOAD_PATH} contains the paths to all Julia package inputs.
-Tests are run with @code{Pkg.test}.
+Tests are run by calling @code{/test/runtests.jl}.
 
 Julia packages require the source @code{file-name} to be the real name of the
 package, correctly capitalized.
diff --git a/guix/build-system/julia.scm b/guix/build-system/julia.scm
index 488fe9b..d3cb41c 100644
--- a/guix/build-system/julia.scm
+++ b/guix/build-system/julia.scm
@@ -75,7 +75,7 @@
 
 (define* (julia-build store name inputs
                       #:key source
-                      (tests? #f)
+                      (tests? #t)
                       (phases '(@ (guix build julia-build-system)
                                   %standard-phases))
                       (outputs '("out"))
diff --git a/guix/build/julia-build-system.scm 
b/guix/build/julia-build-system.scm
index e8ebcf8..61817e0 100644
--- a/guix/build/julia-build-system.scm
+++ b/guix/build/julia-build-system.scm
@@ -69,15 +69,22 @@
      (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 @@ version = \"" version "\"
     (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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]