aboutsummaryrefslogtreecommitdiff
path: root/integration-tests/gradle/src
diff options
context:
space:
mode:
authorVadim Mishenev <vad-mishenev@yandex.ru>2022-11-26 01:11:53 +0200
committerGitHub <noreply@github.com>2022-11-26 01:11:53 +0200
commit9ed17b64f0dd071afaa4f2e9c507937c4e9571d2 (patch)
treef218bedc28f66e1f7d803eae99c0ed1d5ac5cb84 /integration-tests/gradle/src
parentdc1f9d20f599ca8f9311b779645bc5e53784ca92 (diff)
downloaddokka-9ed17b64f0dd071afaa4f2e9c507937c4e9571d2.tar.gz
dokka-9ed17b64f0dd071afaa4f2e9c507937c4e9571d2.tar.bz2
dokka-9ed17b64f0dd071afaa4f2e9c507937c4e9571d2.zip
Fix OOME: Metaspace (#2678)
* Fix OOME: Metaspace * Add stress test * Run sample analysis from `Dispatchers.Default`
Diffstat (limited to 'integration-tests/gradle/src')
-rw-r--r--integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/SequentialTasksExecutionStressTest.kt45
-rw-r--r--integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/TestedVersions.kt1
-rw-r--r--integration-tests/gradle/src/main/kotlin/org/jetbrains/dokka/it/gradle/AbstractGradleIntegrationTest.kt7
3 files changed, 49 insertions, 4 deletions
diff --git a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/SequentialTasksExecutionStressTest.kt b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/SequentialTasksExecutionStressTest.kt
new file mode 100644
index 00000000..32ed27f4
--- /dev/null
+++ b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/SequentialTasksExecutionStressTest.kt
@@ -0,0 +1,45 @@
+package org.jetbrains.dokka.it.gradle
+
+import org.gradle.testkit.runner.TaskOutcome
+import org.junit.runners.Parameterized.Parameters
+import java.io.File
+import kotlin.test.*
+
+/**
+ * Creates 100 tasks for the test project and runs them sequentially under low memory settings.
+ *
+ * If the test passes, it's likely there are no noticeable memory leaks.
+ * If it fails, it's likely that memory is leaking somewhere.
+ */
+class SequentialTasksExecutionStressTest(override val versions: BuildVersions) : AbstractGradleIntegrationTest() {
+
+ companion object {
+ @get:JvmStatic
+ @get:Parameters(name = "{0}")
+ val versions = listOf(TestedVersions.LATEST)
+ }
+
+ @BeforeTest
+ fun prepareProjectFiles() {
+ val templateProjectDir = File("projects", "it-sequential-tasks-execution-stress")
+
+ templateProjectDir.listFiles().orEmpty()
+ .filter { it.isFile }
+ .forEach { topLevelFile -> topLevelFile.copyTo(File(projectDir, topLevelFile.name)) }
+
+ File(templateProjectDir, "src").copyRecursively(File(projectDir, "src"))
+ }
+
+ @Test
+ fun execute() {
+ val result = createGradleRunner(
+ "runTasks",
+ "--info",
+ "--stacktrace",
+ "-Ptask_number=100",
+ jvmArgs = listOf("-Xmx1G", "-XX:MaxMetaspaceSize=350m")
+ ).buildRelaxed()
+
+ assertEquals(TaskOutcome.SUCCESS, assertNotNull(result.task(":runTasks")).outcome)
+ }
+}
diff --git a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/TestedVersions.kt b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/TestedVersions.kt
index b6f2abd3..2b8e5b3c 100644
--- a/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/TestedVersions.kt
+++ b/integration-tests/gradle/src/integrationTest/kotlin/org/jetbrains/dokka/it/gradle/TestedVersions.kt
@@ -2,6 +2,7 @@ package org.jetbrains.dokka.it.gradle
internal object TestedVersions {
+ val LATEST = BuildVersions("7.4.2", "1.7.20")
val BASE =
BuildVersions.permutations(
gradleVersions = listOf("7.4.2", "6.9"),
diff --git a/integration-tests/gradle/src/main/kotlin/org/jetbrains/dokka/it/gradle/AbstractGradleIntegrationTest.kt b/integration-tests/gradle/src/main/kotlin/org/jetbrains/dokka/it/gradle/AbstractGradleIntegrationTest.kt
index 9998f3fd..84efac93 100644
--- a/integration-tests/gradle/src/main/kotlin/org/jetbrains/dokka/it/gradle/AbstractGradleIntegrationTest.kt
+++ b/integration-tests/gradle/src/main/kotlin/org/jetbrains/dokka/it/gradle/AbstractGradleIntegrationTest.kt
@@ -6,8 +6,6 @@ import org.gradle.testkit.runner.internal.DefaultGradleRunner
import org.gradle.tooling.GradleConnectionException
import org.gradle.util.GradleVersion
import org.jetbrains.dokka.it.AbstractIntegrationTest
-import org.junit.Assume
-import org.junit.Assume.assumeFalse
import org.junit.AssumptionViolatedException
import org.junit.runner.RunWith
import org.junit.runners.Parameterized
@@ -29,7 +27,8 @@ abstract class AbstractGradleIntegrationTest : AbstractIntegrationTest() {
}
fun createGradleRunner(
- vararg arguments: String
+ vararg arguments: String,
+ jvmArgs: List<String> = listOf("-Xmx4G", "-XX:MaxMetaspaceSize=2G")
): GradleRunner {
return GradleRunner.create()
.withProjectDir(projectDir)
@@ -46,7 +45,7 @@ abstract class AbstractGradleIntegrationTest : AbstractIntegrationTest() {
* arguments
)
).run { this as DefaultGradleRunner }
- .withJvmArguments("-Xmx4G", "-XX:MaxMetaspaceSize=2G")
+ .withJvmArguments(jvmArgs)
}
fun GradleRunner.buildRelaxed(): BuildResult {