diff options
| author | Vasileios Anagnostopoulos <vasileios.anagnostopoulos@siemens.com> | 2022-10-17 13:11:21 +0200 |
|---|---|---|
| committer | Bruce Ashfield <bruce.ashfield@gmail.com> | 2023-03-08 17:08:01 -0500 |
| commit | e14985f0e392465f8aa91264269dc1b029ce7ac7 (patch) | |
| tree | 4e060f8d662384fadb88adaf47138e285deda1aa | |
| parent | 3e4863e5790266b3736041092f358636048f44cf (diff) | |
| download | meta-virtualization-e14985f0e392465f8aa91264269dc1b029ce7ac7.tar.gz | |
netavark: Add ptest support
Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
| -rw-r--r-- | recipes-containers/netavark/files/run-ptest | 3 | ||||
| -rw-r--r-- | recipes-containers/netavark/files/tests.patch | 17 | ||||
| -rw-r--r-- | recipes-containers/netavark/netavark.inc | 31 |
3 files changed, 51 insertions, 0 deletions
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 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | |||
| 3 | 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 @@ | |||
| 1 | diff --git a/test/helpers.bash b/test/helpers.bash | ||
| 2 | index 89866ec..017b2b5 100644 | ||
| 3 | --- a/test/helpers.bash | ||
| 4 | +++ b/test/helpers.bash | ||
| 5 | @@ -552,10 +552,10 @@ function run_nc_test() { | ||
| 6 | fi | ||
| 7 | |||
| 8 | nsenter -n -t "${CONTAINER_NS_PIDS[$container_ns]}" timeout --foreground -v --kill=10 5 \ | ||
| 9 | - nc $nc_common_args -l -p $container_port &>"$NETAVARK_TMPDIR/nc-out" <$stdin & | ||
| 10 | + ncat $nc_common_args -l -p $container_port &>"$NETAVARK_TMPDIR/nc-out" <$stdin & | ||
| 11 | |||
| 12 | data=$(random_string) | ||
| 13 | - run_in_host_netns nc $nc_common_args $connect_ip $host_port <<<"$data" | ||
| 14 | + run_in_host_netns ncat $nc_common_args $connect_ip $host_port <<<"$data" | ||
| 15 | |||
| 16 | got=$(cat "$NETAVARK_TMPDIR/nc-out") | ||
| 17 | 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 @@ | |||
| 1 | inherit ptest | ||
| 2 | |||
| 1 | PACKAGECONFIG ?= "aardvark-dns" | 3 | PACKAGECONFIG ?= "aardvark-dns" |
| 2 | 4 | ||
| 3 | # From the documentation of netavark | 5 | # From the documentation of netavark |
| @@ -7,9 +9,38 @@ PACKAGECONFIG ?= "aardvark-dns" | |||
| 7 | PACKAGECONFIG[aardvark-dns]= " , , , aardvark-dns" | 9 | PACKAGECONFIG[aardvark-dns]= " , , , aardvark-dns" |
| 8 | 10 | ||
| 9 | 11 | ||
| 12 | SRC_URI += " \ | ||
| 13 | file://run-ptest \ | ||
| 14 | file://tests.patch \ | ||
| 15 | " | ||
| 16 | |||
| 10 | # Cargo installs the binary to bin so move it to where podman expects it | 17 | # Cargo installs the binary to bin so move it to where podman expects it |
| 11 | do_install:append() { | 18 | do_install:append() { |
| 12 | install -d ${D}${libexecdir}/podman/ | 19 | install -d ${D}${libexecdir}/podman/ |
| 13 | mv ${D}${bindir}/* ${D}${libexecdir}/podman/ | 20 | mv ${D}${bindir}/* ${D}${libexecdir}/podman/ |
| 14 | rm -rf ${D}${bindir}/ | 21 | rm -rf ${D}${bindir}/ |
| 15 | } | 22 | } |
| 23 | |||
| 24 | |||
| 25 | do_install_ptest () { | ||
| 26 | cp -r ${S}/test ${D}${PTEST_PATH} | ||
| 27 | } | ||
| 28 | |||
| 29 | RDEPENDS:${PN}-ptest += " \ | ||
| 30 | bats \ | ||
| 31 | bash \ | ||
| 32 | coreutils \ | ||
| 33 | jq \ | ||
| 34 | iproute2 \ | ||
| 35 | dbus-daemon-proxy \ | ||
| 36 | util-linux-unshare \ | ||
| 37 | nmap \ | ||
| 38 | procps-ps \ | ||
| 39 | util-linux-nsenter \ | ||
| 40 | bind-utils \ | ||
| 41 | " | ||
| 42 | |||
| 43 | |||
| 44 | # bind-utils is used to install dig | ||
| 45 | # procps is necessary because the ps from busybox is | ||
| 46 | # not having the same behavior | ||
