guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

05/06: gnu: Open vSwitch: Enable tests.


From: guix-commits
Subject: 05/06: gnu: Open vSwitch: Enable tests.
Date: Tue, 5 Oct 2021 13:53:31 -0400 (EDT)

mbakke pushed a commit to branch master
in repository guix.

commit 772c0fbc55156f09eb15ef66267dc943dc458295
Author: Marius Bakke <marius@gnu.org>
AuthorDate: Tue Oct 5 12:30:01 2021 +0200

    gnu: Open vSwitch: Enable tests.
    
    * gnu/packages/networking.scm (openvswitch)[arguments]: Remove #:tests?.  
Add
    two new phases to patch /bin/sh, and create a 'kill -0' script that handles
    zombies.
    [native-inputs]: Add BASH and PROCPS.
    [inputs]: Add BASH-MINIMAL.
---
 gnu/packages/networking.scm | 44 ++++++++++++++++++++++++++++++++++++--------
 1 file changed, 36 insertions(+), 8 deletions(-)

diff --git a/gnu/packages/networking.scm b/gnu/packages/networking.scm
index 83e54be..7e5636f 100644
--- a/gnu/packages/networking.scm
+++ b/gnu/packages/networking.scm
@@ -82,6 +82,7 @@
   #:use-module (gnu packages autogen)
   #:use-module (gnu packages autotools)
   #:use-module (gnu packages base)
+  #:use-module (gnu packages bash)
   #:use-module (gnu packages bison)
   #:use-module (gnu packages boost)
   #:use-module (gnu packages check)
@@ -2508,18 +2509,42 @@ procedure calls (RPCs).")
                 "0sldyib85v5lh3qp9af0jgvf304pwdmjd0y7rknfwliykgjvgqsm"))))
     (build-system gnu-build-system)
     (arguments
-     '(;; FIXME: many tests fail with:
-       ;;    […]
-       ;;    test -e $OVS_RUNDIR/ovs-vswitchd.pid
-       ;;    ovs-appctl -t ovs-vswitchd exit
-       ;;    hard failure
-       #:tests? #f
-       #:configure-flags
+     '(#:configure-flags
        '("--enable-shared"
          "--localstatedir=/var"
          "--with-dbdir=/var/lib/openvswitch")
        #:phases
        (modify-phases %standard-phases
+         (add-after 'unpack 'use-absolute-/bin/sh
+           (lambda* (#:key inputs #:allow-other-keys)
+             (let* ((bash (assoc-ref inputs "bash-minimal")))
+               (substitute* "ovsdb/ovsdb-server.c"
+                 (("/bin/sh") (string-append bash "/bin/sh"))))))
+         (add-before 'check 'adjust-tests
+           (lambda* (#:key inputs #:allow-other-keys)
+             (let* ((bash (assoc-ref inputs "bash-minimal"))
+                    (/bin/sh (string-append bash "/bin/sh")))
+               (with-fluids ((%default-port-encoding "ISO-8859-1"))
+                 (substitute* (find-files "tests" ".*(run|testsuite)$")
+                   (("#! /bin/sh")
+                    (string-append "#! " /bin/sh))
+
+                   ;; The tests use 'kill -0' to check whether a test has
+                   ;; completed, but it does not work in the build container
+                   ;; because zombies are not reaped automatically (PID 1 is
+                   ;; the builder script).  Change to something that handles
+                   ;; undead processes.
+                   (("kill -0")
+                    "kill-0")))
+               (mkdir "/tmp/bin")
+               (call-with-output-file "/tmp/bin/kill-0"
+                 (lambda (port)
+                   (format port "#!~a
+ps --no-header -p $1 -o state= | grep -qv '^Z$'"
+                           /bin/sh)))
+               (chmod "/tmp/bin/kill-0" #o755)
+               (setenv "PATH"
+                       (string-append "/tmp/bin:" (getenv "PATH"))))))
          (replace 'install
            (lambda _
              (invoke "make"
@@ -2534,9 +2559,12 @@ procedure calls (RPCs).")
        ("pkg-config" ,pkg-config)
        ("python" ,python-wrapper)
        ;; for testing
+       ("bash" ,bash)                   ;for 'compgen'
+       ("procps" ,procps)
        ("util-linux" ,util-linux)))
     (inputs
-     `(("libcap-ng" ,libcap-ng)
+     `(("bash-minimal" ,bash-minimal)
+       ("libcap-ng" ,libcap-ng)
        ("openssl" ,openssl)))
     (synopsis "Virtual network switch")
     (home-page "https://www.openvswitch.org/";)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]