Run a distributed Klocwork analysis in Electric Cloud

To run a distributed Klocwork analysis in Electric Cloud, run kwecbuild from your build directory:

kwecbuild --ec-make <path_to_emake> [<other_options>] <build_specification_file>

where:

  • <path_to_emake> is the path to the Electric Cloud emake utility
  • <other_options> are any of the kwecbuild options
  • <build_specification_file> is a build specification file created by kwinject

Important:

  • kwecbuild must be executed from same directory as the Electric Cloud integration build.
  • The output (tables) directory for kwecbuild must be under the current working directory.

Example

kwecbuild --ec-make /opt/ecloud/i686_Linux/bin/emake --ec-host server01 --output-dir tables kwinject.out

This example command outputs Klocwork tables to the tables subdirectory of the current working directory.

Where does kwecbuild run the various Klocwork analysis stages?

  • The compilation stage is integrated into the Electric Cloud environment. The generated make file is located at <output_tables_directory>/makefile.
  • The issue detection stage is integrated into the Electric Cloud environment. The generated make file is located at <output_tables_directory>/clef/ecMakefile.
  • The linking and reports stages are executed locally.

Limitations

  • Only a full, complete analysis is supported. Incremental analysis is not supported, and it is not possible to resume an analysis with kwecbuild.
  • Multibyte characters (such as Japanese) are not supported by kwecbuild.

Example

The following example uses the open-source project readline.

The <Server_install>/bin directory has been added to $PATH.

Our current working directory is /space/source/x86-32/c/readline/5.2.

Creating a build specification for Electric Cloud

First we need to create a build specification, which will then be used as the basis for our integration build analysis.

  1. We run emake to generate an annotation file.
    /opt/ecloud/i686_Linux/bin/emake --emake-cm=localhost --emake-annodetail=basic --emake-annofile=emake.xml
    

    This command specifies that the emake cluster manager is on localhost, and creates an annotation file named emake.xml.

  2. We convert the annotation into a build trace with kwlogparser.
    kwlogparser --output emake.trace emake-annotation emake.xml
    

    This command converts emake.xml into a build trace named emake.trace.

  3. We convert the build trace into a build specification with kwinject.
    kwinject —-trace-in emake.trace
    

    This command generates a build specification from emake.trace . The default output build specification file name, kwinject.out , will be used.

Running a distributed analysis with kwecbuild

Now we can use the build specification to run a distributed analysis.

  1. We ensure that our current working directory is the same directory as our Electric Cloud integrated build.

    /space/source/x86-32/c/readline/5.2

  2. We run a distributed Klocwork analysis in Electric Cloud, using the build specification as input.

    kwecbuild --force --license-host reprise --ec-make /opt/ecloud/i686_Linux/bin/emake --ec-host localhost --output-dir tables kwinject.out

    This command runs a distributed analysis on the build specification kwinject.out. Note that as required, the output directory for kwecbuild is inside the current working directory. The --force option allows us to overwrite data from a previous analysis.

  3. We make sure the Klocwork Servers are running before performing the next two steps. See Starting the Klocwork Servers.
  4. We create a Klocwork project.

    kwadmin create-project readline52

    This command creates a project named readline52.

  5. We load the analysis results into the database.

    kwadmin load readline52 tables

    This command loads the data in the tables directory into the Klocwork database.