Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
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
53 changes: 51 additions & 2 deletions TestAll.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@ param(
[Switch]$List,

[Parameter(Mandatory=$false)]
[Switch]$ShowSystemInfo=$true
[Switch]$ShowSystemInfo=$true,

[Parameter(Mandatory=$true)]
[string]$wprProfilePath
)

$StartTime = Get-Date
Expand Down Expand Up @@ -133,7 +136,11 @@ function Run-TaefTest
$testFolder = Split-Path -parent $test.TestDef
$tePath = Join-Path $testFolder "te.exe"
$dllFile = Join-Path $testFolder $test.Filename
& $tePath $dllFile $test.Parameters

$teLogFile = (Join-Path $env:Build_SourcesDirectory "BuildOutput\$Configuration\$Platform\Te.wtl")
$teLogPathTo = (Join-Path $env:Build_SourcesDirectory "TestOutput\$Configuration\$Platform")

& $tePath $dllFile $test.Parameters /enableWttLogging /appendWttLogging /screenCaptureOnError /logFile:$teLogFile $/testMode:EtwLogger /EtwLogger:WprProfile=WDGDEPAdex /EtwLogger:SavePoint=TestFailure /EtwLogger:RecordingScope=Execution /EtwLogger:WprProfileFile=$wprProfilePath
}

function Run-PowershellTest
Expand Down Expand Up @@ -223,7 +230,49 @@ if ($List -eq $true)

if ($Test -eq $true)
{
$teLogFile = (Join-Path $env:Build_SourcesDirectory "BuildOutput\$Configuration\$Platform\Te.wtl")
$teLogPathTo = (Join-Path $env:Build_SourcesDirectory "TestOutput\$Configuration\$Platform")
remove-item -Path $teLogFile -ErrorAction Ignore
remove-item -Path (Join-path $teLogPathTo "Te.wtl") -ErrorAction Ignore

Run-Tests

# copy test log to TestOutput folder
if (Test-Path -Path $teLogFile) {
Write-Host "Starting copy test log from '$teLogFile'"

New-Item -ItemType Directory -Path $teLogPathTo -Force
copy-item -Path $teLogFile -Destination $teLogPathTo -Force

Write-Host "Test log copied to '$teLogPathTo'"
}

# copy screenshots to TestOutput folder
$screenshotsFolder = Join-Path $env:Build_SourcesDirectory "WexLogFileOutput"
if (Test-Path -Path $screenshotsFolder) {
Write-Host "Starting copy screenshots from '$screenshotsFolder'"

# Copy at most 50 screenshots to the upload path.
# In the cases where a large number of tests failed, there is little value in uploading dozens of screenshots
$files = Get-ChildItem -Path $screenshotsFolder -Filter *.jpg |Select-Object -First 50
foreach($file in $files)
{
Copy-Item $file.FullName $teLogPathTo -Force
}

# Copy at most 20 tracelogging files to the upload path.
$files = Get-ChildItem -Path $screenshotsFolder -Filter *.etl |Select-Object -First 20
foreach($file in $files)
{
Copy-Item $file.FullName $teLogPathTo -Force
}

Write-Host "Test results copied to '$teLogPathTo'"
}
else
{
Write-Host "WexLogFileOutput not found"
}
}

$TotalTime = (Get-Date)-$StartTime
Expand Down
43 changes: 43 additions & 0 deletions build/AzurePipelinesTemplates/WindowsAppSDK-RunTests-Steps.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
parameters:
buildPlatform: ''
buildConfiguration: ''
ImageName: ''
TaefSelect: '*'
BinaryCompatSwitch: ''
testLocale: ''

steps:
- checkout: self
path: s

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this the default, so we may not really need this?

@haonanttt haonanttt Jul 2, 2025 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we don't explicitly use checkout task, the checkout: self is default. But as we added a checkout: WindowsAppSDKConfig task at line 176, we need to also add checkout: self. Otherwise the current branch will not be checked out. This could be seen at this run. Comparing with original flow, the checkout self task is missed
Before this PR:
image
This PR without checkout: self:
image

If we don't add the checkout path, the checkout: self task somehow will checkout the code to a wrong path, see this run:
Before this PR:
image
This PR without path: s:
image

According to the above results, we need to explicitly write checkout task here

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand the checkout, but am unaware that the "path: s" is needed. Thanks for explaining!


- task: powershell@2
displayName: 'DevCheck: Setup/Verify development environment'
inputs:
Expand Down Expand Up @@ -157,6 +161,8 @@ steps:
Get-Service | Out-Host
sc.exe queryex te.service | Write-Host
sc.exe qc te.service | Write-Host

- checkout: WindowsAppSDKConfig

- task: PowerShell@2
displayName: 'Run TAEF Tests'
Expand All @@ -168,3 +174,40 @@ steps:
-Configuration "${{ parameters.buildConfiguration }}"
-Test
-List
-wprProfilePath "$(Build.SourcesDirectory)\WindowsAppSDKConfig\src\test\AppModelProviders.wprp"

- template: AzurePipelinesTemplates\WindowsAppSDK-ConvertWttLogToXUnit-Steps.yml@WindowsAppSDKConfig
parameters:
WttInputPath: '$(Build.SourcesDirectory)\TestOutput\$(buildConfiguration)\$(buildPlatform)\Te.wtl'
xunitOutputPath: '$(Build.SourcesDirectory)\TestOutput\$(buildConfiguration)\$(buildPlatform)\testResults-$(buildConfiguration)_$(buildPlatform)_${{ parameters.ImageName }}.xml'
TestNamePrefix: '$(buildConfiguration)_$(buildPlatform)_${{ parameters.ImageName }}'
BypassTests: '$(Build.SourcesDirectory)\test\BypassTests.json'
CheckoutPath: '$(Build.SourcesDirectory)\WindowsAppSDKConfig'

- task: PublishTestResults@2
displayName: 'Publish test results'
condition: succeededOrFailed()
inputs:
testResultsFormat: xUnit
testResultsFiles: testResults-*.xml
searchFolder: '$(Build.SourcesDirectory)\TestOutput\$(buildConfiguration)\$(buildPlatform)'
mergeTestResults: true
failTaskOnFailedTests: true
testRunTitle: '$(System.StageName)_${{ parameters.ImageName }}_$(buildConfiguration)$(buildPlatform)'
buildPlatform: ${{ parameters.buildPlatform }}
buildConfiguration: ${{ parameters.buildConfiguration }}

# Edit the artifactAttempt variable when the job has failed, so that the artifact name can be unique.
- task: PowerShell@2
displayName: Edit the artifactAttempt variable when the job has failed
condition: failed()
inputs:
targetType: 'inline'
script: |
Write-Host "##vso[task.setvariable variable=artifactAttempt]_$(System.JobAttempt)"

- task: PublishPipelineArtifact@1
condition: succeededOrFailed()
Comment thread
haonanttt marked this conversation as resolved.
Resolved
inputs:
targetPath: '$(Build.SourcesDirectory)\TestOutput'
artifact: '$(System.StageName)_${{ parameters.ImageName }}_$(buildConfiguration)$(buildPlatform)_$(Agent.JobStatus)$(artifactAttempt)'
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ jobs:
variables:
testPayloadArtifactDir: $(Build.SourcesDirectory)\BuildOutput\$(buildConfiguration)\$(buildPlatform)
AZURE_PIPELINES_DEDUP_PARALLELISM: 16
artifactAttempt: ''
steps:
- template: WindowsAppSDK-RunTests-Steps.yml
parameters:
Expand Down
Loading