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(
251
251
*/
252
252
fun prettifiedPathLog (): String {
253
253
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) ->
255
264
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, ' ' )
259
268
}
260
269
" $prefix$stmt "
261
270
}
262
- return " MD5(path)=${prettifiedPath.md5()} \n $prettifiedPath "
263
- }
264
271
}
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import org.utbot.engine.Edge
4
4
import org.utbot.engine.ExecutionState
5
5
import org.utbot.engine.InterProceduralUnitGraph
6
6
import org.utbot.engine.isReturn
7
+ import org.utbot.engine.pathLogger
7
8
import org.utbot.engine.stmts
8
9
import kotlin.math.min
9
10
import kotlinx.collections.immutable.PersistentList
@@ -38,8 +39,17 @@ class DistanceStatistics(
38
39
* Drops executionState if all the edges on path are covered (with respect to uncovered
39
40
* throw statements of the methods they belong to) and there is no reachable and uncovered statement.
40
41
*/
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
+ }
43
53
44
54
fun isCovered (edge : Edge ): Boolean = graph.isCovered(edge)
45
55
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ package org.utbot.engine.selectors.strategies
3
3
import org.utbot.engine.Edge
4
4
import org.utbot.engine.ExecutionState
5
5
import org.utbot.engine.InterProceduralUnitGraph
6
+ import org.utbot.engine.pathLogger
6
7
import soot.jimple.Stmt
7
8
import soot.jimple.internal.JReturnStmt
8
9
import soot.jimple.internal.JReturnVoidStmt
@@ -31,7 +32,16 @@ class EdgeVisitCountingStatistics(
31
32
* - all statements are already covered and execution is complete
32
33
*/
33
34
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
35
45
}
36
46
37
47
/* *
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ package org.utbot.engine.selectors.strategies
3
3
import org.utbot.engine.Edge
4
4
import org.utbot.engine.ExecutionState
5
5
import org.utbot.engine.InterProceduralUnitGraph
6
+ import org.utbot.engine.pathLogger
6
7
7
8
/* *
8
9
* Stopping strategy that suggest to stop execution
@@ -16,7 +17,13 @@ class StepsLimitStoppingStrategy(
16
17
private var stepsCounter: Int = 0
17
18
18
19
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
20
27
}
21
28
22
29
override fun onVisit (edge : Edge ) {
You can’t perform that action at this time.
0 commit comments