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 5ebdc4367..18a56e299 100644 --- a/tools/junit/src/main/java/org/teavm/junit/BaseWebAssemblyPlatformSupport.java +++ b/tools/junit/src/main/java/org/teavm/junit/BaseWebAssemblyPlatformSupport.java @@ -63,6 +63,6 @@ abstract class BaseWebAssemblyPlatformSupport extends TestPlatformSupport { throw new RuntimeException(e); } }; - return compile(configuration, this::createCTarget, TestNativeEntryPoint.class.getName(), path, ".c", - postBuild, true, additionalProcessing, baseName); + return compile(configuration, this::createCTarget, TestNativeEntryPoint.class.getName(), path, "", + postBuild, additionalProcessing, baseName); } private CTarget createCTarget() { diff --git a/tools/junit/src/main/java/org/teavm/junit/CRunStrategy.java b/tools/junit/src/main/java/org/teavm/junit/CRunStrategy.java index 858d7def8..2bdbf792c 100644 --- a/tools/junit/src/main/java/org/teavm/junit/CRunStrategy.java +++ b/tools/junit/src/main/java/org/teavm/junit/CRunStrategy.java @@ -41,8 +41,9 @@ class CRunStrategy implements TestRunStrategy { exeName += ".exe"; } - File outputFile = new File(run.getBaseDirectory(), exeName); - boolean compilerSuccess = compile(run.getBaseDirectory()); + var sourcesDir = new File(run.getBaseDirectory(), run.getFileName()); + var outputFile = new File(sourcesDir, exeName); + var compilerSuccess = compile(sourcesDir); if (!compilerSuccess) { throw new RuntimeException("C compiler error"); } 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 352d2096b..709a82b71 100644 --- a/tools/junit/src/main/java/org/teavm/junit/JSPlatformSupport.java +++ b/tools/junit/src/main/java/org/teavm/junit/JSPlatformSupport.java @@ -133,7 +133,7 @@ class JSPlatformSupport extends TestPlatformSupport { }; } return compile(configuration, targetSupplier, TestJsEntryPoint.class.getName(), path, ".js", - postBuild, false, additionalProcessing, baseName); + postBuild, additionalProcessing, baseName); } @Override 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 4963af63f..f410604ae 100644 --- a/tools/junit/src/main/java/org/teavm/junit/TestPlatformSupport.java +++ b/tools/junit/src/main/java/org/teavm/junit/TestPlatformSupport.java @@ -60,11 +60,10 @@ abstract class TestPlatformSupport { CompileResult compile(TeaVMTestConfiguration configuration, Supplier targetSupplier, String entryPoint, File path, String extension, - CompilePostProcessor postBuild, boolean separateDir, - Consumer additionalProcessing, String baseName) { + CompilePostProcessor postBuild, Consumer additionalProcessing, String baseName) { CompileResult result = new CompileResult(); - File outputFile = getOutputFile(path, baseName, configuration.getSuffix(), separateDir, extension); + File outputFile = getOutputFile(path, baseName, configuration.getSuffix(), extension); result.file = outputFile; ClassLoader classLoader = TeaVMTestRunner.class.getClassLoader(); @@ -112,21 +111,15 @@ abstract class TestPlatformSupport { } } - private File getOutputFile(File path, String baseName, String suffix, boolean separateDir, String extension) { + private File getOutputFile(File path, String baseName, String suffix, String extension) { StringBuilder simpleName = new StringBuilder(); simpleName.append(baseName); if (!suffix.isEmpty()) { - if (!separateDir) { - simpleName.append('-').append(suffix); - } + simpleName.append('-').append(suffix); } File outputFile; - if (separateDir) { - outputFile = new File(new File(path, simpleName.toString()), "test" + extension); - } else { - simpleName.append(extension); - outputFile = new File(path, simpleName.toString()); - } + simpleName.append(extension); + outputFile = new File(path, simpleName.toString()); return outputFile; } @@ -155,8 +148,8 @@ abstract class TestPlatformSupport { protected final void htmlOutput(File outputPath, File outputPathForMethod, TeaVMTestConfiguration configuration, MethodReference reference, String template) { - var testPath = getOutputFile(outputPath, "classTest", configuration.getSuffix(), false, getExtension()); - var htmlPath = getOutputFile(outputPathForMethod, "test", configuration.getSuffix(), false, ".html"); + var testPath = getOutputFile(outputPath, "classTest", configuration.getSuffix(), getExtension()); + var htmlPath = getOutputFile(outputPathForMethod, "test", configuration.getSuffix(), ".html"); var properties = Map.of( "SCRIPT", "../" + testPath.getName(), "IDENTIFIER", reference.toString() @@ -170,8 +163,8 @@ abstract class TestPlatformSupport { protected final void htmlSingleTestOutput(File outputPathForMethod, TeaVMTestConfiguration configuration, String template) { - File testPath = getOutputFile(outputPathForMethod, "test", configuration.getSuffix(), false, ".wasm"); - File htmlPath = getOutputFile(outputPathForMethod, "test", configuration.getSuffix(), false, ".html"); + File testPath = getOutputFile(outputPathForMethod, "test", configuration.getSuffix(), ".wasm"); + File htmlPath = getOutputFile(outputPathForMethod, "test", configuration.getSuffix(), ".html"); var properties = Map.of( "SCRIPT", testPath.getName(), "IDENTIFIER", ""