Skip to content

[tests] Remove output-drain and build timestamp races - #13695

Draft
simonrozsival wants to merge 5 commits into
dev/simonrozsival/timing-cancellation-retriesfrom
dev/simonrozsival/timing-incremental-output
Draft

simonrozsival wants to merge 5 commits into
dev/simonrozsival/timing-cancellation-retriesfrom
dev/simonrozsival/timing-incremental-output

Conversation

@simonrozsival

@simonrozsival simonrozsival commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

Elapsed-time and timestamp-order assertions can fail even when output handling and incremental builds are correct. Verify the observable process and build results instead.

Bootstrap output draining

Start a descendant that keeps redirected pipes open after its parent exits. Verify that the command's output is captured and draining returns while the descendant is still alive, with a generous hang watchdog and explicit cleanup. This checks that inherited handles do not stall the task without requiring an exact elapsed-time window.

NativeAOT object changes

Give the alternate environment input a known old timestamp and compare the native object contents after changing the managed build flavor. The test still checks that recompilation changed the object, without assuming that two writes receive distinct filesystem timestamps.

R8 rule regeneration

Keep the task-count and generated-rule-content assertions, and remove comparisons between successive write timestamps. Those existing assertions establish when R8 inputs were regenerated even on filesystems with coarse timestamp resolution.

Remove blanket build timestamp checks

Delete BuildTest2.CheckTimestamps rather than stabilize its requirement that every intermediate file be newer than the start of the test. Tool-specific timestamp preservation and filesystem resolution make that blanket rule unreliable, and it is not a product contract. Its conditional typemap.mj and typemap.jm regeneration checks have no producer in this repository; out-of-tree producers have not been assessed.

The test also checked targets skipped by a no-change build. Artifact-specific tests such as ProduceReferenceAssembly, LinkAssembliesNoShrink, and BasicApplicationRepetitiveReleaseBuild remain, but they are not exact replacements for every original assertion. BasicApplicationRepetitiveBuild is still ignored in this layer; #13698 proposes to re-enable it with functional incremental assertions. There is no replacement for the blanket intermediate-age assertion.

Validation

Earlier validation was run with all five layers applied on macOS; intermediate branch heads were not built separately.

  • ./dotnet-local.sh test bin/TestDebug/Microsoft.Android.Build.BaseTasks-Tests.dll --filter 'FullyQualifiedName~BootstrapProcessTests|Name~ProjectScopedRetries' -v minimal — passed (11 tests).
  • ./dotnet-local.sh test bin/TestDebug/MSBuildDeviceIntegration/net11.0/MSBuildDeviceIntegration.dll --filter 'Name~UnchangedProguardRulesDoNotRerunR8' -v minimal — passed (2 R8 modes).
  • ./dotnet-local.sh test bin/TestDebug/net11.0/Xamarin.Android.Build.Tests.dll --filter 'Name~BootstrapUpdatesForCommandLineFlavorChanges|Name~CheckTimestamps' -v minimal — passed (4 tests across CoreCLR and NativeAOT) before CheckTimestamps was deleted.

The drain test establishes bounded completion while the descendant retains its handles; it does not enforce an exact one-second duration.

After the deletion, the #13695 test sources were checked out into a separate worktree and built against its existing Debug SDK; this was not a full checkout of the layer's product code. With V set to the session's files/audit-deletions directory:

  • ./dotnet-local.sh build src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Xamarin.Android.Build.Tests.csproj -bl:$V/13695-build.binlog — passed.
  • ./dotnet-local.sh test bin/TestDebug/net11.0/Xamarin.Android.Build.Tests.dll --list-tests | grep -cE 'CheckTimestamps|ManagedParserGeneratesResourceClasses' — returned 0 matches.
  • ./dotnet-local.sh test bin/TestDebug/net11.0/Xamarin.Android.Build.Tests.dll --filter 'FullyQualifiedName~Xamarin.Android.Build.Tests.ManagedResourceParserTests|Name~AaptRulesAreRegeneratedAfterDeletion|Name~ProduceReferenceAssembly|Name~LinkAssembliesNoShrink|Name~BasicApplicationRepetitiveBuild|Name~BootstrapUpdatesForCommandLineFlavorChanges' --logger "trx;LogFileName=13695-focused.trx" --results-directory $V — 26 passed, 0 failed, 3 skipped. Both BasicApplicationRepetitiveBuild variants are ignored at this layer; ProduceReferenceAssembly(NativeAOT) was also skipped for an unconfirmed reason.

@simonrozsival
simonrozsival force-pushed the dev/simonrozsival/timing-incremental-output branch 3 times, most recently from 4bec3aa to bee0f6f Compare November 23, 2026 07:37
simonrozsival and others added 5 commits November 23, 2026 08:55
Verify that output is captured and draining completes while the pipe-holding descendant is still alive. Use a generous hang watchdog instead of a narrow elapsed-time assertion, and clean up the test-owned descendant.

Co-authored-by: Copilot App <[email protected]>
Give the alternate environment input a known old timestamp (also on the project item, so saving the project does not rewrite it) and compare native object contents after changing the managed build flavor.

Co-authored-by: Copilot App <[email protected]>
Use the existing task-count and rule-content assertions to verify regeneration without requiring successive writes to have distinct timestamps.

Co-authored-by: Copilot App <[email protected]>
Compare initial outputs against a sentinel on the same filesystem and give existing typemaps a known old timestamp before checking regeneration.

Co-authored-by: Copilot App <[email protected]>
CheckTimestamps required every intermediate file to be newer than
the start of the test. That blanket rule depends on how each tool
preserves timestamps and is not a product contract. Its only targeted
regeneration check covered typemap.mj/jm, which nothing in this repo
produces, so that check never ran.

The artifact-specific incremental build tests remain.

Co-authored-by: Copilot App <[email protected]>
@jonathanpeppers
jonathanpeppers force-pushed the dev/simonrozsival/timing-incremental-output branch from a6aa483 to b4cde4f Compare November 23, 2026 14:55

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant