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.
This commit is contained in:
parent
0a6f874b83
commit
772c0fbc55
1 changed files with 36 additions and 8 deletions
|
@ -82,6 +82,7 @@
|
||||||
#:use-module (gnu packages autogen)
|
#:use-module (gnu packages autogen)
|
||||||
#:use-module (gnu packages autotools)
|
#:use-module (gnu packages autotools)
|
||||||
#:use-module (gnu packages base)
|
#:use-module (gnu packages base)
|
||||||
|
#:use-module (gnu packages bash)
|
||||||
#:use-module (gnu packages bison)
|
#:use-module (gnu packages bison)
|
||||||
#:use-module (gnu packages boost)
|
#:use-module (gnu packages boost)
|
||||||
#:use-module (gnu packages check)
|
#:use-module (gnu packages check)
|
||||||
|
@ -2508,18 +2509,42 @@ procedure calls (RPCs).")
|
||||||
"0sldyib85v5lh3qp9af0jgvf304pwdmjd0y7rknfwliykgjvgqsm"))))
|
"0sldyib85v5lh3qp9af0jgvf304pwdmjd0y7rknfwliykgjvgqsm"))))
|
||||||
(build-system gnu-build-system)
|
(build-system gnu-build-system)
|
||||||
(arguments
|
(arguments
|
||||||
'(;; FIXME: many tests fail with:
|
'(#:configure-flags
|
||||||
;; […]
|
|
||||||
;; test -e $OVS_RUNDIR/ovs-vswitchd.pid
|
|
||||||
;; ovs-appctl -t ovs-vswitchd exit
|
|
||||||
;; hard failure
|
|
||||||
#:tests? #f
|
|
||||||
#:configure-flags
|
|
||||||
'("--enable-shared"
|
'("--enable-shared"
|
||||||
"--localstatedir=/var"
|
"--localstatedir=/var"
|
||||||
"--with-dbdir=/var/lib/openvswitch")
|
"--with-dbdir=/var/lib/openvswitch")
|
||||||
#:phases
|
#:phases
|
||||||
(modify-phases %standard-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
|
(replace 'install
|
||||||
(lambda _
|
(lambda _
|
||||||
(invoke "make"
|
(invoke "make"
|
||||||
|
@ -2534,9 +2559,12 @@ procedure calls (RPCs).")
|
||||||
("pkg-config" ,pkg-config)
|
("pkg-config" ,pkg-config)
|
||||||
("python" ,python-wrapper)
|
("python" ,python-wrapper)
|
||||||
;; for testing
|
;; for testing
|
||||||
|
("bash" ,bash) ;for 'compgen'
|
||||||
|
("procps" ,procps)
|
||||||
("util-linux" ,util-linux)))
|
("util-linux" ,util-linux)))
|
||||||
(inputs
|
(inputs
|
||||||
`(("libcap-ng" ,libcap-ng)
|
`(("bash-minimal" ,bash-minimal)
|
||||||
|
("libcap-ng" ,libcap-ng)
|
||||||
("openssl" ,openssl)))
|
("openssl" ,openssl)))
|
||||||
(synopsis "Virtual network switch")
|
(synopsis "Virtual network switch")
|
||||||
(home-page "https://www.openvswitch.org/")
|
(home-page "https://www.openvswitch.org/")
|
||||||
|
|
Reference in a new issue