Skip to content
Open
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
2 changes: 1 addition & 1 deletion .github/skills/update-expected-app-size/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Download updated expected app size files from Azure DevOps artifacts for the cur
The app size tests (`tests/dotnet/UnitTests/AppSizeTest.cs`) compare the built app's size and preserved APIs against expected files stored in `tests/dotnet/UnitTests/expected/`. When the test detects a difference and `WRITE_KNOWN_FAILURES` is not set, it writes the updated expected file to `$(Build.ArtifactStagingDirectory)/updated-expected-sizes/`, and a pipeline step publishes this directory as a build artifact.

The artifact name follows the pattern `{uploadPrefix}updated-expected-sizes-{testPrefix}-{attempt}` (e.g., `updated-expected-sizes-dotnettests_ios-1`). Because the expected files can be very big, the test uploads a unified **diff** for each changed expected file rather than the whole file. Inside the artifact, files are named after the test variant with a `.diff` suffix:
- `{Platform}-{Variant}-size.txt.diff` — e.g., `iOS-MonoVM-size.txt.diff`, `iOS-MonoVM-interpreter-size.txt.diff`, `iOS-NativeAOT-TrimmableStatic-size.txt.diff`, `MacOSX-CoreCLR-Interpreter-size.txt.diff`
- `{Platform}-{Variant}-size.txt.diff` — e.g., `iOS-MonoVM-size.txt.diff`, `iOS-MonoVM-interpreter-size.txt.diff`, `iOS-NativeAOT-TrimmableStatic-size.txt.diff`, `MacOSX-CoreCLR-Interpreter-ManagedStatic-size.txt.diff`
- `{Platform}-{Variant}-preservedapis.txt.diff` — e.g., `iOS-MonoVM-preservedapis.txt.diff`, `MacCatalyst-MonoVM-interpreter-preservedapis.txt.diff`

Each diff is a unified diff (relative to the repository root) that can be applied with `git apply -p1` or `patch -p1`. The expected files on disk are at:
Expand Down
28 changes: 24 additions & 4 deletions tests/dotnet/UnitTests/AppSizeTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,28 +53,30 @@ public void NativeAOT (ApplePlatform platform, string runtimeIdentifiers)
[TestCase (ApplePlatform.TVOS, "tvos-arm64", true)]
[TestCase (ApplePlatform.MacCatalyst, "maccatalyst-arm64", true)]
[TestCase (ApplePlatform.MacOSX, "osx-arm64;osx-x64", false)]
public void CoreCLR_Interpreter (ApplePlatform platform, string runtimeIdentifiers, bool isTrimmed)
public void CoreCLR_Interpreter_ManagedStatic (ApplePlatform platform, string runtimeIdentifiers, bool isTrimmed)
{
var dict = new Dictionary<string, string> () {
{ "UseMonoRuntime", "false" },
{ "PublishReadyToRun", "false" },
{ "NoDSymUtil", "false" }, // off by default for macOS, but we want to test it, so enable it
{ "Registrar", "managed-static" },
};
Run (platform, runtimeIdentifiers, "Release", $"{platform}-CoreCLR-Interpreter", isTrimmed, dict);
Run (platform, runtimeIdentifiers, "Release", $"{platform}-CoreCLR-Interpreter-ManagedStatic", isTrimmed, dict);
}

[TestCase (ApplePlatform.iOS, "ios-arm64", true)]
[TestCase (ApplePlatform.TVOS, "tvos-arm64", true)]
[TestCase (ApplePlatform.MacCatalyst, "maccatalyst-arm64", true)]
[TestCase (ApplePlatform.MacOSX, "osx-arm64;osx-x64", false)]
public void CoreCLR_R2R (ApplePlatform platform, string runtimeIdentifiers, bool isTrimmed)
public void CoreCLR_R2R_ManagedStatic (ApplePlatform platform, string runtimeIdentifiers, bool isTrimmed)
{
var dict = new Dictionary<string, string> () {
{ "UseMonoRuntime", "false" },
{ "PublishReadyToRun", "true" },
{ "NoDSymUtil", "false" }, // off by default for macOS, but we want to test it, so enable it
{ "Registrar", "managed-static" },
};
Run (platform, runtimeIdentifiers, "Release", $"{platform}-CoreCLR-R2R", isTrimmed, dict);
Run (platform, runtimeIdentifiers, "Release", $"{platform}-CoreCLR-R2R-ManagedStatic", isTrimmed, dict);
}

[TestCase (ApplePlatform.iOS, "ios-arm64")]
Expand All @@ -92,6 +94,9 @@ public void NativeAOT_TrimmableStatic (ApplePlatform platform, string runtimeIde
Run (platform, runtimeIdentifiers, "Release", $"{platform}-NativeAOT-TrimmableStatic", false, dict);
}

[TestCase (ApplePlatform.iOS, "ios-arm64", true)]
[TestCase (ApplePlatform.TVOS, "tvos-arm64", true)]
[TestCase (ApplePlatform.MacCatalyst, "maccatalyst-arm64", true)]
[TestCase (ApplePlatform.MacOSX, "osx-arm64;osx-x64", false)]
public void CoreCLR_Interpreter_TrimmableStatic (ApplePlatform platform, string runtimeIdentifiers, bool isTrimmed)
{
Expand All @@ -104,6 +109,21 @@ public void CoreCLR_Interpreter_TrimmableStatic (ApplePlatform platform, string
Run (platform, runtimeIdentifiers, "Release", $"{platform}-CoreCLR-Interpreter-TrimmableStatic", isTrimmed, dict);
}

[TestCase (ApplePlatform.iOS, "ios-arm64", true)]
[TestCase (ApplePlatform.TVOS, "tvos-arm64", true)]
[TestCase (ApplePlatform.MacCatalyst, "maccatalyst-arm64", true)]
[TestCase (ApplePlatform.MacOSX, "osx-arm64;osx-x64", false)]
public void CoreCLR_R2R_TrimmableStatic (ApplePlatform platform, string runtimeIdentifiers, bool isTrimmed)
{
var dict = new Dictionary<string, string> () {
{ "UseMonoRuntime", "false" },
{ "PublishReadyToRun", "true" },
{ "NoDSymUtil", "false" }, // off by default for macOS, but we want to test it, so enable it
{ "Registrar", "trimmable-static" },
};
Run (platform, runtimeIdentifiers, "Release", $"{platform}-CoreCLR-R2R-TrimmableStatic", isTrimmed, dict);
}

// This test will build the SizeTestApp, and capture the resulting app size.
// The app size is stored in a file on disk, so we can make sure app size doesn't change (or at least we notice it and we can update the known state).
// There's a tolerance in the test for minor app size variances, so if this test fails, the current change might not mean there's a big change,
Expand Down
Loading