Start here

Home
About Klocwork
What's new
Fixed issues
Release notes
Installation

Reference

C/C++ checkers
Java checkers
C# checkers
MISRA C 2004 checkers
MISRA C++ 2008 checkers
MISRA C 2012 checkers
MISRA C 2012 checkers with Amendment 1
Commands
Metrics
Troubleshooting
Reference

Product components

C/C++ Integration build analysis
Java Integration build analysis
Desktop analysis
Refactoring
Klocwork Static Code Analysis
Klocwork Code Review
Structure101
Tuning
Custom checkers

Coding environments

Visual Studio
Eclipse for C/C++
Eclipse for Java
IntelliJ IDEA
Other

Administration

Project configuration
Build configuration
Administration
Analysis performance
Server performance
Security/permissions
Licensing
Klocwork Static Code Analysis Web API
Klocwork Code Review Web API

Community

View help online
Visit RogueWave.com
Klocwork Support
Rogue Wave Videos

Legal

Legal information

Running your first integration build analysis

The steps in running your first analysis are:

  1. Create an integration project.
  2. Capture your build settings.
  3. Run the analysis.
  4. Check your build log for errors.
  5. Load the database.

Create an integration project

To create a project, run kwadmin create-project:

kwadmin --url http(s)://<host>:<port>/ create-project <project_name> 

where

  • <host> is the host name of the Klocwork Server
  • <port> is the port number for the Klocwork Server
  • <project_name> is a name for your project.

Project and build names must start with a letter or a digit. Period (.), minus sign (-), ampersand (&), white space and the underscore character are also allowed in project and build names. Also note that each cannot be longer than 64 characters.

Note: To reference a project on the command line, you must specify the project using the correct case (since project names are case sensitive). You must also specify the exact, current name of the project as it appears in Klocwork Static Code Analysis.

Example

kwadmin --url http://server2:8080/ create-project my_project

Capture your build settings

Details: Creating a C/C++ build specification

Run an analysis using the build specification

To analyze your project, run kwbuildproject, specifying the name and server location of your project:

kwbuildproject --url http(s)://<host>:<port>/<project_name> 
--tables-directory <dir> [<options>] <build_specification1> [<build_specification2>...] 

where:

  • <host> is the host name of the Klocwork Server
  • <port> is the port number for the Klocwork Server
  • <project_name> is the name of the project you created above. The --url is not strictly a mandatory option, but the command will use your default installation if you don't specify a project and its Klocwork server location. This means that the analysis may not pick up the latest system build or any customized data such as configuration or KB files associated with the server project.
  • <dir> is the output tables directory (mandatory argument). Note for Linux: Due to a MySQL limitation, the tables directory path name cannot contain a backslash.
  • <options> are any of the options for kwbuildproject
  • <build_specification> is the build specification you generated earlier. You can specify any number of build specifications with this command. Tip: You can also use a build specification template as input to kwbuildproject. See Using a build specification template with kwbuildproject.

Example

kwbuildproject --url http://server2:8080/my_project home/klocwork/myproject.out --tables-directory /my_tables

The kwbuildproject command runs in four stages:

  • compilation
  • issue detection
  • linking
  • report generation

Progress is displayed while the analysis is running. kwbuildproject returns error code 1 on any build failure (such as missing includes and compiler failures). If you see errors such as include or parse errors, see Troubleshooting.

Check your build logs

When the analysis is complete, you can find the full build log (build.log) and parse errors log (parse_errors.log) in the output tables directory. You can also view them in Klocwork Static Code Analysis. See Viewing integration build log files.

See also What's In Your Static Analysis Build Log and Why You Should Care.

Load the database

To load your analysis results into the Klocwork database, run kwadmin load:

kwadmin --url http(s)://<host>:<port>/ load <project_name> [<tables_directory>]

where

  • <host> is the host name of the Klocwork Server
  • <port> is the port number for the Klocwork Server
  • <project_name> is the name of the project you created above
  • <tables_directory> is the path to the Klocwork tables generated by kwbuildproject

Example:

kwadmin --url http://server2:8080/ load my_project /my_tables

Source files for the project are copied from the client side to the server side when the project is loaded into the Klocwork database. Source files as well as all include files are copied to the projects_root in a .ZIP archive.

What's next?