-
Notifications
You must be signed in to change notification settings - Fork 75
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 #823 from mull-project/element-without-compdb
mull-cxx: raise error if Elements reporter is used without compilation DB
- Loading branch information
Showing
5 changed files
with
57 additions
and
7 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
...lit/tests/invalid-input/05-elements-reporter-but-no-compdb/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" | ||
} | ||
] |
27 changes: 27 additions & 0 deletions
27
tests-lit/tests/invalid-input/05-elements-reporter-but-no-compdb/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,27 @@ | ||
int sum(int a, int b) { | ||
return a + b; | ||
} | ||
|
||
int main() { | ||
return sum(-2, 2); | ||
} | ||
|
||
// clang-format off | ||
|
||
/** | ||
RUN: cd / && %CLANG_EXEC -fembed-bitcode -g -O0 %s -o %s.exe | ||
RUN: sed -e "s:%PWD:%s:g" %S/compile_commands.json.template > %S/compile_commands.json | ||
RUN: cd %CURRENT_DIR | ||
RUN: (unset TERM; %MULL_EXEC -linker=%clang_cxx -workers=1 -mutators=cxx_add_to_sub -reporters=Elements "%s.exe" 2>&1; test $? = 1) | %FILECHECK_EXEC "%s" --dump-input=fail --strict-whitespace --match-full-lines --check-prefix=WITHOUT-COMPDB-PROVIDED | ||
WITHOUT-COMPDB-PROVIDED:[error] Mutation Testing Elements Reporter requires compilation database. Please provide it using flags -compdb-path and -compdb-flags. | ||
RUN: (unset TERM; %MULL_EXEC -linker=%clang_cxx -workers=1 -mutators=cxx_add_to_sub -reporters=Elements -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-prefix=WITH-COMPDB-PROVIDED | ||
WITH-COMPDB-PROVIDED:{{^.*}}[info] Running mutants (threads: 1){{$}} | ||
WITH-COMPDB-PROVIDED:[info] Killed mutants (1/1): | ||
WITH-COMPDB-PROVIDED:{{^.*}}/sample.cpp:2:12: warning: Killed: Replaced + with - [cxx_add_to_sub]{{$}} | ||
WITH-COMPDB-PROVIDED: return a + b; | ||
WITH-COMPDB-PROVIDED: ^ | ||
WITH-COMPDB-PROVIDED:[info] All mutations have been killed | ||
WITH-COMPDB-PROVIDED:[info] Mutation score: 100% | ||
**/ |
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