Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 18 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,22 +100,24 @@ Running self-validation produces a report containing the following information:
| DotNet Runtime | <dotnet-runtime-version> |
| Time Stamp | <timestamp> |

Tests:

- SpdxTool_AddPackage: Passed
- SpdxTool_AddRelationship: Passed
- SpdxTool_Validate: Passed
- SpdxTool_CopyPackage: Passed
- SpdxTool_Diagram: Passed
- SpdxTool_FindPackage: Passed
- SpdxTool_GetVersion: Passed
- SpdxTool_Hash: Passed
- SpdxTool_Ntia: Passed
- SpdxTool_Query: Passed
- SpdxTool_RenameId: Passed
- SpdxTool_RunNuGetWorkflow: Passed
- SpdxTool_ToMarkdown: Passed
- SpdxTool_UpdatePackage: Passed
✓ SpdxTool_AddPackage - Passed
✓ SpdxTool_AddRelationship - Passed
✓ SpdxTool_Validate - Passed
✓ SpdxTool_CopyPackage - Passed
✓ SpdxTool_Diagram - Passed
✓ SpdxTool_FindPackage - Passed
✓ SpdxTool_GetVersion - Passed
✓ SpdxTool_Hash - Passed
✓ SpdxTool_Ntia - Passed
✓ SpdxTool_Query - Passed
✓ SpdxTool_RenameId - Passed
✓ SpdxTool_RunNuGetWorkflow - Passed
✓ SpdxTool_ToMarkdown - Passed
✓ SpdxTool_UpdatePackage - Passed

Total Tests: 14
Passed: 14
Failed: 0

Validation Passed
```
Expand Down
38 changes: 20 additions & 18 deletions docs/guide/guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -910,24 +910,26 @@ Example validation report:
| Machine Name | BUILD-SERVER |
| OS Version | Microsoft Windows NT 10.0.19045.0 |
| DotNet Runtime | .NET 8.0.0 |
| Time Stamp | 2024-01-15T10:30:00Z |

Tests:

- SpdxTool_AddPackage: Passed
- SpdxTool_AddRelationship: Passed
- SpdxTool_Validate: Passed
- SpdxTool_CopyPackage: Passed
- SpdxTool_Diagram: Passed
- SpdxTool_FindPackage: Passed
- SpdxTool_GetVersion: Passed
- SpdxTool_Hash: Passed
- SpdxTool_Ntia: Passed
- SpdxTool_Query: Passed
- SpdxTool_RenameId: Passed
- SpdxTool_RunNuGetWorkflow: Passed
- SpdxTool_ToMarkdown: Passed
- SpdxTool_UpdatePackage: Passed
| Time Stamp | 2024-01-15 10:30:00Z |

✓ SpdxTool_AddPackage - Passed
✓ SpdxTool_AddRelationship - Passed
✓ SpdxTool_Validate - Passed
✓ SpdxTool_CopyPackage - Passed
✓ SpdxTool_Diagram - Passed
✓ SpdxTool_FindPackage - Passed
✓ SpdxTool_GetVersion - Passed
✓ SpdxTool_Hash - Passed
✓ SpdxTool_Ntia - Passed
✓ SpdxTool_Query - Passed
✓ SpdxTool_RenameId - Passed
✓ SpdxTool_RunNuGetWorkflow - Passed
✓ SpdxTool_ToMarkdown - Passed
✓ SpdxTool_UpdatePackage - Passed

Total Tests: 14
Passed: 14
Failed: 0

Validation Passed
```
Expand Down
19 changes: 17 additions & 2 deletions src/DemaConsulting.SpdxTool/SelfValidation/Validate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
// SOFTWARE.

using System.Runtime.InteropServices;
using DemaConsulting.TestResults;
using DemaConsulting.TestResults.IO;

namespace DemaConsulting.SpdxTool.SelfValidation;
Expand Down Expand Up @@ -47,8 +48,6 @@ public static void Run(Context context)
| DotNet Runtime | {Environment.Version,-50} |
| Time Stamp | {DateTime.UtcNow,-50:u} |

Tests:

""");

var results = new TestResults.TestResults
Expand All @@ -72,6 +71,22 @@ public static void Run(Context context)
ValidateToMarkdown.Run(context, results);
ValidateUpdatePackage.Run(context, results);

// Calculate and print summary counts
var totalTests = results.Results.Count;
var passedTests = results.Results.Count(t => t.Outcome == TestOutcome.Passed);
var failedTests = results.Results.Count(t => t.Outcome == TestOutcome.Failed);

context.WriteLine($"\nTotal Tests: {totalTests}");
context.WriteLine($"Passed: {passedTests}");
if (failedTests > 0)
{
context.WriteError($"Failed: {failedTests}");
}
else
{
context.WriteLine($"Failed: {failedTests}");
}

// If all validations succeeded (no errors) then report validation passed
if (context.Errors == 0)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,15 @@ public static void Run(Context context, TestResults.TestResults results)
var passed = DoValidate();

// Report validation result
context.WriteLine($"- SpdxTool_AddPackage: {(passed ? "Passed" : "Failed")}");
if (passed)
{
context.WriteLine($"✓ SpdxTool_AddPackage - Passed");
}
else
{
context.WriteError($"✗ SpdxTool_AddPackage - Failed");
}

results.Results.Add(
new TestResult
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,15 @@ public static void Run(Context context, TestResults.TestResults results)
var passed = DoValidate();

// Report validation result
context.WriteLine($"- SpdxTool_AddRelationship: {(passed ? "Passed" : "Failed")}");
if (passed)
{
context.WriteLine($"✓ SpdxTool_AddRelationship - Passed");
}
else
{
context.WriteError($"✗ SpdxTool_AddRelationship - Failed");
}

results.Results.Add(
new TestResult
{
Expand Down
9 changes: 8 additions & 1 deletion src/DemaConsulting.SpdxTool/SelfValidation/ValidateBasic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,14 @@
var passed = DoValidate();

// Report validation result to console
context.WriteLine($"- SpdxTool_Validate: {(passed ? "Passed" : "Failed")}");
if (passed)
{
context.WriteLine($"✓ SpdxTool_Validate - Passed");
}
else
{
context.WriteError($"✗ SpdxTool_Validate - Failed");
}

// Add validation result to test results collection
results.Results.Add(
Expand All @@ -61,7 +68,7 @@
try
{
// Create the temporary validation folder
Directory.CreateDirectory("validate.tmp");

Check warning on line 71 in src/DemaConsulting.SpdxTool/SelfValidation/ValidateBasic.cs

View workflow job for this annotation

GitHub Actions / Build and Test / Build ubuntu-latest

Define a constant instead of using this literal 'validate.tmp' 4 times.

Check warning on line 71 in src/DemaConsulting.SpdxTool/SelfValidation/ValidateBasic.cs

View workflow job for this annotation

GitHub Actions / Build and Test / Build ubuntu-latest

Define a constant instead of using this literal 'validate.tmp' 4 times.

Check warning on line 71 in src/DemaConsulting.SpdxTool/SelfValidation/ValidateBasic.cs

View workflow job for this annotation

GitHub Actions / Build and Test / Build ubuntu-latest

Define a constant instead of using this literal 'validate.tmp' 4 times.

Check warning on line 71 in src/DemaConsulting.SpdxTool/SelfValidation/ValidateBasic.cs

View workflow job for this annotation

GitHub Actions / Build and Test / Build windows-latest

Define a constant instead of using this literal 'validate.tmp' 4 times.

Check warning on line 71 in src/DemaConsulting.SpdxTool/SelfValidation/ValidateBasic.cs

View workflow job for this annotation

GitHub Actions / Build and Test / Build windows-latest

Define a constant instead of using this literal 'validate.tmp' 4 times.

Check warning on line 71 in src/DemaConsulting.SpdxTool/SelfValidation/ValidateBasic.cs

View workflow job for this annotation

GitHub Actions / Build and Test / Build windows-latest

Define a constant instead of using this literal 'validate.tmp' 4 times.

// Run validation tests for both valid and invalid documents
return DoValidateValid() && DoValidateInvalid();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,15 @@ public static void Run(Context context, TestResults.TestResults results)
var passed = DoValidate();

// Report validation result
context.WriteLine($"- SpdxTool_CopyPackage: {(passed ? "Passed" : "Failed")}");
if (passed)
{
context.WriteLine($"✓ SpdxTool_CopyPackage - Passed");
}
else
{
context.WriteError($"✗ SpdxTool_CopyPackage - Failed");
}

results.Results.Add(
new TestResult
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,14 @@ public static void Run(Context context, TestResults.TestResults results)
var passed = DoValidate();

// Report validation result to console
context.WriteLine($"- SpdxTool_Diagram: {(passed ? "Passed" : "Failed")}");
if (passed)
{
context.WriteLine($"✓ SpdxTool_Diagram - Passed");
}
else
{
context.WriteError($"✗ SpdxTool_Diagram - Failed");
}

// Add validation result to test results collection
results.Results.Add(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,15 @@ public static void Run(Context context, TestResults.TestResults results)
var passed = DoValidate();

// Report validation result
context.WriteLine($"- SpdxTool_FindPackage: {(passed ? "Passed" : "Failed")}");
if (passed)
{
context.WriteLine($"✓ SpdxTool_FindPackage - Passed");
}
else
{
context.WriteError($"✗ SpdxTool_FindPackage - Failed");
}

results.Results.Add(
new TestResult
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,15 @@ public static void Run(Context context, TestResults.TestResults results)
var passed = DoValidate();

// Report validation result
context.WriteLine($"- SpdxTool_GetVersion: {(passed ? "Passed" : "Failed")}");
if (passed)
{
context.WriteLine($"✓ SpdxTool_GetVersion - Passed");
}
else
{
context.WriteError($"✗ SpdxTool_GetVersion - Failed");
}

results.Results.Add(
new TestResult
{
Expand Down
9 changes: 8 additions & 1 deletion src/DemaConsulting.SpdxTool/SelfValidation/ValidateHash.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,14 @@
var passed = DoValidate();

// Report validation result to console
context.WriteLine($"- SpdxTool_Hash: {(passed ? "Passed" : "Failed")}");
if (passed)
{
context.WriteLine($"✓ SpdxTool_Hash - Passed");
}
else
{
context.WriteError($"✗ SpdxTool_Hash - Failed");
}

// Add validation result to test results collection
results.Results.Add(
Expand All @@ -61,7 +68,7 @@
try
{
// Create the temporary validation folder
Directory.CreateDirectory("validate.tmp");

Check warning on line 71 in src/DemaConsulting.SpdxTool/SelfValidation/ValidateHash.cs

View workflow job for this annotation

GitHub Actions / Build and Test / Build ubuntu-latest

Define a constant instead of using this literal 'validate.tmp' 5 times.

Check warning on line 71 in src/DemaConsulting.SpdxTool/SelfValidation/ValidateHash.cs

View workflow job for this annotation

GitHub Actions / Build and Test / Build ubuntu-latest

Define a constant instead of using this literal 'validate.tmp' 5 times.

Check warning on line 71 in src/DemaConsulting.SpdxTool/SelfValidation/ValidateHash.cs

View workflow job for this annotation

GitHub Actions / Build and Test / Build windows-latest

Define a constant instead of using this literal 'validate.tmp' 5 times.

Check warning on line 71 in src/DemaConsulting.SpdxTool/SelfValidation/ValidateHash.cs

View workflow job for this annotation

GitHub Actions / Build and Test / Build windows-latest

Define a constant instead of using this literal 'validate.tmp' 5 times.

Check warning on line 71 in src/DemaConsulting.SpdxTool/SelfValidation/ValidateHash.cs

View workflow job for this annotation

GitHub Actions / Build and Test / Build windows-latest

Define a constant instead of using this literal 'validate.tmp' 5 times.

// Run both generation and verification validation tests
return DoValidateGenerate() && DoValidateVerify();
Expand Down
10 changes: 9 additions & 1 deletion src/DemaConsulting.SpdxTool/SelfValidation/ValidateNtia.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,15 @@
var passed = DoValidate();

// Report validation result
context.WriteLine($"- SpdxTool_Ntia: {(passed ? "Passed" : "Failed")}");
if (passed)
{
context.WriteLine($"✓ SpdxTool_Ntia - Passed");
}
else
{
context.WriteError($"✗ SpdxTool_Ntia - Failed");
}

results.Results.Add(
new TestResult
{
Expand All @@ -58,7 +66,7 @@
try
{
// Create the temporary validation folder
Directory.CreateDirectory("validate.tmp");

Check warning on line 69 in src/DemaConsulting.SpdxTool/SelfValidation/ValidateNtia.cs

View workflow job for this annotation

GitHub Actions / Build and Test / Build ubuntu-latest

Define a constant instead of using this literal 'validate.tmp' 5 times.

Check warning on line 69 in src/DemaConsulting.SpdxTool/SelfValidation/ValidateNtia.cs

View workflow job for this annotation

GitHub Actions / Build and Test / Build ubuntu-latest

Define a constant instead of using this literal 'validate.tmp' 5 times.

Check warning on line 69 in src/DemaConsulting.SpdxTool/SelfValidation/ValidateNtia.cs

View workflow job for this annotation

GitHub Actions / Build and Test / Build ubuntu-latest

Define a constant instead of using this literal 'validate.tmp' 5 times.

Check warning on line 69 in src/DemaConsulting.SpdxTool/SelfValidation/ValidateNtia.cs

View workflow job for this annotation

GitHub Actions / Build and Test / Build windows-latest

Define a constant instead of using this literal 'validate.tmp' 5 times.

Check warning on line 69 in src/DemaConsulting.SpdxTool/SelfValidation/ValidateNtia.cs

View workflow job for this annotation

GitHub Actions / Build and Test / Build windows-latest

Define a constant instead of using this literal 'validate.tmp' 5 times.

// Run individual validation tests
return DoValidateMissingSupplier() && DoValidateCompliant();
Expand Down
10 changes: 9 additions & 1 deletion src/DemaConsulting.SpdxTool/SelfValidation/ValidateQuery.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,15 @@ public static void Run(Context context, TestResults.TestResults results)
var passed = DoValidate();

// Report validation result
context.WriteLine($"- SpdxTool_Query: {(passed ? "Passed" : "Failed")}");
if (passed)
{
context.WriteLine($"✓ SpdxTool_Query - Passed");
}
else
{
context.WriteError($"✗ SpdxTool_Query - Failed");
}

results.Results.Add(
new TestResult
{
Expand Down
10 changes: 9 additions & 1 deletion src/DemaConsulting.SpdxTool/SelfValidation/ValidateRenameId.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,15 @@ public static void Run(Context context, TestResults.TestResults results)
var passed = DoValidate();

// Report validation result
context.WriteLine($"- SpdxTool_RenameId: {(passed ? "Passed" : "Failed")}");
if (passed)
{
context.WriteLine($"✓ SpdxTool_RenameId - Passed");
}
else
{
context.WriteError($"✗ SpdxTool_RenameId - Failed");
}

results.Results.Add(
new TestResult
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,15 @@ public static void Run(Context context, TestResults.TestResults results)
var passed = DoValidate();

// Report validation result
context.WriteLine($"- SpdxTool_RunNuGetWorkflow: {(passed ? "Passed" : "Failed")}");
if (passed)
{
context.WriteLine($"✓ SpdxTool_RunNuGetWorkflow - Passed");
}
else
{
context.WriteError($"✗ SpdxTool_RunNuGetWorkflow - Failed");
}

results.Results.Add(
new TestResult
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,14 @@ public static void Run(Context context, TestResults.TestResults results)
var passed = DoValidate();

// Report validation result to console
context.WriteLine($"- SpdxTool_ToMarkdown: {(passed ? "Passed" : "Failed")}");
if (passed)
{
context.WriteLine($"✓ SpdxTool_ToMarkdown - Passed");
}
else
{
context.WriteError($"✗ SpdxTool_ToMarkdown - Failed");
}

// Add validation result to test results collection
results.Results.Add(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,15 @@ public static void Run(Context context, TestResults.TestResults results)
var passed = DoValidate();

// Report validation result
context.WriteLine($"- SpdxTool_UpdatePackage: {(passed ? "Passed" : "Failed")}");
if (passed)
{
context.WriteLine($"✓ SpdxTool_UpdatePackage - Passed");
}
else
{
context.WriteError($"✗ SpdxTool_UpdatePackage - Failed");
}

results.Results.Add(
new TestResult
{
Expand Down
Loading