From 6a43ef2e3da0fb5acaeb7a07ba972b60d65a18ae Mon Sep 17 00:00:00 2001 From: Clo91eaf Date: Wed, 9 Oct 2024 13:47:48 +0800 Subject: [PATCH] [ci] add urg assertion report detail section in summary report --- nix/t1/run/default.nix | 2 +- script/ci/src/Main.scala | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/nix/t1/run/default.nix b/nix/t1/run/default.nix index c41454131..d3ae1ca5e 100644 --- a/nix/t1/run/default.nix +++ b/nix/t1/run/default.nix @@ -85,7 +85,7 @@ let cp -vr $emuOutput $out chmod -R u+w $out - ${vcs-emu.vcs-fhs-env}/bin/vcs-fhs-env -c "urg -dir $emuOutput/*/cm.vdb -format text" + ${vcs-emu.vcs-fhs-env}/bin/vcs-fhs-env -c "urg -dir $emuOutput/*/cm.vdb -format text -metric assert -show summary" cp -vr urgReport $out/ ''; in diff --git a/script/ci/src/Main.scala b/script/ci/src/Main.scala index 75ccbc036..b8c6256ce 100644 --- a/script/ci/src/Main.scala +++ b/script/ci/src/Main.scala @@ -235,8 +235,7 @@ object Main: "## Cycle Update\n" ) - if urgReportFilePath.nonEmpty then - os.write(os.Path(urgReportFilePath.get, os.pwd), "# Coverage report\n") + if urgReportFilePath.nonEmpty then os.write(os.Path(urgReportFilePath.get, os.pwd), "# Coverage report\n") os.walk(os.pwd / ".github" / caseDir) .filter(_.last == "default.json") @@ -292,17 +291,26 @@ object Main: Logger.info("Filtering urg report") val finalMdPath = os.Path(urgReportFilePath.get, os.pwd) val urgAssertFile = emuResultPath / "urgReport" / "asserts.txt" - val heading = "^Summary for Cover Properties$".r + val summaryHeading = "^Summary for Cover Properties$".r val coverSummaryStr = os.read(urgAssertFile) .lines() - .dropWhile(!heading.matches(_)) + .dropWhile(!summaryHeading.matches(_)) .takeWhile(_.distinct != "-") .toArray .mkString("\n") + val detailHeading = "^Detail Report for Cover Properties$".r + val coverDetailStr = + os.read(urgAssertFile) + .lines() + .dropWhile(!detailHeading.matches(_)) + .toArray + .mkString("\n") os.write.append(finalMdPath, s"### Coverage for $config \n") os.write.append(finalMdPath, "```text\n") os.write.append(finalMdPath, coverSummaryStr) + os.write.append(finalMdPath, "----------------------\n") + os.write.append(finalMdPath, coverDetailStr) os.write.append(finalMdPath, "\n```\n") os.write.over(file, ujson.write(cycleRecord, indent = 2))