diff options
author | V3n3RiX <venerix@redcorelinux.org> | 2020-09-02 14:09:07 +0100 |
---|---|---|
committer | V3n3RiX <venerix@redcorelinux.org> | 2020-09-02 14:09:07 +0100 |
commit | b17a3ef12038de50228bade1f05502c74e135321 (patch) | |
tree | 9026dffec53f92cba48ca9a500a4f778e6304380 /eclass/java-utils-2.eclass | |
parent | 3cf7c3ef441822c889356fd1812ebf2944a59851 (diff) |
gentoo resync : 02.09.2020
Diffstat (limited to 'eclass/java-utils-2.eclass')
-rw-r--r-- | eclass/java-utils-2.eclass | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/eclass/java-utils-2.eclass b/eclass/java-utils-2.eclass index 29f13e031f48..a33962f114de 100644 --- a/eclass/java-utils-2.eclass +++ b/eclass/java-utils-2.eclass @@ -1861,6 +1861,44 @@ ejunit4() { ejunit_ "junit-4" "${@}" } +# @FUNCTION: etestng +# @USAGE: etestng_ [-cp $classpath] <test classes> +# @INTERNAL +# @DESCRIPTION: +# Testng wrapper function. Makes it easier to run the tests. +# Launches the tests using org.testng.TestNG. +# +# @CODE +# $1 - -cp or -classpath +# $2 - the classpath passed to it +# $@ - test classes for testng to run. +# @CODE +etestng() { + debug-print-function ${FUNCNAME} $* + + local runner=org.testng.TestNG + local cp=$(java-pkg_getjars --with-dependencies testng) + local tests + + if [[ ${1} = -cp || ${1} = -classpath ]]; then + cp="${cp}:${2}" + shift 2 + else + cp="${cp}:." + fi + + for test in ${@}; do + tests+="${test}," + done + + debug-print "java -cp \"${cp}\" -Djava.io.tmpdir=\"${T}\""\ + "-Djava.awt.headless=true ${runner}"\ + "-usedefaultlisteners false -testclass ${tests}" + java -cp "${cp}" -Djava.io.tmpdir=\"${T}\" -Djava.awt.headless=true\ + ${runner} -usedefaultlisteners false -testclass ${tests}\ + || die "Running TestNG failed." +} + # @FUNCTION: java-utils-2_src_prepare # @DESCRIPTION: # src_prepare Searches for bundled jars |