Subject: [bug#63618] [PATCH WIP] gnu: socat: Enable tests.

From: Bruno Victal <[email-masked]>
Date: Sat, 20 May 2023 22:52:36 +0100

* gnu/packages/networking.scm (socat)[arguments]: Enable tests.
[native-inputs]: Add test dependencies: net-tools, which and procps.
---
 gnu/packages/networking.scm | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/networking.scm b/gnu/packages/networking.scm
index 85fb352ebf..4a2ed0e8a5 100644
--- a/gnu/packages/networking.scm
+++ b/gnu/packages/networking.scm
@@ -1204,9 +1204,25 @@ (define-public socat
                     version ".tar.bz2"))
               (sha256
                (base32
-                "01w0hpqf5xmgn40s1ablfd4y67dlrx5y9zlx24spc1qm8h81hwyl"))))
+                "01w0hpqf5xmgn40s1ablfd4y67dlrx5y9zlx24spc1qm8h81hwyl"))
+              (modules '((guix build utils)))
+              (snippet
+               #~(begin
+                   (substitute* "test.sh"
+                     (("/sbin/ifconfig") "ifconfig")
+                     (("^/bin/rm") "rm"))))))
     (build-system gnu-build-system)
-    (arguments '(#:tests? #f))          ; no test suite
+    (arguments
+     (list
+      #:test-target "test"
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'patch-source-shebangs 'patch-test-shebangs
+            (lambda* (#:key inputs #:allow-other-keys)
+              ;; test.sh embeds some shell scripts.
+              (substitute*  "test.sh"
+                (("/usr/bin/env") (search-input-file inputs "/bin/env"))))))))
+    (native-inputs (list net-tools which procps))  ; for tests
     (inputs (list openssl))
     (home-page "http://www.dest-unreach.org/socat/")
     (synopsis

base-commit: cebf0e36d1e5439f43046ec3d6d995fb18f27218
-- 
2.39.2