-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #837 from mull-project/inlined-header-functions
White and black AST search: fix locations for mutations in header files
- Loading branch information
Showing
27 changed files
with
314 additions
and
151 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
...white-ast-search/_special_cases/01_mutation_in_header_file/compile_commands.json.template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[ | ||
{ | ||
"arguments": [ | ||
"cc", | ||
"-c", | ||
"-fembed-bitcode", | ||
"-g", | ||
"-O0", | ||
"-o", | ||
"%PWD/sample.cpp.exe", | ||
"%PWD/sample.cpp" | ||
], | ||
"directory": "/", | ||
"file": "%PWD/sample.cpp" | ||
} | ||
] |
33 changes: 33 additions & 0 deletions
33
tests-lit/tests/white-ast-search/_special_cases/01_mutation_in_header_file/sample.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#include "sum.h" | ||
|
||
int main() { | ||
return sum(-2, 2); | ||
} | ||
|
||
// clang-format off | ||
|
||
/** | ||
RUN: cd / && %CLANG_EXEC -fembed-bitcode -g %s -o %s.exe | ||
RUN: cd %CURRENT_DIR | ||
RUN: sed -e "s:%PWD:%S:g" %S/compile_commands.json.template > %S/compile_commands.json | ||
RUN: (unset TERM; %MULL_EXEC -linker=%clang_cxx -debug -enable-ast -mutators=cxx_add_to_sub -reporters=IDE -ide-reporter-show-killed -compdb-path %S/compile_commands.json %s.exe 2>&1; test $? = 0) | %FILECHECK_EXEC %s --dump-input=fail --strict-whitespace --match-full-lines | ||
CHECK-NOT:{{^.*[Ee]rror.*$}} | ||
CHECK-NOT:{{^.*[Ww]arning.*$}} | ||
CHECK:[info] AST Search: looking for mutations in the source files (threads: 1) | ||
CHECK:[debug] AST Search: recording mutation "Add to Sub": {{.*}}sum.h:4:12 | ||
CHECK:[info] Applying filter: AST mutation filter (threads: 1) | ||
CHECK:[debug] ASTMutationFilter: whitelisting mutation "Add to Sub": {{.*}}sum.h:4:12 | ||
CHECK:[info] Applying filter: junk (threads: 1) | ||
CHECK:[debug] ASTMutationStorage: recording mutation "Add to Sub": {{.*}}sum.h:4:12 | ||
CHECK:[info] Killed mutants (1/1): | ||
CHECK:{{^.*}}sum.h:4:12: warning: Killed: Replaced + with - [cxx_add_to_sub]{{$}} | ||
CHECK: return a + b; | ||
CHECK: ^ | ||
CHECK:[info] Mutation score: 100% | ||
CHECK:[info] Total execution time: {{.*}} | ||
CHECK-EMPTY: | ||
**/ |
5 changes: 5 additions & 0 deletions
5
tests-lit/tests/white-ast-search/_special_cases/01_mutation_in_header_file/sum.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#pragma once | ||
|
||
static int sum(int a, int b) { | ||
return a + b; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.