1 |
commit: 746ce7f1ccef68849f051ec6e3ed717c374b0074 |
2 |
Author: Miroslav Šulc <fordfrog <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Jul 4 13:53:43 2021 +0000 |
4 |
Commit: Miroslav Šulc <fordfrog <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Jul 4 13:54:19 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=746ce7f1 |
7 |
|
8 |
java-pkg-simple.eclass: added support for running only selected test classes |
9 |
|
10 |
Signed-off-by: Miroslav Šulc <fordfrog <AT> gentoo.org> |
11 |
|
12 |
eclass/java-pkg-simple.eclass | 53 +++++++++++++++++++++++++++---------------- |
13 |
1 file changed, 34 insertions(+), 19 deletions(-) |
14 |
|
15 |
diff --git a/eclass/java-pkg-simple.eclass b/eclass/java-pkg-simple.eclass |
16 |
index 174fa08ce4e..184934eb3bd 100644 |
17 |
--- a/eclass/java-pkg-simple.eclass |
18 |
+++ b/eclass/java-pkg-simple.eclass |
19 |
@@ -168,6 +168,17 @@ fi |
20 |
# JAVA_TESTING_FRAMEWORKS="junit pkgdiff" |
21 |
# @CODE |
22 |
|
23 |
+# @ECLASS-VARIABLE: JAVA_TEST_RUN_ONLY |
24 |
+# @DEFAULT_UNSET |
25 |
+# @DESCRIPTION: |
26 |
+# A array of classes that should be executed during src_test(). This variable |
27 |
+# has precedence over JAVA_TEST_EXCLUDES, that is if this variable is set, |
28 |
+# the other variable is ignored. |
29 |
+# |
30 |
+# @CODE |
31 |
+# JAVA_TEST_RUN_ONLY=( "net.sf.cglib.AllTests" "net.sf.cglib.TestAll" ) |
32 |
+# @CODE |
33 |
+ |
34 |
# @ECLASS-VARIABLE: JAVA_TEST_EXCLUDES |
35 |
# @DEFAULT_UNSET |
36 |
# @DESCRIPTION: |
37 |
@@ -517,25 +528,29 @@ java-pkg-simple_src_test() { |
38 |
fi |
39 |
|
40 |
# grab a set of tests that testing framework will run |
41 |
- tests_to_run=$(find "${classes}" -type f\ |
42 |
- \( -name "*Test.class"\ |
43 |
- -o -name "Test*.class"\ |
44 |
- -o -name "*Tests.class"\ |
45 |
- -o -name "*TestCase.class" \)\ |
46 |
- ! -name "*Abstract*"\ |
47 |
- ! -name "*BaseTest*"\ |
48 |
- ! -name "*TestTypes*"\ |
49 |
- ! -name "*TestUtils*"\ |
50 |
- ! -name "*\$*") |
51 |
- tests_to_run=${tests_to_run//"${classes}"\/} |
52 |
- tests_to_run=${tests_to_run//.class} |
53 |
- tests_to_run=${tests_to_run//\//.} |
54 |
- |
55 |
- # exclude extra test classes, usually corner cases |
56 |
- # that the code above cannot handle |
57 |
- for class in "${JAVA_TEST_EXCLUDES[@]}"; do |
58 |
- tests_to_run=${tests_to_run//${class}} |
59 |
- done |
60 |
+ if [[ -n ${JAVA_TEST_RUN_ONLY} ]]; then |
61 |
+ tests_to_run="${JAVA_TEST_RUN_ONLY[@]}" |
62 |
+ else |
63 |
+ tests_to_run=$(find "${classes}" -type f\ |
64 |
+ \( -name "*Test.class"\ |
65 |
+ -o -name "Test*.class"\ |
66 |
+ -o -name "*Tests.class"\ |
67 |
+ -o -name "*TestCase.class" \)\ |
68 |
+ ! -name "*Abstract*"\ |
69 |
+ ! -name "*BaseTest*"\ |
70 |
+ ! -name "*TestTypes*"\ |
71 |
+ ! -name "*TestUtils*"\ |
72 |
+ ! -name "*\$*") |
73 |
+ tests_to_run=${tests_to_run//"${classes}"\/} |
74 |
+ tests_to_run=${tests_to_run//.class} |
75 |
+ tests_to_run=${tests_to_run//\//.} |
76 |
+ |
77 |
+ # exclude extra test classes, usually corner cases |
78 |
+ # that the code above cannot handle |
79 |
+ for class in "${JAVA_TEST_EXCLUDES[@]}"; do |
80 |
+ tests_to_run=${tests_to_run//${class}} |
81 |
+ done |
82 |
+ fi |
83 |
|
84 |
# launch test |
85 |
for framework in ${JAVA_TESTING_FRAMEWORKS}; do |