Guide and exercise for uploading the correct artifacts for Source Control
What Files should be Checked into Source Control?
When using Source control with C/C++test, make sure to have the following files checked-in:
- All source files that are needed for the project
- Test Folders or other folder(s) you use for your Test Suites
- Stubs Folders or other folder(s) you use for your Stubs
- Do not check in temporary data/files (such as instrumented sources, compiled objects, linked test executable, and automatically-generated header files) with the project. By default, temporary files are in the .cpptest directory of the current workspace. These files should not be stored in source control because C++test can automatically regenerate these as needed.
Project’s configuration after checkout.
After the project is checked out, make sure the project settings are configured correctly. If the project was not correctly configured then the analysis may not work properly as it may not be able to find any of the source files. You can configure the project’s settings by Right-clicking on the root project’s folder and selecting “Properties”. From the Properties window go to “Parasoft->C++test->Build Settings”. Here you can configure how C/C++test will find the project’s information to run analysis on. You can set the project’s settings by clicking on the “Options Source” dropdown at the top and selecting an valid option for your project to run with.
- The Linux installation doesn’t have as many options available as not all the options are supported in the Linux Environment.
For this exercise, we will be using an example project that come with C/C++test and we will be using Subversion four our Source Control. We will also be using the IDE to prepare the project as we would have to manually write our settings for some of them. We will be going through:
- Configuring the build settings to properly run your tests
- Configuring the Test Configuration to be shareable
- (optional) Configuring the machine for Custom Compiler definitions.
- Committing the correct files for Source Control
- Checking out the project and running a test
- We will begin by configuring the project’s Build Settings. You can get there from your IDE by right-clicking your project and selecting “Properties”. This will open the Properties Window for the project. The Build Settings are located at “Parasoft->C++test->Build Settings”.
- Since the BDF has absolute paths based on the machine it was created on, we need to change the Build Settings to use “Use options from a build system” from the drop down. This will configure the project to use whatever build system is used to compile and link the project. This is how C/C++test can find and scan source files for Static Analysis.
- Now that the project’s Build Settings have been configured, we will commit the project and the required artifacts. We will commit the following files:
d. All source files from the project
e. Any Unit Test folders or other folders for the project
f. Any Stub Folders or other folders required for the project.
g. (optional) Custom Compiler Definition file.
- Do not commit the BDF for the project or executable made from the project’s build.
Now that the Project has been committed with Source Control, we are ready to check out the project on another machine to run our tests.
Go to a new machine and check out this project from Source Control. After the project is checked out, go ahead and run a test on it.
- If the project is showing “0/0” files scanned, check the console output. The console output will display what it was trying to do when the test began. You might have to make sure the build utility is available on the PATH. For example make sure that GNU Make is available on the System PATH.