Skip to content

Conversation

@egiptipavel
Copy link
Collaborator

Description

Added support for new types:

  • pointers
  • channels, interfaces (as function parameters)

Changed test generation template

Added support for methods

Parallel fuzzing

Traces -> coverage

Fixes #2117

How to test

Manual tests

Test on utbot-go/go-samples/simple/samples.go and utbot-go/go-samples/simple/supported_types.go files.

Self-check list

  • I've set the proper labels for my PR (at least, for category and component).
  • PR title and description are clear and intelligible.
  • I've added enough comments to my code, particularly in hard-to-understand areas.
  • The functionality I've repaired, changed or added is covered with automated tests.
  • Manual tests have been provided optionally.
  • The documentation for the functionality I've been working on is up-to-date.

@egiptipavel egiptipavel added ctg-enhancement New feature, improvement or change request ctg-bug-fix PR is fixing a bug lang-go Issue is related to Go support labels May 15, 2023
@egiptipavel egiptipavel requested a review from Markoutte May 15, 2023 10:43
@egiptipavel egiptipavel self-assigned this May 15, 2023
},
modify = Routine.ForEach(listOf(chanType.elementTypeId!!)) { self, i, values ->
val model = self as GoUtChanModel
if (i >= model.value.size) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this check always false?

object GoNilValueProvider : ValueProvider<GoTypeId, GoUtModel, GoDescription> {
override fun accept(type: GoTypeId): Boolean = type is GoSliceTypeId || type is GoMapTypeId
override fun accept(type: GoTypeId): Boolean =
type is GoSliceTypeId || type is GoMapTypeId || type is GoChanTypeId || type is GoPointerTypeId || type is GoInterfaceTypeId
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setOf(...).any(...) would be easier to ready

construct = Routine.Create(listOf(pointerType.elementTypeId!!)) { values ->
GoUtPointerModel(value = values.first(), typeId = pointerType)
},
modify = sequenceOf(Routine.Call(listOf(pointerType.elementTypeId)) { self, values ->
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look likes this duplicates the logic from the construct and the sequence can be empty in this case

},
modify = Routine.ForEach(listOf(sliceType.elementTypeId!!)) { self, i, values ->
val model = self as GoUtSliceModel
if (i >= model.length) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as before: do we really need this check?


fun modifyEnvironment(goExecutableAbsolutePath: Path, gopathAbsolutePath: Path): MutableMap<String, String> {
val environment = System.getenv().toMutableMap().apply {
this["Path"] = goExecutableAbsolutePath.parent.toString() + File.pathSeparator + (this["Path"] ?: "")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Path.resolve(String other) can be used here

cell(allFunctionExecutionTimeoutSecondsSpinner)
cell(JBLabel("seconds"))
}
row("Number of fuzzing processes:") {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should a user know about this number?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is important if he wants to run fuzzing instead of generating tests.

fun modifyEnvironment(goExecutableAbsolutePath: Path, gopathAbsolutePath: Path): MutableMap<String, String> {
val environment = System.getenv().toMutableMap().apply {
this["Path"] = goExecutableAbsolutePath.parent.toString() + File.pathSeparator + (this["Path"] ?: "")
this["Path"] = goExecutableAbsolutePath.resolve(File.pathSeparator).toString() + (this["Path"] ?: "")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolve should resolve a child element of the current path.

@egiptipavel egiptipavel merged commit da3e553 into main Jun 9, 2023
@egiptipavel egiptipavel deleted the egiptipavel/go-coverage branch June 9, 2023 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ctg-bug-fix PR is fixing a bug ctg-enhancement New feature, improvement or change request lang-go Issue is related to Go support

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Go. RuntimeException: Execution of GoSourceCodeAnalyzer thrown in IDEA

3 participants