| # |
| # 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 |
| |
| DESCRIPTION="runc tests source" |
| HOMEPAGE="http://runc.io" |
| MY_PV="${PV/_/-}" |
| MY_PN="${PN/-test/}" |
| MY_P="${MY_PN}-${MY_PV}" |
| |
| SRC_URI="https://github.com/opencontainers/${MY_PN}/archive/v${MY_PV}.tar.gz -> ${P}.tar.gz" |
| |
| # 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/opencontainers/runc |
| # inside a clone of the package repo. |
| # https://github.com/google/go-licenses |
| LICENSE="Apache-2.0 BSD-2 BSD MIT" |
| SLOT="0" |
| KEYWORDS="*" |
| |
| RDEPEND=" |
| app-containers/runc |
| dev-util/bats |
| sys-apps/gawk |
| " |
| |
| PATCHES=( |
| "${FILESDIR}/1.1.4-Disable-gcc-and-use-test-binaries-compiled-during-bu.patch" |
| "${FILESDIR}/1.1.4-Update-bats-workdir.patch" |
| "${FILESDIR}/1.1.4-Skip-test-errors-due-to-bugs.patch" |
| "${FILESDIR}/1.1.4-Skip-go-dependent-test-spec.bats.patch" |
| "${FILESDIR}/1.1.4-Skip-flaky-test-in-kill.bats.patch" |
| "${FILESDIR}/1.1.4-Seccomp-tests-arm.patch" |
| ) |
| |
| TESTDATA=tests/integration/testdata |
| |
| src_unpack(){ |
| default |
| mv "${WORKDIR}/${MY_P}" "${WORKDIR}/${MY_PN}" |
| S="${WORKDIR}/${MY_PN}" |
| } |
| |
| src_compile(){ |
| GO=$(tc-getGO) |
| export GO |
| go() { |
| echo "${GO} $@" 1>&2 |
| "${GO}" "$@" |
| } |
| export -f go |
| emake all |
| unset -f go |
| |
| GCC=$(tc-getCC) |
| mv "${TESTDATA}/seccomp_syscall_test1.c" "${TESTDATA}/seccomp_test.c" |
| mv "${TESTDATA}/seccomp_syscall_test2.c" "${TESTDATA}/seccomp_test2.c" |
| |
| for target in "${TESTDATA}"/*.c; do |
| ${GCC} -static -o "${target%.c}" "${target}" |
| done |
| } |
| |
| src_install(){ |
| |
| TESTS_DIR=/usr/local/tests |
| insinto "${TESTS_DIR}" |
| doins -r "${S}" |
| |
| HELPERS_DIR="${TESTS_DIR}/${MY_PN}"/contrib/cmd |
| exeinto "${HELPERS_DIR}"/recvtty |
| doexe "${S}/contrib/cmd/recvtty/recvtty" |
| exeinto "${HELPERS_DIR}"/sd-helper |
| doexe "${S}/contrib/cmd/sd-helper/sd-helper" |
| exeinto "${HELPERS_DIR}"/seccompagent |
| doexe "${S}/contrib/cmd/seccompagent/seccompagent" |
| |
| exeinto "${TESTS_DIR}/${MY_PN}"/overrides/bin |
| newexe "${FILESDIR}/go_arch" go |
| |
| TESTDATA_DIR="${TESTS_DIR}/${MY_PN}/${TESTDATA}" |
| exeinto "${TESTDATA_DIR}" |
| doexe "${S}/${TESTDATA}/dev_access_test" |
| doexe "${S}/${TESTDATA}/seccomp_test" |
| doexe "${S}/${TESTDATA}/seccomp_test2" |
| } |