Skip to content

Commit d74690d

Browse files
committed
Enabled wildfly
1 parent ba246f3 commit d74690d

2 files changed

Lines changed: 50 additions & 108 deletions

File tree

.github/workflows/test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
distribution: 'temurin'
4444
java-version: ${{ matrix.jdkver}}
4545
- name: Run
46-
run: BLACKLIST="wildfly-openssl.*" JNI_FAIL=true RFAT_RERUNS=2 bash ./run.sh "${JAVA_HOME}"
46+
run: JNI_FAIL=true RFAT_RERUNS=2 bash ./run.sh "${JAVA_HOME}"
4747
- name: Upload results
4848
if: ${{ always() }}
4949
uses: actions/upload-artifact@v4

jni/wildfly-openssl.sh

Lines changed: 49 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -1,131 +1,73 @@
1+
#!/bin/bash
2+
13
set -exo pipefail
24
MVOPTS="--batch-mode"
35
if [ "x$EX_MVN" == "x" ] ; then
46
EX_MVN=mvn
57
fi
68

9+
DISABLE_testNoExplicitEnabledProtocols="true"
10+
DISABLE_testMultipleEnabledProtocolsWithClientProtocolWithinEnabledRange="true"
11+
DISABLE_testCipherSuiteConverter="true"
12+
DISABLE_testAvailableProtocolsWithTLS13CipherSuites="true"
13+
14+
function addIgnoreImport() {
15+
if ! grep -e "import org.junit.Ignore" "${1}" ; then #do not create duplicated imports
16+
sed "s/import org.junit.Test;/import org.junit.Test;import org.junit.Ignore;/" -i "${1}"
17+
fi
18+
}
19+
20+
ignoredTests=0
21+
function ignoreMethod() {
22+
local file=$(find -type f | grep "${2}.java$")
23+
grep -e "${1}[(]" "${file}" #check
24+
# do not inject ignore import if nothing will be sed
25+
addIgnoreImport "${file}"
26+
sed "s/${1}[(]/@Ignore ${1}(/g" -i "${file}"
27+
grep -e "@Ignore ${1}[(]" "${file}" #check
28+
let ignoredTests=$ignoredTests+1
29+
}
30+
31+
732
# for generating patches
833
#GIT=git
934
GIT=echo
1035

36+
VERSION=2.2.5.Final
1137
rm -rf wildfly-openssl
1238
mkdir wildfly-openssl
1339
pushd wildfly-openssl
14-
wget https://github.com/wildfly-security/wildfly-openssl/archive/1.1.1.Final.tar.gz
15-
tar -xf 1.1.1.Final.tar.gz
40+
wget https://github.com/wildfly-security/wildfly-openssl/archive/refs/tags/${VERSION}.tar.gz
41+
tar -xf ${VERSION}.tar.gz
1642
# generally the testsuite is poorly designed. see SSLTestUtils.java
1743
# it reuses still same port, and do not release it in finally clausule,
1844
# so although it uses setReuseAddress, any first fail will kill all subsequent tests
1945
# as the port seems to survive junit's vm
20-
pushd wildfly-openssl-1.1.1.Final
46+
pushd wildfly-openssl-${VERSION}
2147
$GIT init
2248
$GIT add *
2349
$GIT commit . -m "initial commit"
24-
f=`find -type f | grep BasicOpenSSLEngineTest.java$`
25-
sed "s/import org.junit.Test;/import org.junit.Test;import org.junit.Ignore;/" -i $f
26-
# this test fails with different crypto policies
27-
sed "s/public void testNoExplicitEnabledProtocols/@Ignore public void testNoExplicitEnabledProtocols/g" -i $f
28-
if [ "x$OTOOL_OS_VERSION" = "x7" -a "x$OTOOL_OS_NAME" = "xel" ] ; then
29-
# tls v 1.0 is being removed
30-
sed "s/public void testMultipleEnabledProtocolsWithClientProtocolWithinEnabledRange/@Ignore public void testMultipleEnabledProtocolsWithClientProtocolWithinEnabledRange/g" -i $f
50+
if [ "$DISABLE_testNoExplicitEnabledProtocols" = "true" ] ; then
51+
# this test fails with different crypto policies
52+
ignoreMethod "public void testNoExplicitEnabledProtocols" "BasicOpenSSLEngineTest"
53+
fi
54+
if [ "$DISABLE_testMultipleEnabledProtocolsWithClientProtocolWithinEnabledRange" = "true" ] ; then
55+
# tls v 1.0 is being removed
56+
ignoreMethod "public void testMultipleEnabledProtocolsWithClientProtocolWithinEnabledRange" "BasicOpenSSLEngineLegacyProtocolsTest"
57+
fi
58+
if [ "$DISABLE_testCipherSuiteConverter" = "true" ] ; then
59+
# this test fails with different crypto policies and there is no JNI at all. However to find wy it fials is interesting TODO.
60+
ignoreMethod "public void testCipherSuiteConverter" "SslCiphersTest"
61+
fi
62+
if [ "$DISABLE_testAvailableProtocolsWithTLS13CipherSuites" = "true" ] ; then
63+
# tls 1.3
64+
ignoreMethod "public void testAvailableProtocolsWithTLS13CipherSuites" "SslCiphersTest"
65+
fi
66+
if [ $ignoredTests -gt 0 ] ; then
67+
$GIT commit . -m "disbaled $ignoredTests tests"
68+
else
69+
echo "No test ignored"
3170
fi
32-
f=`find -type f | grep SslCiphersTest.java$`
33-
sed "s/import org.junit.Test;/import org.junit.Test;import org.junit.Ignore;/" -i $f
34-
# this test fails with different crypto policies and there is no JNI at all. However to find wy it fials is interesting TODO.
35-
sed "s/public void testCipherSuiteConverter/@Ignore public void testCipherSuiteConverter/g" -i $f
36-
patch -p1 <<EOF
37-
--- a/java/src/test/java/org/wildfly/openssl/SSLTestUtils.java
38-
+++ a/java/src/test/java/org/wildfly/openssl/SSLTestUtils.java
39-
@@ -41,8 +41,8 @@
40-
public class SSLTestUtils {
41-
42-
public static final String HOST = System.getProperty("org.wildfly.openssl.test.host", "localhost");
43-
- public static final int PORT = Integer.parseInt(System.getProperty("org.wildfly.openssl.test.port", "7677"));
44-
- public static final int SECONDARY_PORT = Integer.parseInt(System.getProperty("org.wildfly.openssl.test.secondary.port", "7687"));
45-
+ public static final int PORT = Integer.parseInt(System.getProperty("org.wildfly.openssl.test.port", ""+findFreePort()));
46-
+ public static final int SECONDARY_PORT = Integer.parseInt(System.getProperty("org.wildfly.openssl.test.secondary.port", ""+findFreePort()));
47-
48-
private static KeyStore loadKeyStore(final String name) throws IOException {
49-
final InputStream stream = BasicOpenSSLEngineTest.class.getClassLoader().getResourceAsStream(name);
50-
@@ -165,6 +165,17 @@
51-
return out.toByteArray();
52-
}
53-
54-
+ public static int findFreePort() {
55-
+ try (ServerSocket socket = new ServerSocket(0)) {
56-
+ int i = socket.getLocalPort();
57-
+ socket.close();
58-
+ Thread.sleep(1000);
59-
+ return i;
60-
+ } catch (Exception e) {
61-
+ }
62-
+ return -1;
63-
+ }
64-
+
65-
public static ServerSocket createServerSocket() throws IOException {
66-
return createServerSocket(PORT);
67-
}
68-
EOF
69-
$GIT commit . -m "excluded some tests"
70-
patch -p1 <<EOF
71-
diff --git a/java/src/test/java/org/wildfly/openssl/AbstractOpenSSLTest.java b/java/src/test/java/org/wildfly/openssl/AbstractOpenSSLTest.java
72-
index 56d2357..f67442a 100644
73-
--- a/java/src/test/java/org/wildfly/openssl/AbstractOpenSSLTest.java
74-
+++ b/java/src/test/java/org/wildfly/openssl/AbstractOpenSSLTest.java
75-
@@ -18,6 +18,7 @@
76-
package org.wildfly.openssl;
77-
78-
import org.junit.BeforeClass;
79-
+import org.junit.Before;
80-
81-
/**
82-
* @author Stuart Douglas
83-
@@ -26,6 +27,12 @@ public class AbstractOpenSSLTest {
84-
85-
private static boolean first = true;
86-
87-
+ @Before
88-
+ public void reinitPorts(){
89-
+ SSLTestUtils.resetPort();
90-
+ SSLTestUtils.resetSecondaryPort();
91-
+ }
92-
+
93-
@BeforeClass
94-
public static void setup() {
95-
if(first) {
96-
diff --git a/java/src/test/java/org/wildfly/openssl/SSLTestUtils.java b/java/src/test/java/org/wildfly/openssl/SSLTestUtils.java
97-
index f7a4261..8c4aa3d 100644
98-
--- a/java/src/test/java/org/wildfly/openssl/SSLTestUtils.java
99-
+++ b/java/src/test/java/org/wildfly/openssl/SSLTestUtils.java
100-
@@ -41,8 +41,24 @@ import javax.net.ssl.TrustManagerFactory;
101-
public class SSLTestUtils {
102-
103-
public static final String HOST = System.getProperty("org.wildfly.openssl.test.host", "localhost");
104-
- public static final int PORT = Integer.parseInt(System.getProperty("org.wildfly.openssl.test.port", ""+findFreePort()));
105-
- public static final int SECONDARY_PORT = Integer.parseInt(System.getProperty("org.wildfly.openssl.test.secondary.port", ""+findFreePort()));
106-
+ public static int PORT = initPort();
107-
+ public static int SECONDARY_PORT = initSecondaryPort();
108-
+
109-
+ private static int initPort() {
110-
+ return Integer.parseInt(System.getProperty("org.wildfly.openssl.test.port", ""+findFreePort()));
111-
+ }
112-
+
113-
+ private static int initSecondaryPort() {
114-
+ return Integer.parseInt(System.getProperty("org.wildfly.openssl.test.secondary.port", ""+findFreePort()));
115-
+ }
116-
+
117-
+ public static void resetPort(){
118-
+ PORT=initPort();
119-
+ }
120-
+
121-
+ public static void resetSecondaryPort(){
122-
+ SECONDARY_PORT=initSecondaryPort();
123-
+ }
124-
125-
private static KeyStore loadKeyStore(final String name) throws IOException {
126-
final InputStream stream = BasicOpenSSLEngineTest.class.getClassLoader().getResourceAsStream(name);
127-
EOF
128-
$GIT commit . -m "make port random/free for each method"
12971
# it is better to set the libssl and libcrypto on our own
13072
# the wildfly-openssl search is just tragic, and the excception throwns out of it are very missleading
13173
# eg "not found ssl library" may be thrown from findCryptoLibray (where findSSL have passed fine)

0 commit comments

Comments
 (0)