1 |
commit: fe02c66d4b7638575778dcb7cbeb09c42a83c764 |
2 |
Author: William Hubbs <williamh <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Jun 2 16:29:07 2019 +0000 |
4 |
Commit: William Hubbs <williamh <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Jun 2 16:47:11 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fe02c66d |
7 |
|
8 |
meson.eclass: fix tests |
9 |
|
10 |
- use "meson test" to run tests instead of "eninja test" |
11 |
- calculate --num-processes based on ninjaopts or makeopts in the "meson test" |
12 |
call. |
13 |
- allow meson_src_test to accept arguments with the emesontestargs array |
14 |
or passed in the call like meson_src_configure |
15 |
|
16 |
Closes: https://bugs.gentoo.org/680010 |
17 |
Signed-off-by: William Hubbs <williamh <AT> gentoo.org> |
18 |
|
19 |
eclass/meson.eclass | 25 +++++++++++++++++++++++-- |
20 |
1 file changed, 23 insertions(+), 2 deletions(-) |
21 |
|
22 |
diff --git a/eclass/meson.eclass b/eclass/meson.eclass |
23 |
index 65b09932a7a..b9562376b86 100644 |
24 |
--- a/eclass/meson.eclass |
25 |
+++ b/eclass/meson.eclass |
26 |
@@ -41,7 +41,7 @@ esac |
27 |
|
28 |
if [[ -z ${_MESON_ECLASS} ]]; then |
29 |
|
30 |
-inherit ninja-utils python-utils-r1 toolchain-funcs |
31 |
+inherit multiprocessing ninja-utils python-utils-r1 toolchain-funcs |
32 |
|
33 |
fi |
34 |
|
35 |
@@ -78,6 +78,12 @@ fi |
36 |
# Optional meson arguments as Bash array; this should be defined before |
37 |
# calling meson_src_configure. |
38 |
|
39 |
+# @VARIABLE: emesontestargs |
40 |
+# @DEFAULT_UNSET |
41 |
+# @DESCRIPTION: |
42 |
+# Optional meson test arguments as Bash array; this should be defined before |
43 |
+# calling meson_src_test. |
44 |
+ |
45 |
|
46 |
read -d '' __MESON_ARRAY_PARSER <<"EOF" |
47 |
import shlex |
48 |
@@ -246,12 +252,27 @@ meson_src_compile() { |
49 |
} |
50 |
|
51 |
# @FUNCTION: meson_src_test |
52 |
+# @USAGE: [extra meson test arguments] |
53 |
# @DESCRIPTION: |
54 |
# This is the meson_src_test function. |
55 |
meson_src_test() { |
56 |
debug-print-function ${FUNCNAME} "$@" |
57 |
|
58 |
- eninja -C "${BUILD_DIR}" test |
59 |
+ local mesontestargs=( |
60 |
+ --verbose |
61 |
+ -C "${BUILD_DIR}" |
62 |
+ ) |
63 |
+ [[ -n ${NINJAOPTS} || -n ${MAKEOPTS} ]] && |
64 |
+ mesontestargs+=( |
65 |
+ --num-processes "$(makeopts_jobs ${NINJAOPTS:-${MAKEOPTS}})" |
66 |
+ ) |
67 |
+ |
68 |
+ # Append additional arguments from ebuild |
69 |
+ mesontestargs+=("${emesontestargs[@]}") |
70 |
+ |
71 |
+ set -- meson test "${mesontestargs[@]}" "$@" |
72 |
+ echo "$@" >&2 |
73 |
+ "$@" || die "tests failed" |
74 |
} |
75 |
|
76 |
# @FUNCTION: meson_src_install |