netavark: Add ptest support

Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
This commit is contained in:
Vasileios Anagnostopoulos 2022-10-17 13:11:21 +02:00 committed by Bruce Ashfield
parent 3e4863e579
commit e14985f0e3
3 changed files with 51 additions and 0 deletions

View File

@ -0,0 +1,3 @@
#!/bin/bash
NETAVARK=/usr/libexec/podman/netavark bats ./test/

View File

@ -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"

View File

@ -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