Skip to content

Add test coverage for ResultsComparer and CLI helper paths#5199

Open
LoopedBard3 wants to merge 4 commits intodotnet:mainfrom
LoopedBard3:TestAllTheThings
Open

Add test coverage for ResultsComparer and CLI helper paths#5199
LoopedBard3 wants to merge 4 commits intodotnet:mainfrom
LoopedBard3:TestAllTheThings

Conversation

@LoopedBard3
Copy link
Copy Markdown
Member

@LoopedBard3 LoopedBard3 commented Apr 9, 2026

Summary

This expands automated coverage in the repo’s tooling-focused test surface without large production refactors.

What changed

  • Added a new ResultsComparer.Tests project covering:

    • file and directory input handling
    • JSON deserialization from file/stream
    • stats aggregation and output behavior
    • zip/tar.gz decompression flows
    • duplicate-result/version-selection behavior
    • CLI paths for invalid thresholds, missing inputs, and matrix output
  • Expanded BenchmarkDotNet.Extensions command-line option tests to cover:

    • string parameter parsing
    • boolean switch parsing
    • missing/invalid integer argument paths
    • absent-switch behavior
  • Improved Startup.Tests reliability by skipping ETW-dependent Windows tests when not running elevated, instead of aborting the run

Small correctness fixes found while adding coverage

The new tests exposed a few edge-case bugs, which are fixed in this PR:

  • CommandLineOptions.ParseAndRemoveStringsParameter now handles missing switches safely
  • ResultsComparer.Program now tolerates a missing optional --filter
  • TwoInputsComparer now treats EquivalenceTestConclusion.Base as a no-diff case
  • ResultsComparer.Data moniker parsing is now null-safe for additional archive path shapes

Validation

Validated the affected suites in the available environment:

  • ResultsComparer.Tests passing
  • targeted BenchmarkDotNet.Extensions command-line tests passing
  • Startup.Tests now skip environment-dependent cases cleanly

Note: test projects are kept at net11.0; full execution of those targets requires a local/CI environment with the .NET 11 SDK installed.

LoopedBard3 and others added 2 commits April 9, 2026 11:34
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@LoopedBard3 LoopedBard3 requested a review from Copilot April 9, 2026 22:18
@LoopedBard3 LoopedBard3 self-assigned this Apr 9, 2026
@LoopedBard3 LoopedBard3 changed the title Test all the things Add test coverage for ResultsComparer and CLI helper paths Apr 9, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds new unit tests and small robustness tweaks across tooling to improve confidence in ResultsComparer output/CLI parsing and reduce platform-specific test failures.

Changes:

  • Added a new ResultsComparer.Tests project with coverage for Program, Data, Helper, and Stats.
  • Updated ResultsComparer logic for filter handling, moniker parsing, and equivalence-test conclusions.
  • Improved platform gating in Startup.Tests and strengthened/nullability-corrected tests in the BenchmarkDotNet.Extensions harness.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/tools/ScenarioMeasurement/Startup.Tests/StartupTests.cs Updates Windows/Linux platform detection and adds an admin-privilege gate for ETW-related tests.
src/tools/ResultsComparer/TwoInputsComparer.cs Treats EquivalenceTestConclusion.Base as non-difference (like Same) when filtering results.
src/tools/ResultsComparer/ResultsComparer.sln Adds the new ResultsComparer.Tests project and additional solution configurations.
src/tools/ResultsComparer/Properties/AssemblyInfo.cs Exposes internals to ResultsComparer.Tests via InternalsVisibleTo.
src/tools/ResultsComparer/Program.cs Makes filter parsing resilient to null filter arrays.
src/tools/ResultsComparer/Data.cs Adjusts moniker detection (including empty-key guard and Contains-based matching for newer TFMs).
src/tools/ResultsComparer.Tests/StatsTests.cs Adds unit tests for Stats formatting/aggregation and validation behavior.
src/tools/ResultsComparer.Tests/ResultsComparerTestData.cs Adds a JSON test-data generator for BDN-like inputs.
src/tools/ResultsComparer.Tests/ResultsComparer.Tests.csproj Introduces the new ResultsComparer unit test project.
src/tools/ResultsComparer.Tests/ProgramTests.cs Adds CLI-level tests validating error output and “no diffs” behavior.
src/tools/ResultsComparer.Tests/HelperTests.cs Adds tests for file discovery and JSON deserialization helpers.
src/tools/ResultsComparer.Tests/DataTests.cs Adds tests for nested zip + tar.gz extraction and dedup/version preference logic.
src/tests/harness/BenchmarkDotNet.Extensions.Tests/PartitionFilterTests.cs Makes parsed config nullable-aware and asserts non-null on success.
src/tests/harness/BenchmarkDotNet.Extensions.Tests/CommandLineOptionsTests.cs Adds more test cases for parsing/removal helpers (strings/bool/int).
src/harness/BenchmarkDotNet.Extensions/CommandLineOptions.cs Fixes parsing when the target string parameter switch is missing.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@LoopedBard3 LoopedBard3 marked this pull request as ready for review April 10, 2026 18:11
@LoopedBard3 LoopedBard3 marked this pull request as draft April 10, 2026 18:11
@LoopedBard3 LoopedBard3 marked this pull request as ready for review April 13, 2026 20:01
Copilot AI review requested due to automatic review settings April 13, 2026 20:01
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 18 out of 18 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants