NVC Cobertura

Cobertura XML code coverage report as written by NVC 1.23 (nvc --cover-export --format=cobertura).

Read by pyEDAA.Reports.CodeCoverage.Cobertura.NVCCobertura.Document - see NVC Cobertura.

The schema was reverse-engineered from NVC’s src/cov/cov-export.c and accepts nothing else. NVC names Cobertura’s DTD coverage-04.dtd in a document type declaration. It writes every attribute the DTD requires, one package named after the top-level’s library, a class per design unit named ENTITY(ARCHITECTURE), never a method, and on a branching line one condition. A rate has six decimals, every complexity is 0.0, the timestamp is in seconds. A line’s condition-coverage and its condition’s coverage are 0 %, 50 % or 100 %.

Download

NVC-Cobertura.xsd (6.2 kiB)

Validate a report

xmllint --schema NVC-Cobertura.xsd --noout coverage.xml

Source

  1<?xml version="1.0" encoding="UTF-8"?>
  2<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
  3	<xs:annotation>
  4		<xs:documentation>
  5			Cobertura XML code coverage report as written by NVC 1.23 ('nvc --cover-export --format=cobertura'):
  6			reverse-engineered from NVC's 'src/cov/cov-export.c'.
  7
  8			NVC names Cobertura's DTD 'coverage-04.dtd' in a document type declaration. It writes every attribute the DTD
  9			requires, one package named after the top-level's library, a class per design unit named 'ENTITY(ARCHITECTURE)',
 10			never a method, and on a branching line one condition. A rate has six decimals, every 'complexity' is '0.0', the
 11			timestamp is in seconds. A line's 'condition-coverage' and its condition's 'coverage' are '0 %', '50 %' or
 12			'100 %': the directions of the line's branches taken, none, one or both. XML Schema 1.0 can't require them on a
 13			branching line only. No other element or attribute is allowed.
 14		</xs:documentation>
 15	</xs:annotation>
 16
 17	<xs:simpleType name="Rate">
 18		<xs:annotation>
 19			<xs:documentation>A rate in range 0..1, six decimals, e.g. '0.687500'.</xs:documentation>
 20		</xs:annotation>
 21		<xs:restriction base="xs:decimal">
 22			<xs:pattern value="[01]\.\d{6}"/>
 23			<xs:minInclusive value="0"/>
 24			<xs:maxInclusive value="1"/>
 25		</xs:restriction>
 26	</xs:simpleType>
 27
 28	<xs:simpleType name="Complexity">
 29		<xs:annotation>
 30			<xs:documentation>NVC doesn't compute a complexity.</xs:documentation>
 31		</xs:annotation>
 32		<xs:restriction base="xs:decimal">
 33			<xs:pattern value="0\.0"/>
 34		</xs:restriction>
 35	</xs:simpleType>
 36
 37	<xs:simpleType name="Version">
 38		<xs:annotation>
 39			<xs:documentation>NVC's name and version, e.g. 'nvc 1.23.0' or 'nvc 1.24-devel'.</xs:documentation>
 40		</xs:annotation>
 41		<xs:restriction base="xs:string">
 42			<xs:pattern value="nvc \d+\.\d+(\.\d+)?(-devel)?"/>
 43		</xs:restriction>
 44	</xs:simpleType>
 45
 46	<xs:simpleType name="Timestamp">
 47		<xs:annotation>
 48			<xs:documentation>Seconds since the epoch.</xs:documentation>
 49		</xs:annotation>
 50		<xs:restriction base="xs:nonNegativeInteger">
 51			<xs:pattern value="\d{1,10}"/>
 52		</xs:restriction>
 53	</xs:simpleType>
 54
 55	<xs:simpleType name="DesignUnit">
 56		<xs:annotation>
 57			<xs:documentation>A design unit: entity and architecture, e.g. 'COUNTER(RTL)'.</xs:documentation>
 58		</xs:annotation>
 59		<xs:restriction base="xs:string">
 60			<xs:pattern value="[^(]+\(.+\)"/>
 61		</xs:restriction>
 62	</xs:simpleType>
 63
 64	<xs:simpleType name="Boolean">
 65		<xs:annotation>
 66			<xs:documentation>Whether the line branches: 'true' or 'false'.</xs:documentation>
 67		</xs:annotation>
 68		<xs:restriction base="xs:boolean">
 69			<xs:pattern value="true|false"/>
 70		</xs:restriction>
 71	</xs:simpleType>
 72
 73	<xs:simpleType name="Percentage">
 74		<xs:annotation>
 75			<xs:documentation>Directions taken of the line's branches: '0 %', '50 %' or '100 %'.</xs:documentation>
 76		</xs:annotation>
 77		<xs:restriction base="xs:string">
 78			<xs:enumeration value="0 %"/>
 79			<xs:enumeration value="50 %"/>
 80			<xs:enumeration value="100 %"/>
 81		</xs:restriction>
 82	</xs:simpleType>
 83
 84	<xs:attributeGroup name="Rates">
 85		<xs:attribute name="line-rate"   type="Rate"       use="required"/>
 86		<xs:attribute name="branch-rate" type="Rate"       use="required"/>
 87		<xs:attribute name="complexity"  type="Complexity" use="required"/>
 88	</xs:attributeGroup>
 89
 90	<xs:element name="coverage">
 91		<xs:complexType>
 92			<xs:sequence>
 93				<xs:element name="sources">
 94					<xs:complexType>
 95						<xs:sequence>
 96							<xs:element name="source" type="xs:string" fixed="."/>
 97						</xs:sequence>
 98					</xs:complexType>
 99				</xs:element>
100				<xs:element name="packages">
101					<xs:complexType>
102						<xs:sequence>
103							<xs:element ref="package"/>
104						</xs:sequence>
105					</xs:complexType>
106				</xs:element>
107			</xs:sequence>
108			<xs:attribute name="version"          type="Version"               use="required"/>
109			<xs:attribute name="timestamp"        type="Timestamp"             use="required"/>
110			<xs:attribute name="lines-valid"      type="xs:nonNegativeInteger" use="required"/>
111			<xs:attribute name="lines-covered"    type="xs:nonNegativeInteger" use="required"/>
112			<xs:attribute name="branches-valid"   type="xs:nonNegativeInteger" use="required"/>
113			<xs:attribute name="branches-covered" type="xs:nonNegativeInteger" use="required"/>
114			<xs:attributeGroup ref="Rates"/>
115		</xs:complexType>
116	</xs:element>
117
118	<xs:element name="package">
119		<xs:complexType>
120			<xs:sequence>
121				<xs:element name="classes">
122					<xs:complexType>
123						<xs:sequence>
124							<xs:element ref="class" minOccurs="0" maxOccurs="unbounded"/>
125						</xs:sequence>
126					</xs:complexType>
127				</xs:element>
128			</xs:sequence>
129			<xs:attribute name="name" type="xs:token" use="required"/>
130			<xs:attributeGroup ref="Rates"/>
131		</xs:complexType>
132	</xs:element>
133
134	<xs:element name="class">
135		<xs:complexType>
136			<xs:sequence>
137				<xs:element name="methods">
138					<xs:complexType/>
139				</xs:element>
140				<xs:element name="lines">
141					<xs:complexType>
142						<xs:sequence>
143							<xs:element ref="line" minOccurs="0" maxOccurs="unbounded"/>
144						</xs:sequence>
145					</xs:complexType>
146				</xs:element>
147			</xs:sequence>
148			<xs:attribute name="name"     type="DesignUnit" use="required"/>
149			<xs:attribute name="filename" type="xs:string"  use="required"/>
150			<xs:attributeGroup ref="Rates"/>
151		</xs:complexType>
152	</xs:element>
153
154	<xs:element name="line">
155		<xs:complexType>
156			<xs:sequence>
157				<xs:element name="conditions" minOccurs="0">
158					<xs:complexType>
159						<xs:sequence>
160							<xs:element name="condition">
161								<xs:complexType>
162									<xs:attribute name="number"   type="xs:nonNegativeInteger" use="required" fixed="0"/>
163									<xs:attribute name="type"     type="xs:string"             use="required" fixed="jump"/>
164									<xs:attribute name="coverage" type="Percentage"            use="required"/>
165								</xs:complexType>
166							</xs:element>
167						</xs:sequence>
168					</xs:complexType>
169				</xs:element>
170			</xs:sequence>
171			<xs:attribute name="number"             type="xs:positiveInteger"    use="required"/>
172			<xs:attribute name="hits"               type="xs:nonNegativeInteger" use="required"/>
173			<xs:attribute name="branch"             type="Boolean"               use="required"/>
174			<xs:attribute name="condition-coverage" type="Percentage"/>
175		</xs:complexType>
176	</xs:element>
177</xs:schema>