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

Selective mutation instrumentation #218

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

JamesLee-Jones
Copy link
Collaborator

@JamesLee-Jones JamesLee-Jones commented Mar 27, 2024

Allow a subset of possible mutants to be instrumented by first performing a pass to collect the possible mutants into a .json, selecting which should be enabled, and then performing a second pass to instrument them.

@JamesLee-Jones JamesLee-Jones marked this pull request as draft March 27, 2024 13:56
@JamesLee-Jones
Copy link
Collaborator Author

One issue that will have to be overcome here is avoiding writing to the source file if the mutation trees differ. Currently the mutation tree is built and checked as the mutations are applied. If at some point in this process, we find the two trees differ, we wish to throw and error and tell the user that they must be the same. However, because mutations are applied as the tree is built, the source file would have already been modified at this point.

@JamesLee-Jones
Copy link
Collaborator Author

This is currently implemented in such a way that each 'MutationGroup' can be enabled or disabled and thus that all possible mutants for a source location will either be included or excluded. It may be the case that we would like more fine grained control than this but this becomes much more difficult as one function is used for replacing an entire class of mutants. Therefore, this would either require many more replacement functions, or a change how we currently instrument.

@JamesLee-Jones
Copy link
Collaborator Author

JamesLee-Jones commented Apr 1, 2024

My initial idea was to make each mutation function take in a vector<bool> that would contain whether each possible mutant should be used or not and then each mutant could be wrapped in an if check. After some experimenting, this seems to be significantly too slow on even simple code (as in examples/simple/pi.cc) to be feasible.

Another option is to create a new mutation function for each possible combination of enabled mutants that we encounter. This will lead to huge code bloat but will in turn mean that there should be no extra runtime overhead over the approach that we already use since the functions will be inlined. However, this goes against Dredd's design decision to have a single function for each mutant category.

@JamesLee-Jones JamesLee-Jones linked an issue Apr 11, 2024 that may be closed by this pull request
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.

Add Support for Applying Mutations Only at Given Mutation IDs
1 participant