Source tarball comparison validation#4740
Merged
mthalman merged 6 commits intodotnet:mainfrom Feb 12, 2026
Merged
Conversation
- Move TarHelper (tar entry enumeration) to TestUtilities - Move BaselineHelper (baseline comparison) to TestUtilities, returning messages instead of asserting directly - Move ExclusionsHelper (glob-based exclusions) to TestUtilities with parameterized logsDirectory - Update SourceBuild.Tests to use thin wrappers over shared helpers - Refactor tar reading in SourceBuild.Tests and UnifiedBuild.Tests to use shared TarHelper
Validates that all files tracked in the git repository are included in the git archive output. Detects files excluded by export-ignore directives in .gitattributes files within submodules. Uses baseline comparison and glob-based exclusions via shared TestUtilities helpers. Also fixes exclusion file comment parsing to only treat full-line # as comments, allowing # characters in file paths. Removes inline comment syntax from existing exclusion files. See dotnet/source-build#5472
bdaff9d to
b7150da
Compare
Member
Author
|
cc @omajid |
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new validation test that compares the set of files tracked in the VMR git repo against the set of files produced by git archive, to detect unexpected export-ignore exclusions. It also refactors baseline/exclusion helpers into TestUtilities so multiple test projects can share the same infrastructure.
Changes:
- Add
SourceTarballContentTeststo enumerategit ls-treevsgit archiveand baseline the missing-from-archive set (with exclusions). - Move/shared-ize baseline + exclusions helpers into
test/TestUtilities(including a new tar helper). - Update existing tests and exclusion baselines to use the shared helpers and updated exclusion-file comment format.
Reviewed changes
Copilot reviewed 16 out of 17 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| test/TestUtilities/TestUtilities.csproj | Adds FileSystemGlobbing dependency needed by shared exclusion parsing. |
| test/TestUtilities/TarHelper.cs | New helper to enumerate tar entry names from a stream. |
| test/TestUtilities/ExclusionsHelper.cs | Refactors helper into TestUtilities, makes it public, adds required logs directory parameter, adjusts comment parsing rules. |
| test/TestUtilities/BaselineHelper.cs | New shared baseline comparison utilities (including diff via git diff --no-index). |
| test/Microsoft.DotNet.UnifiedBuild.Tests/Utilities.cs | Switches tar enumeration to shared TarHelper. |
| test/Microsoft.DotNet.Tests/assets/SourceTarballContentTests/MissingFromArchiveExclusions.txt | Adds exclusion patterns for known/expected git archive omissions. |
| test/Microsoft.DotNet.Tests/assets/SourceTarballContentTests/MissingFromArchive.txt | Adds baseline file for repo-vs-archive comparison output. |
| test/Microsoft.DotNet.Tests/SourceTarballContentTests.cs | New test comparing git repo contents vs git archive tar output. |
| test/Microsoft.DotNet.Tests/Microsoft.DotNet.Tests.csproj | Adds RepoRoot runtime config option and makes VSTestCLIRunSettings conditional. |
| test/Microsoft.DotNet.Tests/Config.cs | Adds accessors for LogsDirectory and RepoRoot. |
| test/Microsoft.DotNet.SourceBuild.Tests/assets/SdkContentTests/SdkFileDiffExclusions.txt | Updates comments/format to align with “full-line comments only” exclusion parsing. |
| test/Microsoft.DotNet.SourceBuild.Tests/assets/ArtifactsSizeTests/ZeroSizeExclusions.txt | Updates comments/format to align with “full-line comments only” exclusion parsing. |
| test/Microsoft.DotNet.SourceBuild.Tests/Utilities.cs | Uses shared TarHelper for tar listing (materialized to avoid disposed stream). |
| test/Microsoft.DotNet.SourceBuild.Tests/SdkContentTests.cs | Updates ExclusionsHelper construction to pass logs directory. |
| test/Microsoft.DotNet.SourceBuild.Tests/LicenseScanTests.cs | Updates ExclusionsHelper construction to pass logs directory. |
| test/Microsoft.DotNet.SourceBuild.Tests/BaselineHelper.cs | Converts baseline operations to wrappers over TestUtilities.BaselineHelper. |
| test/Microsoft.DotNet.SourceBuild.Tests/ArtifactsSizeTests.cs | Updates ExclusionsHelper construction to pass logs directory. |
Comments suppressed due to low confidence (1)
test/TestUtilities/ExclusionsHelper.cs:42
ExclusionsHelpernow requireslogsDirectory, but the constructor only null-checksexclusionsFileName. SincelogsDirectoryis used forPath.Combine/writing files, add argument validation (null/empty/whitespace) and consider ensuring the directory exists (or throw a clear exception) to avoid late failures when generating updated baselines.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Switch SourceTarballContentTests to read the .tar.gz produced by CreateSourceArtifact instead of invoking git archive in the test. The tarball path is resolved via a glob on ArtifactsAssetsDir. The test is skipped when no tarball is present.
40176cb to
bcaff5b
Compare
ellahathaway
approved these changes
Feb 11, 2026
ellahathaway
approved these changes
Feb 11, 2026
tmds
pushed a commit
to tmds/dotnet
that referenced
this pull request
Feb 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes dotnet/source-build#5472
Adds validation which compares the contents of the VMR repo with the output of the
git archivecommand to ensure they have the expected contents.Refactors the test code to move the baseline/exclusion infrastructure from SourceBuilt.Tests to TestUtilities.
The new test is added to Microsoft.DotNet.Tests project which can then use the baseline/exclusion infrastructure from TestUtilities. This test gathers the list of files from the git repo using the
git ls-treecommand so there's no danger of including other non-repo files like build artifacts. This file list is compared to the list of files that get included in the output of thegit archivecommand.