[Test] Ignore test infrastucture sources in debugging tests

This solves no immediate deficiency, but is a to-do that arose as part
of an ongoing effort to port the old, slightly too restrictive
checkLocalVariableTable tests to the more "functional" debugger
infrastructure.

This just shaves a little bit of overhead off the test expectations
and couples them less tightly to the specifics of the test
infrastructure.
This commit is contained in:
Kristoffer Andersen
2021-01-11 18:28:44 +01:00
committed by max-kammerer
parent 46b7a774b5
commit 836261ba6e
10 changed files with 11 additions and 10 deletions
@@ -110,6 +110,10 @@ abstract class AbstractDebugTest : CodegenTestCase() {
?: File(javaBin, "java").also { assert(it.exists()) }
}
val Location.isInDebugTestInfrastructure: Boolean
get() {
return this.sourcePath().startsWith("helpers" + File.separatorChar)
}
}
@Before
@@ -81,7 +81,9 @@ abstract class AbstractLocalVariableTest : AbstractDebugTest() {
val locatableEvent = event as LocatableEvent
waitUntil { locatableEvent.thread().isSuspended }
val location = locatableEvent.location()
if (location.isInDebugTestInfrastructure) return
if (location.method().isSynthetic) return
val frame = locatableEvent.thread().frame(0)
val visibleVars = try {
frame.visibleVariables().map { variable -> toRecord(frame, variable) }
@@ -60,9 +60,11 @@ abstract class AbstractSteppingTest : AbstractDebugTest() {
val actualLineNumbers = compressRunsWithoutLinenumber(loggedItems as List<LocatableEvent>, LocatableEvent::location)
.filter {
val location = it.location()
// Ignore synthetic code with no line number information
// unless force step into behavior is requested.
forceStepInto || !location.method().isSynthetic
// Ignore:
// - synthetic code with no line number information
// unless force step into behavior is requested.
// - helper code from the test infrastructure
(forceStepInto || !location.method().isSynthetic) && !location.isInDebugTestInfrastructure
}
.map { "// ${it.location().formatAsExpectation()}" }
val actualLineNumbersIterator = actualLineNumbers.iterator()