public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH] meson.eclass: refactor mesontestargs into its own function
@ 2019-08-25 17:37 Mike Gilbert
  0 siblings, 0 replies; only message in thread
From: Mike Gilbert @ 2019-08-25 17:37 UTC (permalink / raw
  To: gentoo-dev

This will allow other src_test implementations to easily compute meson
test arguments.

Signed-off-by: Mike Gilbert <floppym@gentoo.org>
---
 eclass/meson.eclass | 25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/eclass/meson.eclass b/eclass/meson.eclass
index fa859ace996f..b3deba0117fa 100644
--- a/eclass/meson.eclass
+++ b/eclass/meson.eclass
@@ -253,6 +253,19 @@ meson_src_compile() {
 	eninja -C "${BUILD_DIR}" "$@"
 }
 
+# @FUNCTION: meson_set_mesontestargs
+# @DESCRIPTION:
+# Set the mesontestargs array variable for use in meson_src_test or other
+# src_test implementations.
+meson_set_mesontestargs() {
+	mesontestargs=( -C "${BUILD_DIR}" )
+	if [[ -n ${NINJAOPTS+set} || -n ${MAKEOPTS+set} ]]; then
+		mesontestargs+=( --num-processes "$(makeopts_jobs ${NINJAOPTS-${MAKEOPTS}})" )
+	fi
+	# Append additional arguments from ebuild
+	mesontestargs+=("${emesontestargs[@]}")
+}
+
 # @FUNCTION: meson_src_test
 # @USAGE: [extra meson test arguments]
 # @DESCRIPTION:
@@ -260,16 +273,8 @@ meson_src_compile() {
 meson_src_test() {
 	debug-print-function ${FUNCNAME} "$@"
 
-	local mesontestargs=(
-		-C "${BUILD_DIR}"
-	)
-	[[ -n ${NINJAOPTS} || -n ${MAKEOPTS} ]] &&
-		mesontestargs+=(
-			--num-processes "$(makeopts_jobs ${NINJAOPTS:-${MAKEOPTS}})"
-		)
-
-	# Append additional arguments from ebuild
-	mesontestargs+=("${emesontestargs[@]}")
+	local -a mesontestargs
+	meson_set_mesontestargs
 
 	set -- meson test "${mesontestargs[@]}" "$@"
 	echo "$@" >&2
-- 
2.23.0



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2019-08-25 17:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-08-25 17:37 [gentoo-dev] [PATCH] meson.eclass: refactor mesontestargs into its own function Mike Gilbert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox