Getting tests to run from build directory with spaces in it (#1981)

* [build.psm1] - mc.exe input file needs quotes

For filenames that have spaces or paths to that file that have spaces, the input filename needs to have quotes around it.

* Quoted more paths so tests run from directories with spaces

Found a few locations where paths weren't qutoed or escaped with '& ...' that are needed to get tests to run from build directories with spaces in them.
This commit is contained in:
Barry Nolte authored and Andy Schwartzmeyer committed 2016-08-22 09:57:30 -04:00
1 parent bb9a40c6ac
commit 890e80dd54
3 files changed
+9 -9

No files matched your search

+2 -2
View File
@@ -568,7 +568,7 @@ function Start-PSPester {
}
$PesterModule = [IO.Path]::Combine((Split-Path $powershell), "Modules", "Pester")
$Command += "Import-Module $PesterModule; "
$Command += "Import-Module '$PesterModule'; "
$Command += "Invoke-Pester "
$Command += "-OutputFormat ${OutputFormat} -OutputFile ${OutputFile} "
@@ -582,7 +582,7 @@ function Start-PSPester {
$Command += "-Tag @('" + (${Tag} -join "','") + "') "
}
$Command += $Path
$Command += "'" + $Path + "'"
Write-Verbose $Command
# To ensure proper testing, the module path must not be inherited by the spawned process
@@ -208,7 +208,7 @@ Describe "Test suite for NewFileCatalogAndTestFileCatalogCmdlets" -Tags "CI" {
$catalogPath = "$env:TEMP\UserConfigProv\NewFileCatalogFolderWhenCatlogFileIsCreatedInsideSameFolder.cat"
try
{
copy-item $testDataPath\UserConfigProv $env:temp -Recurse -ErrorAction SilentlyContinue
copy-item "$testDataPath\UserConfigProv" $env:temp -Recurse -ErrorAction SilentlyContinue
$null = New-FileCatalog -Path $env:temp\UserConfigProv\ -CatalogFilePath $catalogPath -CatalogVersion 1.0
$result = Test-FileCatalog -Path $env:temp\UserConfigProv\ -CatalogFilePath $catalogPath
}
@@ -13,17 +13,17 @@ Describe "Invoke-Expression" -Tags "CI" {
It "Should return the echoed text from a script" {
$testfile = Join-Path -Path (Join-Path $PSScriptRoot -ChildPath assets) -ChildPath echoscript.ps1
$testcommand = "echo pestertestscript"
$testcommand | Add-Content -Path $testfile
(Invoke-Expression $testfile) | Should Be "pestertestscript"
Remove-Item $testfile
$testcommand | Add-Content -Path "$testfile"
(Invoke-Expression "& '$testfile'") | Should Be "pestertestscript"
Remove-Item "$testfile"
}
It "Should return the echoed text from a script from the alias" {
$testfile = Join-Path -Path (Join-Path $PSScriptRoot -ChildPath assets) -ChildPath echoscript.ps1
$testcommand = "echo pestertestscript"
$testcommand | Add-Content -Path $testfile
(iex $testfile) | Should Be "pestertestscript"
Remove-Item $testfile
$testcommand | Add-Content -Path "$testfile"
(iex "& '$testfile'") | Should Be "pestertestscript"
Remove-Item "$testfile"
}
}
}