Developer-Dashboard
view release on metacpan or search on metacpan
integration/windows/run-qemu-windows-smoke.sh view on Meta::CPAN
\$tarball = Get-ChildItem -Path \$shared -Filter "Developer-Dashboard-*.tar.gz" | Sort-Object LastWriteTime -Descending | Select-Object -First 1
if (-not \$tarball) {
throw "Unable to locate Developer Dashboard tarball in \$shared"
}
if ("$WINDOWS_USE_INSTALL_BOOTSTRAP" -ne "1") {
Write-Status -Name "status.txt" -Value "locate-strawberry-perl"
\$perl = Get-Command perl -ErrorAction SilentlyContinue
if (-not \$perl) {
Write-Status -Name "status.txt" -Value "install-strawberry-perl"
\$installer = "C:\\OEM\\strawberry-perl-installer.msi"
if (-not (Test-Path \$installer)) {
throw "Unable to find staged Strawberry Perl installer at \$installer"
}
Start-Process msiexec.exe -ArgumentList @('/i', \$installer, '/qn', '/norestart') -Wait
}
}
Write-Status -Name "status.txt" -Value "run-strawberry-smoke"
\$smokeArgs = @(
'-NoLogo',
'-NoProfile',
'-ExecutionPolicy', 'Bypass',
'-File', 'C:\\OEM\\run-strawberry-smoke.ps1',
'-Tarball', \$tarball.FullName,
'-StatusRoot', \$shared
)
if ("$WINDOWS_USE_INSTALL_BOOTSTRAP" -eq "1") {
\$smokeArgs += '-UseInstallBootstrap'
\$smokeArgs += '-BootstrapScript'
\$smokeArgs += 'C:\\OEM\\install.ps1'
}
if ("$WINDOWS_SKIP_CPANM_TESTS" -eq "1") {
\$smokeArgs += '-SkipCpanmTests'
}
& powershell.exe @smokeArgs
Write-Status -Name "status.txt" -Value "success"
}
catch {
\$message = (\$_ | Out-String)
Set-Content -Path "\\\\host.lan\\Data\\status.txt" -Value "failure"
Set-Content -Path "\\\\host.lan\\Data\\error.txt" -Value \$message
throw
}
EOF
}
reset_dockur_workdir() {
# Purpose: remove stale Dockur guest state so a fresh smoke rerun always
# replays the OEM bootstrap path instead of booting an old installed image.
# Input: the configured Dockur workdir path.
# Output: deletes the persisted storage, shared, and OEM subdirectories.
rm -rf \
"$WINDOWS_DOCKUR_WORKDIR/storage" \
"$WINDOWS_DOCKUR_WORKDIR/shared" \
"$WINDOWS_DOCKUR_WORKDIR/oem"
}
run_prepared_qemu_smoke() {
# Purpose: boot a prepared Windows image and run the Strawberry smoke over SSH.
# Input: a prepared qcow2 image, SSH credentials, and a built tarball.
# Output: exits zero only when the in-guest Windows smoke passes.
if [[ -z "$WINDOWS_IMAGE" ]]; then
echo "WINDOWS_IMAGE is required and must point to a prepared Windows qcow2 image" >&2
exit 1
fi
if [[ ! -f "$WINDOWS_IMAGE" ]]; then
echo "Windows image does not exist: $WINDOWS_IMAGE" >&2
exit 1
fi
echo "==> boot Windows QEMU guest"
qemu-system-x86_64 \
-enable-kvm \
-m "$WINDOWS_RAM_MB" \
-smp "$WINDOWS_CPU_COUNT" \
-drive "file=$WINDOWS_IMAGE,if=virtio" \
-netdev "user,id=net0,hostfwd=tcp::${WINDOWS_SSH_PORT}-:22,hostfwd=tcp::7890-:7890" \
-device virtio-net-pci,netdev=net0 \
-display none \
-daemonize
QEMU_PID="$(pgrep -n -f "qemu-system-x86_64.*${WINDOWS_IMAGE//\//\\/}" || true)"
for _ in {1..60}; do
if ssh -i "$WINDOWS_SSH_KEY" -p "$WINDOWS_SSH_PORT" -o BatchMode=yes -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null "$WINDOWS_SSH_USER"@127.0.0.1 'echo ssh-ready' >/dev/null 2>&1; then
break
fi
sleep 5
done
echo "==> copy tarball and Windows smoke script into guest"
scp -i "$WINDOWS_SSH_KEY" -P "$WINDOWS_SSH_PORT" -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
"$TARBALL" \
"$ROOT_DIR/install.ps1" \
"$ROOT_DIR/integration/windows/run-strawberry-smoke.ps1" \
"$WINDOWS_SSH_USER"@127.0.0.1:/C:/Temp/
local guest_tarball="C:/Temp/$(basename "$TARBALL")"
echo "==> run Strawberry Perl smoke inside guest"
local guest_command="powershell -NoLogo -NoProfile -ExecutionPolicy Bypass -File C:/Temp/run-strawberry-smoke.ps1 -Tarball '$guest_tarball'"
if [[ "$WINDOWS_USE_INSTALL_BOOTSTRAP" == "1" ]]; then
guest_command="$guest_command -UseInstallBootstrap -BootstrapScript C:/Temp/install.ps1"
fi
ssh -i "$WINDOWS_SSH_KEY" -p "$WINDOWS_SSH_PORT" -o BatchMode=yes -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
"$WINDOWS_SSH_USER"@127.0.0.1 \
"$guest_command"
}
run_dockur_smoke() {
# Purpose: launch Dockur's KVM-backed Windows VM and wait for the OEM smoke marker.
# Input: Dockur image settings, OEM/shared workdir, and a built tarball.
# Output: exits zero only when the guest writes a success marker into the shared folder.
local shared_dir="$WINDOWS_DOCKUR_WORKDIR/shared"
local status_file="$shared_dir/status.txt"
local error_file="$shared_dir/error.txt"
local host_log_file="$shared_dir/dockur-host.log"
local container_log_file="$shared_dir/dockur-container.log"
( run in 1.245 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )