Search code examples
ctestingparasoft

How to create build data file (bdf) in Parasoft?


I am trying to use Parasoft C/C++ Test to check "Coding Standards" with static tests. I found only "How to create bdf in Makefile projects" section in the Parasoft user guide.

How can I create a bdf for every project? Is it mandatory to use makefile project ?


Solution

  • Thanks for your answer, parasoft is not a reputed topic. Answers are worth a piece of gold. I couldn't find cpptesttrace. There are cpptest and cpptestscan. Could they be? I use an old version of parasoft.

    You are correct. 'cpptesttrace' was added in Parasoft C++test version 9.4 (mid-2012), so likely you are using version 9.2 or earlier, where only 'cpptestscan' was present.

    BTW, here is quick explanation of programs inside C++test standalone installation (not Visual Studio plugin):

    • cpptest - starts C++test GUI (Eclipse-based) usually for interactive work on a desktop
    • cpptestcli - C++test command line driver used to automate static analyses, e.g. running as a Jenkins job,
    • cpptestscan - used as a prefix to compiler command line to capture a single compilation information and add it to a BDF file
    • cpptesttrace - (since Parasoft C++test 9.4) used as a prefix to build command line, to capture all compilation commands and save in a BDF file

    The main difference between cpptestscan and cpptesttrace is that:

    • cpptestscan had to be prepended to each compilation command line. This means, cpptestscan could capture single compilation only, and save one at a time into a BDF. This was done typically by overwriting make CC or CXX variable (specifying the compiler, e.g. "cpptestscan g++ -c foo.c -o foo.o").
    • cpptestrace was meant to be prepended once to the entire build command, and it tracked child processes invoked by the build command. Record of all processes recognized as compiler invocations were stored in a BDF.

    cpptestscan was fine if makefile or a build script was flexible enough to allow overwriting compiler at the command line, e.g.

    make CXX="cpptestscan g++" CC="cpptestscan gcc"
    

    It is typically possible with make-based projects. As of custom or auto-generated build scripts, all bets are off. Often, the only option was to modify project build scripts, which people are usually nervous about. In such cases cpptesttrace can help, because it is completely non-intrusive, and can capture build information from almost any build process.

    Going back to the original question of this post, if you have multiple projects:

    • using cpptestscan, you would need to somehow prefix compiler with cpptestscan in each projects' build scripts to create corresponding BDF
    • using cpptesttrace, you could run build for each project adding cpptesttrace in front of each projects' build command to create corresponding BDF The latter is often easier, but you would need newer C++test (the latest version is 10.3).

    I hope that helps. BTW: Check with Parasoft if you could upgrade your C++test.