Fix IDE related test problems after adding ability to run test in parallel in compiler configuration
This commit is contained in:
@@ -428,9 +428,7 @@ public class KotlinTestUtils {
|
||||
|
||||
@NotNull
|
||||
public static File tmpDirForReusableLibrary(String name) throws IOException {
|
||||
File answer = normalizeFile(FileUtil.createTempDirectory(new File(System.getProperty("java.io.tmpdir")), name, ""));
|
||||
deleteOnShutdown(answer);
|
||||
return answer;
|
||||
return normalizeFile(FileUtil.createTempDirectory(new File(System.getProperty("java.io.tmpdir")), name, "", true));
|
||||
}
|
||||
|
||||
private static File normalizeFile(File file) throws IOException {
|
||||
|
||||
@@ -425,9 +425,7 @@ public class KotlinTestUtils {
|
||||
|
||||
@NotNull
|
||||
public static File tmpDirForReusableLibrary(String name) throws IOException {
|
||||
File answer = normalizeFile(FileUtil.createTempDirectory(new File(System.getProperty("java.io.tmpdir")), name, ""));
|
||||
deleteOnShutdown(answer);
|
||||
return answer;
|
||||
return normalizeFile(FileUtil.createTempDirectory(new File(System.getProperty("java.io.tmpdir")), name, "", true));
|
||||
}
|
||||
|
||||
private static File normalizeFile(File file) throws IOException {
|
||||
@@ -437,18 +435,6 @@ public class KotlinTestUtils {
|
||||
return file.getCanonicalFile();
|
||||
}
|
||||
|
||||
private static void deleteOnShutdown(File file) {
|
||||
if (filesToDelete.isEmpty()) {
|
||||
ShutDownTracker.getInstance().registerShutdownTask(() -> {
|
||||
for (File victim : filesToDelete) {
|
||||
FileUtil.delete(victim);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
filesToDelete.add(file);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static KtFile createFile(@NotNull @NonNls String name, @NotNull String text, @NotNull Project project) {
|
||||
String shortName = name.substring(name.lastIndexOf('/') + 1);
|
||||
|
||||
@@ -331,7 +331,8 @@ abstract class AbstractScriptConfigurationTest : KotlinCompletionTestCase() {
|
||||
}
|
||||
|
||||
private fun compileLibToDir(srcDir: File, vararg classpath: String): File {
|
||||
val outDir = KotlinTestUtils.tmpDir("${getTestName(false)}${srcDir.name}Out")
|
||||
//TODO: tmpDir would be enough, but there is tricky fail under AS otherwise
|
||||
val outDir = KotlinTestUtils.tmpDirForReusableLibrary("${getTestName(false)}${srcDir.name}Out")
|
||||
|
||||
val kotlinSourceFiles = FileUtil.findFilesByMask(Pattern.compile(".+\\.kt$"), srcDir)
|
||||
if (kotlinSourceFiles.isNotEmpty()) {
|
||||
|
||||
@@ -9,18 +9,13 @@ import com.eclipsesource.v8.V8
|
||||
import com.eclipsesource.v8.V8Array
|
||||
import com.eclipsesource.v8.V8Object
|
||||
import com.eclipsesource.v8.utils.V8ObjectUtils
|
||||
import com.intellij.openapi.util.io.FileUtil
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils
|
||||
import java.io.File
|
||||
|
||||
class ScriptEngineV8 : ScriptEngine {
|
||||
companion object {
|
||||
// It's important that this is not created per test, but rather per process.
|
||||
val LIBRARY_PATH_BASE = FileUtil.createTempDirectory(
|
||||
File(System.getProperty("java.io.tmpdir")),
|
||||
"j2v8_library_path",
|
||||
"",
|
||||
true
|
||||
).path
|
||||
val LIBRARY_PATH_BASE = KotlinTestUtils.tmpDirForReusableLibrary("j2v8_library_path").path
|
||||
}
|
||||
|
||||
override fun <T> releaseObject(t: T) {
|
||||
|
||||
Reference in New Issue
Block a user