2012-11-09 09:43:11 +00:00
|
|
|
# Automated script to run the pspautotests test suite in PPSSPP.
|
|
|
|
|
|
|
|
import sys
|
|
|
|
import io
|
|
|
|
import os
|
|
|
|
import subprocess
|
|
|
|
|
|
|
|
|
|
|
|
PPSSPP_EXECUTABLES = [ "Windows/Release/PPSSPPHeadless.exe", "SDL/build/ppsspp_headless" ]
|
|
|
|
PPSSPP_EXE = None
|
|
|
|
TEST_ROOT = "pspautotests/tests/"
|
|
|
|
|
|
|
|
# Test names are the C files without the .c extension.
|
|
|
|
# These have worked and should keep working always - regression tests.
|
|
|
|
tests_good = [
|
|
|
|
"cpu/cpu/cpu",
|
|
|
|
"cpu/icache/icache",
|
|
|
|
"cpu/lsu/lsu",
|
2012-11-09 10:20:39 +00:00
|
|
|
"cpu/fpu/fpu",
|
2012-11-09 10:33:22 +00:00
|
|
|
|
|
|
|
"display/display",
|
|
|
|
"dmac/dmactest",
|
|
|
|
"intr/intr",
|
|
|
|
"intr/vblank/vblank",
|
|
|
|
"misc/testgp",
|
|
|
|
"string/string",
|
2012-11-09 09:43:11 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
# These are the next tests up for fixing.
|
|
|
|
tests_next = [
|
2012-11-09 10:33:22 +00:00
|
|
|
"cpu/vfpu/vfpu",
|
|
|
|
"ctrl/ctrl",
|
|
|
|
"io/cwd/cwd",
|
|
|
|
"io/directory/directory",
|
|
|
|
"io/io/io",
|
|
|
|
"io/iodrv/iodrv",
|
|
|
|
"malloc/malloc",
|
|
|
|
"mstick/mstick",
|
|
|
|
"modules/loadexec/loader",
|
|
|
|
"power/power",
|
|
|
|
"rtc/rtc",
|
|
|
|
"sysmem/sysmem",
|
|
|
|
"threads/events/events",
|
|
|
|
"threads/fpl/fpl",
|
|
|
|
"threads/mbx/mbx",
|
|
|
|
"threads/msgpipe/msgpipe",
|
|
|
|
"threads/mutex/mutex",
|
|
|
|
"threads/scheduling/scheduling",
|
|
|
|
"threads/semaphores/semaphores",
|
|
|
|
"threads/threads/threads",
|
|
|
|
"threads/vpl/vpl",
|
|
|
|
"threads/vtimers/vtimers",
|
|
|
|
"threads/wakeup/wakeup",
|
|
|
|
"umd/umd",
|
|
|
|
"umd/callbacks/umd",
|
|
|
|
"umd/io/umd_io",
|
|
|
|
"umd/raw_access/raw_access",
|
|
|
|
"utility/systemparam",
|
|
|
|
"video/pmf",
|
|
|
|
"video/pmf_simple",
|
2012-11-09 09:43:11 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
# These are the tests we ignore (not important, or impossible to run)
|
|
|
|
tests_ignored = [
|
2012-11-09 10:33:22 +00:00
|
|
|
"kirk/kirk",
|
|
|
|
"me/me",
|
2012-11-09 09:43:11 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def init():
|
|
|
|
global PPSSPP_EXE
|
|
|
|
if not os.path.exists("pspautotests"):
|
|
|
|
print "Please run git submodule init; git submodule update;"
|
|
|
|
sys.exit(1)
|
|
|
|
|
|
|
|
if not os.path.exists(TEST_ROOT + "cpu/cpu/cpu.elf"):
|
|
|
|
print "Please install the pspsdk and run build.sh or build.bat in pspautotests/tests"
|
|
|
|
sys.exit(1)
|
|
|
|
|
|
|
|
for p in PPSSPP_EXECUTABLES:
|
|
|
|
if os.path.exists(p):
|
|
|
|
PPSSPP_EXE = p
|
|
|
|
break
|
|
|
|
|
|
|
|
if not PPSSPP_EXE:
|
|
|
|
print "PPSSPP executable missing, please build one."
|
|
|
|
sys.exit(1)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def run_tests(test_list):
|
|
|
|
global PPSSPP_EXE
|
2012-11-09 10:03:01 +00:00
|
|
|
tests_passed = []
|
|
|
|
tests_failed = []
|
2012-11-09 09:43:11 +00:00
|
|
|
|
|
|
|
flags = ""
|
|
|
|
|
|
|
|
for test in test_list:
|
|
|
|
elf_filename = TEST_ROOT + test + ".elf"
|
|
|
|
expected_filename = TEST_ROOT + test + ".expected"
|
|
|
|
if not os.path.exists(expected_filename):
|
|
|
|
print("WARNING: expects file missing, failing test: " + expected_filename)
|
2012-11-09 10:03:01 +00:00
|
|
|
tests_failed.append(test)
|
2012-11-09 09:43:11 +00:00
|
|
|
continue
|
|
|
|
|
|
|
|
expected_output = open(expected_filename).read()
|
|
|
|
|
2012-11-09 10:03:01 +00:00
|
|
|
cmdline = PPSSPP_EXE + " " + elf_filename
|
|
|
|
#print "Cmdline: " + cmdline
|
2012-11-09 09:43:11 +00:00
|
|
|
proc = subprocess.Popen(cmdline, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
|
2012-11-09 10:03:01 +00:00
|
|
|
|
|
|
|
output = proc.stdout.read().strip()
|
|
|
|
if output.startswith("TESTERROR"):
|
|
|
|
print "Failed to run test " + elf_filename + "!"
|
|
|
|
tests_failed.append(test)
|
|
|
|
continue
|
|
|
|
|
|
|
|
different = False
|
|
|
|
expected_lines = expected_output.splitlines()
|
|
|
|
output_lines = output.splitlines()
|
2012-11-09 09:43:11 +00:00
|
|
|
|
2012-11-09 10:03:01 +00:00
|
|
|
for i in range(0, len(expected_lines)):
|
|
|
|
if output_lines[i] != expected_lines[i]:
|
2012-11-09 10:34:59 +00:00
|
|
|
#print "First different line (output vs expected):"
|
|
|
|
#print output_lines[i]
|
|
|
|
#print " --- expected: ---"
|
|
|
|
#print expected_lines[i]
|
2012-11-09 10:03:01 +00:00
|
|
|
different = True
|
2012-11-09 10:36:07 +00:00
|
|
|
break
|
2012-11-09 10:03:01 +00:00
|
|
|
|
|
|
|
if not different:
|
|
|
|
print " " + test + " - passed!"
|
|
|
|
tests_passed.append(test)
|
2012-11-09 09:43:11 +00:00
|
|
|
else:
|
2012-11-09 10:03:01 +00:00
|
|
|
print test + " failed ============== output:"
|
2012-11-09 09:43:11 +00:00
|
|
|
print output
|
|
|
|
print "============== expected output:"
|
|
|
|
print expected_output
|
2012-11-09 10:03:01 +00:00
|
|
|
print "==============================="
|
|
|
|
tests_failed.append(test)
|
|
|
|
|
|
|
|
print "%i tests passed, %i tests failed" % (len(tests_passed), len(tests_failed))
|
|
|
|
if len(tests_failed):
|
|
|
|
print "Failed tests:"
|
|
|
|
for t in tests_failed:
|
|
|
|
print " " + t
|
|
|
|
print "Ran " + PPSSPP_EXE
|
2012-11-09 09:43:11 +00:00
|
|
|
|
|
|
|
def main():
|
|
|
|
init()
|
|
|
|
if len(sys.argv) == 1:
|
|
|
|
run_tests(tests_good)
|
|
|
|
|
|
|
|
main()
|