Gentoo Archives: gentoo-dev

From: "Volkmar W. Pogatzki" <gentoo@××××××××.net>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] [PATCH] java-pkg-simple.eclass: improve test selection for multi-jar packages
Date: Tue, 27 Sep 2022 11:49:42
Message-Id: 20220927114924.32679-1-gentoo@pogatzki.net
1 Testing multi-jar packages was not properly supported.
2 With this change the tests_to_run are selected per module.
3
4 Signed-off-by: Volkmar W. Pogatzki <gentoo@××××××××.net>
5 ---
6 eclass/java-pkg-simple.eclass | 28 +++++++++++++++-------------
7 1 file changed, 15 insertions(+), 13 deletions(-)
8
9 diff --git a/eclass/java-pkg-simple.eclass b/eclass/java-pkg-simple.eclass
10 index 6e38a07f66e..7a9582393dd 100644
11 --- a/eclass/java-pkg-simple.eclass
12 +++ b/eclass/java-pkg-simple.eclass
13 @@ -545,19 +545,21 @@ java-pkg-simple_src_test() {
14 if [[ -n ${JAVA_TEST_RUN_ONLY} ]]; then
15 tests_to_run="${JAVA_TEST_RUN_ONLY[@]}"
16 else
17 - tests_to_run=$(find "${classes}" -type f\
18 - \( -name "*Test.class"\
19 - -o -name "Test*.class"\
20 - -o -name "*Tests.class"\
21 - -o -name "*TestCase.class" \)\
22 - ! -name "*Abstract*"\
23 - ! -name "*BaseTest*"\
24 - ! -name "*TestTypes*"\
25 - ! -name "*TestUtils*"\
26 - ! -name "*\$*")
27 - tests_to_run=${tests_to_run//"${classes}"\/}
28 - tests_to_run=${tests_to_run//.class}
29 - tests_to_run=${tests_to_run//\//.}
30 + pushd "${JAVA_TEST_SRC_DIR}" > /dev/null || die
31 + tests_to_run=$(find * -type f\
32 + \( -name "*Test.java"\
33 + -o -name "Test*.java"\
34 + -o -name "*Tests.java"\
35 + -o -name "*TestCase.java" \)\
36 + ! -name "*Abstract*"\
37 + ! -name "*BaseTest*"\
38 + ! -name "*TestTypes*"\
39 + ! -name "*TestUtils*"\
40 + ! -name "*\$*")
41 + tests_to_run=${tests_to_run//"${classes}"\/}
42 + tests_to_run=${tests_to_run//.java}
43 + tests_to_run=${tests_to_run//\//.}
44 + popd > /dev/null || die
45
46 # exclude extra test classes, usually corner cases
47 # that the code above cannot handle
48 --
49 2.35.1