mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
pass repeat count to fork vms
This commit is contained in:
+11
-7
@@ -43,7 +43,8 @@ public abstract class ForkedByModuleSplitter {
|
||||
|
||||
public int startSplitting(String[] args,
|
||||
String configName,
|
||||
String commandLinePath) throws Exception {
|
||||
String commandLinePath,
|
||||
String repeatCount) throws Exception {
|
||||
args = myForkedDebuggerHelper.excludeDebugPortFromArgs(args);
|
||||
|
||||
myVMParameters = new ArrayList();
|
||||
@@ -60,14 +61,14 @@ public abstract class ForkedByModuleSplitter {
|
||||
}
|
||||
|
||||
long time = System.currentTimeMillis();
|
||||
int result = startSplitting(args, configName);
|
||||
int result = startSplitting(args, configName, repeatCount);
|
||||
myForkedDebuggerHelper.closeDebugSocket();
|
||||
sendTime(time);
|
||||
return result;
|
||||
}
|
||||
|
||||
//read output from wrappers
|
||||
protected int startChildFork(List args, File workingDir, String classpath) throws IOException, InterruptedException {
|
||||
protected int startChildFork(List args, File workingDir, String classpath, String repeatCount) throws IOException, InterruptedException {
|
||||
List vmParameters = new ArrayList(myVMParameters);
|
||||
|
||||
myForkedDebuggerHelper.setupDebugger(vmParameters);
|
||||
@@ -94,6 +95,9 @@ public abstract class ForkedByModuleSplitter {
|
||||
builder.add(getStarterName());
|
||||
builder.add(testOutputPath);
|
||||
builder.add(args);
|
||||
if (repeatCount != null) {
|
||||
builder.add(repeatCount);
|
||||
}
|
||||
builder.setWorkingDir(workingDir);
|
||||
|
||||
final Process exec = builder.createProcess();
|
||||
@@ -103,7 +107,7 @@ public abstract class ForkedByModuleSplitter {
|
||||
}
|
||||
|
||||
//read file with classes grouped by module
|
||||
protected int splitPerModule() throws IOException {
|
||||
protected int splitPerModule(String repeatCount) throws IOException {
|
||||
int result = 0;
|
||||
final BufferedReader perDirReader = new BufferedReader(new FileReader(myWorkingDirsPath));
|
||||
try {
|
||||
@@ -126,7 +130,7 @@ public abstract class ForkedByModuleSplitter {
|
||||
classNames.add(className);
|
||||
}
|
||||
|
||||
final int childResult = startPerModuleFork(moduleName, classNames, packageName, workingDir, classpath, result);
|
||||
final int childResult = startPerModuleFork(moduleName, classNames, packageName, workingDir, classpath, repeatCount, result);
|
||||
result = Math.min(childResult, result);
|
||||
}
|
||||
catch (Exception e) {
|
||||
@@ -140,14 +144,14 @@ public abstract class ForkedByModuleSplitter {
|
||||
return result;
|
||||
}
|
||||
|
||||
protected abstract int startSplitting(String[] args, String configName) throws Exception;
|
||||
protected abstract int startSplitting(String[] args, String configName, String repeatCount) throws Exception;
|
||||
|
||||
protected abstract int startPerModuleFork(String moduleName,
|
||||
List classNames,
|
||||
String packageName,
|
||||
String workingDir,
|
||||
String classpath,
|
||||
int result) throws Exception;
|
||||
String repeatCount, int result) throws Exception;
|
||||
|
||||
protected abstract String getStarterName();
|
||||
|
||||
|
||||
+10
-10
@@ -31,7 +31,8 @@ public abstract class ForkedSplitter extends ForkedByModuleSplitter {
|
||||
}
|
||||
|
||||
protected int startSplitting(String[] args,
|
||||
String configName) throws Exception {
|
||||
String configName,
|
||||
String repeatCount) throws Exception {
|
||||
myRootDescription = createRootDescription(args, configName);
|
||||
if (myRootDescription == null) {
|
||||
return -1;
|
||||
@@ -40,11 +41,10 @@ public abstract class ForkedSplitter extends ForkedByModuleSplitter {
|
||||
if (myWorkingDirsPath == null || new File(myWorkingDirsPath).length() == 0) {
|
||||
final List children = getChildren(myRootDescription);
|
||||
final boolean forkTillMethod = myForkMode.equalsIgnoreCase("method");
|
||||
return splitChildren(children, 0, forkTillMethod, null, System.getProperty("java.class.path")
|
||||
);
|
||||
return splitChildren(children, 0, forkTillMethod, null, System.getProperty("java.class.path"), repeatCount);
|
||||
}
|
||||
else {
|
||||
return splitPerModule();
|
||||
return splitPerModule(repeatCount);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,10 +53,10 @@ public abstract class ForkedSplitter extends ForkedByModuleSplitter {
|
||||
String packageName,
|
||||
String workingDir,
|
||||
String classpath,
|
||||
int result) throws Exception {
|
||||
String repeatCount, int result) throws Exception {
|
||||
if (myForkMode.equals("none")) {
|
||||
final List childArgs = createPerModuleArgs(packageName, workingDir, classNames, myRootDescription);
|
||||
return startChildFork(childArgs, new File(workingDir), classpath);
|
||||
return startChildFork(childArgs, new File(workingDir), classpath, repeatCount);
|
||||
}
|
||||
else {
|
||||
final List children = new ArrayList(getChildren(myRootDescription));
|
||||
@@ -66,7 +66,7 @@ public abstract class ForkedSplitter extends ForkedByModuleSplitter {
|
||||
}
|
||||
}
|
||||
final boolean forkTillMethod = myForkMode.equalsIgnoreCase("method");
|
||||
return splitChildren(children, result, forkTillMethod, new File(workingDir), classpath);
|
||||
return splitChildren(children, result, forkTillMethod, new File(workingDir), classpath, repeatCount);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,16 +74,16 @@ public abstract class ForkedSplitter extends ForkedByModuleSplitter {
|
||||
int result,
|
||||
boolean forkTillMethod,
|
||||
File workingDir,
|
||||
String classpath) throws IOException, InterruptedException {
|
||||
String classpath, String repeatCount) throws IOException, InterruptedException {
|
||||
for (int i = 0, argsLength = children.size(); i < argsLength; i++) {
|
||||
final Object child = children.get(i);
|
||||
final List childTests = getChildren(child);
|
||||
final int childResult;
|
||||
if (childTests.isEmpty() || !forkTillMethod) {
|
||||
childResult = startChildFork(createChildArgs(child), workingDir, classpath);
|
||||
childResult = startChildFork(createChildArgs(child), workingDir, classpath, repeatCount);
|
||||
}
|
||||
else {
|
||||
childResult = splitChildren(childTests, result, forkTillMethod, workingDir, classpath);
|
||||
childResult = splitChildren(childTests, result, forkTillMethod, workingDir, classpath, repeatCount);
|
||||
}
|
||||
result = Math.min(childResult, result);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user