From: Zhang Peng <[email protected]> The ptest build for cri-o was previously disabled due to issues introduced with Go 1.11, which borken the build process. With the current Go version, these issues no longer occur, and the ptest build is now functional. This commit enables ptest support and resolves the "TMPDIR [buildpaths]" issue encountered during the ptest build process.
Signed-off-by: Zhang Peng <[email protected]> --- recipes-containers/cri-o/cri-o_git.bb | 37 ++++++++++++++++++- .../0001-Add-trimpath-to-build-nri.test.patch | 31 ++++++++++++++++ recipes-containers/cri-o/files/run-ptest | 11 ++++++ 3 files changed, 77 insertions(+), 2 deletions(-) create mode 100644 recipes-containers/cri-o/files/0001-Add-trimpath-to-build-nri.test.patch create mode 100644 recipes-containers/cri-o/files/run-ptest diff --git a/recipes-containers/cri-o/cri-o_git.bb b/recipes-containers/cri-o/cri-o_git.bb index efc86fbe..596a43e2 100644 --- a/recipes-containers/cri-o/cri-o_git.bb +++ b/recipes-containers/cri-o/cri-o_git.bb @@ -17,7 +17,9 @@ At a high level, we expect the scope of cri-o to be restricted to the following SRCREV_cri-o = "20c06a19cb395445620c31730c0f1a0a1922eaae" SRC_URI = "\ git://github.com/kubernetes-sigs/cri-o.git;branch=release-1.31;name=cri-o;protocol=https;destsuffix=${GO_SRCURI_DESTSUFFIX} \ + file://0001-Add-trimpath-to-build-nri.test.patch \ file://crio.conf \ + file://run-ptest \ " # Apache-2.0 for docker @@ -28,7 +30,7 @@ GO_IMPORT = "import" PV = "1.31.0+git${SRCREV_cri-o}" -inherit features_check +inherit features_check ptest REQUIRED_DISTRO_FEATURES ?= "seccomp" DEPENDS = " \ @@ -69,6 +71,13 @@ do_compile() { oe_runmake binaries } +do_compile_ptest() { + set +e + + cd ${S}/src/import + + oe_runmake test-binaries +} SYSTEMD_PACKAGES = "${@bb.utils.contains('DISTRO_FEATURES','systemd','${PN}','',d)}" SYSTEMD_SERVICE:${PN} = "${@bb.utils.contains('DISTRO_FEATURES','systemd','crio.service','',d)}" SYSTEMD_AUTO_ENABLE:${PN} = "enable" @@ -100,6 +109,14 @@ do_install() { install -d ${D}${localstatedir}/lib/crio } +do_install_ptest() { + install -d ${D}${PTEST_PATH}/test + install -d ${D}${PTEST_PATH}/bin + install -d ${D}${PTEST_PATH}/vendor + cp -rf ${S}/src/import/test ${D}${PTEST_PATH} + cp -rf ${S}/src/import/bin ${D}${PTEST_PATH} + cp -rf ${S}/src/import/vendor ${D}${PTEST_PATH} +} FILES:${PN}-config = "${sysconfdir}/crio/config/*" FILES:${PN} += "${systemd_unitdir}/system/*" FILES:${PN} += "/usr/local/bin/*" @@ -109,7 +126,23 @@ FILES:${PN} += "/usr/share/containers/oci/hooks.d" ALLOW_EMPTY:${PN} = "1" INSANE_SKIP:${PN} += "ldflags already-stripped textrel" +INSANE_SKIP:${PN}-ptest += "textrel" -deltask compile_ptest_base +RDEPENDS:${PN}-ptest += " \ + bash \ + bats \ + cni \ + crictl \ + bind-utils \ + coreutils \ + dbus-daemon-proxy \ + iproute2 \ + util-linux-unshare \ + jq \ + ipcalc \ + slirp4netns \ + parallel \ + podman \ +" COMPATIBLE_HOST = "^(?!(qemu)?mips).*" diff --git a/recipes-containers/cri-o/files/0001-Add-trimpath-to-build-nri.test.patch b/recipes-containers/cri-o/files/0001-Add-trimpath-to-build-nri.test.patch new file mode 100644 index 00000000..c6be41f0 --- /dev/null +++ b/recipes-containers/cri-o/files/0001-Add-trimpath-to-build-nri.test.patch @@ -0,0 +1,31 @@ +From 0bf230f59d211044e7993543e010b0d7f9dcead3 Mon Sep 17 00:00:00 2001 +From: Peng Zhang <[email protected]> +Date: Fri, 25 Oct 2024 10:42:02 +0800 +Subject: [PATCH] Add --trimpath to build nri.test + +when build test-binary, TMPDIR[buildpaths] error found in nri.test +to fix this error, add "--trimpath" option to build nri.test. + +Upstream-Status: Inappropriate [oe specific] + +Signed-off-by: Peng Zhang <[email protected]> +--- + Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +Index: cri-o-1.31.0+git20c06a19cb395445620c31730c0f1a0a1922eaae/src/import/Makefile +=================================================================== +--- cri-o-1.31.0+git20c06a19cb395445620c31730c0f1a0a1922eaae.orig/src/import/Makefile ++++ cri-o-1.31.0+git20c06a19cb395445620c31730c0f1a0a1922eaae/src/import/Makefile +@@ -169,7 +169,7 @@ test/checkcriu/checkcriu: $(GO_FILES) + $(GO_BUILD) $(GCFLAGS) $(GO_LDFLAGS) -tags "$(BUILDTAGS)" -o $@ ./test/checkcriu + + test/nri/nri.test: $(wildcard test/nri/*.go) +- $(GO) test --tags "test $(BUILDTAGS)" -c ./test/nri -o $@ ++ $(GO) test --tags "test $(BUILDTAGS)" -c ./test/nri -o $@ ${TRIMPATH} + + bin/crio: $(GO_FILES) + $(GO_BUILD) $(GCFLAGS) $(GO_LDFLAGS) -tags "$(BUILDTAGS)" -o $@ ./cmd/crio +-- +2.34.1 + diff --git a/recipes-containers/cri-o/files/run-ptest b/recipes-containers/cri-o/files/run-ptest new file mode 100644 index 00000000..62abe959 --- /dev/null +++ b/recipes-containers/cri-o/files/run-ptest @@ -0,0 +1,11 @@ +#!/bin/sh + +./test/test_runner.sh | while IFS= read -r line; do + if [[ $line =~ ^not\ ok ]]; then + echo "FAIL: ${line#not ok }" + elif [[ $line =~ ^ok && ! $line =~ \#\ skip ]]; then + echo "PASS: ${line#ok }" + elif [[ $line =~ ^ok.*#\ skip ]]; then + echo "SKIP: ${line#ok }" + fi +done -- 2.35.5
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#8971): https://lists.yoctoproject.org/g/meta-virtualization/message/8971 Mute This Topic: https://lists.yoctoproject.org/mt/109593003/21656 Group Owner: [email protected] Unsubscribe: https://lists.yoctoproject.org/g/meta-virtualization/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
