Skip to content

Commit

Permalink
doc: develop: sca: Add Parasoft C/C++test
Browse files Browse the repository at this point in the history
Add documentation for Parasoft C/C++test for Static Code Analysis.

Signed-off-by: Yasushi SHOJI <[email protected]>
  • Loading branch information
yashi authored and carlescufi committed Feb 2, 2024
1 parent 6a069e1 commit 50d8cd4
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
40 changes: 40 additions & 0 deletions doc/develop/sca/cpptest.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
.. _cpptest:

Parasoft C/C++test support
##########################

Parasoft `C/C++test <https://www.parasoft.com/products/parasoft-c-ctest/>`__ is a software testing
and static analysis tool for C and C++. It is a commercial software and you must acquire a
commercial license to use it.

Documentation of C/C++test can be found at https://docs.parasoft.com/. Please refer to the
documentation for how to use it.

Generating Build Data Files
***************************

To use C/C++test, ``cpptestscan`` must be found in your :envvar:`PATH` environment variable. And
:ref:`west build <west-building>` should be called with a ``-DZEPHYR_SCA_VARIANT=cpptest``
parameter, e.g.

.. code-block:: shell
west build -b qemu_cortex_m3 zephyr/samples/hello_world -- -DZEPHYR_SCA_VARIANT=cpptest
A ``.bdf`` file will be generated as :file:`build/sca/cpptest/cpptestscan.bdf`.

Generating a report file
************************

Please refer to Parasoft C/C++test documentation for more details.

To import and generate a report file, something like the following should work.

.. code-block:: shell
cpptestcli -data out -localsettings local.conf -bdf build/sca/cpptest/cpptestscan.bdf -config "builtin://Recommended Rules" -report out/report
You might need to set ``bdf.import.c.compiler.exec``, ``bdf.import.cpp.compiler.exec``, and
``bdf.import.linker.exec`` to the toolchain :ref:`west build <west-building>` used.
1 change: 1 addition & 0 deletions doc/develop/sca/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,4 @@ The following is a list of SCA tools natively supported by Zephyr build system.
codechecker
sparse
gcc
cpptest

0 comments on commit 50d8cd4

Please sign in to comment.