Skip to content

Commit 54356b5

Browse files
Test suite refactoring
1 parent 6aa8aab commit 54356b5

File tree

107 files changed

+101
-45
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+101
-45
lines changed

README.md

Lines changed: 1 addition & 1 deletion

TestSuite/nbactions.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
1111
</goals>
1212
<properties>
13-
<exec.args>-classpath %classpath ${packageClassName} -loglevel INFO testsuite_server</exec.args>
13+
<exec.args>-classpath %classpath ${packageClassName} -loglevel INFO testsuite_server -connect localhost:4433</exec.args>
1414
<exec.executable>java</exec.executable>
1515
</properties>
1616
</action>
@@ -24,7 +24,7 @@
2424
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
2525
</goals>
2626
<properties>
27-
<exec.args>-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address} -classpath %classpath ${packageClassName} -loglevel INFO testsuite_server</exec.args>
27+
<exec.args>-Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address} -classpath %classpath ${packageClassName} -loglevel INFO testsuite_server -connect localhost:4433</exec.args>
2828
<exec.executable>java</exec.executable>
2929
<jpda.listen>true</jpda.listen>
3030
</properties>
@@ -39,7 +39,7 @@
3939
<goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
4040
</goals>
4141
<properties>
42-
<exec.args>-classpath %classpath ${packageClassName} -loglevel INFO testsuite_server</exec.args>
42+
<exec.args>-classpath %classpath ${packageClassName} -loglevel INFO testsuite_server -connect localhost:4433</exec.args>
4343
<exec.executable>java</exec.executable>
4444
</properties>
4545
</action>

TestSuite/src/main/java/de/rub/nds/tlsattacker/testsuite/impl/ServerTestSuite.java

Lines changed: 43 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import de.rub.nds.tlsattacker.tls.workflow.WorkflowExecutor;
2323
import de.rub.nds.tlsattacker.transport.TransportHandler;
2424
import java.io.File;
25+
import java.io.FileFilter;
2526
import java.io.FilenameFilter;
2627
import java.util.LinkedList;
2728
import java.util.List;
@@ -50,30 +51,46 @@ public boolean startTests() {
5051
configHandler = ConfigHandlerFactory.createConfigHandler("client");
5152
configHandler.initialize(generalConfig);
5253

53-
int successfulTests = 0;
54+
List<String> successfulTests = new LinkedList<>();
55+
List<String> failedTests = new LinkedList<>();
5456

5557
File folder = new File(testConfig.getFolder());
56-
File[] tests = folder.listFiles();
57-
for (File testFolder : tests) {
58-
LOGGER.log(LogLevel.CONSOLE_OUTPUT, "Test Suite {} (one of these has to be succesful)",
59-
testFolder.getName());
60-
File[] testCases = testFolder.listFiles();
61-
boolean successfulTest = false;
62-
for (File testCase : testCases) {
63-
if (testCase.isDirectory()) {
64-
LOGGER.log(LogLevel.CONSOLE_OUTPUT, " Running {}", testCase.getName());
58+
File[] testsuites = folder.listFiles(new DirectoryFilter());
59+
for (File testsuite : testsuites) {
60+
LOGGER.log(LogLevel.CONSOLE_OUTPUT, "Starting {} Test Suite", testsuite.getName());
61+
File[] tests = testsuite.listFiles(new DirectoryFilter());
62+
for (File test : tests) {
63+
LOGGER.info("Testing {} (one of these has to be succesful)", test.getName());
64+
File[] testCases = test.listFiles(new DirectoryFilter());
65+
boolean successfulTest = false;
66+
for (File testCase : testCases) {
67+
LOGGER.info(" Running {}", testCase.getName());
6568
if (startTestCase(testCase)) {
6669
// one of our test cases was successful
6770
successfulTest = true;
6871
}
6972
}
73+
if (successfulTest) {
74+
LOGGER.log(LogLevel.CONSOLE_OUTPUT, "{} SUCCESSFUL ", test.getName());
75+
successfulTests.add(test.getName());
76+
} else {
77+
LOGGER.log(LogLevel.CONSOLE_OUTPUT, "{} FAILED ", test.getName());
78+
failedTests.add(test.getName());
79+
}
7080
}
71-
if (successfulTest) {
72-
successfulTests++;
73-
}
7481
}
82+
LOGGER.log(LogLevel.CONSOLE_OUTPUT, "Summary of successful tests");
83+
for (String s : successfulTests) {
84+
LOGGER.log(LogLevel.CONSOLE_OUTPUT, " {}", s);
85+
}
86+
LOGGER.log(LogLevel.CONSOLE_OUTPUT, "Summary of failed tests");
87+
for (String s : failedTests) {
88+
LOGGER.log(LogLevel.CONSOLE_OUTPUT, " {}", s);
89+
}
90+
LOGGER.log(LogLevel.CONSOLE_OUTPUT, "Successful tests: {}", successfulTests.size());
91+
LOGGER.log(LogLevel.CONSOLE_OUTPUT, "Failed tests: {}", failedTests.size());
7592

76-
return (successfulTests > 0);
93+
return (failedTests.isEmpty());
7794
}
7895

7996
private boolean startTestCase(File testFolder) {
@@ -96,7 +113,7 @@ public boolean accept(File dir, String name) {
96113
workflowExecutor.executeWorkflow();
97114
transportHandler.closeConnection();
98115
if (TlsContextAnalyzer.containsFullWorkflow(tlsContext)) {
99-
LOGGER.log(LogLevel.CONSOLE_OUTPUT, " {} passed", xmlFile.getName());
116+
LOGGER.info(" {} passed", xmlFile.getName());
100117
List<ModifiableVariableField> mvfs = ModifiableVariableAnalyzer
101118
.getAllModifiableVariableFieldsRecursively(tlsContext.getWorkflowTrace());
102119
for (ModifiableVariableField mvf : mvfs) {
@@ -113,12 +130,12 @@ public boolean accept(File dir, String name) {
113130
}
114131
}
115132
} else {
116-
LOGGER.log(LogLevel.CONSOLE_OUTPUT, " {} failed", xmlFile.getName());
133+
LOGGER.info(" {} failed", xmlFile.getName());
117134
succesful = false;
118135
}
119136
} catch (WorkflowExecutionException | ConfigurationException | IllegalArgumentException
120137
| IllegalAccessException ex) {
121-
LOGGER.log(LogLevel.CONSOLE_OUTPUT, " {} failed", xmlFile.getName());
138+
LOGGER.info(" {} failed", xmlFile.getName());
122139
LOGGER.info(ex);
123140
succesful = false;
124141
}
@@ -127,4 +144,13 @@ public boolean accept(File dir, String name) {
127144
return succesful;
128145
}
129146

147+
class DirectoryFilter implements FileFilter {
148+
149+
@Override
150+
public boolean accept(File f) {
151+
return f.isDirectory();
152+
}
153+
154+
};
155+
130156
}
Lines changed: 2 additions & 0 deletions

resources/testsuite/TLS_DHE_DSS_WITH_AES_128_CBC_SHA256/README.md renamed to resources/testsuite/CiphersuiteCompatibility/TLS_DHE_DSS_WITH_AES_128_CBC_SHA256/README.md

resources/testsuite/TLS_DHE_DSS_WITH_AES_128_CBC_SHA256/supported/TLS10.xml renamed to resources/testsuite/CiphersuiteCompatibility/TLS_DHE_DSS_WITH_AES_128_CBC_SHA256/supported/TLS10.xml

File renamed without changes.

resources/testsuite/TLS_DHE_DSS_WITH_AES_128_CBC_SHA256/supported/TLS11.xml renamed to resources/testsuite/CiphersuiteCompatibility/TLS_DHE_DSS_WITH_AES_128_CBC_SHA256/supported/TLS11.xml

File renamed without changes.

resources/testsuite/TLS_DHE_DSS_WITH_AES_128_CBC_SHA256/supported/TLS12.xml renamed to resources/testsuite/CiphersuiteCompatibility/TLS_DHE_DSS_WITH_AES_128_CBC_SHA256/supported/TLS12.xml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,15 @@
1717
<Certificate>
1818
<messageIssuer>SERVER</messageIssuer>
1919
</Certificate>
20+
<DHEServerKeyExchange>
21+
<messageIssuer>SERVER</messageIssuer>
22+
</DHEServerKeyExchange>
2023
<ServerHelloDone>
2124
<messageIssuer>SERVER</messageIssuer>
2225
</ServerHelloDone>
23-
<RSAClientKeyExchange>
26+
<DHClientKeyExchange>
2427
<messageIssuer>CLIENT</messageIssuer>
25-
</RSAClientKeyExchange>
28+
</DHClientKeyExchange>
2629
<ChangeCipherSpec>
2730
<messageIssuer>CLIENT</messageIssuer>
2831
</ChangeCipherSpec>

resources/testsuite/TLS_DHE_DSS_WITH_AES_128_CBC_SHA256/unsupported/TLS10.xml renamed to resources/testsuite/CiphersuiteCompatibility/TLS_DHE_DSS_WITH_AES_128_CBC_SHA256/unsupported/TLS10.xml

File renamed without changes.

resources/testsuite/TLS_DHE_DSS_WITH_AES_128_CBC_SHA256/unsupported/TLS11.xml renamed to resources/testsuite/CiphersuiteCompatibility/TLS_DHE_DSS_WITH_AES_128_CBC_SHA256/unsupported/TLS11.xml

File renamed without changes.

0 commit comments

Comments
 (0)