Skip to content

Commit f8647dc

Browse files
nashifkartben
authored andcommitted
sca: add coverity as a SCA variant
Add coverity integration as a SCA variant. This is targetting the service provided by blackduck to open-source projects available on scan.coverity.com. Signed-off-by: Anas Nashif <anas.nashif@intel.com>
1 parent 8be92f8 commit f8647dc

File tree

3 files changed

+55
-0
lines changed

3 files changed

+55
-0
lines changed

cmake/sca/coverity/sca.cmake

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
find_program(COVERITY_BUILD NAMES cov-build REQUIRED)
3+
find_program(COVERITY_CONFIGURE NAMES cov-configure REQUIRED)
4+
message(STATUS "Found SCA: Coverity (${COVERITY_BUILD})")
5+
6+
7+
zephyr_get(COVERITY_OUTPUT_DIR)
8+
9+
if(NOT COVERITY_OUTPUT_DIR)
10+
set(output_dir ${CMAKE_BINARY_DIR}/sca/coverity)
11+
else()
12+
set(output_dir ${COVERITY_OUTPUT_DIR})
13+
endif()
14+
15+
file(MAKE_DIRECTORY ${output_dir})
16+
17+
set(output_arg --dir=${output_dir})
18+
19+
20+
set(CMAKE_C_COMPILER_LAUNCHER ${COVERITY_BUILD} ${output_arg} CACHE INTERNAL "")
21+
set(CMAKE_CXX_COMPILER_LAUNCHER ${COVERITY_BUILD} ${output_arg} CACHE INTERNAL "")

doc/develop/sca/coverity.rst

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
.. _coverity:
2+
3+
Coverity
4+
#########
5+
6+
Coverity Scan is a service by which Black Duck provides the results of analysis
7+
on open source coding projects to open source code developers that have
8+
registered their products with Coverity Scan.
9+
10+
This integration was only tested with scan.coverity.com and the tool
11+
distribution available through this service.
12+
13+
Generating Build Data Files
14+
***************************
15+
16+
To use this integration, coverity tool distribution must be found in your :envvar:`PATH` environment and
17+
:ref:`west build <west-building>` should be called with a ``-DZEPHYR_SCA_VARIANT=coverity``
18+
parameter, e.g.
19+
20+
.. code-block:: shell
21+
22+
west build -b qemu_cortex_m3 samples/hello_world -- -DZEPHYR_SCA_VARIANT=coverity
23+
24+
25+
Results of the scan will be generated as :file:`build/sca/coverity`.
26+
27+
You can also set :envvar:`COVERITY_OUTPUT_DIR` as the destination for multiple
28+
and incremental scan results.
29+
30+
Result Analysis
31+
****************
32+
33+
Follow the instructions on http://scan.coverity.com for uploading results.

doc/develop/sca/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,4 @@ The following is a list of SCA tools natively supported by Zephyr build system.
6767
cpptest
6868
eclair
6969
polyspace
70+
coverity

0 commit comments

Comments
 (0)