From e14985f0e392465f8aa91264269dc1b029ce7ac7 Mon Sep 17 00:00:00 2001 From: Vasileios Anagnostopoulos Date: Mon, 17 Oct 2022 13:11:21 +0200 Subject: netavark: Add ptest support Signed-off-by: Bruce Ashfield --- recipes-containers/netavark/files/run-ptest | 3 +++ recipes-containers/netavark/files/tests.patch | 17 +++++++++++++++ recipes-containers/netavark/netavark.inc | 31 +++++++++++++++++++++++++++ 3 files changed, 51 insertions(+) create mode 100644 recipes-containers/netavark/files/run-ptest create mode 100644 recipes-containers/netavark/files/tests.patch (limited to 'recipes-containers') diff --git a/recipes-containers/netavark/files/run-ptest b/recipes-containers/netavark/files/run-ptest new file mode 100644 index 00000000..41a37dce --- /dev/null +++ b/recipes-containers/netavark/files/run-ptest @@ -0,0 +1,3 @@ +#!/bin/bash + +NETAVARK=/usr/libexec/podman/netavark bats ./test/ diff --git a/recipes-containers/netavark/files/tests.patch b/recipes-containers/netavark/files/tests.patch new file mode 100644 index 00000000..254e4e9d --- /dev/null +++ b/recipes-containers/netavark/files/tests.patch @@ -0,0 +1,17 @@ +diff --git a/test/helpers.bash b/test/helpers.bash +index 89866ec..017b2b5 100644 +--- a/test/helpers.bash ++++ b/test/helpers.bash +@@ -552,10 +552,10 @@ function run_nc_test() { + fi + + nsenter -n -t "${CONTAINER_NS_PIDS[$container_ns]}" timeout --foreground -v --kill=10 5 \ +- nc $nc_common_args -l -p $container_port &>"$NETAVARK_TMPDIR/nc-out" <$stdin & ++ ncat $nc_common_args -l -p $container_port &>"$NETAVARK_TMPDIR/nc-out" <$stdin & + + data=$(random_string) +- run_in_host_netns nc $nc_common_args $connect_ip $host_port <<<"$data" ++ run_in_host_netns ncat $nc_common_args $connect_ip $host_port <<<"$data" + + got=$(cat "$NETAVARK_TMPDIR/nc-out") + assert "$got" == "$data" "ncat received data" diff --git a/recipes-containers/netavark/netavark.inc b/recipes-containers/netavark/netavark.inc index ae3e8473..1127adb9 100644 --- a/recipes-containers/netavark/netavark.inc +++ b/recipes-containers/netavark/netavark.inc @@ -1,3 +1,5 @@ +inherit ptest + PACKAGECONFIG ?= "aardvark-dns" # From the documentation of netavark @@ -7,9 +9,38 @@ PACKAGECONFIG ?= "aardvark-dns" PACKAGECONFIG[aardvark-dns]= " , , , aardvark-dns" +SRC_URI += " \ + file://run-ptest \ + file://tests.patch \ +" + # Cargo installs the binary to bin so move it to where podman expects it do_install:append() { install -d ${D}${libexecdir}/podman/ mv ${D}${bindir}/* ${D}${libexecdir}/podman/ rm -rf ${D}${bindir}/ } + + +do_install_ptest () { + cp -r ${S}/test ${D}${PTEST_PATH} +} + +RDEPENDS:${PN}-ptest += " \ + bats \ + bash \ + coreutils \ + jq \ + iproute2 \ + dbus-daemon-proxy \ + util-linux-unshare \ + nmap \ + procps-ps \ + util-linux-nsenter \ + bind-utils \ +" + + +# bind-utils is used to install dig +# procps is necessary because the ps from busybox is +# not having the same behavior -- cgit v1.2.3-54-g00ecf