Skip to content

Commit 9f5138a

Browse files
authored
Merge pull request #1492 from WebFuzzing/fix-bug-flaky-inference
Fix bug flaky inference
2 parents b3c6ca5 + 604f9b0 commit 9f5138a

3 files changed

Lines changed: 18 additions & 3 deletions

File tree

core-tests/e2e-tests/spring/spring-rest-openapi-v3/src/main/kotlin/com/foo/rest/examples/spring/openapi/v3/flakinessdetect/FlakinessDetectRest.kt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import org.springframework.web.bind.annotation.RequestParam
99
import org.springframework.web.bind.annotation.RestController
1010
import java.time.LocalDateTime
1111
import java.time.format.DateTimeFormatter
12+
import java.util.UUID
1213
import kotlin.math.abs
1314
import kotlin.math.max
1415
import kotlin.math.min
@@ -19,6 +20,18 @@ class FlakinessDetectRest {
1920

2021
companion object{
2122
val formatter = DateTimeFormatter.ofPattern("HH:mm:ss.SSS yyyy-MM-dd EEEE 'Week' ww")
23+
private val START_UP_OBJECT_TAG = arrayOf(javax.validation.constraints.Pattern.Flag.CASE_INSENSITIVE).toString()
24+
}
25+
@GetMapping(path = ["/objectFlag"])
26+
fun getEmptyFlag() : ResponseEntity<String> {
27+
28+
return ResponseEntity.ok(START_UP_OBJECT_TAG)
29+
}
30+
31+
@GetMapping(path = ["/stringuuid"])
32+
fun getStringuuid() : ResponseEntity<String>{
33+
34+
return ResponseEntity.ok( UUID.randomUUID().toString())
2235
}
2336

2437
@GetMapping(path = ["/stringfirst/{n}"])
@@ -89,3 +102,5 @@ data class TimeAgoData(
89102
val message: String,
90103
val calculatedPastTime: String
91104
)
105+
106+
class EmptyForFlag(val flag: String)

core/src/main/kotlin/org/evomaster/core/search/service/FlakinessDetector.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ class FlakinessDetector<T: Individual> : TimeBoxedPhase {
119119
} else {
120120
val normO = derive(oBody)
121121
if (rBody != normO) {
122-
resultToUpdate.setFlakyBody(oBody)
122+
resultToUpdate.setFlakyBody(normO)
123123
}
124124
}
125125
}
@@ -147,7 +147,7 @@ class FlakinessDetector<T: Individual> : TimeBoxedPhase {
147147
*/
148148
val normO = derive(oMsg)
149149
if (rMsg != normO) {
150-
resultToUpdate.setFlakyErrorMessage(oMsg)
150+
resultToUpdate.setFlakyErrorMessage(normO)
151151
}
152152
}
153153
}

core/src/main/kotlin/org/evomaster/core/utils/FlakinessInferenceUtil.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ object FlakinessInferenceUtil {
6666
/**
6767
* Match JVM object toString like com.foo.Bar@1a2b3c.
6868
*/
69-
private val OBJECT_AT_REGEX = Regex("[A-Za-z0-9_.$]+@[0-9a-fA-F]+")
69+
private val OBJECT_AT_REGEX = Regex("""[\[A-Za-z0-9_.$;]+@[0-9a-fA-F]+""")
7070

7171
/**
7272
* Match hex pointers like 0x1a2b3c.

0 commit comments

Comments
 (0)