From 3fc464d84b70dbdc3d03875f96e7613ebf1f3e9a Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Thu, 25 Apr 2019 14:01:05 -0700 Subject: [PATCH] Fix the failed test and update 'Publish-TestResults' to make AzDO fail the task when any tests failed (#9457) # Conflicts: # test/powershell/Modules/Microsoft.PowerShell.Management/Set-Location.Tests.ps1 --- build.psm1 | 2 +- .../Set-Location.Tests.ps1 | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/build.psm1 b/build.psm1 index 4985b1ee08..b7d195e8c3 100644 --- a/build.psm1 +++ b/build.psm1 @@ -1239,7 +1239,7 @@ function Publish-TestResults # If the the "test-case" count is greater than 0, then we have results. # Regardless, we want to upload this as an artifact, so this logic doesn't pertain to that. if ( @(([xml](Get-Content $Path)).SelectNodes(".//test-case")).Count -gt 0 -or $Type -eq 'XUnit' ) { - Write-Host "##vso[results.publish type=$Type;mergeResults=true;runTitle=$Title;publishRunAttachments=true;resultFiles=$tempFilePath;]" + Write-Host "##vso[results.publish type=$Type;mergeResults=true;runTitle=$Title;publishRunAttachments=true;resultFiles=$tempFilePath;failTaskOnFailedTests=true]" } $resolvedPath = (Resolve-Path -Path $Path).ProviderPath diff --git a/test/powershell/Modules/Microsoft.PowerShell.Management/Set-Location.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Management/Set-Location.Tests.ps1 index 5824419f3b..06be447370 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Management/Set-Location.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Management/Set-Location.Tests.ps1 @@ -70,6 +70,23 @@ Describe "Set-Location" -Tags "CI" { Should -Throw -ErrorId "PathNotFound,Microsoft.PowerShell.Commands.SetLocationCommand" } + It "Should use actual casing of folder on case-insensitive filesystem" -Skip:($IsLinux) { + $testPath = New-Item -ItemType Directory -Path testdrive:/teST + Set-Location $testPath.FullName.ToUpper() + $(Get-Location).Path | Should -BeExactly $testPath.FullName + } + + It "Should use actual casing of folder on case-sensitive filesystem: " -Skip:(!$IsLinux) { + $dir = "teST" + $testPathLower = New-Item -ItemType Directory -Path (Join-Path $TestDrive $dir.ToLower()) + $testPathUpper = New-Item -ItemType Directory -Path (Join-Path $TestDrive $dir.ToUpper()) + Set-Location $testPathLower.FullName + $(Get-Location).Path | Should -BeExactly $testPathLower.FullName + Set-Location $testPathUpper.FullName + $(Get-Location).Path | Should -BeExactly $testPathUpper.FullName + { Set-Location (Join-Path $TestDrive $dir) -ErrorAction Stop } | Should -Throw -ErrorId "PathNotFound,Microsoft.PowerShell.Commands.SetLocationCommand" + } + Context 'Set-Location with no arguments' { It 'Should go to $env:HOME when Set-Location run with no arguments from FileSystem provider' {