Skip to content

Commit 0f92d44

Browse files
committed
[utbot-logs]
1. Changed `bracket` signature from plain string message to lambda to remove extra interpolation when message log level is not supported 2. Added notifications in log when summarization phase started/ended.
1 parent 6bb9714 commit 0f92d44

File tree

19 files changed

+760
-757
lines changed

19 files changed

+760
-757
lines changed

utbot-cli/src/main/kotlin/org/utbot/cli/GenerateTestsAbstractCommand.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import org.utbot.framework.plugin.api.TestCaseGenerator
3232
import org.utbot.framework.plugin.api.TreatOverflowAsError
3333
import org.utbot.framework.plugin.api.UtMethodTestSet
3434
import org.utbot.framework.plugin.services.JdkInfoDefaultProvider
35-
import org.utbot.summary.summarize
35+
import org.utbot.summary.summarizeAll
3636
import java.io.File
3737
import java.net.URLClassLoader
3838
import java.nio.file.Files
@@ -161,8 +161,8 @@ abstract class GenerateTestsAbstractCommand(name: String, help: String) :
161161
mockStrategy,
162162
chosenClassesToMockAlways,
163163
generationTimeout
164-
).map {
165-
if (sourceCodeFile != null) it.summarize(searchDirectory, sourceCodeFile.toFile()) else it
164+
).let {
165+
if (sourceCodeFile != null) it.summarizeAll(searchDirectory, sourceCodeFile.toFile()) else it
166166
}
167167

168168

utbot-core/src/main/kotlin/org/utbot/common/Logging.kt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,17 @@ fun elapsedSecFrom(startNano: Long): String {
3636
* is added if non local return happened in [block]
3737
*/
3838
inline fun <T> LoggerWithLogMethod.bracket(
39-
msg: String,
39+
crossinline msgBlock: () -> String,
4040
crossinline closingComment: (Result<T>) -> Any? = { "" },
4141
block: () -> T
4242
): T {
43-
logMethod { "Started: $msg" }
43+
var msg = ""
44+
45+
logMethod {
46+
msg = msgBlock()
47+
"Started: $msg"
48+
}
49+
4450
val startNano = System.nanoTime()
4551
var alreadyLogged = false
4652

utbot-framework/src/main/kotlin/org/utbot/engine/UtBotSymbolicEngine.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ class UtBotSymbolicEngine(
230230
logger.trace { "executing $state concretely..." }
231231

232232

233-
logger.debug().bracket("concolicStrategy<$methodUnderTest>: execute concretely") {
233+
logger.debug().bracket({ "concolicStrategy<$methodUnderTest>: execute concretely"} ) {
234234
val resolver = Resolver(
235235
hierarchy,
236236
state.memory,
@@ -511,7 +511,7 @@ class UtBotSymbolicEngine(
511511
//It's possible that symbolic and concrete stateAfter/results are diverged.
512512
//So we trust concrete results more.
513513
try {
514-
logger.debug().bracket("processResult<$methodUnderTest>: concrete execution") {
514+
logger.debug().bracket({ "processResult<$methodUnderTest>: concrete execution" } ) {
515515

516516
//this can throw CancellationException
517517
val concreteExecutionResult = concreteExecutor.executeConcretely(

0 commit comments

Comments
 (0)