Fix running tests in wasm

This commit is contained in:
Alexey Andreev 2023-08-22 17:02:33 +02:00
parent 9ecb3ad817
commit d7cae4af55
3 changed files with 18 additions and 16 deletions

View File

@ -39,11 +39,23 @@ dependencies {
} }
tasks.test { tasks.test {
systemProperty("teavm.junit.target", "${project.buildDir.absolutePath }/js-tests") systemProperty("teavm.junit.target", "${project.buildDir.absolutePath }/teavm-tests")
systemProperty("teavm.junit.js.runner", "browser-chrome")
systemProperty("teavm.junit.threads", "1") systemProperty("teavm.junit.threads", "1")
systemProperty("teavm.junit.minified", providers.gradleProperty("teavm.tests.minified")) val browser = providers.gradleProperty("teavm.tests.browser").orElse("browser-chrome").get()
systemProperty("teavm.junit.optimized", providers.gradleProperty("teavm.tests.optimized"))
systemProperty("teavm.junit.js.decodeStack", providers.gradleProperty("teavm.tests.decodeStack")) systemProperty("teavm.junit.js", providers.gradleProperty("teavm.tests.wasm").orElse("true").get())
systemProperty("teavm.junit.js.runner", browser)
systemProperty("teavm.junit.minified", providers.gradleProperty("teavm.tests.minified").orElse("false").get())
systemProperty("teavm.junit.optimized", providers.gradleProperty("teavm.tests.optimized").orElse("false").get())
systemProperty("teavm.junit.js.decodeStack", providers.gradleProperty("teavm.tests.decodeStack")
.orElse("false").get())
systemProperty("teavm.junit.wasm", providers.gradleProperty("teavm.tests.wasm").orElse("false").get())
systemProperty("teavm.junit.wasm.runner", browser)
systemProperty("teavm.junit.wasi", providers.gradleProperty("teavm.tests.wasi").orElse("false").get())
systemProperty("teavm.junit.wasi.runner", providers.gradleProperty("teavm.tests.wasi.runner")
.orElse("./run-wasi.sh").get())
maxParallelForks = (Runtime.getRuntime().availableProcessors() / 2).coerceAtLeast(1) maxParallelForks = (Runtime.getRuntime().availableProcessors() / 2).coerceAtLeast(1)
} }

View File

@ -1 +1 @@
~/.wasmtime/bin/wasmtime run --mapdir /::target/wasi-testdir $1 $2 ~/.wasmtime/bin/wasmtime run --mapdir /::build/wasi-testdir $1 $2

View File

@ -41,7 +41,6 @@ import java.util.Properties;
import java.util.Set; import java.util.Set;
import java.util.WeakHashMap; import java.util.WeakHashMap;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.function.BiConsumer; import java.util.function.BiConsumer;
import java.util.function.Consumer; import java.util.function.Consumer;
@ -128,7 +127,6 @@ public class TeaVMTestRunner extends Runner implements Filterable {
private File outputDir; private File outputDir;
private Map<Method, Description> descriptions = new HashMap<>(); private Map<Method, Description> descriptions = new HashMap<>();
private static Map<RunKind, RunnerKindInfo> runners = new HashMap<>(); private static Map<RunKind, RunnerKindInfo> runners = new HashMap<>();
private static ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(1);
private CountDownLatch latch; private CountDownLatch latch;
private List<Method> filteredChildren; private List<Method> filteredChildren;
private ReferenceCache referenceCache = new ReferenceCache(); private ReferenceCache referenceCache = new ReferenceCache();
@ -1046,14 +1044,6 @@ public class TeaVMTestRunner extends Runner implements Filterable {
} }
} }
private static void cleanupRunner(RunKind kind) {
synchronized (TeaVMTestRunner.class) {
RunnerKindInfo info = runners.get(kind);
info.runner.stop();
info.runner = null;
}
}
private File getOutputPath(Method method) { private File getOutputPath(Method method) {
File path = outputDir; File path = outputDir;
path = new File(path, testClass.getName().replace('.', '/')); path = new File(path, testClass.getName().replace('.', '/'));