Files
gentoo/dev-util/bats/bats-1.13.0.ebuild
Henning Schild dd9ee7e708 dev-util/bats: use upstreams way of running parallel tests
Running the self-test does fail if we run it with `--jobs` but works
if we use BATS_NUMBER_OF_PARALLEL_JOBS. The latter is how upstream
does test.

Gentoo CI never found this because of "optfeature" being involved in
src_test(). This change fixes tests for users who have the "optfeature"
dep installed, no reports or gentoo bugs so far, no change in package
content. Upstream issue mentioned in comments.

Signed-off-by: Henning Schild <henning@hennsch.de>
Part-of: https://codeberg.org/gentoo/gentoo/pulls/1507
Merges: https://codeberg.org/gentoo/gentoo/pulls/1507
Signed-off-by: Joonas Niilola <juippis@gentoo.org>
2026-08-10 15:52:00 +03:00

47 lines
1.1 KiB
Bash

# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit multiprocessing optfeature
MY_PN="bats-core"
DESCRIPTION="Bats-core: Bash Automated Testing System"
HOMEPAGE="https://github.com/bats-core/bats-core/"
SRC_URI="https://github.com/${MY_PN}/${MY_PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
S="${WORKDIR}/${MY_PN}-${PV}"
LICENSE="MIT"
SLOT="0"
KEYWORDS="amd64 arm arm64 ~hppa ~ppc ppc64 ~riscv ~sparc x86"
DEPEND="app-shells/bash:*"
RDEPEND="${DEPEND}"
src_test() {
local my_jobs=$(get_nproc)
if ! command -v parallel >/dev/null; then
my_jobs=1
fi
# see https://github.com/bats-core/bats-core/issues/1225
# BATS_NUMBER_OF_PARALLEL_JOBS should be the same as "--jobs" as we had before
# but turns out they are not so testing like upstream does
BATS_NUMBER_OF_PARALLEL_JOBS="${my_jobs}" bin/bats --tap test || die "Tests failed"
}
src_install() {
exeinto /usr/libexec/${MY_PN}
doexe libexec/${MY_PN}/*
exeinto /usr/lib/${MY_PN}
doexe lib/${MY_PN}/*
dobin bin/${PN}
dodoc README.md
doman man/${PN}.1 man/${PN}.7
}
pkg_postinst() {
optfeature "Parallel Execution" sys-process/parallel
}