Skip to content
Merged
Changes from all commits
Commits
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
17 changes: 10 additions & 7 deletions build.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand Down Expand Up @@ -335,22 +336,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"
Expand Down