Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
4da0878
merge
DaniilStepanov Nov 9, 2022
9fa553a
mocks generation
DaniilStepanov Nov 15, 2022
390d805
remove shrinker
Saloed Nov 10, 2022
d823f29
Rename .java to .kt
Saloed Nov 10, 2022
1343666
rewrite quickcheck on Kotlin
Saloed Nov 10, 2022
854c790
Rename .java to .kt
DaniilStepanov Nov 15, 2022
4d374c7
this instance rewriting
DaniilStepanov Nov 15, 2022
3157025
Added mutations
DaniilStepanov Nov 22, 2022
14604b4
minor
DaniilStepanov Nov 22, 2022
c5f5ae2
New seed selection strategy and time budget for generation
DaniilStepanov Nov 29, 2022
1dbcde7
refactoring and fixes
DaniilStepanov Dec 1, 2022
3452621
m
DaniilStepanov Dec 1, 2022
8240554
UnsafeBasedInstanceGenerator done
DaniilStepanov Dec 6, 2022
ad5af5d
Mutator refactorings
DaniilStepanov Dec 6, 2022
9e0ac70
minor
DaniilStepanov Dec 6, 2022
09343b0
Contest mode is done
DaniilStepanov Dec 19, 2022
3a86fd6
merge
DaniilStepanov Dec 19, 2022
1de5db5
constants collector
DaniilStepanov Dec 19, 2022
5fb1090
removed unnecessary files
DaniilStepanov Dec 19, 2022
1cc03c3
bug fixes
DaniilStepanov Dec 20, 2022
7eab043
removing fuzzer executor
DaniilStepanov Dec 20, 2022
3018dd7
Global refactorings
DaniilStepanov Dec 28, 2022
2bc68a0
minor
DaniilStepanov Dec 28, 2022
bbb34cd
minor fixes
DaniilStepanov Dec 28, 2022
4f77b79
minor
DaniilStepanov Dec 28, 2022
dd16ada
Fixed nested classes generation
DaniilStepanov Jan 13, 2023
ddaf943
fixes to contest
DaniilStepanov Jan 18, 2023
554a9c9
Mock renderer added
DaniilStepanov Jan 19, 2023
04fe674
fixes
DaniilStepanov Jan 24, 2023
7392e6d
rebase
DaniilStepanov Jan 24, 2023
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
bug fixes
  • Loading branch information
DaniilStepanov committed Jan 24, 2023
commit 1cc03c3c2173dad1ed6d80815c2fe6dd61c59928
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class GreyBoxFuzzer(
var regenerateThis = false
val thisInstancesHistory = ArrayDeque<ThisInstance>()
val startTime = System.currentTimeMillis()
val endTime = startTime + timeBudgetInMillis / percentageOfTimeBudgetToChangeMode
val endTime = startTime + timeBudgetInMillis / (100L / percentageOfTimeBudgetToChangeMode)
var iterationNumber = 0
while (System.currentTimeMillis() < endTime) {
try {
Expand Down Expand Up @@ -160,7 +160,7 @@ class GreyBoxFuzzer(
if (seeds == null || seeds!!.seedsSize() == 0) return
if (seeds!!.all { it.parameters.isEmpty() }) return
val startTime = System.currentTimeMillis()
val endTime = startTime + timeBudgetInMillis / percentageOfTimeBudgetToChangeMode
val endTime = startTime + timeBudgetInMillis / (100L / percentageOfTimeBudgetToChangeMode)
var iterationNumber = 0
while (System.currentTimeMillis() < endTime) {
if (timeRemain < 0 || isMethodCovered()) return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ object GeneratorConfigurator {
private val maxDouble: Double = 100.0
private val minStringLength: Int = 1
private val maxStringLength: Int = 5
val minCollectionSize: Int = 1
val minCollectionSize: Int = 0
val maxCollectionSize: Int = 5

val sizeAnnotationInstance: Size
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import org.utbot.engine.greyboxfuzzer.quickcheck.generator.GeneratorContext
import org.utbot.engine.greyboxfuzzer.quickcheck.internal.FakeAnnotatedTypeFactory
import org.utbot.engine.greyboxfuzzer.quickcheck.internal.ParameterTypeContext
import org.utbot.engine.greyboxfuzzer.quickcheck.internal.generator.ArrayGenerator
import org.utbot.engine.greyboxfuzzer.quickcheck.internal.generator.CompositeGenerator
import org.utbot.engine.greyboxfuzzer.quickcheck.internal.generator.GeneratorRepository
import ru.vyarus.java.generics.resolver.GenericsResolver
import ru.vyarus.java.generics.resolver.context.ConstructorGenericsContext
Expand All @@ -41,6 +42,7 @@ fun Generator.getComponents(): List<Generator> =
when (this) {
is org.utbot.engine.greyboxfuzzer.quickcheck.generator.ComponentizedGenerator -> this.componentGenerators()
is ArrayGenerator -> listOf(this.component)
is CompositeGenerator -> this.composed.map { it.item }
else -> emptyList()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package org.utbot.engine.greyboxfuzzer.mutator

import kotlin.random.Random

class SeedCollector(private val maxSize: Int = 50, private val methodInstructionsIds: Set<Long>) {
class SeedCollector(private val maxSize: Int = 100, private val methodInstructionsIds: Set<Long>) {
private val seeds = ArrayList<Seed>(maxSize)

fun calcSeedScore(coverage: Set<Long>): Double =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import java.util.Collections
* @param type class token for type of property parameter this generator
* is applicable to
</T> */
abstract class ComponentizedGenerator constructor(type: Class<*>) : org.utbot.engine.greyboxfuzzer.quickcheck.generator.Generator(type) {
private val components: MutableList<org.utbot.engine.greyboxfuzzer.quickcheck.generator.Generator> = ArrayList()
abstract class ComponentizedGenerator constructor(type: Class<*>) : Generator(type) {
private val components: MutableList<Generator> = ArrayList()

/**
* {@inheritDoc}
Expand All @@ -35,7 +35,7 @@ abstract class ComponentizedGenerator constructor(type: Class<*>) : org.utbot.en
}

override fun addComponentGenerators(
newComponents: List<org.utbot.engine.greyboxfuzzer.quickcheck.generator.Generator>
newComponents: List<Generator>
) {
require(newComponents.size == numberOfNeededComponents()) {
String.format(
Expand Down Expand Up @@ -89,12 +89,12 @@ abstract class ComponentizedGenerator constructor(type: Class<*>) : org.utbot.en
/**
* @return this generator's component generators
*/
fun componentGenerators(): List<org.utbot.engine.greyboxfuzzer.quickcheck.generator.Generator> {
fun componentGenerators(): List<Generator> {
return Collections.unmodifiableList(components)
}

override fun copy(): org.utbot.engine.greyboxfuzzer.quickcheck.generator.Generator {
return (super.copy() as org.utbot.engine.greyboxfuzzer.quickcheck.generator.ComponentizedGenerator).also {
override fun copy(): Generator {
return (super.copy() as ComponentizedGenerator).also {
it.components.addAll(components.map { it.copy() })
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ abstract class Generator protected constructor(types: List<Class<*>>) : Gen {
return when (generationState) {
GenerationState.REGENERATE -> {
val possibleConstant =
if (Random.getTrue(20)) {
if (Random.getTrue(25)) {
getConstant()
} else null
(possibleConstant ?: generate(random, status)).also {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import org.utbot.engine.greyboxfuzzer.quickcheck.random.SourceOfRandomness
*
* @param <T> the type of collection generated
</T> */
abstract class CollectionGenerator(type: Class<*>) : org.utbot.engine.greyboxfuzzer.quickcheck.generator.ComponentizedGenerator(type) {
abstract class CollectionGenerator(type: Class<*>) : ComponentizedGenerator(type) {
private var sizeRange: Size? = null
private var distinct = false

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import java.lang.reflect.AnnotatedElement
import java.lang.reflect.AnnotatedType

class CompositeGenerator(composed: List<Weighted<Generator>>) : Generator(Any::class.java) {
private val composed: MutableList<Weighted<Generator>>
val composed: MutableList<Weighted<Generator>>
private var previousChosenGenerator: Generator? = null

init {
Expand Down Expand Up @@ -122,10 +122,11 @@ class CompositeGenerator(composed: List<Weighted<Generator>>) : Generator(Any::c

override fun copy(): Generator {
val composedCopies = composed.map { Weighted(it.item.copy(), it.weight) }.toMutableList()
val gen = Reflection.instantiate(CompositeGenerator::class.java.constructors.first(), composedCopies) as Generator
val gen = Reflection.instantiate(CompositeGenerator::class.java.constructors.first(), composedCopies) as CompositeGenerator
return gen.also {
it.generatedUtModel = generatedUtModel
it.generationState = generationState
it.generatorContext = generatorContext
it.nestedGenerators = nestedGenerators.map { it.copy() }.toMutableList()
GeneratorConfigurator.configureGenerator(it, 100)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ object UtBotJavaApi {
generationTimeoutInMillis,
generate = { symbolicEngine ->
if (isGreyBoxFuzzing) {
symbolicEngine.greyBoxFuzzing()
symbolicEngine.greyBoxFuzzing(generationTimeoutInMillis)
} else {
symbolicEngine.fuzzing { defaultModelProvider ->
customModelProvider.withFallback(defaultModelProvider)
Expand Down