Gentoo Archives: gentoo-commits

From: Florian Schmaus <flow@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/
Date: Wed, 27 Apr 2022 08:45:55
Message-Id: 1651049079.ebf1f3cb5fa8551465f263780719d90400cb5daf.flow@gentoo
1 commit: ebf1f3cb5fa8551465f263780719d90400cb5daf
2 Author: Florian Schmaus <flow <AT> gentoo <DOT> org>
3 AuthorDate: Wed Apr 20 08:28:51 2022 +0000
4 Commit: Florian Schmaus <flow <AT> gentoo <DOT> org>
5 CommitDate: Wed Apr 27 08:44:39 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ebf1f3cb
7
8 java-utils-2.eclass: introduce JAVA_TEST_RUNNER_EXTRA_ARGS
9
10 Also add special handling wrt -usedfaultlisteners for TestNG, see
11 bug #801694.
12
13 Co-authored-by: Miroslav Ć ulc <fordfrog <AT> gentoo.org>
14 Bug: https://bugs.gentoo.org/801694
15 Closes: https://github.com/gentoo/gentoo/pull/2512
16 Signed-off-by: Florian Schmaus <flow <AT> gentoo.org>
17
18 eclass/java-utils-2.eclass | 49 ++++++++++++++++++++++++++++++++++++++--------
19 1 file changed, 41 insertions(+), 8 deletions(-)
20
21 diff --git a/eclass/java-utils-2.eclass b/eclass/java-utils-2.eclass
22 index 2a649942550c..6303895885df 100644
23 --- a/eclass/java-utils-2.eclass
24 +++ b/eclass/java-utils-2.eclass
25 @@ -139,6 +139,20 @@ JAVA_PKG_ALLOW_VM_CHANGE=${JAVA_PKG_ALLOW_VM_CHANGE:="yes"}
26 # )
27 # @CODE
28
29 +# @ECLASS-VARIABLE: JAVA_TEST_RUNNER_EXTRA_ARGS
30 +# @DEFAULT_UNSET
31 +# @DESCRIPTION:
32 +# Array of extra arguments that should be passed to the test runner when running tests.
33 +# It is useful when you need to pass an extra argument to the test runner.
34 +#
35 +# It is used only when running tests.
36 +#
37 +# @CODE
38 +# JAVA_TEST_RUNNER_EXTRA_ARGS=(
39 +# -verbose 3
40 +# )
41 +# @CODE
42 +
43 # @ECLASS_VARIABLE: JAVA_PKG_DEBUG
44 # @DEFAULT_UNSET
45 # @DESCRIPTION:
46 @@ -1807,8 +1821,18 @@ ejunit_() {
47 if [[ "${junit}" == "junit-4" ]] ; then
48 runner=org.junit.runner.JUnitCore
49 fi
50 - debug-print "Calling: java -cp \"${cp}\" -Djava.io.tmpdir=\"${T}\" -Djava.awt.headless=true ${JAVA_TEST_EXTRA_ARGS[@]} ${runner} ${@}"
51 - java -cp "${cp}" -Djava.io.tmpdir="${T}/" -Djava.awt.headless=true ${JAVA_TEST_EXTRA_ARGS[@]} ${runner} "${@}" || die "Running junit failed"
52 +
53 + local args=(
54 + -cp ${cp}
55 + -Djava.io.tmpdir="${T}"
56 + -Djava.awt.headless=true
57 + ${JAVA_TEST_EXTRA_ARGS[@]}
58 + ${runner}
59 + ${JAVA_TEST_RUNNER_EXTRA_ARGS[@]}
60 + ${@}
61 + )
62 + debug-print "Calling: java ${args[@]}"
63 + java "${args[@]}" || die "Running junit failed"
64 }
65
66 # @FUNCTION: ejunit
67 @@ -1886,12 +1910,21 @@ etestng() {
68 tests+="${test},"
69 done
70
71 - debug-print "java -cp \"${cp}\" -Djava.io.tmpdir=\"${T}\""\
72 - "-Djava.awt.headless=true ${JAVA_TEST_EXTRA_ARGS[@]} ${runner}"\
73 - "-usedefaultlisteners false -testclass ${tests}"
74 - java -cp "${cp}" -Djava.io.tmpdir=\"${T}\" -Djava.awt.headless=true ${JAVA_TEST_EXTRA_ARGS[@]}\
75 - ${runner} -usedefaultlisteners false -testclass ${tests}\
76 - || die "Running TestNG failed."
77 + local args=(
78 + -cp ${cp}
79 + -Djava.io.tmpdir="${T}"
80 + -Djava.awt.headless=true
81 + ${JAVA_TEST_EXTRA_ARGS[@]}
82 + ${runner}
83 + ${JAVA_TEST_RUNNER_EXTRA_ARGS[@]}
84 + )
85 +
86 + [[ ! "${JAVA_TEST_RUNNER_EXTRA_ARGS[@]}" =~ "-usedefaultlisteners" ]] && args+=( -usedefaultlisteners false )
87 +
88 + args+=( -testclass ${tests} )
89 +
90 + debug-print "java ${args[@]}"
91 + java ${args[@]} || die "Running TestNG failed."
92 }
93
94 # @FUNCTION: java-utils-2_src_prepare