From f718f829380cd01374008a91401c6a90375d5529 Mon Sep 17 00:00:00 2001 From: Flatcar Buildbot Date: Mon, 23 Oct 2023 07:12:41 +0000 Subject: [PATCH] eclass/java-utils-2: Sync with Gentoo It's from Gentoo commit 9ad2683b86538e21a2d7411fa71058ac534c23de. --- .../portage-stable/eclass/java-utils-2.eclass | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/sdk_container/src/third_party/portage-stable/eclass/java-utils-2.eclass b/sdk_container/src/third_party/portage-stable/eclass/java-utils-2.eclass index 92e02e3085..fd1f708b86 100644 --- a/sdk_container/src/third_party/portage-stable/eclass/java-utils-2.eclass +++ b/sdk_container/src/third_party/portage-stable/eclass/java-utils-2.eclass @@ -1886,13 +1886,17 @@ 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} $* local runner=org.testng.TestNG - local cp=$(java-pkg_getjars --with-dependencies testng) + if [[ ${PN} != testng ]]; then + local cp=$(java-pkg_getjars --with-dependencies testng) + else + local cp=testng.jar + fi local tests if [[ ${1} = -cp || ${1} = -classpath ]]; then @@ -1910,6 +1914,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 +1927,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."