Skip to content

Commit

Permalink
[tests] add coverage hierarchy file in the output of test target
Browse files Browse the repository at this point in the history
  • Loading branch information
Clo91eaf committed Dec 16, 2024
1 parent 81ed7eb commit c656b98
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 3 deletions.
2 changes: 1 addition & 1 deletion t1/src/T1.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1046,7 +1046,7 @@ class T1(val parameter: T1Parameter)
val coverMatch = BoolSequence(
requestReg.valid && requestReg.bits.issue.instruction === BitPat("b" + instruction.encoding.toString)
)
CoverProperty(coverMatch, label = Some(s"1_${instruction.name}"))
CoverProperty(coverMatch, label = Some(s"${instruction.name}"))
}

// // coverage for two instructions
Expand Down
2 changes: 1 addition & 1 deletion tests/builder.nix
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ let
mkdir -p $out/bin
cp ${pname}.elf $out/bin
cp ${pname}.cover $out
${jqBin} --null-input \
--arg name ${pname} \
--arg type ${casePrefix} \
--arg elfPath "$out/bin/${pname}.elf" \
'{ "name": $name, "elf": { "path": $elfPath } }' \
> $out/${pname}.json
Expand Down
1 change: 0 additions & 1 deletion tests/coverage/mlir/hello.hier

This file was deleted.

1 change: 1 addition & 0 deletions tests/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ let
mkdir -p $out/cases/${caseDrv.pname}
cp ${caseDrv}/bin/${caseDrv.pname}.elf $out/cases/${caseDrv.pname}/
cp ${caseDrv}/${caseDrv.pname}.json $out/configs/
cp ${caseDrv}/${caseDrv.pname}.cover $out/configs/
'')
allCases);
in
Expand Down
8 changes: 8 additions & 0 deletions tests/mlir/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
, findAndBuild
, getTestRequiredFeatures
, t1main
, jq
}:

let
Expand Down Expand Up @@ -54,6 +55,13 @@ let
${caseName}.c $pname.S ${t1main} \
-o $pname.elf
if [ ! -f ${sourcePath}/${caseName}.json ]; then
echo "Error: ${sourcePath}/${caseName}.json not found" >&2
else
${jq}/bin/jq -r '[.assert[] | "+assert " + .name] + [.tree[] | "+tree " + .name] + [.module[] | "+module " + .name] | .[]' \
${sourcePath}/${caseName}.json > $pname.cover
fi
runHook postBuild
'';

Expand Down
15 changes: 15 additions & 0 deletions tests/mlir/hello/hello.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"case": "mlir.hello",
"assert": [
{
"description": "vmv.v.i instruction covered",
"name": "vmv_v_i"
},
{
"description": "vmv.v.x instruction covered",
"name": "vmv_v_x"
}
],
"tree": [],
"module": []
}

0 comments on commit c656b98

Please sign in to comment.