diff --git a/docs/articles/verify.md b/docs/articles/verify.md index 42603c1..8105f1c 100644 --- a/docs/articles/verify.md +++ b/docs/articles/verify.md @@ -67,6 +67,7 @@ The report is titled with the device name and opens with a header describing the - **Checked against** is the version of the specification used to verify the device, together with the reason when that is narrower than the version declared by the device. - **Specification** links to the specification documents as they stood at the revision behind the checks. - **Register set** names the generator package supplying the core register metadata, which fully determines the register set expected by the run. +- **Toolkit version** identifies the build of `harp.toolkit` that produced the report, including its source commit. #### Report path ```ps1 diff --git a/src/Harp.Toolkit/Verify/Report.cs b/src/Harp.Toolkit/Verify/Report.cs index 1bd5612..e3a44be 100644 --- a/src/Harp.Toolkit/Verify/Report.cs +++ b/src/Harp.Toolkit/Verify/Report.cs @@ -16,5 +16,6 @@ public class Report public string ProtocolCommit { get; set; } = string.Empty; public string ProtocolCommitUrl { get; set; } = string.Empty; public string RegisterSetVersion { get; set; } = string.Empty; + public string ToolkitVersion { get; set; } = string.Empty; public List Suites { get; set; } = new(); } diff --git a/src/Harp.Toolkit/Verify/ReportTemplate.cshtml b/src/Harp.Toolkit/Verify/ReportTemplate.cshtml index 6085409..08a1fee 100644 --- a/src/Harp.Toolkit/Verify/ReportTemplate.cshtml +++ b/src/Harp.Toolkit/Verify/ReportTemplate.cshtml @@ -50,6 +50,8 @@
@Model.ProtocolCommit
Register set
Harp.Generators @Model.RegisterSetVersion
+
Toolkit version
+
@Model.ToolkitVersion
diff --git a/src/Harp.Toolkit/Verify/VerifyCommand.cs b/src/Harp.Toolkit/Verify/VerifyCommand.cs index a529d74..d236e43 100644 --- a/src/Harp.Toolkit/Verify/VerifyCommand.cs +++ b/src/Harp.Toolkit/Verify/VerifyCommand.cs @@ -1,4 +1,5 @@ using System.CommandLine; +using System.Reflection; using Spectre.Console; using Harp.Generators; using Harp.Toolkit.Verify.Suites; @@ -126,7 +127,8 @@ static async Task RunVerification(string portName, FileInfo? reportFile, bo CheckedProtocolVersion = GetCheckedVersion(target), ProtocolCommit = ProtocolReference.ShortCommit, ProtocolCommitUrl = ProtocolReference.TreeUrl, - RegisterSetVersion = CoreSchema.Version + RegisterSetVersion = CoreSchema.Version, + ToolkitVersion = GetToolkitVersion() }; int currentTest = 0; @@ -240,6 +242,14 @@ static string DescribeAbort(TimeoutException exception, int completedCount, int "Rerun the verification once the device and the connection are stable."; } + static string GetToolkitVersion() + { + var assembly = typeof(VerifyCommand).Assembly; + return assembly.GetCustomAttribute()?.InformationalVersion + ?? assembly.GetName().Version?.ToString() + ?? "not reported"; + } + static string GetDeclaredVersion(ProtocolTarget target) { return target.DeclaredVersion.HasValue