diff --git a/iperf/.gitignore b/iperf/.gitignore new file mode 100644 index 0000000..5ae0598 --- /dev/null +++ b/iperf/.gitignore @@ -0,0 +1,5 @@ +* +!.gitignore +!config.json +!install.ps1 +!README.md diff --git a/iperf/README.md b/iperf/README.md new file mode 100644 index 0000000..97cb551 --- /dev/null +++ b/iperf/README.md @@ -0,0 +1,24 @@ +# iperf3 for AutoHCK + +Windows iperf3 v3.17.1 (amd64) for NetKVM functest throughput and RSS cases. + +## Layout + +``` +iperf/ + config.json + install.ps1 + iperf3-win.zip # not in git — AutoHCK downloads on first use +``` + +Guest install: `C:\iperf\iperf3.exe` on machine PATH. + +Host setup: Linux `iperf3` is configured in AutoHCK test case pre_test_commands. + +## Usage + +```json +"extra_software": ["iperf"] +``` + +Source: https://github.com/ar51an/iperf3-win-builds/releases/tag/3.17.1 diff --git a/iperf/config.json b/iperf/config.json new file mode 100644 index 0000000..e6f809c --- /dev/null +++ b/iperf/config.json @@ -0,0 +1,11 @@ +{ + "download_url": "https://github.com/ar51an/iperf3-win-builds/releases/download/3.17.1/iperf-3.17.1-win64.zip", + "file_name": "iperf3-win.zip", + "install_cmd": "powershell", + "install_args": "-ExecutionPolicy Bypass -File @sw_path@\\install.ps1", + "install_dest": "client", + "install_time": { + "kit": "after", + "driver": "before" + } +} diff --git a/iperf/install.ps1 b/iperf/install.ps1 new file mode 100644 index 0000000..5432c7a --- /dev/null +++ b/iperf/install.ps1 @@ -0,0 +1,40 @@ +$ErrorActionPreference = 'Stop' +$SrcDir = $PSScriptRoot +$InstallDir = 'C:\iperf' +$ZipFile = Join-Path $SrcDir 'iperf3-win.zip' + +if (-not (Test-Path $ZipFile)) { + Write-Output "FAIL: iperf3-win.zip not found at $ZipFile" + exit 1 +} + +$TempDir = Join-Path $env:TEMP ("iperf3_extract_" + [guid]::NewGuid().ToString()) +New-Item -ItemType Directory -Path $TempDir -Force | Out-Null +try { + Expand-Archive -LiteralPath $ZipFile -DestinationPath $TempDir -Force + $exe = Get-ChildItem -Path $TempDir -Recurse -Filter 'iperf3.exe' | Select-Object -First 1 + if (-not $exe) { + Write-Output 'FAIL: iperf3.exe not found inside zip' + exit 1 + } + New-Item -ItemType Directory -Path $InstallDir -Force | Out-Null + Copy-Item -LiteralPath $exe.FullName -Destination (Join-Path $InstallDir 'iperf3.exe') -Force + $dll = Get-ChildItem -Path $TempDir -Recurse -Filter 'cygwin1.dll' | Select-Object -First 1 + if ($dll) { + Copy-Item -LiteralPath $dll.FullName -Destination (Join-Path $InstallDir 'cygwin1.dll') -Force + } +} finally { + Remove-Item -LiteralPath $TempDir -Recurse -Force -ErrorAction SilentlyContinue +} + +$machinePath = [Environment]::GetEnvironmentVariable('Path', 'Machine') +$parts = @() +if (-not [string]::IsNullOrEmpty($machinePath)) { + $parts = @($machinePath -split ';' | Where-Object { $_ -ne '' }) +} +if ($parts -notcontains $InstallDir) { + [Environment]::SetEnvironmentVariable('Path', ($InstallDir + ';' + $machinePath), 'Machine') +} + +Write-Output "PASS: iperf3 installed ($InstallDir)" +exit 0