Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
e2e53f2
Convert 'UTSettings.kt' into '.utbot/settings.properties'
Vassiliy-Kudryashov Nov 17, 2022
0fc356d
Parsing UtSettings.kt line by line to get name, type, possible values…
Vassiliy-Kudryashov Nov 17, 2022
e397cda
Misprint
Vassiliy-Kudryashov Nov 17, 2022
bfda1de
Grade task "generateConfigTemplate"
Vassiliy-Kudryashov Nov 18, 2022
5e567df
Add TODOs for myself
Vassiliy-Kudryashov Nov 18, 2022
e5b879c
Implementation of added TODOs
Vassiliy-Kudryashov Nov 20, 2022
8a39fc2
Compact one-line documentation in output file for enum values
Vassiliy-Kudryashov Nov 21, 2022
02cc183
Add Apache 2.0 license to settings.properties output and tune comment…
Vassiliy-Kudryashov Nov 22, 2022
b2a4581
Add generated template to keep is in repository as well
Vassiliy-Kudryashov Nov 22, 2022
52c60b7
Add template generation to gradle build process
Vassiliy-Kudryashov Nov 23, 2022
bc40dbf
Get rid of unused property timeslotForOneToplevelMethodTraversalMs (W…
Vassiliy-Kudryashov Nov 24, 2022
8ab1578
Add AbstractSettings.areCustomized() ability to tell template from us…
Vassiliy-Kudryashov Nov 24, 2022
7cc19c0
Fix misprints in Apache license text.
Vassiliy-Kudryashov Nov 24, 2022
5c83685
Merge branch 'main' into Vassiliy-Kudryashov/experiments
Vassiliy-Kudryashov Nov 25, 2022
2b9373d
Merge branch 'main' into Vassiliy-Kudryashov/experiments
Vassiliy-Kudryashov Nov 25, 2022
aee42d6
Merge branch 'main' into Vassiliy-Kudryashov/experiments
Vassiliy-Kudryashov Nov 28, 2022
5c1328f
Fix an issue with always-default settings state.
Vassiliy-Kudryashov Dec 2, 2022
270aa3c
Fix a misprint in UtSettings property name "treatAssertAsErrorSuite"
Vassiliy-Kudryashov Dec 2, 2022
bd6dde8
Merge branch 'main' into Vassiliy-Kudryashov/experiments
Vassiliy-Kudryashov Dec 2, 2022
b6e4ea7
Fix a misprint in UtSettings property name "treatAssertAsErrorSuite"
Vassiliy-Kudryashov Dec 2, 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
Compact one-line documentation in output file for enum values
Split Single description for bunch options to dedicated ones in code
Get rid of default value description in code
Skip <a href... lines
Support both var/val options
Add empty lines between description/enum values/default to make output more user-friendly
  • Loading branch information
Vassiliy-Kudryashov committed Nov 21, 2022
commit 8a39fc2768e80b95b6cf0903b3c96612a096b0b1
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ object UtSettings : AbstractSettings(
/**
* Setting to disable coroutines debug explicitly.
*
* True by default, set it to false if debug info is required.
* Set it to false if debug info is required.
*/
var disableCoroutinesDebug: Boolean by getBooleanProperty(true)

Expand Down Expand Up @@ -87,7 +87,7 @@ object UtSettings : AbstractSettings(
/**
* Use debug visualization.
*
* False by default, set it to true if debug visualization is needed.
* Set it to true if debug visualization is needed.
*/
var useDebugVisualization by getBooleanProperty(false)

Expand All @@ -101,31 +101,35 @@ object UtSettings : AbstractSettings(

/**
* Set the value to true to show library classes' graphs in visualization.
*
* False by default.
*/
val showLibraryClassesInVisualization by getBooleanProperty(false)

/**
* Method is paused after this timeout to give an opportunity other methods
* to work
* Method is paused after this timeout to give an opportunity other methods to work
*/
var timeslotForOneToplevelMethodTraversalMs by getIntProperty(2000)

/**
* Use simplification of UtExpressions.
*
* True by default, set it to false to disable expression simplification.
* @see <a href="CONFLUENCE:UtBot+Expression+Optimizations">
* UtBot Expression Optimizations</a>
* Set it to false to disable expression simplification.
* @see <a href="CONFLUENCE:UtBot+Expression+Optimizations">UtBot Expression Optimizations</a>
*/
var useExpressionSimplification by getBooleanProperty(true)

/*
* Activate or deactivate tests on comments && names/displayNames
* */
/**
* Activate or deactivate tests on comments
*/
var testSummary by getBooleanProperty(true)

/**
* Activate or deactivate tests on names
*/
var testName by getBooleanProperty(true)

/**
* Activate or deactivate tests on displayNames
*/
var testDisplayName by getBooleanProperty(true)

/**
Expand All @@ -135,26 +139,31 @@ object UtSettings : AbstractSettings(

/**
* Enable the Summarization module to generate summaries for methods under test.
* True by default.
*
* Note: if it is false, all the execution for a particular method will be stored at the same nameless region.
*/
var enableSummariesGeneration by getBooleanProperty(true)

/**
* Options below regulate which [NullPointerException] check should be performed.
* This option regulates which [NullPointerException] check should be performed for nested methods.
*
* Set an option in true if you want to perform NPE check in the corresponding situations, otherwise set false.
*/
var checkNpeInNestedMethods by getBooleanProperty(true)

/**
* This option regulates which [NullPointerException] check should be performed for nested not private methods.
*
* Set an option in true if you want to perform NPE check in the corresponding situations, otherwise set false.
*/
var checkNpeInNestedNotPrivateMethods by getBooleanProperty(false)

/**
* This option determines whether we should generate [NullPointerException] checks for final or non-public fields
* in non-application classes. Set by true, this option highly decreases test's readability in some cases
* because of using reflection API for setting final/non-public fields in non-application classes.
*
* NOTE: default false value loses some executions with NPE in system classes, but often most of these executions
* NOTE: With false value loses some executions with NPE in system classes, but often most of these executions
* are not expected by user.
*/
var maximizeCoverageUsingReflection by getBooleanProperty(false)
Expand All @@ -168,22 +177,19 @@ object UtSettings : AbstractSettings(

/**
* Use concrete execution.
*
* True by default.
*/
var useConcreteExecution by getBooleanProperty(true)

/**
* Enable code generation tests with every possible configuration
* for every method in samples.
*
* Important: disabled by default. This check requires enormous amount of time.
* Important: is enabled generation requires enormous amount of time.
*/
var checkAllCombinationsForEveryTestInSamples by getBooleanProperty(false)

/**
* Enable transformation UtCompositeModels into UtAssembleModels using AssembleModelGenerator.
* True by default.
*
* Note: false doesn't mean that there will be no assemble models, it means that the generator will be turned off.
* Assemble models will present for lists, sets, etc.
Expand All @@ -198,8 +204,6 @@ object UtSettings : AbstractSettings(

/**
* Enables soft constraints in the engine.
*
* True by default.
*/
var preferredCexOption by getBooleanProperty(true)

Expand Down Expand Up @@ -227,15 +231,11 @@ object UtSettings : AbstractSettings(
/**
* Generate tests that treat possible overflows in arithmetic operations as errors
* that throw Arithmetic Exception.
*
* False by default.
*/
var treatOverflowAsError: Boolean by getBooleanProperty(false)

/**
* Generate tests that treat assertions as error suits.
*
* True by default.
*/
var treatAssertAsErrorSuit: Boolean by getBooleanProperty(true)

Expand Down Expand Up @@ -271,7 +271,7 @@ object UtSettings : AbstractSettings(
* Determines whether should errors from a child process be written to a log file or suppressed.
* Note: being enabled, this option can highly increase disk usage when using ContestEstimator.
*
* False by default (for saving disk space).
* In enabled it consumes a lot of disk space.
*/
var logConcreteExecutionErrors by getBooleanProperty(false)

Expand Down Expand Up @@ -314,16 +314,12 @@ object UtSettings : AbstractSettings(
* It may be usefull during debug.
*
* Note: it might highly impact performance, so do not enable it in release mode.
*
* False by default.
*/
var enableUnsatCoreCalculationForHardConstraints by getBooleanProperty(false)

/**
* Enable it to process states with unknown solver status
* from the queue to concrete execution.
*
* True by default.
*/
var processUnknownStatesDuringConcreteExecution by getBooleanProperty(true)

Expand Down Expand Up @@ -388,7 +384,7 @@ object UtSettings : AbstractSettings(
/**
* Use the sandbox in the concrete executor.
*
* If true (default), the sandbox will prevent potentially dangerous calls, e.g., file access, reading
* If true, the sandbox will prevent potentially dangerous calls, e.g., file access, reading
* or modifying the environment, calls to `Unsafe` methods etc.
*
* If false, all these operations will be enabled and may lead to data loss during code analysis
Expand Down Expand Up @@ -441,8 +437,6 @@ object UtSettings : AbstractSettings(
* Use this option to enable calculation and logging of MD5 for dropped states by statistics.
* Example of such logging:
* Dropping state (lastStatus=UNDEFINED) by the distance statistics. MD5: 5d0bccc242e87d53578ca0ef64aa5864
*
* Default value is false.
*/
var enableLoggingForDroppedStates by getBooleanProperty(false)

Expand Down Expand Up @@ -518,8 +512,15 @@ enum class PathSelectorType {
}

enum class TestSelectionStrategyType {
DO_NOT_MINIMIZE_STRATEGY, // Always adds new test
COVERAGE_STRATEGY // Adds new test only if it increases coverage
/**
* Always adds new test
*/
DO_NOT_MINIMIZE_STRATEGY,

/**
* Adds new test only if it increases coverage
*/
COVERAGE_STRATEGY
}

/**
Expand Down
33 changes: 25 additions & 8 deletions utbot-intellij/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ abstract class SettingsToConfigTask : DefaultTask() {
if (s.startsWith("enum class ")) {
enums.add(EnumInfo(s.substring(11, s.length - 2)))
} else if (s.matches(Regex("[A-Z_]+,?")) && enums.isNotEmpty()) {
var enumValue = s.substring(0, s.length - 1)
var enumValue = s.substring(0, s.length)
if (enumValue.endsWith(",")) enumValue = enumValue.substring(0, enumValue.length - 1)
enums.last().docMap[enumValue] = docLines.toMutableList()
} else if (s.startsWith("const val ")) {
Expand All @@ -113,14 +113,16 @@ abstract class SettingsToConfigTask : DefaultTask() {
} else if (s == "/**") {
docLines.clear()
} else if (s.startsWith("* ")) {
docLines.add(s.substring(2))
} else if (s.startsWith("var")) {
if (!s.contains("href")) {//Links are not supported
docLines.add(s.substring(2))
}
} else if (s.startsWith("var") || s.startsWith("val")) {
acc.clear()
acc.append(s)
} else if (s.isEmpty() && acc.isNotEmpty()) {
s = acc.toString()
acc.clear()
if (s.startsWith("var")) {
if (s.startsWith("var") || s.startsWith("val")) {
var i = s.indexOf(" by ", 3)
if (i > 0) {
var key = s.substring(3, i).trim()
Expand Down Expand Up @@ -152,6 +154,9 @@ abstract class SettingsToConfigTask : DefaultTask() {
if (defaultValue.matches(Regex("[\\d_]+L"))) {
defaultValue = defaultValue.substring(0, defaultValue.length - 1).replace("_", "")
}
if (defaultValue.matches(Regex("^\".+\"$"))) {
defaultValue = defaultValue.substring(1, defaultValue.length - 1)
}
model.defaultValue = defaultValue
model.docLines.addAll(docLines)
}
Expand All @@ -169,9 +174,16 @@ abstract class SettingsToConfigTask : DefaultTask() {
if (split.size > 1) {
model.defaultValue = split[1]
val enumInfo = enums.find { info -> info.className == split[0] }
if (enumInfo!= null) {
model.docLines.add("")
}
enumInfo?.docMap?.forEach {
model.docLines.add(it.key)
it.value.forEach { line -> model.docLines.add(line) }
if (it.value.size == 1) {
model.docLines.add("${it.key}: ${it.value.first()}")
} else {
model.docLines.add(it.key)
it.value.forEach { line -> model.docLines.add(line) }
}
}
}
}
Expand All @@ -180,10 +192,15 @@ abstract class SettingsToConfigTask : DefaultTask() {
writer.println("#")
}
for (docLine in model.docLines) {
writer.println("# $docLine")
if (docLine.isEmpty()) {
writer.println("#")
} else {
writer.println("# $docLine")
}
}
if (!model.docLines.any({ s -> s.toLowerCaseAsciiOnly().contains("default") })) {
writer.println("# ${model.defaultValue} by default")
writer.println("#")
writer.println("# Default value is [${model.defaultValue}]")
}
writer.println("${model.key}=${model.defaultValue}")
writer.flush()
Expand Down