-
Notifications
You must be signed in to change notification settings - Fork 26
/
test.ps1
executable file
·42 lines (33 loc) · 1.01 KB
/
test.ps1
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
39
40
41
42
$test_rom_file = "bin/m12test.gba"
$log_file = "bin/test.log"
$sleep_time = 120
$failure_text = "FAIL"
$end_text = "Done!"
$mgba_name = "mgba-sdl"
If ($IsWindows) { $mgba_cmd = "bin/$mgba_name.exe" }
ElseIf ($IsLinux -or $IsMacOS) { $mgba_cmd = "bin/$mgba_name" }
"Building the test ROM..."
.\build.ps1 -t
if ($LASTEXITCODE -ne 0) { exit -1 }
Remove-Item -Path $log_file
"Starting the emulator..."
& $mgba_cmd -l 16 -C logLevel.gba.bios=0 -C logToFile=1 -C logFile=$log_file $test_rom_file &
if ($LASTEXITCODE -ne 0) { exit -1 }
"Sleeping for $sleep_time seconds..."
Start-Sleep $sleep_time
"Closing the emulator..."
Stop-Process -Name $mgba_name
if ($LASTEXITCODE -ne 0) { exit -1 }
$fails = Select-String -Path $log_file -Pattern $failure_text
if ($fails.count -ne 0) {
"Test failures:"
$fails
exit -1
}
$end_session = Select-String -Path $log_file -Pattern $end_text
if ($end_session.count -eq 0) {
"The tests did not run to completion!"
exit -1
}
"No failures!"
exit 0