Gentoo Archives: gentoo-dev

From: Mike Gilbert <floppym@g.o>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] [PATCH] meson.eclass: refactor mesontestargs into its own function
Date: Sun, 25 Aug 2019 17:37:40
Message-Id: 20190825173732.450816-1-floppym@gentoo.org
1 This will allow other src_test implementations to easily compute meson
2 test arguments.
3
4 Signed-off-by: Mike Gilbert <floppym@g.o>
5 ---
6 eclass/meson.eclass | 25 +++++++++++++++----------
7 1 file changed, 15 insertions(+), 10 deletions(-)
8
9 diff --git a/eclass/meson.eclass b/eclass/meson.eclass
10 index fa859ace996f..b3deba0117fa 100644
11 --- a/eclass/meson.eclass
12 +++ b/eclass/meson.eclass
13 @@ -253,6 +253,19 @@ meson_src_compile() {
14 eninja -C "${BUILD_DIR}" "$@"
15 }
16
17 +# @FUNCTION: meson_set_mesontestargs
18 +# @DESCRIPTION:
19 +# Set the mesontestargs array variable for use in meson_src_test or other
20 +# src_test implementations.
21 +meson_set_mesontestargs() {
22 + mesontestargs=( -C "${BUILD_DIR}" )
23 + if [[ -n ${NINJAOPTS+set} || -n ${MAKEOPTS+set} ]]; then
24 + mesontestargs+=( --num-processes "$(makeopts_jobs ${NINJAOPTS-${MAKEOPTS}})" )
25 + fi
26 + # Append additional arguments from ebuild
27 + mesontestargs+=("${emesontestargs[@]}")
28 +}
29 +
30 # @FUNCTION: meson_src_test
31 # @USAGE: [extra meson test arguments]
32 # @DESCRIPTION:
33 @@ -260,16 +273,8 @@ meson_src_compile() {
34 meson_src_test() {
35 debug-print-function ${FUNCNAME} "$@"
36
37 - local mesontestargs=(
38 - -C "${BUILD_DIR}"
39 - )
40 - [[ -n ${NINJAOPTS} || -n ${MAKEOPTS} ]] &&
41 - mesontestargs+=(
42 - --num-processes "$(makeopts_jobs ${NINJAOPTS:-${MAKEOPTS}})"
43 - )
44 -
45 - # Append additional arguments from ebuild
46 - mesontestargs+=("${emesontestargs[@]}")
47 + local -a mesontestargs
48 + meson_set_mesontestargs
49
50 set -- meson test "${mesontestargs[@]}" "$@"
51 echo "$@" >&2
52 --
53 2.23.0