diff options
author | Petteri Räty <betelgeuse@gentoo.org> | 2007-05-06 09:47:36 +0000 |
---|---|---|
committer | Petteri Räty <betelgeuse@gentoo.org> | 2007-05-06 09:47:36 +0000 |
commit | d86c977e09aa50b3ca9cb0c2f551ef04e28833c3 (patch) | |
tree | 38fda8fbde37a8f6e0b13a01505fb785a364be9d /eclass/java-utils-2.eclass | |
parent | Remove old revision. (diff) | |
download | historical-d86c977e09aa50b3ca9cb0c2f551ef04e28833c3.tar.gz historical-d86c977e09aa50b3ca9cb0c2f551ef04e28833c3.tar.bz2 historical-d86c977e09aa50b3ca9cb0c2f551ef04e28833c3.zip |
Add ejunit
Diffstat (limited to 'eclass/java-utils-2.eclass')
-rw-r--r-- | eclass/java-utils-2.eclass | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/eclass/java-utils-2.eclass b/eclass/java-utils-2.eclass index c6f185ca445a..b4cadff77a1c 100644 --- a/eclass/java-utils-2.eclass +++ b/eclass/java-utils-2.eclass @@ -6,7 +6,7 @@ # # Licensed under the GNU General Public License, v2 # -# $Header: /var/cvsroot/gentoo-x86/eclass/java-utils-2.eclass,v 1.83 2007/05/04 17:20:08 caster Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/java-utils-2.eclass,v 1.84 2007/05/06 09:47:36 betelgeuse Exp $ # ----------------------------------------------------------------------------- @@ -1653,6 +1653,36 @@ java-pkg_ant-tasks-depend() { } # ------------------------------------------------------------------------------ +# @ebuild-function ejunit +# +# Junit wrapper function. Makes it easier to run the tests and checks for +# dev-java/junit in DEPEND. Launches the tests using junit.textui.TestRunner. +# +# Examples: +# ejunit -cp build/classes org.blinkenlights.jid3.test.AllTests +# ejunit org.blinkenlights.jid3.test.AllTests +# +# @param $1 - -cp or -classpath +# @param $2 - classpath, junit gets appended +# @param $@ - the rest of the parameters are passed to java +# ------------------------------------------------------------------------------ +ejunit() { + debug-print-function ${FUNCNAME} $* + + local cp + if [[ ${1} = -cp || ${1} = -classpath ]]; then + cp=${2}:$(java-pkg_getjars --build-only junit) + shift 2 + else + cp=$(java-pkg_getjars --build-only junit):. + fi + + local runner=junit.textui.TestRunner + debug-print "Calling: java -cp \"${cp}\" -Djava.awt.headless=true ${runner} ${@}" + java -cp "${cp}" -Djava.awt.headless=true ${runner} "${@}" || die "Running junit failed" +} + +# ------------------------------------------------------------------------------ # @section-end helper # ------------------------------------------------------------------------------ |