Skip to content

Commit 29b21fb

Browse files
committed
Special Char Unit Test [WIP]
1 parent fe8c851 commit 29b21fb

File tree

4 files changed

+91
-1
lines changed

4 files changed

+91
-1
lines changed

build-tools/automation/azure-pipelines.yaml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -921,6 +921,55 @@ stages:
921921

922922
- template: yaml-templates/fail-on-issue.yaml
923923

924+
# Check - "Xamarin.Android (Smoke Tests MSBuild Emulator - Windows)"
925+
- job: win_msbuilddevice_tests
926+
displayName: MSBuild Emulator - Windows
927+
pool: $(HostedWinVS2019)
928+
timeoutInMinutes: 90
929+
cancelTimeoutInMinutes: 5
930+
workspace:
931+
clean: all
932+
steps:
933+
- template: yaml-templates/setup-test-environment.yaml
934+
935+
- script: $(System.DefaultWorkingDirectory)/build-tools/xaprepare/xaprepare/bin/$(XA.Build.Configuration)/xaprepare.exe --s=EmulatorTestDependencies --no-emoji --run-mode=CI
936+
displayName: install emulator
937+
938+
- task: DownloadPipelineArtifact@2
939+
inputs:
940+
artifactName: $(TestAssembliesArtifactName)
941+
downloadPath: $(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration)
942+
943+
- task: MSBuild@1
944+
displayName: start emulator
945+
inputs:
946+
solution: tests/Mono.Android-Tests/Mono.Android-Tests.csproj
947+
configuration: $(XA.Build.Configuration)
948+
msbuildArguments: /t:AcquireAndroidTarget /bl:$(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration)/start-emulator.binlog
949+
950+
- template: yaml-templates/run-nunit-tests.yaml
951+
parameters:
952+
testRunTitle: MSBuildDeviceIntegration Smoke - Windows
953+
testAssembly: $(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration)/MSBuildDeviceIntegration/net472/MSBuildDeviceIntegration.dll
954+
nunitConsoleExtraArgs: --where "cat == SmokeTests"
955+
testResultsFile: TestResult-MSBuildDeviceIntegrationSmoke-$(XA.Build.Configuration).xml
956+
957+
- task: MSBuild@1
958+
displayName: shut down emulator
959+
inputs:
960+
solution: tests/Mono.Android-Tests/Mono.Android-Tests.csproj
961+
configuration: $(XA.Build.Configuration)
962+
msbuildArguments: >-
963+
/t:AcquireAndroidTarget,ReleaseAndroidTarget
964+
/bl:$(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration)/shutdown-emulator.binlog
965+
condition: always()
966+
967+
- template: yaml-templates/upload-results.yaml
968+
parameters:
969+
artifactName: Test Results - MSBuild Smoke With Emulator - Windows
970+
971+
- template: yaml-templates/fail-on-issue.yaml
972+
924973
- stage: msbuild_legacy
925974
displayName: Legacy Tests
926975
dependsOn: mac_build

build-tools/xaprepare/xaprepare/ConfigAndData/Configurables.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ namespace Xamarin.Android.Prepare
1515
//
1616
partial class Configurables
1717
{
18-
const string BinutilsVersion = "2.37-XA.1";
18+
const string BinutilsVersion = "2.35.2-XA.1";
1919

2020
const string MicrosoftOpenJDK11Version = "11.0.10";
2121
const string MicrosoftOpenJDK11Release = "9.1";

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,27 @@ public void BuildBasicApplication ([ValueSource (nameof (SupportedTargetFramewor
5959
}
6060
}
6161

62+
[Test]
63+
[Category ("SmokeTests")]
64+
public void SmokeTestBuildWithSpecialCharacters ([Values (false, true)] bool forms)
65+
{
66+
var testName = "テスト";
67+
68+
var rootPath = Path.Combine (Root, "temp", TestName);
69+
var proj = forms ?
70+
new XamarinFormsAndroidApplicationProject () :
71+
new XamarinAndroidApplicationProject ();
72+
proj.ProjectName = testName;
73+
proj.IsRelease = true;
74+
if (forms) {
75+
proj.PackageReferences.Clear ();
76+
proj.PackageReferences.Add (KnownPackages.XamarinForms_4_7_0_1142);
77+
}
78+
using (var builder = CreateApkBuilder (Path.Combine (rootPath, proj.ProjectName))){
79+
Assert.IsTrue (builder.Build (proj), "Build should have succeeded.");
80+
}
81+
}
82+
6283
public static string GetLinkedPath (ProjectBuilder builder, bool isRelease, string filename)
6384
{
6485
return Builder.UseDotNet && isRelease ?

tests/MSBuildDeviceIntegration/Tests/InstallAndRunTests.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,26 @@ public void MonoSymbolicateAndroidStackTrace ()
178178
}) ;
179179
}
180180

181+
[Test]
182+
[Category ("UsesDevice"), Category ("SmokeTests")]
183+
public void SmokeTestBuildAndRunWithSpecialCharacters ()
184+
{
185+
AssertHasDevices ();
186+
var testName = "テスト";
187+
188+
var rootPath = Path.Combine (Root, "temp", TestName);
189+
var proj = new XamarinFormsAndroidApplicationProject () {
190+
ProjectName = testName,
191+
IsRelease = true,
192+
};
193+
proj.SetAndroidSupportedAbis ("armeabi-v7a", "x86");
194+
proj.SetDefaultTargetDevice ();
195+
using (var builder = CreateApkBuilder (Path.Combine (rootPath, proj.ProjectName))){
196+
Assert.IsTrue (builder.Install (proj), "Install should have succeeded.");
197+
Assert.True (builder.RunTarget (proj, "_Run", doNotCleanupOnUpdate: true), "Project should have run.");
198+
}
199+
}
200+
181201
[Test, Category ("MonoSymbolicate")]
182202
public void MonoSymbolicateNetStandardStackTrace ()
183203
{

0 commit comments

Comments
 (0)