im SO not the writer of this code
This commit is contained in:
+4
-2
@@ -91,14 +91,16 @@ function Invoke-Scp {
|
|||||||
if ($Recurse) { $arguments += '-r' }
|
if ($Recurse) { $arguments += '-r' }
|
||||||
if ($HostKey) { $arguments += @('-batch', '-hostkey', $HostKey) }
|
if ($HostKey) { $arguments += @('-batch', '-hostkey', $HostKey) }
|
||||||
if ($Pass) { $arguments += @('-pw', $Pass) }
|
if ($Pass) { $arguments += @('-pw', $Pass) }
|
||||||
$arguments += @($Local, $Dest)
|
$arguments += @($Local)
|
||||||
|
$arguments += $Dest
|
||||||
Invoke-Ext -Exe $pscp.Path -Arguments $arguments -Label 'scp'
|
Invoke-Ext -Exe $pscp.Path -Arguments $arguments -Label 'scp'
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$arguments = @('-O')
|
$arguments = @('-O')
|
||||||
if ($Quiet) { $arguments += '-q' }
|
if ($Quiet) { $arguments += '-q' }
|
||||||
if ($Recurse) { $arguments += '-r' }
|
if ($Recurse) { $arguments += '-r' }
|
||||||
$arguments += @($Local, $Dest)
|
$arguments += @($Local)
|
||||||
|
$arguments += $Dest
|
||||||
Invoke-Ext -Exe 'scp' -Arguments $arguments -Label 'scp'
|
Invoke-Ext -Exe 'scp' -Arguments $arguments -Label 'scp'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+42
-13
@@ -44,11 +44,40 @@ function Get-WorkspacePackages {
|
|||||||
function Get-TestBinaryPaths {
|
function Get-TestBinaryPaths {
|
||||||
param([string[]]$CargoOutput)
|
param([string[]]$CargoOutput)
|
||||||
|
|
||||||
@(
|
$paths = New-Object System.Collections.Generic.List[string]
|
||||||
$CargoOutput |
|
|
||||||
Select-String -Pattern "Executable.*\((.+)\)" |
|
foreach ($line in $CargoOutput) {
|
||||||
ForEach-Object { $_.Matches.Groups[1].Value }
|
if ([string]::IsNullOrWhiteSpace($line)) {
|
||||||
)
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$msg = $line | ConvertFrom-Json -ErrorAction Stop
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($msg.reason -ne "compiler-artifact") {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if (-not $msg.executable) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
$isTestProfile = $false
|
||||||
|
if ($null -ne $msg.profile -and $null -ne $msg.profile.test) {
|
||||||
|
$isTestProfile = [bool]$msg.profile.test
|
||||||
|
}
|
||||||
|
if (-not $isTestProfile) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
$paths.Add([string]$msg.executable)
|
||||||
|
}
|
||||||
|
|
||||||
|
@($paths)
|
||||||
}
|
}
|
||||||
|
|
||||||
function Build-RemoteExecCommand {
|
function Build-RemoteExecCommand {
|
||||||
@@ -115,12 +144,12 @@ foreach ($packageName in $packages) {
|
|||||||
Write-Host "Building tests for $packageName..." -ForegroundColor Cyan
|
Write-Host "Building tests for $packageName..." -ForegroundColor Cyan
|
||||||
|
|
||||||
# Stream cargo output and convert to text
|
# Stream cargo output and convert to text
|
||||||
$cargoOutput = cargo test --no-run -p $packageName --target armv7-unknown-linux-musleabihf $(if ($BuildProfile -eq "release") { "-r" }) 2>&1 |
|
$cargoOutput = cargo test --no-run -p $packageName --target armv7-unknown-linux-musleabihf --message-format json $(if ($BuildProfile -eq "release") { "-r" }) 2>&1 |
|
||||||
ForEach-Object {
|
ForEach-Object {
|
||||||
$line = if ($_ -is [System.Management.Automation.ErrorRecord]) { $_.ToString() } else { $_ }
|
$line = if ($_ -is [System.Management.Automation.ErrorRecord]) { $_.ToString() } else { $_ }
|
||||||
if ($Verbose) {
|
# if ($Verbose) {
|
||||||
Write-Host $line
|
# Write-Host $line # this thing fills QUICK im not printing any
|
||||||
}
|
# }
|
||||||
$line
|
$line
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -158,14 +187,14 @@ foreach ($packageName in $packages) {
|
|||||||
Ensure-RemoteParentDir -RemoteDirPath $remoteRunDir -RemoteHost $RemoteHost -Password $password
|
Ensure-RemoteParentDir -RemoteDirPath $remoteRunDir -RemoteHost $RemoteHost -Password $password
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
$remoteUploadDir = (Normalize-PosixPath $remoteRunDir).TrimEnd('/') + '/'
|
||||||
|
Invoke-Scp -Local ($testBinaries | ForEach-Object { $_.FullName }) -Dest "${RemoteHost}:$remoteUploadDir" -Pass $password -Quiet
|
||||||
|
|
||||||
foreach ($testBinary in $testBinaries) {
|
foreach ($testBinary in $testBinaries) {
|
||||||
Write-Host "`nTesting: $packageName / $($testBinary.Name)" -ForegroundColor Cyan
|
Write-Host "`nTesting: $packageName / $($testBinary.Name)" -ForegroundColor Cyan
|
||||||
|
|
||||||
$remoteBinaryPath = New-RemoteBinaryPath -RemoteRunDir $remoteRunDir -TestBinary $testBinary
|
$remoteBinaryPath = New-RemoteBinaryPath -RemoteRunDir $remoteRunDir -TestBinary $testBinary
|
||||||
|
|
||||||
# Copy and make executable
|
|
||||||
Invoke-Scp -Local $testBinary.FullName -Dest "${RemoteHost}:$remoteBinaryPath" -Pass $password -Quiet
|
|
||||||
|
|
||||||
# Build test args
|
# Build test args
|
||||||
$parts = @()
|
$parts = @()
|
||||||
if ($Filter) { $parts += $Filter }
|
if ($Filter) { $parts += $Filter }
|
||||||
@@ -192,7 +221,7 @@ foreach ($packageName in $packages) {
|
|||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
try {
|
try {
|
||||||
Invoke-Ssh -Cmd ("rm -r " + (Quote-ShArg $remoteRunDir)) -Remote $RemoteHost -Pass $password -Quiet
|
Invoke-Ssh -Cmd ("rm -rf " + (Quote-ShArg $remoteRunDir)) -Remote $RemoteHost -Pass $password -Quiet
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
Write-Warning "Failed to remove remote test dir: $remoteRunDir"
|
Write-Warning "Failed to remove remote test dir: $remoteRunDir"
|
||||||
|
|||||||
Reference in New Issue
Block a user