cpptesttrace
Hi,
I am running CLI command cpptesttrace and cpptestcli on a C++ project on Linux.
I have a workspace that has many project dependencies.
How can I set up the command line to run in one line command several projects.
1. Create bdf for all project.
2. Run cpptestcli on all bdf files for all projects in worksapce in one line command.
Thanks
Best Answer
-
Hi @elch,
Regarding:
- Create bdf for all project.
- Run cpptestcli on all bdf files for all projects in worksapce in one line command.
There are multiple ways to organize scaning builds into BDF files, and then running analysis on them.
Assuming you want to run analysis on all projects at once:
If you need to create a single BDF for multiple projects, you just need to prefix the build command with cpptesttrace and maybe add a few extra options.
If your build consists of multiple commands, just prefix each of them with cpptesttrace.
In fact, if you specify the same exact BDF to each cpptesttrace command, subsequent builds will be appended to the BDF.For example:
If you have projects and their make files located at:$HOME/dev/proj1/Makefile $HOME/dev/proj2/Makefile ...
you can run cpptesttrace as follows:
cd $HOME/dev/proj1/ cpptesttrace --cpptesttraceOutputFile=$HOME/dev/common.bdf make clean all cd $HOME/dev/proj2/ cpptesttrace --cpptesttraceOutputFile=$HOME/dev/common.bdf make clean all ...
Note, that I used absolute path to the BDF file. This ensures that the same exact BDF is used for each build, even if make changes working folders internally.
Once you have the BDF, you can run analysis on all the sources from all projects at once using the single BDF.
If your build command is typically ./build.sh -b, then yes, to scan the whole build you would use:
cpptesttrace ./build.sh -b
perhaps with some extra --cpptesttrace* options, as needed.
Alternative approach could be to create separate BDFs for each project, and then create separate C/C++test projects that can be imported into C/C++test workspace, Depending on your build organization this may be done manually or with some scripting to automate the whole proces. As a benefit, you can then run analysis on each project separately with cpptestcli -resource option, or on all projects at once when you just specify workspace without pointing out to specific resources/projects.
but again, this requires a bit more work, so if you just want to run analysis on multiple BDF's at once, it might be simpler to just "cat" them together, for example:``cat //cpptest.bdf > main.bdf
5
Answers
-
Hi,
Addition to my question.
We are building our project with build.sh script with eclipse commands.
How Do I "wrap" cpptesttrace my build process in order to create one bdf file.
cpptesttrace ./build.sh -bThanks
0 -
Thanks on the detailed answer & explanation.
I took second approach where I append to a one single bdf file.
Some more info on my project.- When running analysis via Eclipse plugin there are no issues.
- I notice that also there are temp bdf files in .cpptest folder for each project.
- My build.sh script include eclipse command to build several projects in a loop.
- While going the append approach the bdf is been created for each project...
- But the issue is that bdf file is been created , almost empty from content compare to the temp bdf that is been created in the GUI scan.
- The bdf consists from the following lines:
working dir=....
project_name=........
arg=gcc
arg= print-search-dirs
Any suggestions
Thanks
Eldad0 -
Hi @elch,
As of
I notice that also there are temp bdf files in .cpptest folder for each project.
these files are maintained by C/C++test and for the purpose of Eclipse runs. In general, anything under .metadata/ and .cpptest/ is "internal" so if you plan to come up with a process, i would not rely on these files, and treat them as something temporary, that can be recreated.
I would like to focus on:
- My build.sh script include eclipse command to build several projects in a loop.
- While going the append approach the bdf is been created for each project...
- But the issue is that bdf file is been created , almost empty from content compare to the temp bdf that is been created in the GUI scan.
I have a bunch of questions at this point, so let us start with the following:
- I would need some more information about #3, on how exactly the build is done.
- From what I understand, you are using eclipse command line to build your project?
- It does not use make, or anything else?
- Woudl you be able to show example commands used?
- Since the bdf is created, it means the monitoring mechanism is working in general. Is the action captured in BDF ("gcc --print-search-dirs") run by Eclipse build, or by something else in build.sh?
- Is your build script runing a clean before actual build actions are invoked? If the build was done earlier, and not cleaned, there is possibility that no compilations will be run (since all object files are up-to-date). In such case we would not capture anything.
0 -
Hi @elch,
Let us move the discussion to support channel for now. I will contact you by email.1