Skip to content

Commit

Permalink
[test] Add an analyze_and_parse test for review status cfg files
Browse files Browse the repository at this point in the history
  • Loading branch information
Szelethus committed Dec 8, 2023
1 parent 2d4ede1 commit f75d4c6
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
$version: 1
rules:
- filters:
filepath: simple1.cpp
checker_name: core.DivideZero
actions:
review_status: false_positive
reason: Division by zero in test files is automatically intentional.
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
NORMAL#CodeChecker log --output $LOGFILE$ --build "make simple1" --quiet
NORMAL#CodeChecker analyze $LOGFILE$ --output $OUTPUT$ --analyzers clangsa --review-status-config simple1_review_status1.yaml

# The review status config file should've set the report to false_positive.
# We expect to see the first parse to return with 'no defects', and the second
# with one defect.
NORMAL#CodeChecker parse $OUTPUT$ --review-status=confirmed
NORMAL#CodeChecker parse $OUTPUT$ --review-status
--------------------------------------------------------------------------------
[] - Starting build...
[] - Using CodeChecker ld-logger.
[] - Build finished successfully.
[] - Starting static analysis ...
[] - [1/1] clangsa analyzed simple1.cpp successfully.
[] - ----==== Summary ====----
[] - Successfully analyzed
[] - clangsa: 1
[] - Total analyzed compilation commands: 1
[] - ----=================----
[] - Analysis finished.
[] - To view results in the terminal use the "CodeChecker parse" command.
[] - To store results use the "CodeChecker store" command.
[] - See --help and the user guide for further options about parsing and storing the reports.
[] - ----=================----
Found no defects in simple1.cpp

----======== Summary ========----
---------------------------------------------
Number of processed analyzer result files | 1
Number of analyzer reports | 0
---------------------------------------------
----=================----
[HIGH] simple1.cpp:18:15: Division by zero [core.DivideZero]
return 2015 / x;
^

Found 1 defect(s) in simple1.cpp


----==== Severity Statistics ====----
----------------------------
Severity | Number of reports
----------------------------
HIGH | 1
----------------------------
----=================----

----==== Checker Statistics ====----
----------------------------------------------
Checker name | Severity | Number of reports
----------------------------------------------
core.DivideZero | HIGH | 1
----------------------------------------------
----=================----

----==== File Statistics ====----
-------------------------------
File name | Number of reports
-------------------------------
simple1.cpp | 1
-------------------------------
----=================----

----======== Summary ========----
---------------------------------------------
Number of processed analyzer result files | 1
Number of analyzer reports | 1
---------------------------------------------
----=================----

0 comments on commit f75d4c6

Please sign in to comment.