| # |
| # Copyright 2023 Google LLC |
| # |
| # This program is free software; you can redistribute it and/or |
| # modify it under the terms of the GNU General Public License |
| # version 2 as published by the Free Software Foundation. |
| # |
| # This program is distributed in the hope that it will be useful, |
| # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| # GNU General Public License for more details. |
| # |
| EAPI=7 |
| |
| inherit toolchain-funcs go-module |
| |
| VERSION="2.0.0-beta.0" |
| MY_PN="${PN/-test/}" |
| MY_P="${MY_PN}-${PV}" |
| |
| DESCRIPTION="Test source for containerd" |
| HOMEPAGE="https://containerd.io/" |
| SRC_URI="https://github.com/containerd/containerd/archive/v${VERSION}.tar.gz -> ${MY_P}.tar.gz" |
| SRC_URI+=" ${P}-deps.tar.xz" |
| |
| # This includes the licenses of dependencies as the binary is statically linked. |
| # |
| # If LICENSE contains BSD, ISC, or MIT, then chromite will scan the source for |
| # copyright attribution. If the package vendors its dependencies or includes a |
| # THIRD_PARTY_LICENSES/ directory, then chromite will properly attribute all |
| # dependencies in about_os_credits.html. |
| # |
| # This list was determined by inspecting the output of: |
| # go-licenses csv github.com/containerd/containerd/cmd/containerd |
| # go-licenses csv github.com/containerd/containerd/cmd/ctr |
| # go-licenses csv github.com/containerd/containerd/cmd/containerd-shim |
| # go-licenses csv github.com/containerd/containerd/cmd/containerd-shim-runc-v1 |
| # go-licenses csv github.com/containerd/containerd/cmd/containerd-shim-runc-v2 |
| # go-licenses csv github.com/containerd/containerd/cmd/containerd-stress |
| # inside a clone of the package repo. |
| # https://github.com/google/go-licenses |
| LICENSE="Apache-2.0 BSD-2 BSD ISC MIT MPL-2.0" |
| SLOT="0" |
| KEYWORDS="*" |
| |
| PATCHES=( |
| "${FILESDIR}"/1.7.0-Add-cgroup-parent-to-PodSandboxConfig.patch |
| "${FILESDIR}"/2.0.0-fix_TestContainerStopCancellation.patch |
| "${FILESDIR}"/2.0.0-fix_TestContainerPids.patch |
| ) |
| |
| src_unpack() { |
| default |
| mv "${WORKDIR}/containerd-${VERSION}" "${WORKDIR}/${MY_PN}" |
| S="${WORKDIR}/${MY_PN}" |
| go-module_src_unpack |
| } |
| |
| src_compile() { |
| # lakitu: Use the go cross-compiler |
| GO="$(tc-getGO)" |
| export GO |
| |
| GOFLAGS="-v -x -mod=vendor" ${GO} test -c ./integration \ |
| -o bin/cri-integration.test |
| |
| cd integration/client || die |
| CGO_ENABLED=0 ${GO} test -c . -o bin/client.test |
| } |
| |
| src_install(){ |
| TESTS_DIR=/usr/local/tests/"${MY_PN}" |
| insinto "${TESTS_DIR}" |
| doins -r "${S}"/bin |
| |
| exeinto "${TESTS_DIR}"/bin |
| doexe "${S}"/bin/cri-integration.test |
| doexe "${S}"/integration/client/bin/client.test |
| } |