Skip to content
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

Integrate Solver with ApiWsStructureMutator #1078

Draft
wants to merge 25 commits into
base: master
Choose a base branch
from

Conversation

agusaldasoro
Copy link
Collaborator

@agusaldasoro agusaldasoro commented Sep 16, 2024

Integration between Z3Solver and config.generateSqlDataWithDSE.

What does this PR include?

  • New Module: e2e-z3solver tests
  • Creates an API with one endpoint that returns 200 or 400 depending on the query result
  • Injected the Z3Solver only when config.generateSqlDataWithDSE

Future work

  • When using a query without a WHERE clause, it fails to load the failedWhere queries.

@agusaldasoro agusaldasoro changed the title Integrate Solver with ApiWsStructureMutator [WIP] Integrate Solver with ApiWsStructureMutator Oct 6, 2024
Comment on lines 50 to 53
// TODO: This should only be initialized when config.generateSqlDataWithDSE is enabled
// TODO: Also, z3solver.close() should be invoked
// when the application is shutting down to stop the Docker container and clean the tmp folder
@Inject
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@arcuri82 How and where should I do that?

Copy link
Collaborator

Choose a reason for hiding this comment

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

@agusaldasoro read docs/for_developers.md, in particular the part about Guice. So, likely would need to be defined in org.evomaster.core.BaseModule

val fileName = storeToTmpFile(smtLib) // Store SMTLib to a temporary file
val z3Response = executor.solveFromFile(fileName) // Solve using Z3
override fun solve(schemaDto: DbSchemaDto, sqlQuery: String, numberOfRows: Int): List<SqlAction> {
// TODO: Use memoized, if it's the same schema and query, return the same result and don't do any calculation
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@arcuri82 What do you think of this? Running the same query more than once extracts the same SMT solver, and as we are not using any seed the result is the same.

Copy link
Collaborator

Choose a reason for hiding this comment

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

hi @agusaldasoro (and @jgaleotti ). if the query is the same, those could be cached, and executed only once. however, how often does that happen? I would assume most of the times the queries are parametric (based on inputs coming from the HTTP request). we could still use a cache, but need to make sure it is bound in size

@agusaldasoro agusaldasoro changed the title [WIP] Integrate Solver with ApiWsStructureMutator Integrate Solver with ApiWsStructureMutator Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants