Description

Coverity Documentation

Version
latest

The cov-test-configuration command parses the given input script, invokes cov-translate on the native compiler commands, and asserts that the given facts about the translated command lines are true. The translation takes place according to the configuration generated by the cov-configure command.

If all tests pass, it exits with 0. Otherwise, it exits with a non-zero code.

Note: The cov-translate command uses the same configuration as this command and translates native command-line options into cov-emit options but does NOT execute cov-emit. See cov-translate --dry-run .

Any command names referenced by the input script must be executable in the current environment.

The input script must be a well-formed, valid JSON text file encoded in UTF-8. See www.json.org for more information on JSON.

Sample input script format:

[
	{
		 "section" : "My Section Label",
 	    "tests": [
 	    	{
     			"given_input" : "gcc -m64 -c foo.c",
     			"assert_that_output": {
     				"contains": [ "-w", "-D__NO_INLINE__", "--incompat_proto" ],
     				"omits": [ "-m32" ]
     			}
   	 	 }
    	 ]
	}
]

The expected structure is the following:

  • An array of one or more "section" objects.
  • Each "section" object is composed of:
    "section"
    A label that names a section of tests.
    "tests"
    An array of one or more test objects.
  • Each test object is composed of:

    • given_input: The native command line to translate.

    • assert_that_output: An assertion object applied to translated command line.

  • An assertion object is composed of one or more of the following assertion operators:

    • contains: List of one or more command-line options that are required in translation.

    • omits: List of one or more command-line options that are forbidden in translation.

Each test translates the given_input with cov-translate and checks that all the assertion operators pass when applied to the translation.