summary refs log tree commit diff
path: root/distro
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2012-12-20 19:00:14 +0100
committerLudovic Courtès <ludo@gnu.org>2012-12-20 19:00:14 +0100
commit42ff70e26263bfe4c55398a246a3ab0ad2b6200c (patch)
treedbdab5603ed8a12fdf9fe07fe7f2279dbfff18d0 /distro
parent530c169561b366d60457e499f7eb198929ffa917 (diff)
downloadguix-42ff70e26263bfe4c55398a246a3ab0ad2b6200c.tar.gz
distro: libtool: Run test suite in parallel; patch references to /bin/sh.
* distro/packages/autotools.scm (libtool): Add `pre-check' phase.
Diffstat (limited to 'distro')
-rw-r--r--distro/packages/autotools.scm26
1 files changed, 24 insertions, 2 deletions
diff --git a/distro/packages/autotools.scm b/distro/packages/autotools.scm
index 238025b540..1c01b3d3db 100644
--- a/distro/packages/autotools.scm
+++ b/distro/packages/autotools.scm
@@ -100,8 +100,30 @@ Standards.  Automake requires the use of Autoconf.")
     (native-inputs `(("m4" ,m4)
                      ("perl" ,perl)))
     (arguments
-     ;; TODO: Use `TESTSUITEFLAGS=-jN' for tests.
-     `(#:patches (list (assoc-ref %build-inputs "patch/skip-tests"))))
+     `(#:patches (list (assoc-ref %build-inputs "patch/skip-tests"))
+       #:phases (alist-cons-before
+                 'check 'pre-check
+                 (lambda* (#:key inputs #:allow-other-keys)
+                   ;; Run the test suite in parallel, if possible.
+                   (let ((ncores
+                          (cond
+                           ((getenv "NIX_BUILD_CORES")
+                            =>
+                            (lambda (n)
+                              (if (zero? (string->number n))
+                                  (number->string (current-processor-count))
+                                  n)))
+                           (else "1"))))
+                    (setenv "TESTSUITEFLAGS"
+                            (string-append "-j" ncores)))
+
+                   ;; Path references to /bin/sh.
+                   (patch-shebang "libtoolize")
+                   (let ((bash (assoc-ref inputs "bash")))
+                     (substitute* "tests/testsuite"
+                       (("/bin/sh")
+                        (string-append bash "/bin/bash")))))
+                 %standard-phases)))
     (inputs `(("patch/skip-tests"
                ,(search-patch "libtool-skip-tests.patch"))))
     (synopsis "GNU Libtool, a generic library support script")