From 09c1c134486f49e84e700e376fb1b403b23c7db2 Mon Sep 17 00:00:00 2001 From: "Steve Lee [MSFT]" Date: Sun, 13 Aug 2017 22:36:25 -0700 Subject: [PATCH] use testdrive for temp files, increase timeout --- .../Microsoft.PowerShell.Management/FileSystem.Tests.ps1 | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/test/powershell/Modules/Microsoft.PowerShell.Management/FileSystem.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Management/FileSystem.Tests.ps1 index 1bdc01588c1..210e6ea30bf 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Management/FileSystem.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Management/FileSystem.Tests.ps1 @@ -203,17 +203,16 @@ Describe "Basic FileSystem Provider Tests" -Tags "CI" { Context "Validate behavior when access is denied" { BeforeAll { + $powershell = Join-Path $PSHOME "powershell" if ($IsWindows) { - $powershell = "powershell.exe" $protectedPath = Join-Path ([environment]::GetFolderPath("windows")) "appcompat" "Programs" $protectedPath2 = Join-Path $protectedPath "Install" $newItemPath = Join-Path $protectedPath "foo" } - $errFile = "error.txt" - $doneFile = "done.txt" + $errFile = "$testdrive\error.txt" + $doneFile = "$testdrive\done.txt" } - AfterEach { Remove-Item -Force $errFile -ErrorAction SilentlyContinue Remove-Item -Force $doneFile -ErrorAction SilentlyContinue @@ -231,7 +230,7 @@ Describe "Basic FileSystem Provider Tests" -Tags "CI" { runas.exe /trustlevel:0x20000 "$powershell -nop -c try { $cmdline -ErrorAction Stop } catch { `$_.FullyQualifiedErrorId | Out-File $errFile }; New-Item -Type File -Path $doneFile" $startTime = Get-Date - while (((Get-Date) - $startTime).TotalSeconds -lt 5 -and -not (Test-Path $doneFile)) + while (((Get-Date) - $startTime).TotalSeconds -lt 10 -and -not (Test-Path $doneFile)) { Start-Sleep -Milliseconds 100 }