-
Notifications
You must be signed in to change notification settings - Fork 74
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
Mull is not mutating the shared object file #903
Comments
Hi @duthades, thank you for reporting the issue! Indeed, mull should be mutating the shared object, but it's not supported in an automated way at the moment. Also, more details are here (see the "two-step process). |
Hi @AlexDenisov, I tried to mutate both executable and the shared object separately and then run the test manually using
Am I missing something here? |
Hi @AlexDenisov, did you have a chance to look at this issue? |
Hi @duthades, After some thinking, I know what's the problem is! The best solution would be to teach As a workaround, I can suggest looking at this tutorial https://mull.readthedocs.io/en/latest/tutorials/NonStandardTestSuite.html. mull-runner -ide-reporter-show-killed mutated_objs/libvalid_age.so -test-program=test_valid_age_mutated.out This way, it will search for mutants at This is not ideal, but it should do the job. |
Hi @AlexDenisov, This workaround is working on the above example code. I was wondering if there is a timeline to implement a feature to automatically scan the dependent shared files for mutations? This workaround has made the integration of this tool in our pipeline very complex. Here is the psedocode for integeration: def mutate(target):
all_mutations = []
all_shared_libs = get_all_shared_files_for(target)
for each_lib in all_shared_libs:
linker_flags = get_linker_flags(each_lib)
compiler_flags = get_compiler_flags(each_lib)
mutate_shared_lib(each_lib, linker_flags, compiler_flags)
mutated_lib = get_mutated_lib_for(each_lib)
all_mutations.append(check_mutation_status(mutated_lib, target))
return all_mutations Finding linker flags and compiler flags is not always straight forward for dependent shared files (we use bazel for building and testing). This way the runtime is also increases by |
Hi @duthades, thank you so much for trying and confirming that the workaround actually works! I can certainly see the pain with this solution. I'll see how much effort it'd take and will get back to you soon. |
Hi @AlexDenisov, I have noticed one more issue while testing. When I modify #include "valid_age.h"
int valid_age(int age) {
static int lower_limit = 21;
if (age >= lower_limit) {
return 1;
}
return 0;
} When I try to mutate this shared object file using the following commands: clang++ -fPIC -g0 -Wall '-Wno-error=self-assign-overloaded' -fembed-bitcode -g '-std=c++14' -no-canonical-prefixes -Wno-builtin-macro-redefined -c valid_age.cpp -o _objs/valid_age.pic.o
clang++ -shared -o _objs/libvalid_age.so _objs/valid_age.pic.o -pipe '-fuse-ld=lld' -Wl,-z,relro,-z,now,-z,notext -no-canonical-prefixes -pthread -Wl,--push-state -Wl,-as-needed -ldl -lrt -Wl,--pop-state
mull-cxx --disable-junk-detection --debug --linker="/usr/local/bin/clang++" --mutators="cxx_all" --linker-flags="-shared -fPIC -pipe -fuse-ld=lld -Wl,-z,relro,-z,now,-z,notext -no-canonical-prefixes -pthread -Wl,--push-state -Wl,-as-needed -ldl -lrt -Wl,--pop-state" --mutate-only -output=_mutated_objs/libvalid_age.so _objs/libvalid_age.so Mull throws following error:
|
@AlexDenisov did you have any chance to estimate effort? And probably an rough ETA for the fix? |
@duthades the issue is that Mull doesn't respect certain compiler flags when lowering bitcode to the machine code. UPD: here is the list of the versions: https://cloudsmith.io/~mull-project/repos/mull-nightly/packages/?q=version%3A0.13.0-pr929 Also, it's best to ensure that Mull uses the same major version of Clang/LLVM you use to build the software. |
Hi @AlexDenisov, I compiled and installed mull with this PR changes for llvm 11. This change did not show mutated shared libs. I used the code and command from this comment - #903 (comment) with |
@duthades my latest comment only addresses the issue with the |
@AlexDenisov I got it now. I misunderstood your comment earlier. I tried to run the new mull tool using the code with static variable and commands from #903 (comment). The tool was able to mutate successfully now. :) |
@duthades #931 is supposed to fix the original issue. Please, feel free to reopen the issue if the issue is still there. Regarding the rest (specifically #903 (comment)), we are working on a clang plugin that would allow more seamless build system integration (at least we hope so). |
The tool is not mutating the shared object file. Here are the details to replicate the behavior.
Details:
valid_age.h
valid_age.cpp
test_valid_age.cpp
Commands
Expected Behavior
The tool should mutate both valid_age.cpp and test_valid_age.cpp.
Current Behavior
The tool is only validating test_valid_age.cpp
Versions
mull-cxx
The text was updated successfully, but these errors were encountered: