Subject: [PATCH] gnu: curl: Rework tests.

From: Tomas Volf <[email-masked]>
Date: Sun, 22 Jun 2025 00:45:02 +0200

* gnu/packages/curl.scm (curl)[arguments]<#:phases>{'check}: Do not replace.
{'patch-runtests}: New phase.
{'skip-tests}: Always add, do work conditionally based on the system.

Change-Id: I78e2bf40cbb29f45568b62c5e63bc7ceea5e13ef
---
Simplify the tests, there is no need to replace the 'check phase.  This should
go to core-updates due to number of packages that depend on curl.

 gnu/packages/curl.scm | 65 +++++++++++++++----------------------------
 1 file changed, 22 insertions(+), 43 deletions(-)

diff --git a/gnu/packages/curl.scm b/gnu/packages/curl.scm
index 3e9cd517a2..d9d6bde891 100644
--- a/gnu/packages/curl.scm
+++ b/gnu/packages/curl.scm
@@ -106,50 +106,29 @@ (define-public curl
               (mkdir-p (string-append #$output:doc "/share/man"))
               (rename-file (string-append #$output "/share/man/man3")
                            (string-append #$output:doc "/share/man/man3"))))
-          (replace 'check
-            (lambda* (#:key tests? parallel-tests? make-flags #:allow-other-keys)
+          (add-after 'unpack 'patch-runtests
+            (lambda _
               (substitute* "tests/runtests.pl"
-                (("/bin/sh") (which "sh")))
-              (when tests?
-                (let* ((job-count (string-append
-                                   "-j"
-                                   (if parallel-tests?
-                                       (number->string (parallel-job-count))
-                                       "1")))
-                       ;; Ignore test 1477 due to a missing file in the 8.5.0
-                       ;; release.  See
-                       ;; <https://github.com/curl/curl/issues/12462>.
-                       (arguments `("-C" "tests" "test"
-                                    ,@make-flags
-                                    ,(if #$(or (system-hurd?)
-                                               (target-arm32?)
-                                               (target-aarch64?))
-                                         ;; protocol FAIL
-                                         (string-append "TFLAGS=~1474 "
-                                                        "!1477 "
-                                                        job-count)
-                                         (string-append "TFLAGS=\"~1477 "
-                                                        job-count "\"")))))
-                  ;; The top-level "make check" does "make -C tests quiet-test", which
-                  ;; is too quiet.  Use the "test" target instead, which is more
-                  ;; verbose.
-                  (apply invoke "make" arguments)))))
-          #$@(if (system-hurd?)
-                 #~((add-after 'unpack 'skip-tests
-                      (lambda _
-                        (let ((port (open-file "tests/data/DISABLED" "a")))
-                          (display "526\n" port)
-                          (display "527\n" port)
-                          (display "532\n" port)
-                          (display "533\n" port)
-                          (display "537\n" port)
-                          (display "546\n" port)
-                          (display "564\n" port)
-                          (display "575\n" port)
-                          (display "1021\n" port)
-                          (display "1501\n" port)
-                          (close port)))))
-                 #~()))))
+                (("/bin/sh") (which "sh")))))
+          (add-after 'unpack 'skip-tests
+            (lambda _
+              (let ((port (open-file "tests/data/DISABLED" "a")))
+                (when #$(or (system-hurd?)
+                            (target-arm32?)
+                            (target-aarch64?))
+                  (display "1474\n" port))
+                (when #$(system-hurd?)
+                  (display "526\n" port)
+                  (display "527\n" port)
+                  (display "532\n" port)
+                  (display "533\n" port)
+                  (display "537\n" port)
+                  (display "546\n" port)
+                  (display "564\n" port)
+                  (display "575\n" port)
+                  (display "1021\n" port)
+                  (display "1501\n" port))
+                (close port)))))))
     (native-inputs
      (list nghttp2 perl pkg-config python-minimal-wrapper))
     (inputs
--
2.49.0