-
Notifications
You must be signed in to change notification settings - Fork 46
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
Extract Traverser from UtBotSymbolicEngine #307
Conversation
8b50bb2
to
f7359f3
Compare
utbot-framework/src/main/kotlin/org/utbot/engine/TraversalContext.kt
Outdated
Show resolved
Hide resolved
utbot-framework/src/main/kotlin/org/utbot/framework/plugin/api/UtBotTestCaseGenerator.kt
Show resolved
Hide resolved
utbot-framework/src/main/kotlin/org/utbot/engine/TraversalContext.kt
Outdated
Show resolved
Hide resolved
f7359f3
to
f6bca78
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
6679597
to
5274326
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checked force mocks: no regression so far.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems nice.
utbot-framework/src/main/kotlin/org/utbot/engine/ExecutionState.kt
Outdated
Show resolved
Hide resolved
Convert Traversal functions to extension functions
5274326
to
33c61d1
Compare
Description
Split the logic of
UtBotSymbolicEngine
into two classes:UtBotSymbolicEngine
Traverser
Introduced new classes and some TODO stubs:
StateLabel
is used for markingExecutionState
accordingly to their status (INTERMIDIATE, CONCRETE, TERMINAL). See the comments in the code for more information.TraversalContext
is a context during one Jimple instruction traversal. Now there are some TODO stubs for the future work.Refactored several relevant places with non-functional changes:
SymbolicResult
inprocessResult
Fixes #259
Details
Previously
UtBotSymbolicEngine
had the complex logic of different types:The idea is to split some of the aspects of the engine logic into different classes. In this MR the extraction of Jimple traversal was done. Now we have two classes:
UtBotSymbolicEngine
Now
UtBotSymbolicEngine
is a manager class. It's created once for one method analysis process. We can't reuse it for different methods. It sets up everything forTraverser
, controls the flow of polling states from the queue and pushing new states to the queue and also processes terminal states.So now the next things are done in
UtBotSymbolicEngine
:Traverser
Traverser
is responsible for traversing the top instruction from the passedExecutionState
. It's created insideUtBotSymbolicEngine
and can't be reused between different methods ("method-under-test"s). The main function istraverse(state: ExecutionState): Collection<ExecutionState>
which takes anExecutionState
and produces next states, so all other extra information needed for traversal should be passed via the constructor ofTraverser
.Please note, that now it's
Traverser
responsibility to choose the right label for the nextExecutionState
. ThenUtBotSymbolicEngine
matches on this label and decides what to do with this state.So now the next things are done in
Traverser
:Type of Change
How Has This Been Tested?
Automated Testing
Ran all tests in IDEA. No new test failures have been detected in this change.
Checklist: