From: "Volkmar W. Pogatzki" <gentoo@pogatzki.net>
To: gentoo-dev@lists.gentoo.org
Subject: [gentoo-dev] [PATCH 1/4] java-utils-2.eclass: allow etestng to run testng.xml
Date: Thu, 28 Sep 2023 07:10:15 +0200 [thread overview]
Message-ID: <20230928051202.4548-1-gentoo@pogatzki.net> (raw)
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[@]}"
java ${args[@]} || die "Running TestNG failed."
--
2.41.0
next reply other threads:[~2023-09-28 5:12 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-28 5:10 Volkmar W. Pogatzki [this message]
2023-09-28 5:10 ` [gentoo-dev] [PATCH 2/4] dev-java/testng: add 6.11 Volkmar W. Pogatzki
2023-09-28 5:10 ` [gentoo-dev] [PATCH 3/4] java-pkg-simple.eclass: avoid reverse dependency for dev-java/testng Volkmar W. Pogatzki
2023-09-28 5:10 ` [gentoo-dev] [PATCH 4/4] java-utils-2.eclass: " Volkmar W. Pogatzki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230928051202.4548-1-gentoo@pogatzki.net \
--to=gentoo@pogatzki.net \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox