Skip to content

Commit

Permalink
Polishing
Browse files Browse the repository at this point in the history
  • Loading branch information
sormuras committed Jun 26, 2018
1 parent 992ad0e commit d031831
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static com.github.forax.pro.api.MutableConfig.derive;

import java.io.IOException;
import java.lang.module.ModuleDescriptor;
import java.lang.module.ModuleFinder;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.UndeclaredThrowableException;
Expand Down Expand Up @@ -88,9 +89,11 @@ private int execute(TesterConf tester, Path testPath) throws IOException {
var loader = createTestClassLoader(tester, testPath, moduleName);

var testConfClass = load(loader, TestConf.class);
var testConf = create(testConfClass, new Class<?>[] { java.lang.module.ModuleDescriptor.class, boolean.class}, moduleDescriptor, tester.parallel());
var testConfTypes = new Class<?>[] {ModuleDescriptor.class, boolean.class};
var testConf = create(testConfClass, testConfTypes, moduleDescriptor, tester.parallel());
var runnerClass = load(loader, TesterRunner.class);
var runner = (IntSupplier) create(runnerClass, new Class<?>[] { testConfClass }, testConf);
var runnerTypes = new Class<?>[] {testConfClass};
var runner = (IntSupplier) create(runnerClass, runnerTypes, testConf);

try {
var future = executor.submit(runner::getAsInt);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,16 @@ private static int launchJUnitPlatform(TestConf testConf) {
var moduleName = testConf.moduleName();
var moduleNameAndVersion = testConf.moduleNameAndVersion();
var parallel = testConf.parallel();

var builder = LauncherDiscoveryRequestBuilder.request();
builder.selectors(selectModule(moduleName));
builder.configurationParameter("junit.jupiter.execution.parallel.enabled", "" + parallel);
builder.configurationParameter("junit.jupiter.execution.parallel.enabled", Boolean.toString(parallel));

var startTimeMillis = System.currentTimeMillis();
var launcher = LauncherFactory.create();
var launcherDiscoveryRequest = builder.build();
var summaryGeneratingListener = new SummaryGeneratingListener();
LauncherFactory.create().execute(launcherDiscoveryRequest, summaryGeneratingListener);
var startTimeMillis = System.currentTimeMillis();
launcher.execute(launcherDiscoveryRequest, summaryGeneratingListener);
var duration = System.currentTimeMillis() - startTimeMillis;
var summary = summaryGeneratingListener.getSummary();
int failures = (int) summary.getTestsFailedCount();
Expand Down

0 comments on commit d031831

Please sign in to comment.