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>
---
eclass/java-utils-2.eclass | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/eclass/java-utils-2.eclass b/eclass/java-utils-2.eclass
index c1f42408e462..3fe64e1c317d 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[@]}"