From aa273571db3339f508219e5625a76f1c24b0b9e4 Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Wed, 1 Jun 2016 11:10:29 -0700 Subject: [PATCH 1/2] Fix and improve Start-PSxUnit * Last PR had a typo in "TestAruments" which caused the configuration not to get picked up * Now bails appropriately if PowerShell wasn't built, instead of rebuilding it every time * Passes `-verbose` to the xUnit runner, not dotnet, so we can see which test failed --- build.psm1 | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/build.psm1 b/build.psm1 index b075b1d77..a2274492f 100644 --- a/build.psm1 +++ b/build.psm1 @@ -335,22 +335,24 @@ function Start-PSxUnit { return } + $Arguments = "--configuration", "Linux", "-parallel", "none" if ($PSCmdlet.MyInvocation.BoundParameters["Verbose"].IsPresent) { - $Verbose = "--verbose" + $Arguments += "-verbose" } $Content = Split-Path -Parent (Get-PSOutput) - $BuildArguments = "--configuration", "Linux" - $TestAruments = $BuildArguments + @("-parallel", "none") + if (-not (Test-Path $Content)) { + throw "PowerShell must be built before running tests!" + } + try { Push-Location $PSScriptRoot/test/csharp # Path manipulation to obtain test project output directory $Output = Join-Path $pwd ((Split-Path -Parent (Get-PSOutput)) -replace (New-PSOptions).Top) - Write-Host "Output is $Output" + Write-Verbose "Output is $Output" - Start-NativeExecution { dotnet $Verbose build $BuildArguments } Copy-Item -ErrorAction SilentlyContinue -Recurse -Path $Content/* -Include Modules,libpsl-native* -Destination $Output - Start-NativeExecution { dotnet $Verbose test $TestArguments } + Start-NativeExecution { dotnet test $Arguments } if ($LASTEXITCODE -ne 0) { throw "$LASTEXITCODE xUnit tests failed" From 66ddfcdaffc596792eb8d4256bda23b07da8aa16 Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Wed, 1 Jun 2016 11:13:49 -0700 Subject: [PATCH 2/2] Make git describe work relative to script So that you don't have to watch your CWD when running commands from the build module. --- build.psm1 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build.psm1 b/build.psm1 index a2274492f..bb1fed04a 100644 --- a/build.psm1 +++ b/build.psm1 @@ -53,7 +53,8 @@ function Start-PSBuild { [string]$msbuildConfiguration = "Release" ) - git describe --dirty --abbrev=60 > "$psscriptroot/powershell.version" + # save Git description to file for PowerShell to include in PSVersionTable + git --git-dir="$PSScriptRoot/.git" describe --dirty --abbrev=60 > "$psscriptroot/powershell.version" # simplify ParameterSetNames if ($PSCmdlet.ParameterSetName -eq 'FullCLR') {