Skip to content

Commit

Permalink
Fix not adding initial methods to coverage zone
Browse files Browse the repository at this point in the history
  • Loading branch information
ancavar committed Jul 7, 2024
1 parent b560b01 commit 042b6ea
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 7 additions & 1 deletion usvm-core/src/main/kotlin/org/usvm/ps/PathSelectorFactory.kt
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,14 @@ fun <Method, Statement, State, Block> createAIPathSelector(
addOnCoveredObserver { _, _, statement ->
blockGraph.blockOf(statement).coveredByTest = true
}
fun addBlocksToCoverageZone(method: Method) {
val blocksOfMethod = blockGraph.blocks.filter { blockGraph.methodOf(it) == method }
blocksOfMethod.forEach { it.inCoverageZone = true }
}
// initial methods
coverageZone.forEach(::addBlocksToCoverageZone)
addOnMethodAddedObserver { method ->
blockGraph.blocks.filter { blockGraph.methodOf(it) == method }.forEach { it.inCoverageZone = true }
addBlocksToCoverageZone(method)
}
}

Expand Down
1 change: 1 addition & 0 deletions usvm-jvm/src/main/kotlin/org/usvm/machine/JcMachine.kt
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ class JcMachine(
val initialStates = mutableMapOf<JcMethod, JcState>()
methods.forEach {
initialStates[it] = interpreter.getInitialState(it, targets)
blockGraph.addNewMethod(it)
}

val methodsToTrackCoverage =
Expand Down

0 comments on commit 042b6ea

Please sign in to comment.