Add build, deploy and test sources
This commit is contained in:
1 parent
825be27efd
commit
b8dfcda031
115 files changed
+8548
No files matched your search
@@ -0,0 +1,31 @@
|
||||
# Run VHD test elevated: cleanup leftovers, then run the AutoIt driver.
|
||||
$ErrorActionPreference = 'Continue'
|
||||
$dir = 'C:\PF\USBInstaller\test'
|
||||
$out = Join-Path $dir 'vhd-run.log'
|
||||
"start: $(Get-Date -Format 'HH:mm:ss') admin=$(([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator))" | Set-Content $out -Encoding UTF8
|
||||
|
||||
# 1. kill leftovers from previous interrupted runs
|
||||
Get-Process -Name 'test','syn' -ErrorAction SilentlyContinue | ForEach-Object {
|
||||
try { $_.Kill() } catch {}
|
||||
"killed $($_.ProcessName) $($_.Id)" | Add-Content $out -Encoding UTF8
|
||||
}
|
||||
Get-CimInstance Win32_Process -Filter "Name='AutoIt3.exe'" | Where-Object { $_.CommandLine -like '*driver*' } | ForEach-Object {
|
||||
try { Stop-Process -Id $_.ProcessId -Force } catch {}
|
||||
"killed AutoIt3 $($_.ProcessId)" | Add-Content $out -Encoding UTF8
|
||||
}
|
||||
Start-Sleep -Seconds 2
|
||||
|
||||
# 2. detach any leftover test VHD
|
||||
$vhd = Join-Path $dir 'pf-test.vhdx'
|
||||
$sp = Join-Path $dir 'dp-cleanup.txt'
|
||||
('select vdisk file="' + $vhd + '"' + "`r`n" + 'detach vdisk noerr' + "`r`n" + 'exit' + "`r`n") | Set-Content $sp -Encoding ASCII
|
||||
& diskpart.exe /s $sp | Out-Null
|
||||
Start-Sleep -Seconds 2
|
||||
if (Test-Path $vhd) {
|
||||
try { Remove-Item $vhd -Force } catch { "could not delete vhd: $($_.Exception.Message)" | Add-Content $out -Encoding UTF8 }
|
||||
}
|
||||
"leftover vhd present: $(Test-Path $vhd)" | Add-Content $out -Encoding UTF8
|
||||
|
||||
# 3. run the driver
|
||||
& 'C:\Program Files (x86)\AutoIt3\AutoIt3.exe' (Join-Path $dir 'driver-vhd.au3') *>> $out
|
||||
"exit: $LASTEXITCODE end: $(Get-Date -Format 'HH:mm:ss')" | Add-Content $out -Encoding UTF8
|
||||
Reference in new issue
Block a user