Fix IDE related test problems after adding ability to run test in parallel in compiler configuration

This commit is contained in:
Mikhael Bogdanov
2019-03-26 15:30:42 +01:00
parent 4df31b2360
commit 9c21c71c63
4 changed files with 6 additions and 26 deletions
@@ -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);