gnu: coreutils: Patch 'cut' unit test on ARM.
authorLudovic Courtès <ludo@gnu.org>
Sat, 25 Mar 2017 22:28:54 +0000 (23:28 +0100)
committerLudovic Courtès <ludo@gnu.org>
Sat, 25 Mar 2017 22:31:10 +0000 (23:31 +0100)
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'.

gnu/local.mk
gnu/packages/base.scm
gnu/packages/patches/coreutils-cut-huge-range-test.patch [new file with mode: 0644]

index 6df3e58..ba908cd 100644 (file)
@@ -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          \
index ba9c820..2a6f6a4 100644 (file)
@@ -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
diff --git a/gnu/packages/patches/coreutils-cut-huge-range-test.patch b/gnu/packages/patches/coreutils-cut-huge-range-test.patch
new file mode 100644 (file)
index 0000000..0be2cef
--- /dev/null
@@ -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.