build scripts: export OOM heap dump as a build artifact

Also use a special name for it to make it easier to download.
This commit is contained in:
nik
2017-09-19 19:51:35 +03:00
parent 5095a76baa
commit 68f55bc689
2 changed files with 18 additions and 0 deletions
@@ -31,6 +31,8 @@ abstract class TestingTasks {
*/
abstract void runTests(List<String> additionalJvmOptions, String defaultMainModule, Predicate<File> rootExcludeCondition)
abstract File createSnapshotsDirectory()
static TestingTasks create(CompilationContext context, TestingOptions options = new TestingOptions()) {
return new TestingTasksImpl(context, options)
}
@@ -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<String> 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