From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:470:142:3::10]:59721) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ieJc0-0006c2-Ns for guix-patches@gnu.org; Mon, 09 Dec 2019 09:02:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ieJbu-0000Dp-EJ for guix-patches@gnu.org; Mon, 09 Dec 2019 09:02:08 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:46835) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ieJbu-0000Dl-Az for guix-patches@gnu.org; Mon, 09 Dec 2019 09:02:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ieJbu-00030l-97 for guix-patches@gnu.org; Mon, 09 Dec 2019 09:02:02 -0500 Subject: [bug#38546] [PATCH 2/3] gnu: julia-build-system: Enable tests. References: <87v9qpvbyr.fsf@guixSD.i-did-not-set--mail-host-address--so-tickle-me> In-Reply-To: <87v9qpvbyr.fsf@guixSD.i-did-not-set--mail-host-address--so-tickle-me> Resent-Message-ID: From: =?UTF-8?Q?Nicol=C3=B2?= Balzarotti Date: Thu, 10 Oct 2019 17:49:15 +0200 Message-ID: <87sgltvbs1.fsf@guixSD.i-did-not-set--mail-host-address--so-tickle-me> MIME-Version: 1.0 Content-Type: text/plain List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: Guix Patches <38546@debbugs.gnu.org> --- guix/build-system/julia.scm | 4 +++- guix/build/julia-build-system.scm | 28 +++++++++++++++++++--------- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/guix/build-system/julia.scm b/guix/build-system/julia.scm index 488fe9bb1d..0c07484f12 100644 --- a/guix/build-system/julia.scm +++ b/guix/build-system/julia.scm @@ -26,6 +26,7 @@ #:use-module (guix build-system gnu) #:use-module (ice-9 match) #:use-module (srfi srfi-26) + #:use-module (gnu packages check) ;; libfaketime #:export (%julia-build-system-modules julia-build julia-build-system)) @@ -68,6 +69,7 @@ ;; Keep the standard inputs of 'gnu-build-system'. ,@(standard-packages))) (build-inputs `(("julia" ,julia) + ("libfaketime" ,libfaketime) ,@native-inputs)) (outputs outputs) (build julia-build) @@ -75,7 +77,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 ff6fcf5fe3..bd4c64fa11 100644 --- a/guix/build/julia-build-system.scm +++ b/guix/build/julia-build-system.scm @@ -32,7 +32,13 @@ ;; Code: (define (invoke-julia code) - (invoke "julia" "-e" code)) + ;; Julia stores the result of the time() call + ;; inside the precompiled file. When trying to load it, its precompilation + ;; it fails at comparing the file mtime with the precompilation time, + ;; always triggering a recompile. This fixes the stored value. + ;; Also, libc.jl rand() uses time() as its seed. This might introduce indeterminism while building + ;; Default guix mtime is 1, so I'm setting the same here (if they differ, precompilation is invalid) + (invoke "faketime" "-f" "1970-01-01 00:00:01" "julia" "-e" code)) ;; subpath where we store the package content (define %package-path "/share/julia/packages/") @@ -78,13 +84,17 @@ (invoke-julia (string-append "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/"))) - (setenv "JULIA_DEPOT_PATH" builddir) - (setenv "JULIA_LOAD_PATH" (generate-load-path inputs outputs)) - (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/"))) + (setenv "JULIA_DEPOT_PATH" builddir) + (setenv "JULIA_LOAD_PATH" (generate-load-path inputs outputs)) + (display builddir) + (invoke "julia" (string-append builddir + "packages/" + package "/test/runtests.jl")))) #t) (define (julia-create-package-toml outputs source @@ -119,7 +129,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) -- 2.24.0