Skip to content

Commit

Permalink
0.1.4
Browse files Browse the repository at this point in the history
- Update XML writer to properly emit ignore and illegal bins
- Update XML reader to properly read crossExpr elements

Signed-off-by: Matthew Ballance <matt.ballance@gmail.com>
  • Loading branch information
mballance committed Sep 22, 2024
1 parent bd7f266 commit a10e09e
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 6 deletions.
4 changes: 4 additions & 0 deletions doc/Changelog.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@

## 0.1.4
- Update XML writer to properly emit ignore and illegal bins
- Update XML reader to properly read crossExpr elements

## 0.1.3
- Adjust XML reader to reconstruct type coverage based on
instance coverage saved in the UCIS XML file
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import os
from setuptools import setup, find_namespace_packages

version="0.1.3"
version="0.1.4"

if "BUILD_NUM" in os.environ.keys():
version = version + "." + os.environ["BUILD_NUM"]
Expand Down
4 changes: 2 additions & 2 deletions src/ucis/xml/xml_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,8 @@ def readCovergroup(self, cg_t, cg_l):

if cp_name not in cr_m.keys():
cp_l = []
crossExpr = next(cr_e.iter("crossExpr"))
for cp_n in crossExpr.text.split(','):
for crossExpr in cr_e.iter("crossExpr"):
cp_n = crossExpr.text.strip()
logging.debug("cp_n=\"" + cp_n + "\"")
if cp_n in cp_m.keys():
cp_l.append(cp_m[cp_n][0])
Expand Down
8 changes: 5 additions & 3 deletions src/ucis/xml/xml_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,8 @@ def write_coverpoint(self, cgInstElem, cp : Coverpoint):

self.write_options(cpElem, cp)

self.write_coverpoint_bins(cpElem, cp.coverItems(CoverTypeT.CVGBIN))
self.write_coverpoint_bins(cpElem, cp.coverItems(
CoverTypeT.CVGBIN|CoverTypeT.IGNOREBIN|CoverTypeT.ILLEGALBIN))

def write_coverpoint_bins(self, cpElem, coveritems : Iterator[CoverIndex]):
# TODO: should probably organize bins into a structure that fits more nicely into the interchage format
Expand All @@ -232,7 +233,7 @@ def write_coverpoint_bins(self, cpElem, coveritems : Iterator[CoverIndex]):
cov_data = cp_bin.getCoverData()
cpBinElem = self.mkElem(cpElem, "coverpointBin")
self.setAttr(cpBinElem, "name", cp_bin.getName())

if cp_bin.data.type == CoverTypeT.CVGBIN:
self.setAttr(cpBinElem, "type", "bins")
elif cp_bin.data.type == CoverTypeT.IGNOREBIN:
Expand Down Expand Up @@ -268,7 +269,8 @@ def write_cross(self, cgInstElem, cr):
crossExpr = self.mkElem(crossElem, "crossExpr")
crossExpr.text = cr.getIthCrossedCoverpoint(i).getScopeName()

self.write_cross_bins(crossElem, cr.coverItems(CoverTypeT.CVGBIN))
self.write_cross_bins(crossElem, cr.coverItems(
CoverTypeT.CVGBIN|CoverTypeT.IGNOREBIN|CoverTypeT.ILLEGALBIN))

def write_cross_bins(self, crossElem, coveritems : Iterator[CoverIndex]):

Expand Down
20 changes: 20 additions & 0 deletions ve/unit/test_merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,8 +486,28 @@ def test_1db_2ci_2cp_1cr(self):

dst_db = MemFactory.create()

from ucis.xml.xml_writer import XmlWriter
from ucis.xml.xml_reader import XmlReader
from io import StringIO


merger = DbMerger()
merger.merge(dst_db, [src_db])

# writer = XmlWriter()
# cov = StringIO()
# writer.write(cov, dst_db)
# print("Result:\n%s\n" % cov.getvalue())
# reader = XmlReader()
# dst_db_p = reader.read(StringIO(cov.getvalue()))

# from ucis.report.text_coverage_report_formatter import TextCoverageReportFormatter

# rpt_p = CoverageReportBuilder.build(dst_db_p)
# rpt_s_p = StringIO()
# rpt_fmt = TextCoverageReportFormatter(rpt_p, rpt_s_p)
# rpt_fmt.report()
# print("Final report:\n%s\n" % rpt_s_p.getvalue())

rpt = CoverageReportBuilder.build(dst_db)

Expand Down

0 comments on commit a10e09e

Please sign in to comment.