Configuring Coverity

It is possible to incorporate Coverity results in the TICS output for files.

Prerequisites

For a successful Coverity integration, the following prerequisites must be met:

Basic configuration

To use Coverity one has to set-up the required properties in either the SERVER.txt to apply them for all projects or in PROJECTS.txt to apply them project specific. If the properties are declared in the SERVER file and also in the PROJECT the project specific properties will overwrite the global properties.

Syntax

The following properties have to be declared either on SERVER or PROJECT level:

'TOOLS' => {
  'Coverity' => {
    'WEBSERVICE' => {
      'USERNAME' => 'Login name',
      'PASSWORD:PLAIN' => 'Password',
      'URL' => 'URL of Coverity Web API, for example: https://coverity.tomtomgroup.com:443',
      ['AUTHENTICATIONKEYFILE' => 'The location of an authentication key generated from Coverity Connect'],
      ['TIMEOUT' => The time a webservice call may take (in seconds) before it is aborted],
      ['NR_OF_RETRIES' => The number of retries when the data cannot be fetched because of connection timeout ],
      ['CONNECTION_RETRY_TIMEOUT' => The time (in seconds) between retries],
    },
  ['INSTALLDIR' => 'Bin directory of Coverity Analysis'],
  ['INTERMEDIATEDIR' => 'Path to an intermediate directory that is used to store the results of the build and analysis. It can be can be used to speed up the analysis by reusing the intermediate directory Coverity generates (Refer to Coverity documentation for details)'],
  'COVBUILD' => {
    'BUILDCOMMAND' => ['Build commands needed for cov-build'],
    ['TIMEOUT' = The time (in seconds) that cov-build is allowed to run before TICS terminates the call)]
  },
  ['COVANALYZE' => {
    ['TIMEOUT' = The time (in seconds) that cov-analyze is allowed to run before TICS terminates the call]
  }],
  ['COVCOMMIT' => {
    ['TIMEOUT' = The time (in seconds) that cov-commit-defects is allowed to run before TICS terminates the call]
  }],
  ['LICENSE' => {
       'SECURITY' => 0|1 #Whether your Coverity license includes security analysis.
    }]
  }
}

The following properties have to be applied on PROJECT level:

'VIEWS' => {
  'branch name' => {
    'TOOLS' => {
      'Coverity' => {
        'PROJECT' => 'Project name in Coverity',
        ['STREAM' => 'Stream name in Coverity'],
        ['BRANCHDIR' => 'Branchdir used for the Coverity analysis'],
      },
    },
  },
},

Example for BRANCHDIR:

This section will give a more detailed explanation to clarify how to define the 'BRANCHDIR' property and why it is needed. The screenshot below shows an actual live set-up where the BRANCHDIR is needed to get TICS to work with Coverity. Now for TICS to work with Coverity it is needed to translate the relative path of TICS to the absolute path of Coverity. As seen on the screenshot below the project name of the Coverity project is Maps QA. The prefix that is needed to translate the path is highlighted in the Coverity path (first green box). Note that the BRANCHNAME needs to be removed from the relative path of TICS.

image

The situation above requires the following set-up of properties:

'VIEWS' => {
  'master' => {
    'TOOLS' => {
      'Coverity' => {
        'PROJECT' => 'Maps QA',
        'BRANCHDIR' => '/opt/jenkins/workspace/DARTS-Coverity/'
      },
    },
  },
},

Example for BUILDCOMMAND and LICENSE:

A project can also be configured with BUILDCOMMAND, Cov-build timeout and LICENSE as follows:

'VIEWS' => {
  'master' => {
    'TOOLS' => {
      'Coverity' => {
        'PROJECT' => 'Maps QA',
        'BRANCHDIR' => '/opt/jenkins/workspace/DARTS-Coverity/',
        'COVBUILD' => {
          'BUILDCOMMAND' => ['gradlew'],
          'TIMEOUT' => 3600
        },
        'LICENSE' => {
          'SECURITY' => 1,
        },
      },
    },
  },
},

AUTHENTICATIONKEYFILE:

A Coverity authentication key file can be used instead of a username and password by configuring the location of the file with AUTHENTICATIONKEYFILE in the SERVER.txt/PROJECTS.txt as follows:

  'TOOLS' => {
    'Coverity' => {
      'WEBSERVICE' => {
        'URL' => 'localhost:8080'
        'AUTHENTICATIONKEYFILE' => '/path/to/coverity-auth-key.txt',
      }
    },
  },

Alternatively, an authentication key file named coverity-auth-key.txt can be added in the TICS configuration directory. In that case, it is not necessary to configure the AUTHENTICATIONKEYFILE property, since TICS will find it automatically.

Note

An authentication key file can be generated from Coverity Connect:

image