Skip to content

Commit

Permalink
Merge pull request #13052 from Youssef1313/consolidate
Browse files Browse the repository at this point in the history
build: Consolidate generator testing projects
  • Loading branch information
jeromelaban committed Sep 19, 2023
2 parents d079850 + 2d5e405 commit 87a7954
Show file tree
Hide file tree
Showing 207 changed files with 326 additions and 534 deletions.
78 changes: 14 additions & 64 deletions build/ci/.azure-devops-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,20 @@ jobs:
- template: templates/dotnet-install.yml
- template: templates/jdk-setup.yml

- task: DownloadBuildArtifacts@0
displayName: Download build artifact
inputs:
artifactName: 'NugetPackages-Artifacts-reference-$(XAML_FLAVOR_BUILD)'
downloadPath: '$(Agent.WorkFolder)'

- task: ExtractFiles@1
displayName: Restore binaries structure
inputs:
archiveFilePatterns: '$(Agent.WorkFolder)/NugetPackages-Artifacts*/*-bin-$(XAML_FLAVOR_BUILD).zip'
destinationFolder: $(build.sourcesdirectory)
cleanDestinationFolder: false
overwriteExistingFiles: true

- task: MSBuild@1
inputs:
solution: src/Uno.UI-UnitTests-only.slnf
Expand All @@ -78,7 +92,6 @@ jobs:
!**\obj\**
!**\*Wasm.Test*.dll
!**\*UITests.dll
!**\*netcore.Tests.dll
!**\*.RuntimeTests.dll
!**\testhost*.*
!**\Microsoft*.dll
Expand All @@ -89,66 +102,3 @@ jobs:
batchingBasedOnAgentsOption: customBatchSize
rerunFailedTests: 'true'
customBatchSizeValue: 200 # test count / 10 (https://developercommunity.visualstudio.com/content/problem/891803/vstestconsoleadapter-fails-with-outofmemory.html?childToView=896206#comment-896206)


- job: Unit_Tests_netcore
displayName: 'Unit Tests UWP(netcore)'
timeoutInMinutes: 90

pool:
vmImage: ${{ parameters.vmImage }}

strategy:
matrix:
UWP:
UNO_UWP_BUILD: true
XAML_FLAVOR_BUILD: UWP

# Disabled as tests explicitly use UWP types.
# Will be migrated once the whole tree is moved to WinUI
# WinUI:
# UNO_UWP_BUILD: false
# XAML_FLAVOR_BUILD: WinUI

variables:
CombinedConfiguration: Release|Any CPU
CI_Build: true

# This is required to be able to use hard links as much as possible
NUGET_PACKAGES: $(Agent.WorkFolder)\.nuget

# Only build for NetPrevious
UnoDisableNetCurrentMobile: true
UnoDisableNetCurrent: true

steps:
- checkout: self
clean: true

- template: templates/dotnet-install.yml
- template: templates/download-winui-converted-tree.yml

- task: DownloadBuildArtifacts@0
displayName: Download build artifact
inputs:
artifactName: 'NugetPackages-Artifacts-reference-$(XAML_FLAVOR_BUILD)'
downloadPath: '$(Agent.WorkFolder)'

- task: ExtractFiles@1
displayName: Restore binaries structure
inputs:
archiveFilePatterns: '$(Agent.WorkFolder)/NugetPackages-Artifacts*/*-bin-$(XAML_FLAVOR_BUILD).zip'
destinationFolder: $(build.sourcesdirectory)
cleanDestinationFolder: false
overwriteExistingFiles: true

# Run on windows for now, as some generators tests fail with :
# error CS0041: Unexpected error writing debug information -- 'Value cannot be null. (Parameter 'type')'
- task: DotNetCoreCLI@2
displayName: Run netcore Unit Tests
inputs:
command: test
projects: |
**/*netcore.Tests.csproj
arguments: -c Release
publishTestResults: true
2 changes: 1 addition & 1 deletion build/filters/Uno.UI-packages-reference.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"SourceGenerators\\SourceGeneratorHelpers\\SourceGeneratorHelpers.shproj",
"SourceGenerators\\System.Xaml\\Uno.Xaml.csproj",
"SourceGenerators\\Uno.UI.SourceGenerators.Internal\\Uno.UI.SourceGenerators.Internal.csproj",
"SourceGenerators\\Uno.UI.SourceGenerators.netcore.Tests\\Uno.UI.SourceGenerators.netcore.Tests.csproj",
"SourceGenerators\\Uno.UI.SourceGenerators.Tests\\Uno.UI.SourceGenerators.Tests.csproj",
"SourceGenerators\\Uno.UI.SourceGenerators\\Uno.UI.SourceGenerators.csproj",
"SourceGenerators\\Uno.UI.Tasks\\Uno.UI.Tasks.csproj",
"Uno.Analyzers.Tests\\Uno.Analyzers.Tests.csproj",
Expand Down
2 changes: 1 addition & 1 deletion doc/articles/contributing/guidelines/creating-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ If you want to actually test that generated XAML produces correct behavior, whic

### Source generator tests

These can be used to assert that a given input to a given source generator produces specific expected diagnostics. They infrastructure for the tests easily allows to test the generator output exactly, but you should avoid that kind of assertion if you can. These tests exist in [`.UI.SourceGenerators.netcoremobile.Tests`](https://github.com/unoplatform/uno/tree/master/src/SourceGenerators/Uno.UI.SourceGenerators.netcore.Tests).
These can be used to assert that a given input to a given source generator produces specific expected diagnostics. They infrastructure for the tests easily allows to test the generator output exactly, but you should avoid that kind of assertion if you can. These tests exist in [`Uno.UI.SourceGenerators.Tests`](https://github.com/unoplatform/uno/tree/master/src/SourceGenerators/Uno.UI.SourceGenerators.Tests).

### UI snapshot tests

Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,9 @@ public async Task Initialize(CancellationToken ct)
// Build the analyzer document additional data information
var analyzerDocumentId = DocumentId.CreateNewId(project.Id);

// For now, there is no need to customize these for each test.
var globalConfigBuilder = new StringBuilder($"""
is_global = true
# For now, there is no need to customize these for each test.
build_property.MSBuildProjectFullPath = C:\Project\{project.Name}.csproj
build_property.RootNamespace = {project.Name}
build_property.XamlSourceGeneratorTracingFolder = {_baseWorkFolder}
Expand Down

0 comments on commit 87a7954

Please sign in to comment.