Skip to content

Commit a427688

Browse files
authored
[tests] Remove the last set of ignored MSBuild tests (#8246)
Fixes: #7777 The last set of ignored test categories have been removed or migrated to existing tests: * Test configurations related to AotMode=Hybrid and AotMode=Full have been removed. * BuildTest.CheckSequencePointGeneration has been removed due to it relying on mono symbol output. * EnvironmentContentTests.CheckBuildIdIsUnique has been removed due to it relying on mono symbol output. * PackagingTest.CheckManagedSymbolsArchive has been removed due to it relying on mono symbol output. * InstallAndRunTests.MonoSymbolicateAndroidStackTrace has been removed due to it relying on mono symbol output. * InstallAndRunTests.MonoSymbolicateNetStandardStackTrace has been removed due to it relying on mono symbol output. * EmbeddedDSOTests.BinariesExist removed as it is implicitly covered by tests that validate .apk contents. * EmbeddedDSOTests.EnvironmentFileContents removed as it is covered by BuildTest.CheckAssemblyCounts. * EmbeddedDSOTests.DSOPageAlignment assert moved to PackagingTest.EmbeddedDSOs. * EmbeddedDSOTests.DSOCompressionMode and EmbeddedDSOTests.AndroidManifestHasFlag removed as they are covered by PackagingTest.EmbeddedDSOs.
1 parent 866b2c2 commit a427688

File tree

16 files changed

+94
-725
lines changed

16 files changed

+94
-725
lines changed

build-tools/automation/azure-pipelines.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ stages:
273273
parameters:
274274
testRunTitle: Xamarin.Android.Build.Tests - Linux .NET 6 Smoke Tests
275275
testAssembly: $(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration)/$(DotNetStableTargetFramework)/Xamarin.Android.Build.Tests.dll
276-
dotNetTestExtraArgs: --filter "TestCategory = SmokeTests $(DotNetNUnitCategories)"
276+
dotNetTestExtraArgs: --filter "TestCategory = SmokeTests"
277277
testResultsFile: TestResult-NETSmokeMSBuildTests-Linux-$(XA.Build.Configuration).xml
278278

279279
- template: yaml-templates/upload-results.yaml

build-tools/automation/yaml-templates/build-windows.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ stages:
9696
testRunTitle: Smoke MSBuild Tests - Windows Dotnet Build
9797
testAssembly: $(System.DefaultWorkingDirectory)\bin\Test$(XA.Build.Configuration)\$(DotNetStableTargetFramework)\Xamarin.Android.Build.Tests.dll
9898
testResultsFile: TestResult-SmokeMSBuildTests-WinDotnetBuild-$(XA.Build.Configuration).xml
99-
dotNetTestExtraArgs: --filter "TestCategory = SmokeTests $(DotNetNUnitCategories)"
99+
dotNetTestExtraArgs: --filter "TestCategory = SmokeTests"
100100

101101
- template: upload-results.yaml
102102
parameters:

build-tools/automation/yaml-templates/run-msbuild-tests.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
parameters:
2-
testOS: # 'macOS' or 'Windows'
3-
jobName: # Name of the job
4-
jobDisplayName: # Display name of the job
5-
agentCount: # Number of build agents to run in parallel
6-
testFilter: # Filter used to select tests (NUnit test selection language, not dotnet test filter language)
2+
testOS: '' # 'macOS' or 'Windows'
3+
jobName: '' # Name of the job
4+
jobDisplayName: '' # Display name of the job
5+
agentCount: 1 # Number of build agents to run in parallel
6+
testFilter: '' # Filter used to select tests (NUnit test selection language, not dotnet test filter language)
77
xaSourcePath: $(System.DefaultWorkingDirectory)
88
repositoryAlias: 'self'
99
commit: ''
@@ -48,7 +48,7 @@ jobs:
4848
- template: run-sliced-nunit-tests.yaml
4949
parameters:
5050
testAssembly: ${{ parameters.xaSourcePath }}/bin/Test$(XA.Build.Configuration)/$(DotNetStableTargetFramework)/Xamarin.Android.Build.Tests.dll
51-
testFilter: ${{ parameters.testFilter }} $(ExcludedNUnitCategories)
51+
testFilter: ${{ parameters.testFilter }}
5252
testRunTitle: Xamarin.Android.Build.Tests - ${{ parameters.testOS }}
5353
retryFailedTests: false
5454
xaSourcePath: ${{ parameters.xaSourcePath }}

build-tools/automation/yaml-templates/run-sliced-nunit-tests.yaml

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,28 @@
11
parameters:
2-
testAssembly: # NUnit test assembly to run
3-
testFilter: # Filter used to select tests (NUnit test selection language, not dotnet test filter language)
4-
testRunTitle: # Title of the test run
2+
testAssembly: '' # NUnit test assembly to run
3+
testFilter: '' # Filter used to select tests (NUnit test selection language, not dotnet test filter language)
4+
testRunTitle: '' # Title of the test run
55
xaSourcePath: $(System.DefaultWorkingDirectory)
66
retryFailedTests: true # Retry failed tests once
77

88
steps:
9-
- pwsh: |
10-
dotnet-test-slicer `
11-
slice `
12-
--test-assembly="${{ parameters.testAssembly }}" `
13-
--test-filter="${{ parameters.testFilter }}" `
14-
--slice-number=$(System.JobPositionInPhase) `
15-
--total-slices=$(System.TotalJobsInPhase) `
9+
- ${{if parameters.testFilter}}:
10+
- pwsh: >-
11+
dotnet-test-slicer slice
12+
--test-assembly="${{ parameters.testAssembly }}"
13+
--test-filter="${{ parameters.testFilter }}"
14+
--slice-number=$(System.JobPositionInPhase)
15+
--total-slices=$(System.TotalJobsInPhase)
1616
--outfile="${{ parameters.testAssembly }}.runsettings"
17-
displayName: Slice unit tests
17+
displayName: Slice unit tests with filter
18+
- ${{ else }}:
19+
- pwsh: >-
20+
dotnet-test-slicer slice
21+
--test-assembly="${{ parameters.testAssembly }}"
22+
--slice-number=$(System.JobPositionInPhase)
23+
--total-slices=$(System.TotalJobsInPhase)
24+
--outfile="${{ parameters.testAssembly }}.runsettings"
25+
displayName: Slice unit tests
1826
1927
- ${{ if eq(parameters.retryFailedTests, 'false') }}:
2028
# If we aren't using auto-retry logic, then this is just a simple template call

build-tools/automation/yaml-templates/stage-msbuild-emulator-tests.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ stages:
5757
- template: run-sliced-nunit-tests.yaml
5858
parameters:
5959
testAssembly: ${{ parameters.xaSourcePath }}/bin/Test$(XA.Build.Configuration)/MSBuildDeviceIntegration/$(DotNetStableTargetFramework)/MSBuildDeviceIntegration.dll
60-
testFilter: cat != TimeZoneInfo & cat != Localization $(ExcludedNUnitCategories)
60+
testFilter: $(ExcludedNightlyNUnitCategories)
6161
testRunTitle: MSBuildDeviceIntegration On Device - macOS
6262

6363
- ${{ if ne(parameters.usesCleanImages, true) }}:

build-tools/automation/yaml-templates/stage-msbuild-tests.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ stages:
2222
jobName: mac_msbuild_tests
2323
jobDisplayName: macOS > Tests > MSBuild
2424
agentCount: 10
25-
testFilter: cat != Dummy # This is because $(ExcludedNUnitCategories) gets appended which starts with '&'
2625
xaSourcePath: ${{ parameters.xaSourcePath }}
2726
repositoryAlias: ${{ parameters.repositoryAlias }}
2827
commit: ${{ parameters.commit }}
@@ -34,7 +33,6 @@ stages:
3433
jobName: win_msbuild_tests
3534
jobDisplayName: Windows > Tests > MSBuild
3635
agentCount: 6
37-
testFilter: cat != Dummy # This is because $(ExcludedNUnitCategories) gets appended which starts with '&'
3836
xaSourcePath: ${{ parameters.xaSourcePath }}
3937
repositoryAlias: ${{ parameters.repositoryAlias }}
4038
commit: ${{ parameters.commit }}

build-tools/automation/yaml-templates/variables.yaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,7 @@ variables:
4848
value: false
4949
- name: IsRelOrTargetingRel
5050
value: $[or(startsWith(variables['Build.SourceBranch'], 'refs/heads/release/'), startsWith(variables['System.PullRequest.TargetBranch'], 'release/'))]
51-
- name: DotNetNUnitCategories
52-
value: '& TestCategory != DotNetIgnore & TestCategory != HybridAOT & TestCategory != MkBundle & TestCategory != MonoSymbolicate & TestCategory != StaticProject & TestCategory != SystemApplication'
5351
- name: DefaultTestSdkPlatforms # Comma-separated SDK Platform(s) to install on test agents (no spaces)
5452
value: 33,34
55-
- name: ExcludedNUnitCategories
56-
value: '& cat != DotNetIgnore & cat != HybridAOT & cat != MkBundle & cat != MonoSymbolicate & cat != StaticProject & cat != SystemApplication'
53+
- name: ExcludedNightlyNUnitCategories
54+
value: 'cat != SystemApplication & cat != TimeZoneInfo & cat != Localization'

src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/AotTests.cs

Lines changed: 1 addition & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -363,76 +363,20 @@ public static void Foo () {
363363
sb.Dispose ();
364364
}
365365

366-
[Test]
367-
[Category ("HybridAOT")]
368-
public void HybridAOT ([Values ("armeabi-v7a;arm64-v8a", "armeabi-v7a", "arm64-v8a")] string abis)
369-
{
370-
// There's no point in testing all of the ABIs with and without assembly blobs, let's test just one of them this way
371-
bool usesAssemblyBlobs = String.Compare ("arm64-v8a", abis, StringComparison.Ordinal) == 0;
372-
var proj = new XamarinAndroidApplicationProject () {
373-
IsRelease = true,
374-
AotAssemblies = true,
375-
};
376-
proj.SetProperty ("AndroidAotMode", "Hybrid");
377-
// So we can use Mono.Cecil to open assemblies directly
378-
proj.SetProperty ("AndroidEnableAssemblyCompression", "False");
379-
proj.SetProperty ("AndroidUseAssemblyStore", usesAssemblyBlobs.ToString ());
380-
proj.SetAndroidSupportedAbis (abis);
381-
382-
using (var b = CreateApkBuilder ()) {
383-
384-
if (abis == "armeabi-v7a") {
385-
proj.SetProperty ("_AndroidAotModeValidateAbi", "False");
386-
b.Build (proj);
387-
proj.SetProperty ("_AndroidAotModeValidateAbi", () => null);
388-
}
389-
390-
if (abis.Contains ("armeabi-v7a")) {
391-
b.ThrowOnBuildFailure = false;
392-
Assert.IsFalse (b.Build (proj), "Build should have failed.");
393-
string error = b.LastBuildOutput
394-
.SkipWhile (x => !x.StartsWith ("Build FAILED.", StringComparison.Ordinal))
395-
.FirstOrDefault (x => x.Contains ("error XA1025:"));
396-
Assert.IsNotNull (error, "Build should have failed with XA1025.");
397-
return;
398-
}
399-
400-
b.Build (proj);
401-
402-
var apk = Path.Combine (Root, b.ProjectDirectory, proj.OutputPath, $"{proj.PackageName}-Signed.apk");
403-
FileAssert.Exists (apk);
404-
var helper = new ArchiveAssemblyHelper (apk, usesAssemblyBlobs);
405-
Assert.IsTrue (helper.Exists ($"assemblies/{proj.ProjectName}.dll"), $"{proj.ProjectName}.dll should exist in apk!");
406-
407-
using (var stream = helper.ReadEntry ($"assemblies/{proj.ProjectName}.dll")) {
408-
stream.Position = 0;
409-
using (var assembly = AssemblyDefinition.ReadAssembly (stream)) {
410-
var type = assembly.MainModule.GetType ($"{proj.ProjectName}.MainActivity");
411-
var method = type.Methods.First (m => m.Name == "OnCreate");
412-
Assert.LessOrEqual (method.Body.Instructions.Count, 1, "OnCreate should have stripped method bodies!");
413-
}
414-
}
415-
}
416-
}
417-
418366
[Test]
419367
[Category ("LLVM")]
420-
public void NoSymbolsArgShouldReduceAppSize ([Values ("", "Hybrid")] string androidAotMode, [Values (false, true)] bool skipDebugSymbols)
368+
public void NoSymbolsArgShouldReduceAppSize ([Values (false, true)] bool skipDebugSymbols)
421369
{
422370
if (IsWindows)
423371
Assert.Ignore ("https://github.com/dotnet/runtime/issues/88625");
424372

425-
AssertAotModeSupported (androidAotMode);
426-
427373
var proj = new XamarinAndroidApplicationProject () {
428374
IsRelease = true,
429375
AotAssemblies = true,
430376
};
431377
var supportedAbi = "arm64-v8a";
432378
proj.SetAndroidSupportedAbis (supportedAbi);
433379
proj.SetProperty ("EnableLLVM", true.ToString ());
434-
if (!string.IsNullOrEmpty (androidAotMode))
435-
proj.SetProperty ("AndroidAotMode", androidAotMode);
436380

437381
var xaAssemblySize = 0;
438382
var xaAssemblySizeNoSymbol = 0;

src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest.TestCaseSource.cs

Lines changed: 0 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -148,65 +148,6 @@ public partial class BuildTest : BaseTest
148148
/* expectedResult */ CommercialBuildAvailable ? "debug" : "release",
149149
},
150150
};
151-
152-
static object [] SequencePointChecks () => new object [] {
153-
new object[] {
154-
/* isRelease */ true,
155-
/* monoSymbolArchive */ true ,
156-
/* aotAssemblies */ false,
157-
/* debugSymbols */ true,
158-
/* expectedRuntime */ "release",
159-
/* usesAssemblyBlobs */ false,
160-
},
161-
new object[] {
162-
/* isRelease */ true,
163-
/* monoSymbolArchive */ true ,
164-
/* aotAssemblies */ true,
165-
/* debugSymbols */ true,
166-
/* expectedRuntime */ "release",
167-
/* usesAssemblyBlobs */ false,
168-
},
169-
new object[] {
170-
/* isRelease */ true,
171-
/* monoSymbolArchive */ false ,
172-
/* aotAssemblies */ false,
173-
/* debugSymbols */ true,
174-
/* expectedRuntime */ "release",
175-
/* usesAssemblyBlobs */ false,
176-
},
177-
new object[] {
178-
/* isRelease */ true,
179-
/* monoSymbolArchive */ false ,
180-
/* aotAssemblies */ false,
181-
/* debugSymbols */ true,
182-
/* expectedRuntime */ "release",
183-
/* usesAssemblyBlobs */ true,
184-
},
185-
new object[] {
186-
/* isRelease */ true,
187-
/* monoSymbolArchive */ false ,
188-
/* aotAssemblies */ true,
189-
/* debugSymbols */ false,
190-
/* expectedRuntime */ "release",
191-
/* usesAssemblyBlobs */ false,
192-
},
193-
new object[] {
194-
/* isRelease */ true,
195-
/* monoSymbolArchive */ true ,
196-
/* aotAssemblies */ true,
197-
/* debugSymbols */ false,
198-
/* expectedRuntime */ "release",
199-
/* usesAssemblyBlobs */ false,
200-
},
201-
new object[] {
202-
/* isRelease */ true,
203-
/* monoSymbolArchive */ true ,
204-
/* aotAssemblies */ true,
205-
/* debugSymbols */ false,
206-
/* expectedRuntime */ "release",
207-
/* usesAssemblyBlobs */ true,
208-
},
209-
};
210151
#pragma warning restore 414
211152
}
212153
}

src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest.cs

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -355,64 +355,6 @@ public void CheckWhichRuntimeIsIncluded (string supportedAbi, bool debugSymbols,
355355
}
356356
}
357357

358-
[Test]
359-
[Category ("AOT"), Category ("MonoSymbolicate")]
360-
[TestCaseSource (nameof (SequencePointChecks))]
361-
public void CheckSequencePointGeneration (bool isRelease, bool monoSymbolArchive, bool aotAssemblies,
362-
bool debugSymbols, string expectedRuntime, bool usesAssemblyBlobs)
363-
{
364-
var proj = new XamarinAndroidApplicationProject () {
365-
IsRelease = isRelease,
366-
AotAssemblies = aotAssemblies
367-
};
368-
var abis = new [] { "armeabi-v7a", "x86" };
369-
proj.SetAndroidSupportedAbis (abis);
370-
proj.SetProperty (proj.ActiveConfigurationProperties, "MonoSymbolArchive", monoSymbolArchive);
371-
proj.SetProperty (proj.ActiveConfigurationProperties, "DebugSymbols", debugSymbols);
372-
proj.SetProperty (proj.ActiveConfigurationProperties, "AndroidUseAssemblyStore", usesAssemblyBlobs.ToString ());
373-
using (var b = CreateApkBuilder ()) {
374-
Assert.IsTrue (b.Build (proj), "Build should have succeeded.");
375-
var apk = Path.Combine (Root, b.ProjectDirectory,
376-
proj.OutputPath, $"{proj.PackageName}-Signed.apk");
377-
var msymarchive = Path.Combine (Root, b.ProjectDirectory, proj.OutputPath, proj.PackageName + ".apk.mSYM");
378-
var helper = new ArchiveAssemblyHelper (apk, usesAssemblyBlobs);
379-
if (aotAssemblies) {
380-
foreach (var abi in abis) {
381-
var assemblies = Path.Combine (Root, b.ProjectDirectory, proj.IntermediateOutputPath,
382-
"aot", abi, "libaot-UnnamedProject.dll.so");
383-
var shouldExist = monoSymbolArchive && debugSymbols;
384-
var symbolicateFile = Directory.GetFiles (Path.Combine (Root, b.ProjectDirectory, proj.IntermediateOutputPath,
385-
"aot", abi), "UnnamedProject.dll.msym", SearchOption.AllDirectories).FirstOrDefault ();
386-
if (shouldExist)
387-
Assert.IsNotNull (symbolicateFile, "UnnamedProject.dll.msym should exist");
388-
else
389-
Assert.IsNull (symbolicateFile, "{0} should not exist", symbolicateFile);
390-
if (shouldExist) {
391-
var foundMsyms = Directory.GetFiles (Path.Combine (msymarchive), "UnnamedProject.dll.msym", SearchOption.AllDirectories).Any ();
392-
Assert.IsTrue (foundMsyms, "UnnamedProject.dll.msym should exist in the archive {0}", msymarchive);
393-
}
394-
Assert.IsTrue (File.Exists (assemblies), "{0} libaot-UnnamedProject.dll.so does not exist", abi);
395-
Assert.IsTrue (helper.Exists ($"lib/{abi}/libaot-UnnamedProject.dll.so"),
396-
$"lib/{0}/libaot-UnnamedProject.dll.so should be in the {proj.PackageName}-Signed.apk", abi);
397-
Assert.IsTrue (helper.Exists ("assemblies/UnnamedProject.dll"),
398-
$"UnnamedProject.dll should be in the {proj.PackageName}-Signed.apk");
399-
}
400-
}
401-
var runtimeInfo = b.GetSupportedRuntimes ();
402-
foreach (var abi in abis) {
403-
var runtime = runtimeInfo.FirstOrDefault (x => x.Abi == abi && x.Runtime == expectedRuntime);
404-
Assert.IsNotNull (runtime, "Could not find the expected runtime.");
405-
var inApk = ZipHelper.ReadFileFromZip (apk, String.Format ("lib/{0}/{1}", abi, runtime.Name));
406-
var inApkRuntime = runtimeInfo.FirstOrDefault (x => x.Abi == abi && x.Size == inApk.Length);
407-
Assert.IsNotNull (inApkRuntime, "Could not find the actual runtime used.");
408-
Assert.AreEqual (runtime.Size, inApkRuntime.Size, "expected {0} got {1}", expectedRuntime, inApkRuntime.Runtime);
409-
}
410-
411-
b.Clean (proj);
412-
Assert.IsTrue (!Directory.Exists (msymarchive), "{0} should have been deleted on Clean", msymarchive);
413-
}
414-
}
415-
416358
[Test]
417359
public void CheckItemMetadata ([Values (true, false)] bool isRelease)
418360
{

0 commit comments

Comments
 (0)