Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[net9.0] Fix API23 Core device tests #24128

Merged
merged 5 commits into from
Aug 27, 2024
Merged
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
5 changes: 5 additions & 0 deletions eng/devices/android.cake
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,11 @@ void ExecuteTests(string project, string device, string appPath, string appPacka
}
finally
{
if (testsFailed)
{
// uncomment if you want to copy the test app to the results directory for any reason
// CopyFile(testApp, new DirectoryPath(resultsDir).CombineWithFilePath(new FilePath(testApp).GetFilename()));
}

HandleTestResults(resultsDir, testsFailed, false);
}
Expand Down
50 changes: 36 additions & 14 deletions eng/pipelines/common/device-tests-steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ parameters:
device: '' # the xharness device to use
apiversion: '' # the iOS device api version to use
cakeArgs: '' # additional cake args
androidConfiguration: '' # Indicates the configuration to use for Android. We're slowly enabling this for all projects
provisionatorChannel: 'latest'
agentPoolAccessToken: ''
artifactName: 'nuget'
Expand Down Expand Up @@ -88,20 +89,41 @@ steps:
continueOnError: true
timeoutInMinutes: 5

- pwsh: |
./build.ps1 -Script eng/devices/${{ parameters.platform }}.cake --project="${{ parameters.path }}" --device=${{ parameters.device }} --apiversion=${{ parameters.apiversion }} --packageid=${{ parameters.windowsPackageId }} --results="$(TestResultsDirectory)" --binlog="$(LogDirectory)" ${{ parameters.cakeArgs }}
displayName: $(Agent.JobName)
workingDirectory: ${{ parameters.checkoutDirectory }}
condition: and(succeeded(), ne(variables['Platform.Name'], 'Mac'))
retryCountOnTaskFailure: 1

- bash: |
# Execute the powershell script from a bash shell on Mac to avoid interference between powershell processes that lead to this error: The STDIO streams did not close within 10 seconds of the exit event from process '/usr/local/bin/pwsh'. This may indicate a child process inherited the STDIO streams and has not yet exited.
pwsh ./build.ps1 -Script eng/devices/${{ parameters.platform }}.cake --project="${{ parameters.path }}" --device=${{ parameters.device }} --apiversion=${{ parameters.apiversion }} --packageid=${{ parameters.windowsPackageId }} --results="$(TestResultsDirectory)" --binlog="$(LogDirectory)" ${{ parameters.cakeArgs }}
displayName: $(Agent.JobName)
workingDirectory: ${{ parameters.checkoutDirectory }}
condition: and(succeeded(), eq(variables['Platform.Name'], 'Mac'))
retryCountOnTaskFailure: 1
# Everything should be release but doing android for now to work around an xharness issue
- ${{ if eq(parameters.platform, 'android')}}:
- pwsh: |
./build.ps1 -Script eng/devices/${{ parameters.platform }}.cake --project="${{ parameters.path }}" --device=${{ parameters.device }} --apiversion=${{ parameters.apiversion }} --packageid=${{ parameters.windowsPackageId }} --results="$(TestResultsDirectory)" --binlog="$(LogDirectory)" ${{ parameters.cakeArgs }} --configuration=${{ parameters.androidConfiguration }}
displayName: $(Agent.JobName)
workingDirectory: ${{ parameters.checkoutDirectory }}
condition: and(succeeded(), ne(variables['Platform.Name'], 'Mac'))
retryCountOnTaskFailure: 1

- ${{ if eq(parameters.platform, 'android')}}:
- bash: |
# Execute the powershell script from a bash shell on Mac to avoid interference between powershell processes that lead to this error: The STDIO streams did not close within 10 seconds of the exit event from process '/usr/local/bin/pwsh'. This may indicate a child process inherited the STDIO streams and has not yet exited.
pwsh ./build.ps1 -Script eng/devices/${{ parameters.platform }}.cake --project="${{ parameters.path }}" --device=${{ parameters.device }} --apiversion=${{ parameters.apiversion }} --packageid=${{ parameters.windowsPackageId }} --results="$(TestResultsDirectory)" --binlog="$(LogDirectory)" ${{ parameters.cakeArgs }} --configuration=${{ parameters.androidConfiguration }}
displayName: $(Agent.JobName)
workingDirectory: ${{ parameters.checkoutDirectory }}
condition: and(succeeded(), eq(variables['Platform.Name'], 'Mac'))
retryCountOnTaskFailure: 1

- ${{ if ne(parameters.platform, 'android')}}:
- pwsh: |
./build.ps1 -Script eng/devices/${{ parameters.platform }}.cake --project="${{ parameters.path }}" --device=${{ parameters.device }} --apiversion=${{ parameters.apiversion }} --packageid=${{ parameters.windowsPackageId }} --results="$(TestResultsDirectory)" --binlog="$(LogDirectory)" ${{ parameters.cakeArgs }}
displayName: $(Agent.JobName)
workingDirectory: ${{ parameters.checkoutDirectory }}
condition: and(succeeded(), ne(variables['Platform.Name'], 'Mac'))
retryCountOnTaskFailure: 1

- ${{ if ne(parameters.platform, 'android')}}:
- bash: |
# Execute the powershell script from a bash shell on Mac to avoid interference between powershell processes that lead to this error: The STDIO streams did not close within 10 seconds of the exit event from process '/usr/local/bin/pwsh'. This may indicate a child process inherited the STDIO streams and has not yet exited.
pwsh ./build.ps1 -Script eng/devices/${{ parameters.platform }}.cake --project="${{ parameters.path }}" --device=${{ parameters.device }} --apiversion=${{ parameters.apiversion }} --packageid=${{ parameters.windowsPackageId }} --results="$(TestResultsDirectory)" --binlog="$(LogDirectory)" ${{ parameters.cakeArgs }}
displayName: $(Agent.JobName)
workingDirectory: ${{ parameters.checkoutDirectory }}
condition: and(succeeded(), eq(variables['Platform.Name'], 'Mac'))
retryCountOnTaskFailure: 1
# Everything should be release but doing android for now to work around an xharness issue

- ${{ if eq(parameters.platform, 'ios')}}:
- bash: |
Expand Down
3 changes: 3 additions & 0 deletions eng/pipelines/common/device-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ parameters:
artifactName: 'nuget'
artifactItemPattern: '**/*.nupkg'
checkoutDirectory: $(System.DefaultWorkingDirectory)
androidConfiguration: 'debug' # Indicates the configuration to use for Android. We're slowly enabling this for all projects
useArtifacts: false
targetFrameworkVersion:
- tfm: ''
Expand Down Expand Up @@ -48,6 +49,7 @@ stages:
${{ replace(coalesce(project.desc, project.name), ' ', '_') }}_API_${{ api }}:
REQUIRED_XCODE: $(DEVICETESTS_REQUIRED_XCODE)
PROJECT_PATH: ${{ project.android }}
ANDROID_CONFIGURATION: ${{ project.androidConfiguration }}
TARGET_FRAMEWORK_VERSION: ${{ parameters.targetFrameworkVersion.tfm }}
${{ if eq(api, 27) }}:
DEVICE: android-emulator-32_${{ api }}
Expand All @@ -70,6 +72,7 @@ stages:
checkoutDirectory: ${{ parameters.checkoutDirectory }}
useArtifacts: ${{ parameters.useArtifacts }}
poolName: ${{ parameters.androidPool.name }}
androidConfiguration: $(ANDROID_CONFIGURATION)

- stage: ios_device_tests_${{ replace(parameters.targetFrameworkVersion.tfm, '.', '') }}
displayName: ${{ parameters.targetFrameworkVersion.tfm }} iOS Device Tests
Expand Down
7 changes: 6 additions & 1 deletion eng/pipelines/device-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ stages:
windowsVersions: ['packaged', 'unpackaged']
provisionatorChannel: ${{ parameters.provisionatorChannel }}
${{ else }}:
androidApiLevels: [ 33 ]
androidApiLevels: [ 33, 23 ]
iosVersions: [ 'simulator-17.2' ]
catalystVersions: [ 'latest' ]
windowsVersions: ['packaged', 'unpackaged']
Expand All @@ -126,6 +126,7 @@ stages:
- name: essentials
desc: Essentials
androidApiLevelsExclude: [25] # Ignore for now API25 since the runs's are not stable
androidConfiguration: 'Release'
windowsPackageId: 'com.microsoft.maui.essentials.devicetests'
android: $(System.DefaultWorkingDirectory)/src/Essentials/test/DeviceTests/Essentials.DeviceTests.csproj
ios: $(System.DefaultWorkingDirectory)/src/Essentials/test/DeviceTests/Essentials.DeviceTests.csproj
Expand All @@ -134,6 +135,7 @@ stages:
- name: graphics
desc: Graphics
androidApiLevelsExclude: [25] # Ignore for now API25 since the runs's are not stable
androidConfiguration: 'Release'
windowsPackageId: 'com.microsoft.maui.graphics.devicetests'
android: $(System.DefaultWorkingDirectory)/src/Graphics/tests/DeviceTests/Graphics.DeviceTests.csproj
ios: $(System.DefaultWorkingDirectory)/src/Graphics/tests/DeviceTests/Graphics.DeviceTests.csproj
Expand All @@ -142,6 +144,7 @@ stages:
- name: core
desc: Core
androidApiLevelsExclude: [25] # Ignore for now API25 since the runs's are not stable
androidConfiguration: 'Release'
windowsPackageId: 'com.microsoft.maui.core.devicetests'
android: $(System.DefaultWorkingDirectory)/src/Core/tests/DeviceTests/Core.DeviceTests.csproj
ios: $(System.DefaultWorkingDirectory)/src/Core/tests/DeviceTests/Core.DeviceTests.csproj
Expand All @@ -150,6 +153,7 @@ stages:
- name: controls
desc: Controls
androidApiLevelsExclude: [27, 25] # Ignore for now API25 since the runs's are not stable
androidConfiguration: 'Debug'
windowsPackageId: 'com.microsoft.maui.controls.devicetests'
android: $(System.DefaultWorkingDirectory)/src/Controls/tests/DeviceTests/Controls.DeviceTests.csproj
ios: $(System.DefaultWorkingDirectory)/src/Controls/tests/DeviceTests/Controls.DeviceTests.csproj
Expand All @@ -158,6 +162,7 @@ stages:
- name: blazorwebview
desc: BlazorWebView
androidApiLevelsExclude: [ 30, 29, 28, 27, 26, 25, 24, 23, 22, 21 ] # BlazorWebView requires a recent version of Chrome
androidConfiguration: 'Release'
windowsPackageId: 'Microsoft.Maui.MauiBlazorWebView.DeviceTests'
android: $(System.DefaultWorkingDirectory)/src/BlazorWebView/tests/MauiDeviceTests/MauiBlazorWebView.DeviceTests.csproj
ios: $(System.DefaultWorkingDirectory)/src/BlazorWebView/tests/MauiDeviceTests/MauiBlazorWebView.DeviceTests.csproj
Expand Down
5 changes: 5 additions & 0 deletions src/Core/tests/DeviceTests/Core.DeviceTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@
<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
</ItemGroup>


<PropertyGroup>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\TestUtils\src\DeviceTests\TestUtils.DeviceTests.csproj" />
<ProjectReference Include="..\..\..\TestUtils\src\DeviceTests.Runners\TestUtils.DeviceTests.Runners.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public async Task ThrowsForIncorrectTypes(Type type)
await Assert.ThrowsAsync<InvalidCastException>(() => service.GetDrawableAsync(imageSource, MauiProgram.DefaultContext));
}

#if DEBUG
[Theory]
[InlineData("#FF0000")]
[InlineData("#00FF00")]
Expand All @@ -44,5 +45,6 @@ public async Task GetDrawableAsync(string colorHex)

bitmap.AssertColorAtCenter(expectedColor);
}
#endif
}
}
Loading