Subject: bug#25974: [PATCH 2/2] gnu: nss: Skip failing test on armhf.

From: Marius Bakke <[email-masked]>
Date: Sun, 5 Mar 2017 15:49:50 +0100

* gnu/packages/patches/nss-skip-test-armhf.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add it.
* gnu/packages/gnuzilla.scm (nss)[native-inputs]: Add patch.
[arguments]: Add phase to apply when target system is armhf.
---
 gnu/local.mk                                   |  1 +
 gnu/packages/gnuzilla.scm                      | 18 ++++++++++++++++--
 gnu/packages/patches/nss-skip-test-armhf.patch | 17 +++++++++++++++++
 3 files changed, 34 insertions(+), 2 deletions(-)
 create mode 100644 gnu/packages/patches/nss-skip-test-armhf.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index c88892df5..9db9ba18d 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -781,6 +781,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/ninja-zero-mtime.patch			\
   %D%/packages/patches/node-9077.patch				\
   %D%/packages/patches/nss-pkgconfig.patch			\
+  %D%/packages/patches/nss-skip-test-armhf.patch		\
   %D%/packages/patches/ntfs-3g-CVE-2017-0358.patch		\
   %D%/packages/patches/nvi-assume-preserve-path.patch		\
   %D%/packages/patches/nvi-dbpagesize-binpower.patch		\
diff --git a/gnu/packages/gnuzilla.scm b/gnu/packages/gnuzilla.scm
index 34ad25ed3..183dc5e83 100644
--- a/gnu/packages/gnuzilla.scm
+++ b/gnu/packages/gnuzilla.scm
@@ -5,6 +5,7 @@
 ;;; Copyright © 2015 Sou Bunnbu <[email-masked]>
 ;;; Copyright © 2016 Efraim Flashner <[email-masked]>
 ;;; Copyright © 2016 Alex Griffin <[email-masked]>
+;;; Copyright © 2017 Marius Bakke <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -203,7 +204,7 @@ in the Mozilla clients.")
     (build-system gnu-build-system)
     (outputs '("out" "bin"))
     (arguments
-     '(#:parallel-build? #f ; failed
+     `(#:parallel-build? #f ; failed
        #:make-flags
        (let* ((out (assoc-ref %outputs "out"))
               (nspr (string-append (assoc-ref %build-inputs "nspr")))
@@ -229,6 +230,14 @@ in the Mozilla clients.")
              (when (string-prefix? "x86_64" system)
                (setenv "USE_64" "1"))
              #t))
+         ,@(if (string-prefix? "armhf" (or (%current-target-system)
+                                           (%current-system)))
+               `((add-after
+                  'unpack 'skip-failing-test
+                  (lambda* (#:key inputs #:allow-other-keys)
+                    (let ((patch (assoc-ref inputs "skip-test-armhf")))
+                      (zero? (system* "patch" "-p1" "--input" patch))))))
+               '())
          (replace 'check
            (lambda _
              ;; Use 127.0.0.1 instead of $HOST.$DOMSUF as HOSTADDR for testing.
@@ -271,7 +280,12 @@ in the Mozilla clients.")
      `(("sqlite" ,sqlite)
        ("zlib" ,zlib)))
     (propagated-inputs `(("nspr" ,nspr))) ; required by nss.pc.
-    (native-inputs `(("perl" ,perl)))
+    (native-inputs `(("perl" ,perl)
+                     ,@(if (string-prefix? "armhf" (or (%current-target-system)
+                                                       (%current-system)))
+                           `(("skip-test-armhf"
+                              ,(search-patch "nss-skip-test-armhf.patch")))
+                           '())))
 
     ;; The NSS test suite takes around 48 hours on Loongson 3A (MIPS) when
     ;; another build is happening concurrently on the same machine.
diff --git a/gnu/packages/patches/nss-skip-test-armhf.patch b/gnu/packages/patches/nss-skip-test-armhf.patch
new file mode 100644
index 000000000..4b7137688
--- /dev/null
+++ b/gnu/packages/patches/nss-skip-test-armhf.patch
@@ -0,0 +1,17 @@
+--- nss-3.29.2/nss/gtests/ssl_gtest/ssl_skip_unittest.cc	2017-03-05 14:07:38.952200827 +0100
++++ nss-3.29.2/nss/gtests/ssl_gtest/ssl_skip_unittest.cc	2017-03-05 14:07:52.964650050 +0100
+@@ -165,14 +165,6 @@
+   client_->CheckErrorCode(SSL_ERROR_RX_UNEXPECTED_HELLO_DONE);
+ }
+ 
+-TEST_P(TlsSkipTest, SkipCertAndKeyExch) {
+-  auto chain = new ChainedPacketFilter();
+-  chain->Add(new TlsHandshakeSkipFilter(kTlsHandshakeCertificate));
+-  chain->Add(new TlsHandshakeSkipFilter(kTlsHandshakeServerKeyExchange));
+-  ServerSkipTest(chain);
+-  client_->CheckErrorCode(SSL_ERROR_RX_UNEXPECTED_HELLO_DONE);
+-}
+-
+ TEST_P(TlsSkipTest, SkipCertAndKeyExchEcdsa) {
+   Reset(TlsAgent::kServerEcdsa256);
+   auto chain = new ChainedPacketFilter();
-- 
2.12.0