mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 08:14:09 -08:00
junit: don't start browser if corresponding test platforms disabled
This commit is contained in:
parent
ef359c3604
commit
997a31b683
|
@ -61,15 +61,18 @@ class CPlatformSupport extends TestPlatformSupport<CTarget> {
|
|||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean isEnabled() {
|
||||
return Boolean.getBoolean(C_ENABLED);
|
||||
}
|
||||
|
||||
@Override
|
||||
List<TeaVMTestConfiguration<CTarget>> getConfigurations() {
|
||||
List<TeaVMTestConfiguration<CTarget>> configurations = new ArrayList<>();
|
||||
if (Boolean.getBoolean(C_ENABLED)) {
|
||||
configurations.add(TeaVMTestConfiguration.C_DEFAULT);
|
||||
if (Boolean.getBoolean(OPTIMIZED)) {
|
||||
configurations.add(TeaVMTestConfiguration.C_OPTIMIZED);
|
||||
}
|
||||
}
|
||||
return configurations;
|
||||
}
|
||||
|
||||
|
|
|
@ -79,10 +79,14 @@ class JSPlatformSupport extends TestPlatformSupport<JavaScriptTarget> {
|
|||
return ".js";
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean isEnabled() {
|
||||
return Boolean.parseBoolean(System.getProperty(JS_ENABLED, "true"));
|
||||
}
|
||||
|
||||
@Override
|
||||
List<TeaVMTestConfiguration<JavaScriptTarget>> getConfigurations() {
|
||||
List<TeaVMTestConfiguration<JavaScriptTarget>> configurations = new ArrayList<>();
|
||||
if (Boolean.parseBoolean(System.getProperty(JS_ENABLED, "true"))) {
|
||||
configurations.add(TeaVMTestConfiguration.JS_DEFAULT);
|
||||
if (Boolean.getBoolean(MINIFIED)) {
|
||||
configurations.add(TeaVMTestConfiguration.JS_MINIFIED);
|
||||
|
@ -90,7 +94,6 @@ class JSPlatformSupport extends TestPlatformSupport<JavaScriptTarget> {
|
|||
if (Boolean.getBoolean(OPTIMIZED)) {
|
||||
configurations.add(TeaVMTestConfiguration.JS_OPTIMIZED);
|
||||
}
|
||||
}
|
||||
return configurations;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@ final class PropertyNames {
|
|||
static final String PATH_PARAM = "teavm.junit.target";
|
||||
static final String JS_RUNNER = "teavm.junit.js.runner";
|
||||
static final String WASM_RUNNER = "teavm.junit.wasm.runner";
|
||||
static final String THREAD_COUNT = "teavm.junit.threads";
|
||||
static final String JS_ENABLED = "teavm.junit.js";
|
||||
static final String JS_DECODE_STACK = "teavm.junit.js.decodeStack";
|
||||
static final String C_ENABLED = "teavm.junit.c";
|
||||
|
|
|
@ -110,11 +110,13 @@ public class TeaVMTestRunner extends Runner implements Filterable {
|
|||
platforms.add(new CPlatformSupport(classSource, referenceCache));
|
||||
|
||||
for (var platform : platforms) {
|
||||
if (platform.isEnabled()) {
|
||||
var runStrategy = platform.createRunStrategy(outputDir);
|
||||
if (runStrategy != null) {
|
||||
runners.put(platform.getPlatform(), runStrategy);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (var strategy : runners.values()) {
|
||||
strategy.beforeAll();
|
||||
|
@ -734,15 +736,14 @@ public class TeaVMTestRunner extends Runner implements Filterable {
|
|||
return new Failure(description, throwable);
|
||||
}
|
||||
|
||||
private boolean submitRun(TestRun run) throws IOException {
|
||||
private void submitRun(TestRun run) throws IOException {
|
||||
runsInCurrentClass.add(run);
|
||||
var strategy = runners.get(run.getKind());
|
||||
if (strategy == null) {
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
|
||||
strategy.runTest(run);
|
||||
return true;
|
||||
}
|
||||
|
||||
private File getOutputPath(Method method, TestPlatformSupport<?> platform) {
|
||||
|
|
|
@ -45,6 +45,8 @@ abstract class TestPlatformSupport<T extends TeaVMTarget> {
|
|||
this.referenceCache = referenceCache;
|
||||
}
|
||||
|
||||
abstract boolean isEnabled();
|
||||
|
||||
abstract TestRunStrategy createRunStrategy(File outputDir);
|
||||
|
||||
abstract TestPlatform getPlatform();
|
||||
|
|
|
@ -55,15 +55,18 @@ class WasiPlatformSupport extends BaseWebAssemblyPlatformSupport {
|
|||
return "wasi";
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean isEnabled() {
|
||||
return Boolean.getBoolean(WASI_ENABLED);
|
||||
}
|
||||
|
||||
@Override
|
||||
List<TeaVMTestConfiguration<WasmTarget>> getConfigurations() {
|
||||
List<TeaVMTestConfiguration<WasmTarget>> configurations = new ArrayList<>();
|
||||
if (Boolean.getBoolean(WASI_ENABLED)) {
|
||||
configurations.add(TeaVMTestConfiguration.WASM_DEFAULT);
|
||||
if (Boolean.getBoolean(OPTIMIZED)) {
|
||||
configurations.add(TeaVMTestConfiguration.WASM_OPTIMIZED);
|
||||
}
|
||||
}
|
||||
return configurations;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,15 +61,18 @@ class WebAssemblyPlatformSupport extends BaseWebAssemblyPlatformSupport {
|
|||
return "wasm";
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean isEnabled() {
|
||||
return Boolean.getBoolean(WASM_ENABLED);
|
||||
}
|
||||
|
||||
@Override
|
||||
List<TeaVMTestConfiguration<WasmTarget>> getConfigurations() {
|
||||
List<TeaVMTestConfiguration<WasmTarget>> configurations = new ArrayList<>();
|
||||
if (Boolean.getBoolean(WASM_ENABLED)) {
|
||||
configurations.add(TeaVMTestConfiguration.WASM_DEFAULT);
|
||||
if (Boolean.getBoolean(OPTIMIZED)) {
|
||||
configurations.add(TeaVMTestConfiguration.WASM_OPTIMIZED);
|
||||
}
|
||||
}
|
||||
return configurations;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user