Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Extract Traverser from UtBotSymbolicEngine#307

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
sergeypospelov merged 19 commits intomainfromsergey/engine-refactoring
Jul 8, 2022

Conversation

@sergeypospelov
Copy link
Member

@sergeypospelovsergeypospelov commentedJun 27, 2022
edited
Loading

Description

Split the logic ofUtBotSymbolicEngine 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:

  • Changed signatures of some traversal functions
  • Moved some functions to more convenient places
  • Fixed hack on nullableSymbolicResult inprocessResult
  • Other minor refactorings

Fixes#259

Details

PreviouslyUtBotSymbolicEngine had the complex logic of different types:

  • setting up everything
  • working with the states queue
  • Jimple travesal
  • working with the symbolic state
  • processing final states

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

NowUtBotSymbolicEngine 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 inUtBotSymbolicEngine:

  • setting up everything
  • working with the states queue
  • processing final states

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'sTraverser 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 inTraverser:

  • Jimple travesal
  • working with the symbolic state

Type of Change

  • Refactoring (non-functional change improving code quality)

How Has This Been Tested?

Automated Testing

Ran all tests in IDEA. No new test failures have been detected in this change.

Checklist:

  • The change followed the style guidelines of the UTBot project
  • Self-review of the code is passed
  • The change contains enough commentaries, particularly in hard-to-understand areas
  • New documentation is provided or existed one is altered
  • No new warnings (Except some TODOs for the following MRs)
  • All tests pass locally with my changes

@sergeypospelovsergeypospelov self-assigned thisJun 27, 2022
@sergeypospelovsergeypospelovforce-pushed thesergey/engine-refactoring branch from8b50bb2 tof7359f3CompareJune 27, 2022 08:56
@sergeypospelovsergeypospelov changed the titleSergey/engine refactoringExtract Traverser from UtBotSymbolicEngine ([#259](https://github.com/UnitTestBot/UTBotJava/issues/259))Jun 27, 2022
@sergeypospelovsergeypospelov changed the titleExtract Traverser from UtBotSymbolicEngine ([#259](https://github.com/UnitTestBot/UTBotJava/issues/259))Extract Traverser from UtBotSymbolicEngine (#259)Jun 27, 2022
@sergeypospelovsergeypospelov changed the titleExtract Traverser from UtBotSymbolicEngine (#259)Extract Traverser from UtBotSymbolicEngineJun 27, 2022
Copy link
Collaborator

@SBOne-KenobiSBOne-Kenobi left a comment

Choose a reason for hiding this comment

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

LGTM

@sergeypospelovsergeypospelovforce-pushed thesergey/engine-refactoring branch 2 times, most recently from6679597 to5274326CompareJuly 7, 2022 05:38
Copy link
Member

@nikitavlaevnikitavlaev left a 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.

sergeypospelov reacted with thumbs up emoji
Copy link
Collaborator

@dtimdtim left a comment

Choose a reason for hiding this comment

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

Seems nice.

@sergeypospelovsergeypospelovforce-pushed thesergey/engine-refactoring branch from5274326 to33c61d1CompareJuly 8, 2022 08:29
@sergeypospelovsergeypospelov merged commitc6bb765 intomainJul 8, 2022
@sergeypospelovsergeypospelov deleted the sergey/engine-refactoring branchJuly 8, 2022 10:32
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@dtimdtimdtim approved these changes

@EgorkaKulikovEgorkaKulikovEgorkaKulikov approved these changes

@CaelmBleiddCaelmBleiddCaelmBleidd approved these changes

@nikitavlaevnikitavlaevnikitavlaev approved these changes

@SBOne-KenobiSBOne-KenobiSBOne-Kenobi approved these changes

Assignees

@sergeypospelovsergeypospelov

Labels

None yet

Projects

Archived in project

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Extract Traverser from UtBotSymbolicEngine

7 participants

@sergeypospelov@dtim@EgorkaKulikov@CaelmBleidd@nikitavlaev@SBOne-Kenobi

[8]ページ先頭

©2009-2025 Movatter.jp