Skip to content

Commit

Permalink
[ci] run new coverage for line/toggle coverage
Browse files Browse the repository at this point in the history
Signed-off-by: Clo91eaf <[email protected]>

[ci] run urg parallelly

Signed-off-by: Clo91eaf <[email protected]>
  • Loading branch information
Clo91eaf committed Jan 9, 2025
1 parent 826dfca commit 8813d79
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 9 deletions.
6 changes: 4 additions & 2 deletions nix/t1/run/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
, vcs-emu
, vcs-emu-rtlink
, vcs-emu-cover
, vcs-emu-cover-full
, vcs-emu-trace
, vcs-dpi-lib
, cases
Expand Down Expand Up @@ -40,6 +41,7 @@ let
verilator-emu-trace = runVerilatorEmu verilator-emu-trace case;
vcs-emu = runVCSEmu vcs-emu-rtlink case;
vcs-emu-cover = runVCSEmu vcs-emu-cover case;
vcs-emu-cover-full = runVCSEmu vcs-emu-cover-full case;
vcs-emu-trace = runVCSEmu vcs-emu-trace case;
vcs-prof-vcd = runFsdb2vcd (runVCSEmu vcs-emu-trace case);
};
Expand Down Expand Up @@ -92,11 +94,11 @@ let
in
runCommand "catch-${configName}-all-emu-result-for-ci" { } script;

_vcsEmuResult = runCommand "get-vcs-emu-result" { __noChroot = true; emuOutput = _getAllResult "vcs-emu-cover"; } ''
_vcsEmuResult = runCommand "get-vcs-emu-result" { __noChroot = true; emuOutput = _getAllResult "vcs-emu-cover-full"; } ''
cp -vr $emuOutput $out
chmod -R u+w $out
${vcs-emu.snps-fhs-env}/bin/snps-fhs-env -c "urg -dir $emuOutput/*/cm.vdb -format text -metric assert -show summary"
${vcs-emu.snps-fhs-env}/bin/snps-fhs-env -c "urg -dir $emuOutput/*/cm.vdb -format text -metric line+tgl+assert -show summary"
cp -vr urgReport $out/
'';
in
Expand Down
30 changes: 23 additions & 7 deletions script/ci/src/Main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@ object Main:

val testAttr = emuLib.toLowerCase() match
case "verilator" => s".#t1.$config.$top.run.$caseName.verilator-emu"
case "vcs" => s".#t1.$config.$top.run.$caseName.vcs-emu-cover"
// TODO: should not be cover for every test case
case "vcs" => s".#t1.$config.$top.run.$caseName.vcs-emu-cover-full"
case _ => Logger.fatal(s"Invalid test type ${emuLib}")
val testResultPath =
try
Expand Down Expand Up @@ -279,25 +280,40 @@ object Main:
Logger.info("Filtering urg report")
val finalMdPath = os.Path(urgReportFilePath.get, os.pwd)
val urgAssertFile = emuResultPath / "urgReport" / "asserts.txt"
val summaryHeading = "^Summary for Cover Properties$".r
val urgSummaryFile = emuResultPath / "urgReport" / "tests.txt"

val summaryHeading = "^Total Coverage Summary $".r
val summaryStr =
os.read(urgSummaryFile)
.lines()
.dropWhile(!summaryHeading.matches(_))
.takeWhile(!_.trim.isEmpty)
.toArray
.mkString("\n")

val coverSummaryHeading = "^Summary for Cover Properties$".r
val coverSummaryStr =
os.read(urgAssertFile)
.lines()
.dropWhile(!summaryHeading.matches(_))
.takeWhile(_.distinct != "-")
.dropWhile(!coverSummaryHeading.matches(_))
.takeWhile(!_.trim.isEmpty)
.toArray
.mkString("\n")
val detailHeading = "^Detail Report for Cover Properties$".r

val coverDetailHeading = "^Detail Report for Cover Properties$".r
val coverDetailStr =
os.read(urgAssertFile)
.lines()
.dropWhile(!detailHeading.matches(_))
.dropWhile(!coverDetailHeading.matches(_))
.toArray
.mkString("\n")

os.write.append(finalMdPath, s"### Coverage for $config \n")
os.write.append(finalMdPath, "```text\n")
os.write.append(finalMdPath, summaryStr)
os.write.append(finalMdPath, "\n----------------------\n")
os.write.append(finalMdPath, coverSummaryStr)
os.write.append(finalMdPath, "----------------------\n")
os.write.append(finalMdPath, "\n----------------------\n")
os.write.append(finalMdPath, coverDetailStr)
os.write.append(finalMdPath, "\n```\n")

Expand Down

0 comments on commit 8813d79

Please sign in to comment.