summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiroslav Šulc <fordfrog@gentoo.org>2021-07-04 15:53:43 +0200
committerMiroslav Šulc <fordfrog@gentoo.org>2021-07-04 15:54:19 +0200
commit746ce7f1ccef68849f051ec6e3ed717c374b0074 (patch)
tree0430709ddd1a0ceac561202a0ed330abc89be0ee /eclass/java-pkg-simple.eclass
parentapp-emacs/helm: Remove old (diff)
downloadgentoo-746ce7f1ccef68849f051ec6e3ed717c374b0074.tar.gz
gentoo-746ce7f1ccef68849f051ec6e3ed717c374b0074.tar.bz2
gentoo-746ce7f1ccef68849f051ec6e3ed717c374b0074.zip
java-pkg-simple.eclass: added support for running only selected test classes
Signed-off-by: Miroslav Šulc <fordfrog@gentoo.org>
Diffstat (limited to 'eclass/java-pkg-simple.eclass')
-rw-r--r--eclass/java-pkg-simple.eclass53
1 files changed, 34 insertions, 19 deletions
diff --git a/eclass/java-pkg-simple.eclass b/eclass/java-pkg-simple.eclass
index 174fa08ce4ea..184934eb3bd3 100644
--- a/eclass/java-pkg-simple.eclass
+++ b/eclass/java-pkg-simple.eclass
@@ -168,6 +168,17 @@ fi
# JAVA_TESTING_FRAMEWORKS="junit pkgdiff"
# @CODE
+# @ECLASS-VARIABLE: JAVA_TEST_RUN_ONLY
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# A array of classes that should be executed during src_test(). This variable
+# has precedence over JAVA_TEST_EXCLUDES, that is if this variable is set,
+# the other variable is ignored.
+#
+# @CODE
+# JAVA_TEST_RUN_ONLY=( "net.sf.cglib.AllTests" "net.sf.cglib.TestAll" )
+# @CODE
+
# @ECLASS-VARIABLE: JAVA_TEST_EXCLUDES
# @DEFAULT_UNSET
# @DESCRIPTION:
@@ -517,25 +528,29 @@ java-pkg-simple_src_test() {
fi
# grab a set of tests that testing framework will run
- tests_to_run=$(find "${classes}" -type f\
- \( -name "*Test.class"\
- -o -name "Test*.class"\
- -o -name "*Tests.class"\
- -o -name "*TestCase.class" \)\
- ! -name "*Abstract*"\
- ! -name "*BaseTest*"\
- ! -name "*TestTypes*"\
- ! -name "*TestUtils*"\
- ! -name "*\$*")
- tests_to_run=${tests_to_run//"${classes}"\/}
- tests_to_run=${tests_to_run//.class}
- tests_to_run=${tests_to_run//\//.}
-
- # exclude extra test classes, usually corner cases
- # that the code above cannot handle
- for class in "${JAVA_TEST_EXCLUDES[@]}"; do
- tests_to_run=${tests_to_run//${class}}
- done
+ if [[ -n ${JAVA_TEST_RUN_ONLY} ]]; then
+ tests_to_run="${JAVA_TEST_RUN_ONLY[@]}"
+ else
+ tests_to_run=$(find "${classes}" -type f\
+ \( -name "*Test.class"\
+ -o -name "Test*.class"\
+ -o -name "*Tests.class"\
+ -o -name "*TestCase.class" \)\
+ ! -name "*Abstract*"\
+ ! -name "*BaseTest*"\
+ ! -name "*TestTypes*"\
+ ! -name "*TestUtils*"\
+ ! -name "*\$*")
+ tests_to_run=${tests_to_run//"${classes}"\/}
+ tests_to_run=${tests_to_run//.class}
+ tests_to_run=${tests_to_run//\//.}
+
+ # exclude extra test classes, usually corner cases
+ # that the code above cannot handle
+ for class in "${JAVA_TEST_EXCLUDES[@]}"; do
+ tests_to_run=${tests_to_run//${class}}
+ done
+ fi
# launch test
for framework in ${JAVA_TESTING_FRAMEWORKS}; do