~ruther/guix-local

d1e3f59c9b8d1be79eded04fe23cceb56b4372f0 — Ludovic Courtès 9 years ago ac7a8f1
gnu: coreutils: Patch 'cut' unit test on ARM.

Fixes <https://bugs.gnu.org/26253>.

* gnu/packages/patches/coreutils-cut-huge-range-test.patch: New file.
* gnu/packages/base.scm (coreutils)[native-inputs]: Add it as an input.
[arguments] <#:phases>: On ARM, add 'patch-cut-test' phase.
* gnu/local.mk (dist_patch_DATA): Add 'coreutils-cut-huge-range-test.patch'.
3 files changed, 50 insertions(+), 4 deletions(-)

M gnu/local.mk
M gnu/packages/base.scm
A gnu/packages/patches/coreutils-cut-huge-range-test.patch
M gnu/local.mk => gnu/local.mk +1 -0
@@ 514,6 514,7 @@ dist_patch_DATA =						\
  %D%/packages/patches/clx-remove-demo.patch			\
  %D%/packages/patches/cmake-fix-tests.patch			\
  %D%/packages/patches/coda-use-system-libs.patch		\
  %D%/packages/patches/coreutils-cut-huge-range-test.patch	\
  %D%/packages/patches/coreutils-fix-cross-compilation.patch    \
  %D%/packages/patches/cpio-CVE-2016-2037.patch			\
  %D%/packages/patches/cpufrequtils-fix-aclocal.patch		\

M gnu/packages/base.scm => gnu/packages/base.scm +27 -4
@@ 307,9 307,17 @@ used to apply commands with arbitrarily long arguments.")
    ;; copy of help2man.  However, don't pass it when cross-compiling since
    ;; that would lead it to try to run programs to get their '--help' output
    ;; for help2man.
    (if (%current-target-system)
        '()
        `(("perl" ,perl))))
    `(,@(if (%current-target-system)
            '()
            `(("perl" ,perl)))

      ;; Apply this patch only on ARM to avoid a full rebuild.
      ;; TODO: Move to 'patches' in the next update cycle.
      ,@(if (string-prefix? "arm" (or (%current-target-system)
                                      (%current-system)))
            `(("cut-test.patch"
               ,(search-patch "coreutils-cut-huge-range-test.patch")))
            '())))
   (outputs '("out" "debug"))
   (arguments
    `(#:parallel-build? #f            ; help2man may be called too early


@@ 328,7 336,22 @@ used to apply commands with arbitrarily long arguments.")
                    (substitute* (find-files "tests" "\\.sh$")
                      (("#!/bin/sh")
                       (format #f "#!~a/bin/sh" bash)))))
                %standard-phases)))

                ,@(if (string-prefix? "arm" (or (%current-target-system)
                                                (%current-system)))
                      '((alist-cons-before
                         'build 'patch-cut-test
                         (lambda* (#:key inputs native-inputs
                                   #:allow-other-keys)
                           (let ((patch (or (assoc-ref inputs
                                                       "cut-test.patch")
                                            (assoc-ref native-inputs
                                                       "cut-test.patch"))))
                             (zero?
                              (system* "patch" "-p1" "--force"
                                       "--input" patch))))
                         %standard-phases))
                      '(%standard-phases)))))
   (synopsis "Core GNU utilities (file, text, shell)")
   (description
    "GNU Coreutils includes all of the basic command-line tools that are

A gnu/packages/patches/coreutils-cut-huge-range-test.patch => gnu/packages/patches/coreutils-cut-huge-range-test.patch +22 -0
@@ 0,0 1,22 @@
This patch fixes 100% reproducible test failures on arm-linux-gnueabihf in our
the build environment chroot, as reported at <https://bugs.gnu.org/26253>.
It is a followup to this upstream patch:

   commit 28803c8a3144d5d4363cdbd148bbe067af1a67c2
   Author: Pádraig Brady <P@draigBrady.com>
   Date:   Fri Mar 3 00:25:54 2017 -0800

       tests: avoid a spurious failure on older debian

... which appeared to be insufficient.

--- a/tests/misc/cut-huge-range.sh
+++ b/tests/misc/cut-huge-range.sh
@@ -22,6 +22,7 @@ getlimits_
 
 vm=$(get_min_ulimit_v_ cut -b1 /dev/null) \
   || skip_ "this shell lacks ulimit support"
+vm=$(($vm + $(getconf PAGESIZE))) # avoid spurious failures
 
 # sed script to subtract one from the input.
 # Each input line should consist of a positive decimal number.