Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BlockHound integration #1821

Merged
merged 15 commits into from
Mar 16, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add an integration test for coroutine debugger java agent
  • Loading branch information
dkhalanskyjb committed Mar 16, 2020
commit 76ab90f2d8428a6033e7a87c2ee6bd5cd7e3a359
1 change: 1 addition & 0 deletions integration-testing/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ The tests are the following:
`-PdryRun` affects `npmPublish` so that it only provides a packed publication
and does not in fact attempt to send the build for publication.
* `MavenPublicationValidator` depends on the published artifacts and tests artifacts binary content and absence of atomicfu in the classpath
* `DebugAgentTest` checks that the coroutine debugger can be run as a Java agent.

All the available tests can be run with `integration-testing:test`.
17 changes: 16 additions & 1 deletion integration-testing/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ sourceSets {
compileClasspath += sourceSets.test.runtimeClasspath
runtimeClasspath += sourceSets.test.runtimeClasspath
}
debugAgentTest {
kotlin
compileClasspath += sourceSets.test.runtimeClasspath
runtimeClasspath += sourceSets.test.runtimeClasspath
}
}

task npmTest(type: Test) {
Expand All @@ -44,19 +49,29 @@ task mavenTest(type: Test) {
classpath = sourceSet.runtimeClasspath
}

task debugAgentTest(type: Test) {
def sourceSet = sourceSets.debugAgentTest
dependsOn(project(':kotlinx-coroutines-debug').shadowJar)
jvmArgs ('-javaagent:' + project(':kotlinx-coroutines-debug').shadowJar.outputs.files.getFiles()[0])
testClassesDirs = sourceSet.output.classesDirs
classpath = sourceSet.runtimeClasspath
}

dependencies {
testCompile "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
testCompile 'junit:junit:4.12'
npmTestCompile 'org.apache.commons:commons-compress:1.18'
npmTestCompile 'com.google.code.gson:gson:2.8.5'
mavenTestRuntimeOnly project(':kotlinx-coroutines-core')
mavenTestRuntimeOnly project(':kotlinx-coroutines-android')
debugAgentTestCompile project(':kotlinx-coroutines-core')
debugAgentTestCompile project(':kotlinx-coroutines-debug')
}

compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
}

test {
dependsOn([npmTest, mavenTest])
dependsOn([npmTest, mavenTest, debugAgentTest])
}
20 changes: 20 additions & 0 deletions integration-testing/src/debugAgentTest/kotlin/DebugAgentTest.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
import org.junit.*
import kotlinx.coroutines.*
import kotlinx.coroutines.debug.*
import java.io.*

class DebugAgentTest {

@Test
fun agentDumpsCoroutines() = runBlocking {
val baos = ByteArrayOutputStream()
DebugProbes.dumpCoroutines(PrintStream(baos))
// if the agent works, then dumps should contain something,
// at least the fact that this test is running.
Assert.assertTrue(baos.toString().contains("agentDumpsCoroutines"))
}

}