guix-commits
[Top][All Lists]
Advanced

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

04/04: gnu: idris: Run tests.


From: guix-commits
Subject: 04/04: gnu: idris: Run tests.
Date: Thu, 11 Apr 2019 20:52:26 -0400 (EDT)

bavier pushed a commit to branch master
in repository guix.

commit 89647ff1d4abc4674973392cb7e08d14898e3ac9
Author: Eric Bavier <address@hidden>
Date:   Thu Apr 11 19:30:39 2019 -0500

    gnu: idris: Run tests.
    
    * gnu/packages/patches/idris-test-no-node.patch: New patch.
    * gnu/local.mk (dist_patch_DATA): Add it.
    * gnu/packages/idris.scm (idris)[origin]: Use it.
    [native-inputs]: New field.
    [arguments]: Remove "#:tests? #f".  Add custom 'check' phase after 
'install'.
---
 gnu/local.mk                                  |  1 +
 gnu/packages/idris.scm                        | 23 ++++++++--
 gnu/packages/patches/idris-test-no-node.patch | 61 +++++++++++++++++++++++++++
 3 files changed, 81 insertions(+), 4 deletions(-)

diff --git a/gnu/local.mk b/gnu/local.mk
index 6815fa8..a618516 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -919,6 +919,7 @@ dist_patch_DATA =                                           
\
   %D%/packages/patches/icedtea-6-hotspot-gcc-segfault-workaround.patch  \
   %D%/packages/patches/icedtea-7-hotspot-gcc-segfault-workaround.patch  \
   %D%/packages/patches/id3lib-CVE-2007-4460.patch                      \
+  %D%/packages/patches/idris-test-no-node.patch                        \
   %D%/packages/patches/ilmbase-fix-tests.patch                 \
   %D%/packages/patches/inkscape-poppler-compat3.patch          \
   %D%/packages/patches/intltool-perl-compatibility.patch       \
diff --git a/gnu/packages/idris.scm b/gnu/packages/idris.scm
index 0f653d8..ec3eb15 100644
--- a/gnu/packages/idris.scm
+++ b/gnu/packages/idris.scm
@@ -20,12 +20,14 @@
 ;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
 
 (define-module (gnu packages idris)
+  #:use-module (gnu packages)
   #:use-module (gnu packages haskell)
   #:use-module (gnu packages haskell-check)
   #:use-module (gnu packages haskell-web)
   #:use-module (gnu packages libffi)
   #:use-module (gnu packages multiprecision)
   #:use-module (gnu packages ncurses)
+  #:use-module (gnu packages perl)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system haskell)
   #:use-module (guix download)
@@ -44,8 +46,14 @@
                     "idris-" version "/idris-" version ".tar.gz"))
               (sha256
                (base32
-                "0fn9h58l592j72njwma1ia48h8h87wi2rjqfxs7j2lfmvgfv18fi"))))
+                "0fn9h58l592j72njwma1ia48h8h87wi2rjqfxs7j2lfmvgfv18fi"))
+              (patches (search-patches "idris-test-no-node.patch"))))
     (build-system haskell-build-system)
+    (native-inputs                      ;For tests
+     `(("perl" ,perl)
+       ("ghc-tasty" ,ghc-tasty)
+       ("ghc-tasty-golden" ,ghc-tasty-golden)
+       ("ghc-tasty-rerun" ,ghc-tasty-rerun)))
     (inputs
      `(("gmp" ,gmp)
        ("ncurses" ,ncurses)
@@ -78,8 +86,7 @@
        ("ghc-vector-binary-instances" ,ghc-vector-binary-instances)
        ("ghc-zip-archive" ,ghc-zip-archive)))
     (arguments
-     `(#:tests? #f ; FIXME: Test suite doesn't run in a sandbox.
-       #:configure-flags
+     `(#:configure-flags
        (list (string-append "--datasubdir="
                             (assoc-ref %outputs "out") "/lib/idris")
              "-fFFI" "-fGMP")
@@ -98,7 +105,15 @@
                 (lambda (module)
                   (symlink (string-append modules "/" module)
                            (string-append lib "/" module)))
-                '("prelude" "base" "contrib" "effects" "pruviloj"))))))))
+                '("prelude" "base" "contrib" "effects" "pruviloj")))))
+         (delete 'check)                ;Run check later
+         (add-after 'install 'check
+           (lambda* (#:key outputs #:allow-other-keys #:rest args)
+             (let ((out (assoc-ref outputs "out")))
+               (setenv "TASTY_NUM_THREADS" (number->string 
(parallel-job-count)))
+               (setenv "IDRIS_CC" "gcc") ;Needed for creating executables
+               (setenv "PATH" (string-append out "/bin:" (getenv "PATH")))
+               (apply (assoc-ref %standard-phases 'check) args)))))))
     (native-search-paths
      (list (search-path-specification
             (variable "IDRIS_LIBRARY_PATH")
diff --git a/gnu/packages/patches/idris-test-no-node.patch 
b/gnu/packages/patches/idris-test-no-node.patch
new file mode 100644
index 0000000..c04ad41
--- /dev/null
+++ b/gnu/packages/patches/idris-test-no-node.patch
@@ -0,0 +1,61 @@
+From 6c52e1b902b869c25e2fe39cff6364143a04da61 Mon Sep 17 00:00:00 2001
+From: Niklas Larsson <address@hidden>
+Date: Tue, 11 Dec 2018 19:56:22 +0100
+Subject: [PATCH] Only check for Node when required
+
+---
+ test/TestRun.hs | 34 ++++++++++++++++++++--------------
+ 1 file changed, 20 insertions(+), 14 deletions(-)
+
+diff --git a/test/TestRun.hs b/test/TestRun.hs
+index c7db9fdcd..4809911f3 100644
+--- a/test/TestRun.hs
++++ b/test/TestRun.hs
+@@ -11,6 +11,7 @@ import Data.Proxy
+ import Data.Typeable
+ import Options.Applicative
+ import System.Directory
++import System.Environment
+ import System.Exit
+ import System.FilePath ((</>))
+ import System.Info
+@@ -103,20 +104,25 @@ runTest path flags = do
+       normalise (x : xs) = x : normalise xs
+       normalise [] = []
+ 
++checkNode :: IO  ()
++checkNode = do
++    nodePath   <- findExecutable "node"
++    nodejsPath <- findExecutable "nodejs"
++    let node = nodePath <|> nodejsPath
++    case node of
++      Nothing -> do
++        putStrLn "For running the test suite against Node, node must be 
installed."
++        exitFailure
++      Just _  -> return ()
++
+ main :: IO ()
+ main = do
+-  nodePath   <- findExecutable "node"
+-  nodejsPath <- findExecutable "nodejs"
+-  let node = nodePath <|> nodejsPath
+-  case node of
+-    Nothing -> do
+-      putStrLn "For running the test suite against Node, node must be 
installed."
+-      exitFailure
+-    Just _  -> do
+-      defaultMainWithIngredients ingredients $
++    args <- getArgs
++    when ("--node" `elem` args) checkNode
++    defaultMainWithIngredients ingredients $
+         askOption $ \(NodeOpt node) ->
+-          let (codegen, flags) = if node then (JS, ["--codegen", "node"])
+-                                         else (C , [])
+-           in
+-            mkGoldenTests (testFamiliesForCodegen codegen)
+-                        (flags ++ idrisFlags)
++            let (codegen, flags) = if node then (JS, ["--codegen", "node"])
++                                           else (C , [])
++            in
++                mkGoldenTests (testFamiliesForCodegen codegen) (flags ++ 
idrisFlags)
++



reply via email to

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