Sign inSign up

parasoft/cpptest

By parasoft

Updated 15 days ago

Parasoft C/C++test

Image
0

10K+

parasoft/cpptest repository overview

Quick reference

What is Parasoft C/C++test?

Parasoft C/C++test is a unified, fully integrated testing solution for C and C++ software development. C/C++test uses a comprehensive set of analysis techniques, including pattern-based static analysis, dataflow analysis, metrics, code coverage, and more, to help you verify code quality and ensure compliance with industry standards, such as MISRA, AUTOSAR, and CERT.

What is included in this image

This image is based on Debian Linux and includes:

  • C/C++test Standard (installed into /opt/parasoft/cpptest)
  • GNU GCC toolchain (gcc, g++)
  • C / C++ build tools (make, cmake)
  • Common utilities (git, mc, vim, wget, curl, fontconfig, sudo, openssh-client)

How to use this image

Licensing
  • You must accept the Parasoft End User License Agreement (EULA) to use this product. To accept the EULA, change parasoft.eula.accepted from false to true in the examples below.
  • Be sure Parasoft License Server or Parasoft DTP is deployed in your organization.

To license Parasoft C/C++test, create a cpptestcli.properties configuration file with the license settings:

# Accept the Parasoft EULA to use this product
parasoft.eula.accepted=false

# Specify the license edition or features
cpptest.license.use_network=true
cpptest.license.network.edition=server_compliance_edition

# For license retrieved from License Server:
license.network.url=<HOST>:<PORT>
license.network.use.specified.server=true

# For license retrieved from DTP Server:
dtp.url=<HOST>:<PORT>
dtp.user=<USER>
dtp.password=<PASSWORD>

The cpptestcli.properties file should be placed in one of the following locations accessible inside the running container:

  • The C/C++test working directory (typically, the root directory of a C / C++ project).
  • Another location explicitly specified using the -settings flag: cpptestcli -settings /path/to/cpptestcli.properties ....
  • The /home/parasoft or /opt/parasoft/cpptest directory inside the image. See Image customization.
Basic commands
  • To run the C/C++test command line interface:
    $ docker run --rm parasoft/cpptest cpptestcli
  • To run the build tools:
    $ docker run --rm parasoft/cpptest cmake -S . -B build
    $ docker run --rm parasoft/cpptest make clean all
  • To log into the container:
    $ docker run --rm -it parasoft/cpptest bash
Running static analysis for a project located inside the container

In this example, a Makefile project is located inside the container. The current working directory ($PWD) will be mounted to the running container, so that the cpptestcli.properties configuration file can be accessed by C/C++test. Also, the analysis report will be generated in the mounted directory ($PWD/reports).

  1. Create and configure the $PWD/cpptestcli.properties configuration file (see Licensing).
  2. Run the cpptestcli command to launch the analysis in the project root directory (/opt/parasoft/cpptest/examples/ATM) :
    $ docker run --rm -v $PWD:$PWD -w /opt/parasoft/cpptest/examples/ATM parasoft/cpptest cpptestcli -compiler gcc_14-64 -config "builtin://Recommended Rules" -settings $PWD/cpptestcli.properties -report $PWD/reports -module . -trace make clean all
  3. Review the analysis report in $PWD/reports.
Running static analysis for a project located on the host

In this example, a CMake project is located on the host in the current working directory ($PWD). The directory will be mounted to the running container, so that all project files and the cpptestcli.properties configuration file can be accessed by C/C++test. Also, the analysis report will be generated in the mounted directory ($PWD/reports).

  1. Create and configure the $PWD/cpptestcli.properties configuration file (see Licensing).
  2. Configure / build the project and run the cpptestcli command to launch the analysis in the mounted directory ($PWD):
    $ docker run --rm -v $PWD:$PWD -w $PWD parasoft/cpptest bash -c "cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -S . -B build && cpptestcli -compiler gcc_14-64 -config 'builtin://Recommended Rules' -module . -input build/compile_commands.json"
  3. Review the analysis report in $PWD/reports.
Performing functional tests with code coverage analysis

In this example, a CMake project is located inside the container and the code coverage analysis will be enabled for the project. All the following steps will be performed interactively inside the container (alternatively, they all can be automated / scripted).

  1. Log into the container:
    $ docker run --rm -it parasoft/cpptest bash
  2. Create and configure the cpptestcli.properties configuration file in the $HOME directory (see Licensing).
  3. Go to the project root directory:
    $$ cd /opt/parasoft/cpptest/examples/Timer
  4. Build the application with code coverage enabled:
    $$ cmake -DCPPTEST_HOME=/opt/parasoft/cpptest -DCPPTEST_COVERAGE=ON -S . -B build
    $$ cd build && make
  5. Run the instrumented application to perform testing:
    $$ ./timer
  6. Generate the code coverage report:
    $$ make cpptest_coverage_report
  7. Review the report in /opt/parasoft/cpptest/examples/Timer/build/cpptest-coverage/Timer/reports.

Image customization

You can customize the Parasoft C/C++test image. The following example shows a Dockerfile for building a C/C++test image with GNU GCC 12 compiler and C/C++test configuration file copied into the $HOME directory:

FROM parasoft/cpptest

# install gcc-12
# be sure to use the 'root' user to install new packages
USER root
RUN apt-get update && \
    DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends gcc-12 && \
    rm -rf /var/lib/apt/lists/*

# pre-configure C/C++test by copying cpptestcli.properties into the $HOME directory
# be sure to restore default 'parasoft' user
USER parasoft:parasoft
COPY cpptestcli.properties /home/parasoft/

License

You need to view and agree to the Parasoft End User License Agreement (EULA) for the software contained in this image.

As with all Docker images, these likely also contain other software which may be under other licenses. As for any pre-built image usage, it is the image user's responsibility to ensure that any use of this image complies with any relevant licenses for all software contained within.

Tag summary

Content type

Image

Digest

sha256:7f9526af3

Size

513.5 MB

Last updated

15 days ago

docker pull parasoft/cpptest