Skip to content

Commit 8a78d34

Browse files
committed
Add an option to show library classes' graphs in visualization
1 parent d9b7076 commit 8a78d34

File tree

2 files changed

+16
-3
lines changed
  • utbot-framework/src/main/kotlin/org/utbot/engine/selectors/strategies
  • utbot-framework-api/src/main/kotlin/org/utbot/framework

2 files changed

+16
-3
lines changed

utbot-framework-api/src/main/kotlin/org/utbot/framework/UtSettings.kt

+7
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,13 @@ object UtSettings : AbstractSettings(
123123
*/
124124
val copyVisualizationPathToClipboard get() = useDebugVisualization
125125

126+
/**
127+
* Set the value to true to show library classes' graphs in visualization.
128+
*
129+
* False by default.
130+
*/
131+
val showLibraryClassesInVisualization by getBooleanProperty(false)
132+
126133
/**
127134
* Method is paused after this timeout to give an opportunity other methods
128135
* to work

utbot-framework/src/main/kotlin/org/utbot/engine/selectors/strategies/GraphViz.kt

+9-3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import org.utbot.engine.isReturn
1111
import org.utbot.engine.selectors.PathSelector
1212
import org.utbot.engine.stmts
1313
import org.utbot.framework.UtSettings.copyVisualizationPathToClipboard
14+
import org.utbot.framework.UtSettings.showLibraryClassesInVisualization
1415
import soot.jimple.Stmt
1516
import soot.toolkits.graph.ExceptionalUnitGraph
1617
import java.awt.Toolkit
@@ -103,7 +104,10 @@ class GraphViz(
103104
graph.allEdges.forEach { edge ->
104105
val (edgeSrc, edgeDst, _) = edge
105106

106-
if (stmtToSubgraph[edgeSrc] !in libraryGraphs && stmtToSubgraph[edgeDst] !in libraryGraphs) {
107+
val srcInLibraryMethod = stmtToSubgraph[edgeSrc] in libraryGraphs
108+
val dstInLibraryMethod = stmtToSubgraph[edgeDst] !in libraryGraphs
109+
110+
if (!(srcInLibraryMethod || dstInLibraryMethod) || showLibraryClassesInVisualization) {
107111
dotGlobalGraph.addDotEdge(edge)
108112
}
109113
}
@@ -143,8 +147,10 @@ class GraphViz(
143147
}
144148

145149
// Filter library methods
146-
uncompletedStack.removeIf { it.name in libraryGraphs }
147-
fullStack.removeIf { it.name in libraryGraphs }
150+
if (!showLibraryClassesInVisualization) {
151+
uncompletedStack.removeIf { it.name in libraryGraphs }
152+
fullStack.removeIf { it.name in libraryGraphs }
153+
}
148154

149155
// Update nodes and edges properties
150156
dotGlobalGraph.updateProperties(executionState)

0 commit comments

Comments
 (0)