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

* - fix up for release on some device tests but not all yet

* - fix

* - options

* Update device-tests-steps.yml

* - try me

---------

Co-authored-by: Shane Neuville <shneuvil@microsoft.com>
This commit is contained in:
Rui Marinho 2024-08-27 15:29:20 +01:00 коммит произвёл GitHub
Родитель ea92461940
Коммит 88652454e0
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
6 изменённых файлов: 56 добавлений и 14 удалений

Просмотреть файл

@ -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);
}

Просмотреть файл

@ -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'
@ -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
# 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
- 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
- ${{ 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: |

Просмотреть файл

@ -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: ''
@ -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 }}
@ -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

Просмотреть файл

@ -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']
@ -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
@ -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
@ -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
@ -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
@ -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

Просмотреть файл

@ -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" />

Просмотреть файл

@ -22,6 +22,7 @@ namespace Microsoft.Maui.DeviceTests
await Assert.ThrowsAsync<InvalidCastException>(() => service.GetDrawableAsync(imageSource, MauiProgram.DefaultContext));
}
#if DEBUG
[Theory]
[InlineData("#FF0000")]
[InlineData("#00FF00")]
@ -44,5 +45,6 @@ namespace Microsoft.Maui.DeviceTests
bitmap.AssertColorAtCenter(expectedColor);
}
#endif
}
}