-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_tests.ps1
More file actions
38 lines (31 loc) · 1.01 KB
/
run_tests.ps1
File metadata and controls
38 lines (31 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
param([string]$testsfile=".\tests.txt", [string]$test)
$num_failed = 0
$num_passed = 0
foreach ($line in Get-Content $testsfile) {
$ti = $line.split(" ")
$test_expected_result = $ti[0]
$test_name = $ti[1]
if ($test) {
if ($test -ne $test_name) {continue}
}
$proc = Start-Process -FilePath "wesnoth.exe" -ArgumentList "-d -u$($test_name)" -PassThru -NoNewWindow
try
{
$proc | Wait-Process -Timeout 20 -ErrorAction Stop
}
catch
{
Write-Host "TIMEOUT`t$($test_name)" -ForegroundColor Yellow
$proc | Stop-Process -Force
$num_failed = $num_failed + 1
continue
}
if($proc.ExitCode -eq $test_expected_result){
Write-Host "SUCCESS`t$($test_name)"
$num_passed = $num_passed + 1
} else {
Write-Host "FAIL`t$($test_name)`tExpected $($test_expected_result) but got $($proc.ExitCode)" -ForegroundColor Yellow
$num_failed = $num_failed + 1
}
}
Write-Output "`nPASSED: $num_passed FAILED: $num_failed"