Skip to content

Commit a7a1f39

Browse files
minor
1 parent a226ed1 commit a7a1f39

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
lines changed

utbot-framework/src/main/kotlin/org/utbot/framework/concrete/UtFuzzingExecutionInstrumentation.kt

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.utbot.framework.concrete
22

3+
import org.objectweb.asm.Type
34
import org.utbot.framework.concrete.constructors.ConstructOnlyUserClassesOrCachedObjectsStrategy
45
import org.utbot.framework.concrete.mock.InstrumentationContext
56
import org.utbot.framework.concrete.phases.PhaseError
@@ -62,7 +63,7 @@ object UtFuzzingExecutionInstrumentation : UtExecutionInstrumentationWithStatsCo
6263

6364
// statistics collection
6465
val coverage = statisticsCollectionContext.start { getCoverage(clazz) }.toLocalCoverage(traceHandler)
65-
val classJVMName = clazz.name.replace('.', '/')
66+
val classJVMName = Type.getInternalName(clazz)
6667
val methodInstructions =
6768
traceHandler.processingStorage.getMethodInstructions(classJVMName, methodSignature)
6869

@@ -140,7 +141,7 @@ object UtFuzzingExecutionInstrumentationWithStateAfterCollection : UtExecutionIn
140141

141142
// statistics collection
142143
val coverage = statisticsCollectionContext.start { getCoverage(clazz) }.toLocalCoverage(traceHandler)
143-
val classJVMName = clazz.name.replace('.', '/')
144+
val classJVMName = Type.getInternalName(clazz)
144145
val methodInstructions =
145146
traceHandler.processingStorage.getMethodInstructions(classJVMName, methodSignature)
146147

utbot-greyboxfuzzer/src/main/kotlin/org/utbot/greyboxfuzzer/GreyBoxFuzzer.kt

+3-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package org.utbot.greyboxfuzzer
33
import kotlinx.coroutines.flow.FlowCollector
44
import kotlinx.coroutines.flow.flow
55
import mu.KotlinLogging
6+
import org.objectweb.asm.Type
67
import org.utbot.framework.plugin.api.*
78
import org.utbot.framework.plugin.api.util.isConstructor
89
import org.utbot.framework.plugin.api.util.isStatic
@@ -242,7 +243,7 @@ class GreyBoxFuzzer(
242243
): Set<Instruction> {
243244
val currentMethodCoverage = coverage.coveredInstructions
244245
.asSequence()
245-
.filter { it.className == methodUnderTest.classId.name.replace('.', '/') }
246+
.filter { it.className == Type.getInternalName(methodUnderTest.classId.jClass) }
246247
.filter { it.methodSignature == methodUnderTest.signature }
247248
// .map { it.id }
248249
//.filter { it in methodInstructionsIds!! }
@@ -256,7 +257,7 @@ class GreyBoxFuzzer(
256257
methodInstructions ?: return false
257258
val coveredInstructions =
258259
CoverageCollector.coverage
259-
.filter { it.className == methodUnderTest.classId.name.replace('.', '/') }
260+
.filter { it.className == Type.getInternalName(methodUnderTest.classId.jClass) }
260261
.filter { it.methodSignature == methodUnderTest.signature }
261262
.toSet()
262263
return coveredInstructions.containsAll(methodInstructions!!)

utbot-greyboxfuzzer/src/main/kotlin/org/utbot/greyboxfuzzer/util/GreyBoxFuzzingStatisticPrinter.kt

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
package org.utbot.greyboxfuzzer.util
22

3+
import org.objectweb.asm.Type
34
import org.utbot.framework.plugin.api.ExecutableId
45
import org.utbot.framework.plugin.api.UtExecution
6+
import org.utbot.framework.plugin.api.util.jClass
57

68
object GreyBoxFuzzingStatisticPrinter {
79

@@ -16,7 +18,7 @@ object GreyBoxFuzzingStatisticPrinter {
1618
for ((method, instructions) in methodsToInstructionsNumbers) {
1719
val coveredMethodInstructions = CoverageCollector.coverage
1820
.asSequence()
19-
.filter { it.className == method.classId.name.replace('.', '/') }
21+
.filter { it.className == Type.getInternalName(method.classId.jClass) }
2022
.filter { it.methodSignature == method.signature }
2123
.toSet()
2224
val coveredMethodLines = coveredMethodInstructions.map { it.lineNumber }.toSet()

utbot-junit-contest/src/main/kotlin/org/utbot/contest/GreyBoxFuzzerContest.kt

+1-4
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,7 @@ class GreyBoxFuzzerContest {
105105
var testsCounter = 0
106106
for (test in testSet) {
107107
val method = test.method
108-
val statsForMethod = StatsForMethod(
109-
"${method.classId.simpleName}#${method.name}#${method.signature}",
110-
Type.getInternalName(method.classId.jClass)
111-
)
108+
val statsForMethod = StatsForMethod("${method.classId.simpleName}#${method.name}")
112109
statsForClass.statsForMethods.add(statsForMethod)
113110
for (result in test.executions) {
114111
try {

0 commit comments

Comments
 (0)