These are my CLI notes both for Linux and Windows. The cpptestcli can understand a Visual Studio 2019 solution, therefore, there is no need to generate a bdf file. Other projet types (make, cmake, etc) needs to have a generated bdf file.
# Two ways it can be done:
# First way
# Mere presence of cpptestcli.properties in pwd is NOT honored. First need to create associated workspace.
cpptestcli -data ~/parasoft/workspace/democicd -bdf cpptestscan.bdf
cpptestcli -config "builtin://Effective C++" -data ~/parasoft/workspace/democicd/ -report report -property report.format=sarif -settings /some/path/cpptestcli.properties
# Second way
# Mere presence of cpptestcli.properties in pwd is honored. No need of an associated workspace. The compiler has to be specified.
bin/cli/cpptestcli -config "builtin://Effective C++" -compiler gcc_11-64 -input cpptestscan.bdf -report report3 -property report.format=sarif [-settings /some/path/cpptestcli.properties]
TODO: To clarify further below to indicate whether cpptestcli or bin/cli/cpptestcli is meant:
cpptestcli -config "builtin://Recommended Rules" -solution demo-visualstudio.sln -report reports
cpptesttrace --cpptesttraceProjectName=hello make
cpptestcli -data "D:\wp1" -bdf cpptestscan.bdf
cpptestcli -data "D:\wp1" -config "builtin://Generate Unit Tests" -resource "hello/ATM/ATM.cxx"
cpptestcli -data "D:\wp1" -config "builtin://Generate Unit Tests"
cpptestcli -data "D:\wp1" -config "builtin://Run Unit Tests"
cpptestcli -data "D:\wp1" -config "builtin://Run Keil uVision Tests - ULINKPro or Simulator (ITM)"
cpptestcli -solution demo-visualstudio.sln -config "builtin://Effective C++"
Set-ExecutionPolicy Unrestricted
Get-ExecutionPolicy
cpptestcli -config "builtin://Effective C++" -compiler gcc_11-64 -trace make
# or
cpptestcli -config "builtin://Effective C++" -settings ~/cpptestcli.properties -compiler gcc_11-64 -trace make CC=gcc CXX=g++
https://asciinema.org/a/Knto0fLCwru6RrxqRoba5Lakl
"/c/Program Files (x86)/Parasoft/C++test for Visual Studio/10.6"/cpptestcli.exe -config "builtin://Effective C++" -solution demo-visualstudio.sln -report d:/report
"/c/Program Files (x86)/Parasoft/C++test for Visual Studio/10.6"/cpptestcli.exe -config "builtin://Effective C++" -solution demo-visualstudio.sln -report d:/report -property report.format=sarif
bin/cli/cpptestcli -config https://gist.githubusercontent.com/daparic/3f754066fde95fccaa050d61a052c7fa/raw/4d799966cae3c1190d7028d8a25172dc5940e80b/MYCWE362.properties -bdf cpptest
scan.bdf -compiler gcc_11-64
cpptestcli -config /tmp/MYCWE362.properties -bdf cpptestscan.bdf
$ type wr-cc
wr-cc is /opt/wndrvr/wrsdk-vxworks7-qemu-1.13.2_23.09/vxsdk/host/x86_64-linux/bin/wr-cc
$ wr-cc --version
clang version 16.0.0.1 (git://ala-cngitmirror-prod.wrs.com/llvm/clang.git 577521ca9d20893fb1725e736eee6c9442c4a8f9) (git://ala-cngitmirror-prod.wrs.com/llvm/llvm.git 27addbd28ded33590a03920414e8ec600e9e752c)
Target: x86_64
Thread model: posix
InstalledDir: /opt/wndrvr/wrsdk-vxworks7-qemu-1.13.2_23.09/vxsdk/host/x86_64-linux/bin/../../../../compilers/llvm-16.0.0.1/LINUX64/bin
make CC='cpptestscan --cpptestscanOutputFile=trace.bdf wr-cc' CXX='cpptestscan --cpptestscanOutputFile=trace.bdf wr-c++'
cpptestcli -config "builtin://Recommended Rules" -compiler wrclang_9_0-x86_64 -input trace.bdf
Try we must, for UT:
$ cat opts.properties
bdf.import.compiler.family=wrclang_9_0-x86_64
bdf.import.c.compiler.exec=wr-cc
bdf.import.cpp.compiler.exec=wr-c++
bdf.import.linker.exec=wr-cc
$ mkdir /tmp/oo/
$ /opt/parasoft/cpptest_professional-2023.2.0-linux.x86_64/cpptestcli -data /tmp/oo/ -config "builtin://Generate Unit Tests" -bdf trace.bdf -localsettings opts.properties
$ /opt/parasoft/cpptest_professional-2023.2.0-linux.x86_64/cpptestcli -data /tmp/oo/ -config "builtin://Run Unit Tests" -bdf trace.bdf -localsettings opts.properties
# SA
cpptestcli -data /PATH/TO/WORKSPACE -resource /SpeedSensor/SpeedSensor.c -config "builtin://Recommended Rules"
# UT
cpptestcli -data /PATH/TO/WORKSPACE -resource /SpeedSensor/tests/TestSuite_SpeedSensor.c -config "builtin://Run Unit Tests"
The presence of parasoft.suppress beside ATM.cpp is honored in the report.html. The -module . seems to play a role here in suppression, without it, the parasoft.suppress is ignored and additionally, no header file is analyzed.
bin/cli/cpptestcli -config "builtin://Effective C++" -compiler gcc_13-64 -input cpptestscan.bdf -module . -module misc/bbb/ccc -report report9
cpptestcli -config "builtin://Effective C++" -compiler gcc_13-64 -input cpptestscan.bdf -report report/ -exclude **/misc/**
cpptestcli -data ~/home/dx/parasoft/2024.2.0/demo-eclipse/ -config "builtin://Generate Unit Test" -exclude **/misc/aaa/* -report report/
My reminder gitlab setup: