summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Schmaus <flow@gentoo.org>2022-04-20 10:28:51 +0200
committerFlorian Schmaus <flow@gentoo.org>2022-04-27 10:44:39 +0200
commitebf1f3cb5fa8551465f263780719d90400cb5daf (patch)
treea350acaf25a46b5ca8faaa865c0ed0dada555335
parentdev-python/setuptools-rust: Remove old (diff)
downloadgentoo-ebf1f3cb.tar.gz
gentoo-ebf1f3cb.tar.bz2
gentoo-ebf1f3cb.zip
java-utils-2.eclass: introduce JAVA_TEST_RUNNER_EXTRA_ARGS
Also add special handling wrt -usedfaultlisteners for TestNG, see bug #801694. Co-authored-by: Miroslav Ć ulc <fordfrog@gentoo.org> Bug: https://bugs.gentoo.org/801694 Closes: https://github.com/gentoo/gentoo/pull/2512 Signed-off-by: Florian Schmaus <flow@gentoo.org>
-rw-r--r--eclass/java-utils-2.eclass49
1 files changed, 41 insertions, 8 deletions
diff --git a/eclass/java-utils-2.eclass b/eclass/java-utils-2.eclass
index 2a649942550c..6303895885df 100644
--- a/eclass/java-utils-2.eclass
+++ b/eclass/java-utils-2.eclass
@@ -139,6 +139,20 @@ JAVA_PKG_ALLOW_VM_CHANGE=${JAVA_PKG_ALLOW_VM_CHANGE:="yes"}
# )
# @CODE
+# @ECLASS-VARIABLE: JAVA_TEST_RUNNER_EXTRA_ARGS
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Array of extra arguments that should be passed to the test runner when running tests.
+# It is useful when you need to pass an extra argument to the test runner.
+#
+# It is used only when running tests.
+#
+# @CODE
+# JAVA_TEST_RUNNER_EXTRA_ARGS=(
+# -verbose 3
+# )
+# @CODE
+
# @ECLASS_VARIABLE: JAVA_PKG_DEBUG
# @DEFAULT_UNSET
# @DESCRIPTION:
@@ -1807,8 +1821,18 @@ ejunit_() {
if [[ "${junit}" == "junit-4" ]] ; then
runner=org.junit.runner.JUnitCore
fi
- debug-print "Calling: java -cp \"${cp}\" -Djava.io.tmpdir=\"${T}\" -Djava.awt.headless=true ${JAVA_TEST_EXTRA_ARGS[@]} ${runner} ${@}"
- java -cp "${cp}" -Djava.io.tmpdir="${T}/" -Djava.awt.headless=true ${JAVA_TEST_EXTRA_ARGS[@]} ${runner} "${@}" || die "Running junit failed"
+
+ local args=(
+ -cp ${cp}
+ -Djava.io.tmpdir="${T}"
+ -Djava.awt.headless=true
+ ${JAVA_TEST_EXTRA_ARGS[@]}
+ ${runner}
+ ${JAVA_TEST_RUNNER_EXTRA_ARGS[@]}
+ ${@}
+ )
+ debug-print "Calling: java ${args[@]}"
+ java "${args[@]}" || die "Running junit failed"
}
# @FUNCTION: ejunit
@@ -1886,12 +1910,21 @@ etestng() {
tests+="${test},"
done
- debug-print "java -cp \"${cp}\" -Djava.io.tmpdir=\"${T}\""\
- "-Djava.awt.headless=true ${JAVA_TEST_EXTRA_ARGS[@]} ${runner}"\
- "-usedefaultlisteners false -testclass ${tests}"
- java -cp "${cp}" -Djava.io.tmpdir=\"${T}\" -Djava.awt.headless=true ${JAVA_TEST_EXTRA_ARGS[@]}\
- ${runner} -usedefaultlisteners false -testclass ${tests}\
- || die "Running TestNG failed."
+ local args=(
+ -cp ${cp}
+ -Djava.io.tmpdir="${T}"
+ -Djava.awt.headless=true
+ ${JAVA_TEST_EXTRA_ARGS[@]}
+ ${runner}
+ ${JAVA_TEST_RUNNER_EXTRA_ARGS[@]}
+ )
+
+ [[ ! "${JAVA_TEST_RUNNER_EXTRA_ARGS[@]}" =~ "-usedefaultlisteners" ]] && args+=( -usedefaultlisteners false )
+
+ args+=( -testclass ${tests} )
+
+ debug-print "java ${args[@]}"
+ java ${args[@]} || die "Running TestNG failed."
}
# @FUNCTION: java-utils-2_src_prepare