summaryrefslogtreecommitdiff
path: root/eclass/java-utils-2.eclass
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2021-07-03 22:39:47 +0100
committerV3n3RiX <venerix@redcorelinux.org>2021-07-03 22:39:47 +0100
commit7f0ccc917c7abe6223784c703d86cd14755691fb (patch)
tree8c6793f68896b341e22f33d7e6cef88e481f4a8b /eclass/java-utils-2.eclass
parent9aa80713372911cec499b3adb2cd746790920916 (diff)
gentoo resync : 03.07.2021
Diffstat (limited to 'eclass/java-utils-2.eclass')
-rw-r--r--eclass/java-utils-2.eclass26
1 files changed, 21 insertions, 5 deletions
diff --git a/eclass/java-utils-2.eclass b/eclass/java-utils-2.eclass
index 3368e6977f60..ed4951ac97b7 100644
--- a/eclass/java-utils-2.eclass
+++ b/eclass/java-utils-2.eclass
@@ -118,13 +118,29 @@ JAVA_PKG_ALLOW_VM_CHANGE=${JAVA_PKG_ALLOW_VM_CHANGE:="yes"}
# Normally this is determined from the jre/jdk version specified in RDEPEND.
# See java-pkg_get-target function below.
#
-# Should generallyonly be used for testing and debugging.
+# Should generally only be used for testing and debugging.
#
# emerge bar to be compatible with 1.3
# @CODE
# JAVA_PKG_WANT_TARGET=1.3 emerge bar
# @CODE
+# @ECLASS-VARIABLE: JAVA_TEST_EXTRA_ARGS
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Array of extra arguments that should be passed to java command when running tests.
+# It is useful when you need to pass a value to a Java program that uses
+# System.getProperty(). If it uses System.getenv(), use `export var=value` instead.
+#
+# It is used only when running tests.
+#
+# @CODE
+# JAVA_TEST_EXTRA_ARGS=(
+# -Dsome.var=x
+# "-Dother.var=\"y z\""
+# )
+# @CODE
+
# @ECLASS-VARIABLE: JAVA_PKG_DEBUG
# @DEFAULT_UNSET
# @DESCRIPTION:
@@ -1797,8 +1813,8 @@ 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 ${runner} ${@}"
- java -cp "${cp}" -Djava.io.tmpdir="${T}/" -Djava.awt.headless=true ${runner} "${@}" || die "Running junit failed"
+ 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"
}
# @FUNCTION: ejunit
@@ -1877,9 +1893,9 @@ etestng() {
done
debug-print "java -cp \"${cp}\" -Djava.io.tmpdir=\"${T}\""\
- "-Djava.awt.headless=true ${runner}"\
+ "-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 -cp "${cp}" -Djava.io.tmpdir=\"${T}\" -Djava.awt.headless=true ${JAVA_TEST_EXTRA_ARGS[@]}\
${runner} -usedefaultlisteners false -testclass ${tests}\
|| die "Running TestNG failed."
}