diff --git a/tests/build.gradle.kts b/tests/build.gradle.kts index b64025249..6ab4574b2 100644 --- a/tests/build.gradle.kts +++ b/tests/build.gradle.kts @@ -60,28 +60,23 @@ tasks.test { systemProperty("teavm.junit.c.compiler", providers.gradleProperty("teavm.tests.c.compiler") .orElse("compile-c-unix-fast.sh").get()) - jvmArgumentProviders += object : CommandLineArgumentProvider { - override fun asArguments(): Iterable { - val dependencies = configurations.testRuntimeClasspath.get() - .incoming.resolutionResult.allDependencies - .asSequence() - .filterIsInstance() - .map { it.requested } - .filterIsInstance() - .map { project.rootProject.project(it.projectPath) } - val projects = dependencies + project - val dirs = projects.map { it.layout.projectDirectory }.flatMap { - sequenceOf( - it.dir("src/main/java"), - it.dir("src/test/java") - ) - } - val result = dirs - .map { it.asFile.absolutePath } - .joinToString(File.pathSeparator) - return listOf("-Dteavm.junit.sourceDirs=$result") - } + val dependencies = configurations.testRuntimeClasspath.get() + .incoming.resolutionResult.allDependencies + .asSequence() + .filterIsInstance() + .map { it.requested } + .filterIsInstance() + .map { project.rootProject.project(it.projectPath) } + val projects = dependencies + project + val dirs = projects.map { it.layout.projectDirectory }.flatMap { + sequenceOf( + it.dir("src/main/java"), + it.dir("src/test/java") + ) } + systemProperty("teavm.junit.sourceDirs", dirs + .map { it.asFile.absolutePath } + .joinToString(File.pathSeparator)) maxParallelForks = (Runtime.getRuntime().availableProcessors() / 2).coerceAtLeast(1) } \ No newline at end of file diff --git a/tests/src/test/java/org/teavm/classlib/java/io/PipedInputStreamTest.java b/tests/src/test/java/org/teavm/classlib/java/io/PipedInputStreamTest.java index acbf970c0..17b3f8225 100644 --- a/tests/src/test/java/org/teavm/classlib/java/io/PipedInputStreamTest.java +++ b/tests/src/test/java/org/teavm/classlib/java/io/PipedInputStreamTest.java @@ -375,6 +375,7 @@ public class PipedInputStreamTest { } @Test + @SkipPlatform(TestPlatform.C) public void read_after_write_close() throws Exception { PipedInputStream in = new PipedInputStream(); PipedOutputStream out = new PipedOutputStream(); diff --git a/tests/src/test/java/org/teavm/classlib/java/time/TestLocalDate.java b/tests/src/test/java/org/teavm/classlib/java/time/TestLocalDate.java index e1ba0582a..d1e692015 100644 --- a/tests/src/test/java/org/teavm/classlib/java/time/TestLocalDate.java +++ b/tests/src/test/java/org/teavm/classlib/java/time/TestLocalDate.java @@ -99,7 +99,9 @@ import java.util.Arrays; import java.util.List; import org.junit.runner.RunWith; import org.teavm.classlib.java.time.temporal.MockFieldNoValue; +import org.teavm.junit.SkipPlatform; import org.teavm.junit.TeaVMTestRunner; +import org.teavm.junit.TestPlatform; import org.testng.annotations.BeforeMethod; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; @@ -942,6 +944,7 @@ public class TestLocalDate extends AbstractDateTimeTest { } @Test(expectedExceptions = NullPointerException.class) + @SkipPlatform(TestPlatform.C) public void test_plus_longPeriodUnit_null() { test2007x07x15.plus(1, (TemporalUnit) null); } @@ -1302,6 +1305,7 @@ public class TestLocalDate extends AbstractDateTimeTest { } @Test(expectedExceptions = NullPointerException.class) + @SkipPlatform(TestPlatform.C) public void test_minus_longPeriodUnit_null() { test2007x07x15.minus(1, (TemporalUnit) null); } diff --git a/tests/src/test/java/org/teavm/classlib/java/time/TestLocalDateTime.java b/tests/src/test/java/org/teavm/classlib/java/time/TestLocalDateTime.java index 1f78f091e..117e8d1a0 100644 --- a/tests/src/test/java/org/teavm/classlib/java/time/TestLocalDateTime.java +++ b/tests/src/test/java/org/teavm/classlib/java/time/TestLocalDateTime.java @@ -1261,6 +1261,7 @@ public class TestLocalDateTime extends AbstractDateTimeTest { } @Test(expectedExceptions = NullPointerException.class) + @SkipPlatform(TestPlatform.C) public void test_plus_longPeriodUnit_null() { test2007x07x15x12x30x40x987654321.plus(1, null); } @@ -1971,6 +1972,7 @@ public class TestLocalDateTime extends AbstractDateTimeTest { } @Test(expectedExceptions = NullPointerException.class) + @SkipPlatform(TestPlatform.C) public void test_minus_longPeriodUnit_null() { test2007x07x15x12x30x40x987654321.minus(1, null); } diff --git a/tests/src/test/java/org/teavm/classlib/java/time/TestOffsetTime.java b/tests/src/test/java/org/teavm/classlib/java/time/TestOffsetTime.java index 3438c1677..3caf12cba 100644 --- a/tests/src/test/java/org/teavm/classlib/java/time/TestOffsetTime.java +++ b/tests/src/test/java/org/teavm/classlib/java/time/TestOffsetTime.java @@ -95,7 +95,9 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; import org.junit.runner.RunWith; +import org.teavm.junit.SkipPlatform; import org.teavm.junit.TeaVMTestRunner; +import org.teavm.junit.TestPlatform; import org.testng.annotations.BeforeMethod; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; @@ -666,6 +668,7 @@ public class TestOffsetTime extends AbstractDateTimeTest { } @Test(expectedExceptions = NullPointerException.class) + @SkipPlatform(TestPlatform.C) public void test_with_TemporalField_null() { test11x30x59x500pone.with((TemporalField) null, 0); } diff --git a/tests/src/test/java/org/teavm/classlib/java/time/TestZonedDateTime.java b/tests/src/test/java/org/teavm/classlib/java/time/TestZonedDateTime.java index a0c29d5f0..c65e58584 100644 --- a/tests/src/test/java/org/teavm/classlib/java/time/TestZonedDateTime.java +++ b/tests/src/test/java/org/teavm/classlib/java/time/TestZonedDateTime.java @@ -112,7 +112,9 @@ import java.util.Arrays; import java.util.List; import org.junit.runner.RunWith; import org.teavm.classlib.java.time.temporal.MockFieldNoValue; +import org.teavm.junit.SkipPlatform; import org.teavm.junit.TeaVMTestRunner; +import org.teavm.junit.TestPlatform; import org.testng.annotations.BeforeMethod; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; @@ -1454,6 +1456,7 @@ public class TestZonedDateTime extends AbstractDateTimeTest { } @Test(expectedExceptions = NullPointerException.class) + @SkipPlatform(TestPlatform.C) public void test_plus_longUnit_null() { testDateTimeParis.plus(0, null); } diff --git a/tests/src/test/java/org/teavm/classlib/java/time/temporal/TestYear.java b/tests/src/test/java/org/teavm/classlib/java/time/temporal/TestYear.java index 8a0252ac0..6811e2f5d 100644 --- a/tests/src/test/java/org/teavm/classlib/java/time/temporal/TestYear.java +++ b/tests/src/test/java/org/teavm/classlib/java/time/temporal/TestYear.java @@ -78,7 +78,9 @@ import java.util.Arrays; import java.util.List; import org.junit.runner.RunWith; import org.teavm.classlib.java.time.AbstractDateTimeTest; +import org.teavm.junit.SkipPlatform; import org.teavm.junit.TeaVMTestRunner; +import org.teavm.junit.TestPlatform; import org.testng.annotations.BeforeMethod; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; @@ -708,6 +710,7 @@ public class TestYear extends AbstractDateTimeTest { } @Test(expectedExceptions = NullPointerException.class) + @SkipPlatform(TestPlatform.C) public void test_compareTo_nullYear() { Year doy = null; Year test = Year.of(1); diff --git a/tools/junit/src/main/java/org/teavm/junit/BaseWebAssemblyPlatformSupport.java b/tools/junit/src/main/java/org/teavm/junit/BaseWebAssemblyPlatformSupport.java index 18a56e299..2dc3682bb 100644 --- a/tools/junit/src/main/java/org/teavm/junit/BaseWebAssemblyPlatformSupport.java +++ b/tools/junit/src/main/java/org/teavm/junit/BaseWebAssemblyPlatformSupport.java @@ -65,4 +65,9 @@ abstract class BaseWebAssemblyPlatformSupport extends TestPlatformSupport { cTarget.setLineNumbersGenerated(Boolean.parseBoolean(System.getProperty(C_LINE_NUMBERS, "false"))); return cTarget; } + + @Override + boolean usesFileName() { + return false; + } } diff --git a/tools/junit/src/main/java/org/teavm/junit/JSPlatformSupport.java b/tools/junit/src/main/java/org/teavm/junit/JSPlatformSupport.java index 709a82b71..bb7797205 100644 --- a/tools/junit/src/main/java/org/teavm/junit/JSPlatformSupport.java +++ b/tools/junit/src/main/java/org/teavm/junit/JSPlatformSupport.java @@ -147,4 +147,9 @@ class JSPlatformSupport extends TestPlatformSupport { MethodReference reference) { htmlSingleTestOutput(outputPathForMethod, configuration, "teavm-run-test.html"); } + + @Override + boolean usesFileName() { + return true; + } } diff --git a/tools/junit/src/main/java/org/teavm/junit/TestPlatformSupport.java b/tools/junit/src/main/java/org/teavm/junit/TestPlatformSupport.java index f410604ae..dc14647d2 100644 --- a/tools/junit/src/main/java/org/teavm/junit/TestPlatformSupport.java +++ b/tools/junit/src/main/java/org/teavm/junit/TestPlatformSupport.java @@ -58,6 +58,8 @@ abstract class TestPlatformSupport { abstract CompileResult compile(Consumer additionalProcessing, String baseName, TeaVMTestConfiguration configuration, File path); + abstract boolean usesFileName(); + CompileResult compile(TeaVMTestConfiguration configuration, Supplier targetSupplier, String entryPoint, File path, String extension, CompilePostProcessor postBuild, Consumer additionalProcessing, String baseName) { @@ -89,10 +91,15 @@ abstract class TestPlatformSupport { vm.entryPoint(entryPoint); - if (!outputFile.getParentFile().exists()) { + if (usesFileName()) { + if (!outputFile.getParentFile().exists()) { + outputFile.getParentFile().mkdirs(); + } + vm.build(new DirectoryBuildTarget(outputFile.getParentFile()), outputFile.getName()); + } else { outputFile.getParentFile().mkdirs(); + vm.build(new DirectoryBuildTarget(outputFile), ""); } - vm.build(new DirectoryBuildTarget(outputFile.getParentFile()), outputFile.getName()); if (!vm.getProblemProvider().getProblems().isEmpty()) { result.success = false; result.errorMessage = buildErrorMessage(vm);