File tree Expand file tree Collapse file tree 4 files changed +44
-10
lines changed
utbot-framework/src/main/kotlin/org/utbot/engine Expand file tree Collapse file tree 4 files changed +44
-10
lines changed Original file line number Diff line number Diff line change @@ -251,14 +251,21 @@ data class ExecutionState(
251251 */
252252 fun prettifiedPathLog (): String {
253253 val path = fullPath()
254- val prettifiedPath = path.joinToString(separator = " \n " ) { (stmt, depth, decision) ->
254+ val prettifiedPath = prettifiedPath(path)
255+ return " MD5(path)=${md5(prettifiedPath)} \n $prettifiedPath "
256+ }
257+
258+ private fun md5 (prettifiedPath : String ) = prettifiedPath.md5()
259+
260+ fun md5 () = prettifiedPath(fullPath()).md5()
261+
262+ private fun prettifiedPath (path : List <Step >) =
263+ path.joinToString(separator = " \n " ) { (stmt, depth, decision) ->
255264 val prefix = when (decision) {
256- CALL_DECISION_NUM -> " call[${depth} ] - " + " " .padEnd(2 * depth, ' ' )
257- RETURN_DECISION_NUM -> " ret[${depth - 1 } ] - " + " " .padEnd(2 * depth, ' ' )
258- else -> " " + " " .padEnd(2 * depth, ' ' )
265+ CALL_DECISION_NUM -> " call[${depth} ] - " + " " .padEnd(2 * depth, ' ' )
266+ RETURN_DECISION_NUM -> " ret[${depth - 1 } ] - " + " " .padEnd(2 * depth, ' ' )
267+ else -> " " + " " .padEnd(2 * depth, ' ' )
259268 }
260269 " $prefix$stmt "
261270 }
262- return " MD5(path)=${prettifiedPath.md5()} \n $prettifiedPath "
263- }
264271}
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import org.utbot.engine.Edge
44import org.utbot.engine.ExecutionState
55import org.utbot.engine.InterProceduralUnitGraph
66import org.utbot.engine.isReturn
7+ import org.utbot.engine.pathLogger
78import org.utbot.engine.stmts
89import kotlin.math.min
910import kotlinx.collections.immutable.PersistentList
@@ -38,8 +39,17 @@ class DistanceStatistics(
3839 * Drops executionState if all the edges on path are covered (with respect to uncovered
3940 * throw statements of the methods they belong to) and there is no reachable and uncovered statement.
4041 */
41- override fun shouldDrop (state : ExecutionState ) =
42- state.edges.all { graph.isCoveredWithAllThrowStatements(it) } && distanceToUncovered(state) == Int .MAX_VALUE
42+ override fun shouldDrop (state : ExecutionState ): Boolean {
43+ val shouldDrop = state.edges.all { graph.isCoveredWithAllThrowStatements(it) } && distanceToUncovered(state) == Int .MAX_VALUE
44+
45+ if (shouldDrop) {
46+ pathLogger.debug {
47+ " Dropping state (lastStatus=${state.solver.lastStatus} ) by the distance statistics. MD5: ${state.md5()} "
48+ }
49+ }
50+
51+ return shouldDrop
52+ }
4353
4454 fun isCovered (edge : Edge ): Boolean = graph.isCovered(edge)
4555
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ package org.utbot.engine.selectors.strategies
33import org.utbot.engine.Edge
44import org.utbot.engine.ExecutionState
55import org.utbot.engine.InterProceduralUnitGraph
6+ import org.utbot.engine.pathLogger
67import soot.jimple.Stmt
78import soot.jimple.internal.JReturnStmt
89import soot.jimple.internal.JReturnVoidStmt
@@ -31,7 +32,16 @@ class EdgeVisitCountingStatistics(
3132 * - all statements are already covered and execution is complete
3233 */
3334 override fun shouldDrop (state : ExecutionState ): Boolean {
34- return state.edges.all { graph.isCoveredWithAllThrowStatements(it) } && state.isComplete()
35+ val shouldDrop = state.edges.all { graph.isCoveredWithAllThrowStatements(it) } && state.isComplete()
36+
37+ if (shouldDrop) {
38+ pathLogger.debug {
39+ " Dropping state (lastStatus=${state.solver.lastStatus} ) " +
40+ " by the edge visit counting statistics. MD5: ${state.md5()} "
41+ }
42+ }
43+
44+ return shouldDrop
3545 }
3646
3747 /* *
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ package org.utbot.engine.selectors.strategies
33import org.utbot.engine.Edge
44import org.utbot.engine.ExecutionState
55import org.utbot.engine.InterProceduralUnitGraph
6+ import org.utbot.engine.pathLogger
67
78/* *
89 * Stopping strategy that suggest to stop execution
@@ -16,7 +17,13 @@ class StepsLimitStoppingStrategy(
1617 private var stepsCounter: Int = 0
1718
1819 override fun shouldStop (): Boolean {
19- return stepsCounter > stepsLimit
20+ val shouldDrop = stepsCounter > stepsLimit
21+
22+ if (shouldDrop) {
23+ pathLogger.debug { " Steps limit has been exceeded: current step limit is $stepsLimit " }
24+ }
25+
26+ return shouldDrop
2027 }
2128
2229 override fun onVisit (edge : Edge ) {
You can’t perform that action at this time.
0 commit comments