Skip to content

Commit

Permalink
Make runtime-testsuite tests run in parallel
Browse files Browse the repository at this point in the history
  • Loading branch information
jcking committed Dec 20, 2021
1 parent ed31d62 commit cc65c15
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: 2.1
jobs:
test_tool_and_runtime_java:
docker:
- image: cimg/openjdk:8.0
- image: cimg/openjdk:11.0.13
steps:
- checkout
- run:
Expand Down Expand Up @@ -32,7 +32,7 @@ jobs:
type: string
default: java
docker:
- image: cimg/openjdk:8.0
- image: cimg/openjdk:11.0.13
environment:
TARGET: << parameters.target >>
GROUP: << parameters.test-group >>
Expand Down
3 changes: 3 additions & 0 deletions runtime-testsuite/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@
<include>**/dart/Test*.java</include>
<include>${antlr.tests.swift}</include>
</includes>
<parallel>all</parallel>
<useUnlimitedThreads>true</useUnlimitedThreads>
<forkCount>0</forkCount>
</configuration>
</plugin>
<plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ public boolean buildProject() {
return true;
}

private synchronized boolean initializeRuntime() {
private static synchronized boolean initializeRuntime() {
// Compile runtime project once per tests session
if (isRuntimeInitialized)
return true;
Expand Down Expand Up @@ -247,7 +247,7 @@ private synchronized boolean initializeRuntime() {
}
cSharpTestProjectContent = out.toString().replace(cSharpAntlrRuntimeDllName, Paths.get(cSharpCachingDirectory, cSharpAntlrRuntimeDllName).toString());

success = runProcess(args, cSharpCachingDirectory);
success = initializeRuntimeAt(args, cSharpCachingDirectory);
} catch (Exception e) {
e.printStackTrace(System.err);
return false;
Expand All @@ -261,6 +261,27 @@ private static String getConfig() {
return isDebug ? "Debug" : "Release";
}

private static boolean initializeRuntimeAt(String[] args, String path) throws Exception {
ProcessBuilder pb = new ProcessBuilder(args);
pb.directory(new File(path));
Process process = pb.start();
StreamVacuum stdoutVacuum = new StreamVacuum(process.getInputStream());
StreamVacuum stderrVacuum = new StreamVacuum(process.getErrorStream());
stdoutVacuum.start();
stderrVacuum.start();
process.waitFor();
stdoutVacuum.join();
stderrVacuum.join();
int exitValue = process.exitValue();
boolean success = (exitValue == 0);
if (!success) {
System.err.println("runProcess command: " + Utils.join(args, " "));
System.err.println("runProcess exitValue: " + exitValue);
System.err.println("runProcess stdoutVacuum: " + stdoutVacuum.toString());
}
return success;
}

private boolean runProcess(String[] args, String path) throws Exception {
return runProcess(args, path, 0);
}
Expand Down

0 comments on commit cc65c15

Please sign in to comment.