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