dev-java/felix-gogo-runtime: enabled tests for all java versions

Signed-off-by: Miroslav Šulc <fordfrog@gentoo.org>
This commit is contained in:
Miroslav Šulc
2023-12-01 11:02:17 +01:00
parent 60cdbd1189
commit eabdf0892f
2 changed files with 26 additions and 13 deletions

View File

@@ -37,6 +37,8 @@ RDEPEND="${CP_DEPEND}
BDEPEND="verify-sig? ( sec-keys/openpgp-keys-apache-felix )"
VERIFY_SIG_OPENPGP_KEY_PATH="${BROOT}/usr/share/openpgp-keys/felix.apache.org.asc"
PATCHES=( "${FILESDIR}/${P}-skip-tests-non-java-8.patch" )
JAVA_SRC_DIR="src/main/java"
JAVA_TEST_EXCLUDES=(
#Invalid test class No runnable methods
@@ -48,17 +50,6 @@ JAVA_TEST_GENTOO_CLASSPATH="
"
JAVA_TEST_SRC_DIR="src/test/java"
src_test() {
local vm_version="$(java-config -g PROVIDES_VERSION)"
if ver_test "${vm_version}" -lt 11; then
java-pkg-simple_src_test
else
# There was 1 failure:
# 1) testPipe(org.apache.felix.gogo.runtime.TestParser)
# org.junit.ComparisonFailure: expected:<[def]> but was:<[]>
# at org.junit.Assert.assertEquals(Assert.java:117)
# at org.junit.Assert.assertEquals(Assert.java:146)
# at org.apache.felix.gogo.runtime.TestParser.testPipe(TestParser.java:152)
einfo "Tests would fail with Java 11 or higher"
fi
src_prepare() {
default
}

View File

@@ -0,0 +1,22 @@
skip tests that fail with java > 1.8 if java > 1.8 is used
we compare here just that the first part of the version is 1
which is true only for version 1.8, other versions have first number
like 11, 17, 21 and those fail the condition hence the remaining tests
are skipped
we cannot use System.version() here as this is available only since java 9
--- a/src/test/java/org/apache/felix/gogo/runtime/TestParser.java
+++ b/src/test/java/org/apache/felix/gogo/runtime/TestParser.java
@@ -149,9 +149,10 @@ public class TestParser extends AbstractParserTest
assertEquals("def", c.execute("echo def|grep d.*|capture"));
assertEquals("def", c.execute("echoout def|grep d.*|capture"));
assertEquals("def", c.execute("myecho def|grep d.*|capture"));
- assertEquals("def", c.execute("(echoout abc; echoout def; echoout ghi)|grep d.*|capture"));
assertEquals("", c.execute("echoout def; echoout ghi | grep d.* | capture"));
assertEquals("hello world", c.execute("echo hello world|capture"));
+ org.junit.Assume.assumeTrue("1".equals(System.getProperty("java.version").split("\\.")[0]));
+ assertEquals("def", c.execute("(echoout abc; echoout def; echoout ghi)|grep d.*|capture"));
assertEquals("defghi", c.execute("(echoout abc; echoout def; echoout ghi)|grep 'def|ghi'|capture"));
}