Created
January 28, 2015 21:09
-
-
Save nicolasbadano/d414e9696624d1c2b532 to your computer and use it in GitHub Desktop.
A3_AGM_UnitTest.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$gameArgs = "-window -nosplash -world=empty -noPause -mod=@CBA_A3_DEV;@AGM_dev; -autotest=A3_AGM_UnitTest.cfg" | |
$gameDir = "F:\Juegos\Steam\SteamApps\common\Arma 3" | |
$logDir = "C:\Users\nico\AppData\Local\Arma 3" | |
$targetMod = "@AGM_dev" | |
$regex = "" | |
$pboFps = @() | |
$pboList = @() | |
$pboList += ,@('agm_core', @()) | |
$pboList += ,@('agm_interaction', @("agm_core")) | |
$pboList += ,@('agm_ai', @("agm_core")) | |
$pboList += ,@('agm_aircraft', @("agm_core")) | |
$pboList += ,@('agm_armour', @("agm_core")) | |
$pboList += ,@('agm_attach', @("agm_core", "agm_interaction")) | |
$pboList += ,@('agm_backblast', @("agm_core")) | |
$pboList += ,@('agm_backpacks', @("agm_core")) | |
$pboList += ,@('agm_ballistics', @("agm_core")) | |
$pboList += ,@('agm_captives', @("agm_core", "agm_interaction")) | |
$pboList += ,@('agm_difficulties', @("agm_core")) | |
$pboList += ,@('agm_disposable', @("agm_core")) | |
$pboList += ,@('agm_explosives', @("agm_core", "agm_interaction")) | |
$pboList += ,@('agm_fastroping', @("agm_core")) | |
$pboList += ,@('agm_firecontrolsystem', @("agm_core", "agm_interaction")) | |
$pboList += ,@('agm_gforces', @("agm_core", "agm_medical")) | |
$pboList += ,@('agm_goggles', @("agm_core")) | |
$pboList += ,@('agm_grenades', @("agm_core")) | |
$pboList += ,@('agm_hearing', @("agm_core", "agm_interaction")) | |
$pboList += ,@('agm_inventory', @("agm_core")) | |
$pboList += ,@('agm_logistics', @("agm_core", "agm_interaction")) | |
$pboList += ,@('agm_magazinerepack', @("agm_core", "agm_interaction")) | |
$pboList += ,@('agm_map', @("agm_core", "agm_interaction")) | |
$pboList += ,@('agm_markers', @("agm_core")) | |
$pboList += ,@('agm_medical', @("agm_core", "agm_interaction")) | |
$pboList += ,@('agm_movement', @("agm_core")) | |
$pboList += ,@('agm_nametags', @("agm_core")) | |
$pboList += ,@('agm_nightvision', @("agm_core")) | |
$pboList += ,@('agm_noradio', @("agm_core")) | |
$pboList += ,@('agm_overheating', @("agm_core", "agm_interaction")) | |
$pboList += ,@('agm_parachute', @("agm_core")) | |
$pboList += ,@('agm_ragdolls', @("agm_core")) | |
$pboList += ,@('agm_realisticnames', @("agm_core")) | |
$pboList += ,@('agm_recoil', @("agm_core")) | |
$pboList += ,@('agm_reload', @("agm_core")) | |
$pboList += ,@('agm_respawn', @("agm_core", "agm_interaction")) | |
$pboList += ,@('agm_resting', @("agm_core")) | |
$pboList += ,@('agm_safemode', @("agm_core")) | |
$pboList += ,@('agm_scopes', @("agm_core")) | |
$pboList += ,@('agm_smallarms', @("agm_core")) | |
$pboList += ,@('agm_switchunits', @("agm_core")) | |
$pboList += ,@('agm_thermals', @("agm_core")) | |
$pboList += ,@('agm_topdownattack', @("agm_core")) | |
$pboList += ,@('agm_vector', @("agm_core")) | |
$pboList += ,@('agm_vehicles', @("agm_core")) | |
$pboList += ,@('agm_weaponselect', @("agm_core")) | |
$pboList += ,@('agm_wind', @("agm_core", "agm_interaction")) | |
function disableAllMods | |
{ | |
$addonDir = "$gameDir\$targetMod\addons\" | |
foreach($pbo in $pboList) | |
{ | |
$file = $addonDir + $pbo[0] + ".pbo" | |
if (Test-Path $file) { | |
Rename-Item $file ($pbo[0] + ".pbo.disabled") | |
} | |
} | |
} | |
function testAllMods | |
{ | |
$addonDir = "$gameDir\$targetMod\addons\" | |
Write-Host ("Testing without AGM") | |
#start game and wait for finish | |
Start-Process -FilePath ($gameDir + "\arma3.exe") -ArgumentList $gameArgs -NoNewWindow -Wait | |
#get log file | |
$latestFile = gci $logDir | sort LastWriteTime | select -last 1 | |
$latestFile = Get-Content ($logDir + "\" + $latestFile) | |
$logValue = [regex]::match($latestFile, '<AVERAGE FPS>(.*?)</AVERAGE FPS>').Groups[1].Value | |
$pboFps += ,@('vanilla', $logValue) | |
Write-Host "Test ran and got $logValue FPS" | |
foreach($pbo in $pboList) | |
{ | |
$file = $addonDir + $pbo[0] + ".pbo.disabled" | |
if (Test-Path $file) { | |
# enabled dependancies | |
foreach($dep in $pbo[1]) { | |
$file2 = $addonDir + $dep + ".pbo.disabled" | |
if (Test-Path $file2) { | |
Rename-Item $file2 ($dep + ".pbo") | |
} | |
} | |
#enable mod | |
Rename-Item $file ($pbo[0] + ".pbo") | |
Write-Host ("Testing mod pbo:" + $pbo[0]) | |
#start game and wait for finish | |
Start-Process -FilePath ($gameDir + "\arma3.exe") -ArgumentList $gameArgs -NoNewWindow -Wait | |
#get log file | |
$latestFile = gci $logDir | sort LastWriteTime | select -last 1 | |
$latestFile = Get-Content ($logDir + "\" + $latestFile) | |
$logValue = [regex]::match($latestFile, '<AVERAGE FPS>(.*?)</AVERAGE FPS>').Groups[1].Value | |
$pboFps += ,@($pbo[0], $logValue) | |
Write-Host "Test ran and got $logValue FPS" | |
} | |
} | |
} | |
disableAllMods | |
Write-Host "Disabled mod pbos" | |
testAllMods #test all mods via adding more one at a time | |
#testEachMod #test only one mod pbo enabled at a time | |
Write-Host "Tested all mod pbos" | |
foreach($data in $pboFps) | |
{ | |
Write-Host ($data) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment