Closed JonathanFoo0523 closed 2 months ago
This sound pretty serious - are you able to dig into what is going wrong in the prelude code?
Then, I wonder how we could write a regression test for this. Perhaps a program like:
int main() { printf("0\n"); printf("1\n"); printf("2\n"); ... }
with a large number of printfs. I think that dredd will only try statement deletion mutations, so that enabling mutant i should cause the print for i to be omitted. This could be used to test whether things are working correctly - what do you think?
I guess the problem is related to int and int literals represented as 32-bits. Changing 1
to 1ull
and returning a uint64_t
type instead of int
seems to fix it.
I think the example program for the regression test will be mutated to:
int main() {
if (__dredd(...)) { printf("0\n"); }
if (__dredd(...)) { printf("1\n"); }
if (__dredd(...)) { printf("2\n"); }
...
}
We will need to actually run the program to observe that one print statement is missing from stdout, right? Most of the regression tests just compare the original source file and the mutated source file, instead of compiling and running the mutated binary.
Attempt to fix with #231
If the fix is acceptable, I will rewrite the expected dredd output for the single_file
regression test.
Attempt to fix with #231
If the fix is acceptable, I will rewrite the expected dredd output for the
single_file
regression test.
Running .dev_shell.sh.template
at the root of the repo followed by scripts/regenerate_single_file_expectations.sh
should do this for you automatically.
Example
results in
Expected result