summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolkmar W. Pogatzki <gentoo@pogatzki.net>2023-02-27 13:26:24 +0100
committerMiroslav Šulc <fordfrog@gentoo.org>2023-10-18 09:46:32 +0200
commit95fbb322960db274e981b5632dc9a01e540ee8f6 (patch)
tree95481cb7010046c92affff31fbbbce8c8d59d797 /eclass/java-utils-2.eclass
parentdev-java/jcommander: add 1.64 (diff)
downloadgentoo-95fbb322960db274e981b5632dc9a01e540ee8f6.tar.gz
gentoo-95fbb322960db274e981b5632dc9a01e540ee8f6.tar.bz2
gentoo-95fbb322960db274e981b5632dc9a01e540ee8f6.zip
java-utils-2.eclass: allow etestng to run testng.xml
The etestng function is presently limited to running test classes and has no option for running testng.xml files. Using testng.xml in an ebuild requires manual coding in src_test(). This change adds a switch to the etestng function which allows running default src_test() with either testng.xml files or test classes. Signed-off-by: Volkmar W. Pogatzki <gentoo@pogatzki.net> Signed-off-by: Miroslav Šulc <fordfrog@gentoo.org>
Diffstat (limited to 'eclass/java-utils-2.eclass')
-rw-r--r--eclass/java-utils-2.eclass9
1 files changed, 7 insertions, 2 deletions
diff --git a/eclass/java-utils-2.eclass b/eclass/java-utils-2.eclass
index 92e02e3085b1..1efb655acf71 100644
--- a/eclass/java-utils-2.eclass
+++ b/eclass/java-utils-2.eclass
@@ -1886,7 +1886,7 @@ ejunit4() {
# @CODE
# $1 - -cp or -classpath
# $2 - the classpath passed to it
-# $@ - test classes for testng to run.
+# $@ - test classes or testng.xml for testng to run.
# @CODE
etestng() {
debug-print-function ${FUNCNAME} $*
@@ -1910,6 +1910,7 @@ etestng() {
-cp ${cp}
-Djava.io.tmpdir="${T}"
-Djava.awt.headless=true
+ -Dtest.resources.dir="${JAVA_TEST_RESOURCE_DIRS}"
${JAVA_TEST_EXTRA_ARGS[@]}
${runner}
${JAVA_TEST_RUNNER_EXTRA_ARGS[@]}
@@ -1922,7 +1923,11 @@ etestng() {
)
fi
- args+=( -testclass ${tests} )
+ if [[ "${test%.xml}" == "${test}" ]]; then
+ args+=( -testclass ${tests} )
+ else
+ args+=( ${tests%,} )
+ fi
debug-print "java ${args[@]}"
java ${args[@]} || die "Running TestNG failed."