GHDL coverage 1.0.0
The coverage file GHDL writes when simulating with ghdl -r --coverage, format version 1.0.0, as a JSON Schema.
Read by pyEDAA.Reports.CodeCoverage.GHDL.Document, for a coverage file stating "version": "1.0.0" - see
GHDL coverage JSON.
GHDL publishes no schema of its coverage file. This one is reverse-engineered from GHDL’s writer
src/ghdldrv/ghdlcovout.adb and its reader src/ghdldrv/ghdlcov.adb: every field GHDL writes is
required, a result is 0 or 1 per line number, and an unknown field is rejected.
Download
GHDL-Coverage-1.0.0.schema.json (2.2 kiB)
Validate a coverage file
check-jsonschema --schemafile GHDL-Coverage-1.0.0.schema.json coverage-*.json
Source
1{
2 "$schema": "https://json-schema.org/draft/2020-12/schema",
3 "$id": "https://edaa-org.github.io/pyEDAA.Reports/Schemas/GHDL-Coverage-1.0.0.schema.json",
4 "title": "GHDL coverage file, format version 1.0.0",
5 "description": "The coverage file GHDL writes with 'ghdl -r --coverage', format version 1.0.0. Reverse-engineered from GHDL's writer 'src/ghdldrv/ghdlcovout.adb' and reader 'src/ghdldrv/ghdlcov.adb'.",
6 "type": "object",
7 "required": ["app", "version", "testcase", "timestamp", "outputs"],
8 "properties": {
9 "app": {"description": "Kind of the file.", "const": "GHDL coverage output file"},
10 "version": {"description": "Version of the format.", "const": "1.0.0"},
11 "testcase": {"description": "Name of the testcase; GHDL writes 'unknown'.", "type": "string"},
12 "timestamp": {"description": "Time the file was written, UTC, as YYYYMMDDhhmmss.mmm.", "type": "string", "pattern": "^[0-9]{14}\\.[0-9]{3}$"},
13 "outputs": {
14 "description": "The source files with coverage points.",
15 "type": "array",
16 "items": {"$ref": "#/$defs/Output"}
17 }
18 },
19 "additionalProperties": false,
20 "$defs": {
21 "Output": {
22 "description": "A source file: its name, where it was analyzed, its checksum, and the result per line.",
23 "type": "object",
24 "required": ["file", "dir", "sha1", "mode", "max-line", "result"],
25 "properties": {
26 "file": {"description": "The file's name, as given to the analysis.", "type": "string", "minLength": 1},
27 "dir": {"description": "The directory the file was analyzed in: '.' for the directory GHDL ran in, '' for an absolute file name.", "type": "string"},
28 "sha1": {"description": "SHA-1 checksum of the file's content.", "type": "string", "pattern": "^[0-9a-f]{40}$"},
29 "mode": {"description": "Kind of coverage: statement coverage.", "enum": ["stmt"]},
30 "max-line": {"description": "The last line with a coverage point.", "type": "integer", "minimum": 1},
31 "result": {
32 "description": "Per line with a coverage point: 1, if a statement of the line ran, else 0.",
33 "type": "object",
34 "minProperties": 1,
35 "propertyNames": {"pattern": "^[1-9][0-9]*$"},
36 "additionalProperties": {"enum": [0, 1]}
37 }
38 },
39 "additionalProperties": false
40 }
41 }
42}