Skip to content

Make UtExecution abstract, introduce UtFailedExecution as its child #804

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ sealed class UtResult
* - coverage information (instructions) if this execution was obtained from the concrete execution.
* - comments, method names and display names created by utbot-summary module.
*/
open class UtExecution(
abstract class UtExecution(
Copy link
Collaborator

Choose a reason for hiding this comment

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

@dtim @Markoutte I remember that month ago we discussed that it could be UTExecution which are not defeined on early stages what it is (fuzzing or symbolic). Could we do this changes? Do we really cover by UtSymbolic/UtFuzzing/UtFailed all variants of the UtExecution at this momemnt?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks like it covers all at the moment. Isn't it a problem when we add another implementation for UtExecution for a summarization?

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 that major changes in summarization/engine/fuzzer interfaces will require another refactoring anyway. In this PR I just want to distinguish more clearly between all possible execution types, to make it easier (as I see it, I may be wrong) for the summarizer to check for failed executions.

If the issue #800 can be fixed without this hierarchy change, it's OK for me to drop this PR and discuss a better/conceptually correct refactoring. I think that the final decision is up to @amandelpie

val stateBefore: EnvironmentModels,
val stateAfter: EnvironmentModels,
val result: UtExecutionResult,
Expand Down Expand Up @@ -224,6 +224,27 @@ class UtSymbolicExecution(
}
}

/**
* Execution that result in an error (e.g., JVM crash or another concrete execution error).
*
* Contains:
* - state before the execution;
* - result (a [UtExecutionFailure] or its subclass);
* - coverage information (instructions) if this execution was obtained from the concrete execution.
* - comments, method names and display names created by utbot-summary module.
*
* This execution does not contain any "after" state, as it is generally impossible to obtain
* in case of failure. [MissingState] is used instead.
*/
class UtFailedExecution(
stateBefore: EnvironmentModels,
result: UtExecutionFailure,
coverage: Coverage? = null,
summary: List<DocStatement>? = null,
testMethodName: String? = null,
displayName: String? = null
) : UtExecution(stateBefore, MissingState, result, coverage, summary, testMethodName, displayName)

open class EnvironmentModels(
val thisInstance: UtModel?,
val parameters: List<UtModel>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ import org.utbot.framework.plugin.api.UtAssembleModel
import org.utbot.framework.plugin.api.UtConcreteExecutionFailure
import org.utbot.framework.plugin.api.UtError
import org.utbot.framework.plugin.api.UtExecution
import org.utbot.framework.plugin.api.UtFailedExecution
import org.utbot.framework.plugin.api.UtInstrumentation
import org.utbot.framework.plugin.api.UtMethod
import org.utbot.framework.plugin.api.UtNullModel
Expand Down Expand Up @@ -518,9 +519,8 @@ class UtBotSymbolicEngine(
stateBefore: EnvironmentModels,
e: ConcreteExecutionFailureException
) {
val failedConcreteExecution = UtExecution(
val failedConcreteExecution = UtFailedExecution(
stateBefore = stateBefore,
stateAfter = MissingState,
result = UtConcreteExecutionFailure(e)
)

Expand Down