Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
1175678
squash constraint model synthesis
AbdullinAM Sep 28, 2022
d69ebc4
squash constraint model synthesis
AbdullinAM Sep 28, 2022
8d68488
resolver fix
AbdullinAM Sep 29, 2022
c6cac8d
model based post condition constructor restored
AbdullinAM Sep 29, 2022
df75f26
very primitive global timeoutfor synthesis
AbdullinAM Oct 11, 2022
e10a50e
Primitive Stream wrappers (no laziness and source mutations support) …
Damtev Sep 28, 2022
80da28b
Avoid summary duplication #985 (#1015)
onewhl Sep 28, 2022
608d56c
Fix bug in filtering Kotlin getters/setters in plugin (#1026)
volivan239 Sep 28, 2022
1f59106
Reordered the test clusters (#991)
amandelpie Sep 30, 2022
f96c118
Fix build directory for classes from Kotlin files (#1019)
volivan239 Sep 30, 2022
40bf31b
Improve choosing between simpleName and canonicalName in rendered cod…
EgorkaKulikov Sep 30, 2022
3380506
Run tests on `push` into release branches (#1045)
viktoriia-fomina Sep 30, 2022
234ace0
Fix utbot-maven compilation (#1049)
dtim Oct 1, 2022
1a0289d
Support AssertionError in SARIF report (#1032)
mmvpm Oct 3, 2022
7b417c9
Render links in the invokes part of JavaDocs (#1051)
onewhl Oct 3, 2022
0cedf7a
Improve fuzzer recursive model providers (#1039)
Markoutte Oct 3, 2022
4293d4f
IndexNotReadyException thrown in IDEA with installed UnitTestBot plug…
Vassiliy-Kudryashov Oct 3, 2022
a5d628c
Publish without workflow run number (#1053)
viktoriia-fomina Oct 3, 2022
ba08cb7
Modificators processing in AssembleModelGenerator and UtBotFieldModif…
EgorkaKulikov Oct 3, 2022
ae5b883
Gradle cache usage added #974 (#998)
bissquit Oct 4, 2022
b6d8a65
Try to fix memory leak in CgComponents (#1057)
EgorkaKulikov Oct 4, 2022
77194a3
Repeating SourceFolder fix (#1073)
Domonion Oct 4, 2022
0ff62da
Include information about triggered recursion to Javadocs (#1084)
onewhl Oct 4, 2022
e5d8b5f
Fix rendering for different IDE versions (#1087)
onewhl Oct 4, 2022
8016349
Fixed unavailable mock classes (#1066)
Damtev Oct 5, 2022
f55c96d
Engine process #2 (#1067)
Domonion Oct 5, 2022
f3af058
Remove unsat states from invokes (#1071)
CaelmBleidd Oct 5, 2022
e298169
Settings revision, 2nd iteration #977 (#1088)
Vassiliy-Kudryashov Oct 5, 2022
5a690b9
Fix soot initialization (#1090)
sergeypospelov Oct 5, 2022
cd3dcd1
Improve verification that static mocking is configured (#1091)
EgorkaKulikov Oct 5, 2022
b067af9
Fix assertions (#1096)
SBOne-Kenobi Oct 5, 2022
43efb96
Cancel test generation if compilation was not successful #1100 (#1103)
volivan239 Oct 5, 2022
bf272b6
Vassiliy kudryashov/1021 plugin support idea 20222 new (#1094)
Vassiliy-Kudryashov Oct 5, 2022
fc61391
Wrap method reference into @link tag only if the invoked method is no…
onewhl Oct 6, 2022
4ce788d
Notify and reason to the user that UtBot can't be run on the class in…
EgorkaKulikov Oct 6, 2022
0abc48b
Make snapshot version calendar-dependant (#1108)
Vassiliy-Kudryashov Oct 6, 2022
a215477
We create temporary files a lot, we have to clean it either (#1089)
Vassiliy-Kudryashov Oct 7, 2022
8280807
Get PsiClass' package by declaration in containingFile and not by its…
volivan239 Oct 7, 2022
8fb3938
Out of process bug fixes (#1109)
Domonion Oct 7, 2022
5fb1e16
Plugin setting to choose Kotlin generation doesn't work #1075 (#1110)
Vassiliy-Kudryashov Oct 7, 2022
ad150ba
Lessen thisInstance creation in parameterized test generation (#1065)
sofurihafe Oct 7, 2022
2f03687
Fix settings persistence: we save IDs, thus we should parse IDs inste…
Vassiliy-Kudryashov Oct 7, 2022
15bdfa8
Support Android Studio in utbot-intellij (#1121)
EgorkaKulikov Oct 10, 2022
166b393
Select Kotlin test src root by default when generating for Kotlin #94…
volivan239 Oct 10, 2022
c7618bb
Filter generated sources in Android Studio projects #692 (#1123)
EgorkaKulikov Oct 10, 2022
5479449
Exclude mocking javax (#1124)
SBOne-Kenobi Oct 10, 2022
06c548e
Linux engine process fix (#1126)
Domonion Oct 10, 2022
7e71d75
Android Studio troubleshooting related to Lombok improved (#1131)
EgorkaKulikov Oct 11, 2022
1a18c53
Other class is not mocked as required #747 (#1033)
Markoutte Oct 11, 2022
d1bea97
Add parameterized test generation in CI (#1114)
sofurihafe Oct 11, 2022
5181cef
Fix static mocking (#1142)
SBOne-Kenobi Oct 12, 2022
4706d1b
Added simple custom JavaDocs for the tests produced by Fuzzer (#1069)
amandelpie Oct 12, 2022
d36b988
Concrete execution fails for a static method using a static field #71…
Markoutte Oct 12, 2022
a55999d
Field assertions fixes (#920)
Damtev Oct 12, 2022
529c10d
Fix dump mode fail (#1146)
Domonion Oct 13, 2022
4470ea8
Refactor Sarif reports (#1152)
mmvpm Oct 13, 2022
d4cb666
Publish plugin and CLI for minor release (#1155)
viktoriia-fomina Oct 14, 2022
cad8133
Fixing long summarization timeouts & mics (#1151)
Domonion Oct 14, 2022
724b794
squash constraint model synthesis
AbdullinAM Sep 28, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Improve fuzzer recursive model providers (#1039)
  • Loading branch information
Markoutte authored and AbdullinAM committed Oct 17, 2022
commit 0cedf7a1fa0d340b1c9be2cf15cd74e3afd2bc71
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,28 @@ import org.utbot.fuzzer.fuzzNumbers

class ArrayModelProvider(
idGenerator: IdentityPreservingIdGenerator<Int>,
recursionDepthLeft: Int = 1
recursionDepthLeft: Int = 2
) : RecursiveModelProvider(idGenerator, recursionDepthLeft) {

override fun newInstance(parentProvider: RecursiveModelProvider): RecursiveModelProvider =
ArrayModelProvider(parentProvider.idGenerator, parentProvider.recursionDepthLeft - 1)
.copySettings(parentProvider)
override fun newInstance(parentProvider: RecursiveModelProvider, constructor: ModelConstructor): RecursiveModelProvider {
val provider = ArrayModelProvider(parentProvider.idGenerator, parentProvider.recursionDepthLeft - 1)
provider.copySettings(parentProvider)
provider.totalLimit = minOf(parentProvider.totalLimit, constructor.limit)
return provider
}

override fun generateModelConstructors(
description: FuzzedMethodDescription,
parameterIndex: Int,
classId: ClassId,
): Sequence<ModelConstructor> = sequence {
if (!classId.isArray) return@sequence
val lengths = fuzzNumbers(description.concreteValues, 0, 3) { it in 1..10 }
val lengths = fuzzNumbers(description.concreteValues, 0, 3) { it in 1..10 }.toList()
lengths.forEach { length ->
yield(ModelConstructor(listOf(FuzzedType(classId.elementClassId!!)), repeat = length) { values ->
createFuzzedArrayModel(classId, length, values.map { it.model } )
}.apply {
limit = (totalLimit / lengths.size).coerceAtLeast(1)
})
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import org.utbot.fuzzer.objects.create

class CollectionWithModificationModelProvider(
idGenerator: IdentityPreservingIdGenerator<Int>,
recursionDepthLeft: Int = 1,
recursionDepthLeft: Int = 2,
private var defaultModificationCount: IntArray = intArrayOf(0, 1, 3)
) : RecursiveModelProvider(idGenerator, recursionDepthLeft) {

Expand Down Expand Up @@ -55,7 +55,7 @@ class CollectionWithModificationModelProvider(
)
private var modificationCount = 7

override fun newInstance(parentProvider: RecursiveModelProvider): RecursiveModelProvider {
override fun newInstance(parentProvider: RecursiveModelProvider, constructor: ModelConstructor): RecursiveModelProvider {
val newInstance = CollectionWithModificationModelProvider(
parentProvider.idGenerator, parentProvider.recursionDepthLeft - 1
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ import org.utbot.fuzzer.objects.assembleModel
*/
class ObjectModelProvider(
idGenerator: IdentityPreservingIdGenerator<Int>,
recursionDepthLeft: Int = 1,
recursionDepthLeft: Int = 2,
) : RecursiveModelProvider(idGenerator, recursionDepthLeft) {
override fun newInstance(parentProvider: RecursiveModelProvider): RecursiveModelProvider {
override fun newInstance(parentProvider: RecursiveModelProvider, constructor: ModelConstructor): RecursiveModelProvider {
val newInstance = ObjectModelProvider(parentProvider.idGenerator, parentProvider.recursionDepthLeft - 1)
newInstance.copySettings(parentProvider)
newInstance.branchingLimit = 1
Expand All @@ -62,9 +62,9 @@ class ObjectModelProvider(
)

constructors.forEach { constructorId ->
yield(ModelConstructor(constructorId.parameters.map { classId -> FuzzedType(classId) }) {
assembleModel(idGenerator.createId(), constructorId, it)
})
// When branching limit = 1 this block tries to create new values
// and mutate some fields. Only if there's no option next block
// with empty constructor should be used.
if (constructorId.parameters.isEmpty()) {
val fields = findSuitableFields(constructorId.classId, description)
if (fields.isNotEmpty()) {
Expand All @@ -75,6 +75,9 @@ class ObjectModelProvider(
)
}
}
yield(ModelConstructor(constructorId.parameters.map { classId -> FuzzedType(classId) }) {
assembleModel(idGenerator.createId(), constructorId, it)
})
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ abstract class RecursiveModelProvider(
/**
* Creates instance of the class on which it is called, assuming that it will be called recursively from [parentProvider]
*/
protected abstract fun newInstance(parentProvider: RecursiveModelProvider): RecursiveModelProvider
protected abstract fun newInstance(parentProvider: RecursiveModelProvider, constructor: ModelConstructor): RecursiveModelProvider

/**
* Creates [ModelProvider]s that will be used to generate values recursively. The order of elements in returned list is important:
Expand Down Expand Up @@ -101,16 +101,16 @@ abstract class RecursiveModelProvider(
neededTypes[index % neededTypes.size] // because we can repeat neededTypes several times
}
}
return fuzz(syntheticMethodDescription, nextModelProvider())
return fuzz(syntheticMethodDescription, nextModelProvider(this))
.map { createModel(it) }
.take(limit)
}

private fun nextModelProvider(): ModelProvider =
private fun nextModelProvider(constructor: ModelConstructor): ModelProvider =
if (recursionDepthLeft > 0) {
modelProviderForRecursiveCalls.map {
if (it is RecursiveModelProvider) {
it.newInstance(this)
it.newInstance(this, constructor)
} else { it }
}
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ class ModelProviderTest {

withUtContext(UtContext(this::class.java.classLoader)) {
val result = collect(
ObjectModelProvider(ReferencePreservingIntIdGenerator(0)),
ObjectModelProvider(ReferencePreservingIntIdGenerator(0), recursionDepthLeft = 1),
parameters = listOf(MyA::class.java.id)
)
assertEquals(1, result.size)
Expand Down Expand Up @@ -478,14 +478,14 @@ class ModelProviderTest {
)

withUtContext(UtContext(this::class.java.classLoader)) {
val result = collect(ObjectModelProvider(ReferencePreservingIntIdGenerator(0)).apply {
val result = collect(ObjectModelProvider(ReferencePreservingIntIdGenerator(0), recursionDepthLeft = 1).apply {
modelProviderForRecursiveCalls = PrimitiveDefaultsModelProvider
}, parameters = listOf(FieldSetterClass::class.java.id))
assertEquals(1, result.size)
assertEquals(2, result[0]!!.size)
assertEquals(0, (result[0]!![0] as UtAssembleModel).modificationsChain.size) { "One of models must be without any modifications" }
assertEquals(0, (result[0]!![1] as UtAssembleModel).modificationsChain.size) { "One of models must be without any modifications" }
val expectedModificationSize = 3
val modificationsChain = (result[0]!![1] as UtAssembleModel).modificationsChain
val modificationsChain = (result[0]!![0] as UtAssembleModel).modificationsChain
val actualModificationSize = modificationsChain.size
assertEquals(expectedModificationSize, actualModificationSize) { "In target class there's only $expectedModificationSize fields that can be changed, but generated $actualModificationSize modifications" }

Expand Down Expand Up @@ -513,10 +513,10 @@ class ModelProviderTest {
}
assertEquals(1, result.size)
assertEquals(3, result[0]!!.size)
assertEquals(0, (result[0]!![0] as UtAssembleModel).modificationsChain.size) { "One of models must be without any modifications" }
assertEquals(0, (result[0]!![2] as UtAssembleModel).modificationsChain.size) { "Modification by constructor doesn't change fields" }
assertEquals(0, (result[0]!![2] as UtAssembleModel).modificationsChain.size) { "One of models must be without any modifications" }
assertEquals(0, (result[0]!![1] as UtAssembleModel).modificationsChain.size) { "Modification by constructor doesn't change fields" }
val expectedModificationSize = 1
val modificationsChain = (result[0]!![1] as UtAssembleModel).modificationsChain
val modificationsChain = (result[0]!![0] as UtAssembleModel).modificationsChain
val actualModificationSize = modificationsChain.size
assertEquals(expectedModificationSize, actualModificationSize) { "In target class there's only $expectedModificationSize fields that can be changed, but generated $actualModificationSize modifications" }

Expand Down