diff --git a/platform/build-scripts/groovy/org/jetbrains/intellij/build/TestingTasks.groovy b/platform/build-scripts/groovy/org/jetbrains/intellij/build/TestingTasks.groovy index 698ce9c52682..b8ab235ca0f7 100644 --- a/platform/build-scripts/groovy/org/jetbrains/intellij/build/TestingTasks.groovy +++ b/platform/build-scripts/groovy/org/jetbrains/intellij/build/TestingTasks.groovy @@ -31,6 +31,8 @@ abstract class TestingTasks { */ abstract void runTests(List additionalJvmOptions, String defaultMainModule, Predicate rootExcludeCondition) + abstract File createSnapshotsDirectory() + static TestingTasks create(CompilationContext context, TestingOptions options = new TestingOptions()) { return new TestingTasksImpl(context, options) } diff --git a/platform/build-scripts/groovy/org/jetbrains/intellij/build/impl/TestingTasksImpl.groovy b/platform/build-scripts/groovy/org/jetbrains/intellij/build/impl/TestingTasksImpl.groovy index e5617c638b42..daf42e608bfd 100644 --- a/platform/build-scripts/groovy/org/jetbrains/intellij/build/impl/TestingTasksImpl.groovy +++ b/platform/build-scripts/groovy/org/jetbrains/intellij/build/impl/TestingTasksImpl.groovy @@ -60,11 +60,14 @@ class TestingTasksImpl extends TestingTasks { FileUtilRt.createParentDirs(classpathFile) classpathFile.text = testsClasspath.findAll({ new File(it).exists() }).join('\n') + File snapshotsDir = createSnapshotsDirectory() + String hprofSnapshotFilePath = new File(snapshotsDir, "intellij-tests-oom.hprof").absolutePath List jvmArgs = [ "-ea", "-server", "-Xbootclasspath/a:${context.getModuleOutputPath(context.findRequiredModule("boot"))}".toString(), "-XX:+HeapDumpOnOutOfMemoryError", + "-XX:HeapDumpPath=$hprofSnapshotFilePath".toString(), "-XX:ReservedCodeCacheSize=300m", "-XX:SoftRefLRUPolicyMSPerMB=50", "-XX:+UseConcMarkSweepGC", @@ -192,6 +195,19 @@ class TestingTasksImpl extends TestingTasks { else //run other suites instead of BootstrapTests runJUnitTask(jvmArgs, systemProperties, testsClasspath) + + if (new File(hprofSnapshotFilePath).exists()) { + context.notifyArtifactBuilt(hprofSnapshotFilePath) + } + } + + @Override + @CompileDynamic + File createSnapshotsDirectory() { + File snapshotsDir = new File("$context.paths.projectHome/out/snapshots") + context.ant.delete(dir: snapshotsDir) + context.ant.mkdir(dir: snapshotsDir) + return snapshotsDir } @CompileDynamic