Test suite actually runs properly now

This commit is contained in:
Henrik Rydgard 2012-11-09 11:03:01 +01:00
parent 8ea53dd778
commit 94f5de1ac0
3 changed files with 36 additions and 17 deletions

View File

@ -663,7 +663,7 @@ void sceIoDevctl() //(const char *name, int cmd, void *arg, size_t arglen, void
std::string data(Memory::GetCharPointer(argAddr), argLen);
if (PSP_CoreParameter().printfEmuLog)
{
puts(data.c_str());
printf("%s", data.c_str());
#ifdef _WIN32
OutputDebugString(data.c_str());
#endif

View File

@ -104,6 +104,7 @@ int main(int argc, const char* argv[])
coreParameter.gpuCore = GPU_NULL;
coreParameter.enableSound = false;
coreParameter.headLess = true;
coreParameter.printfEmuLog = true;
g_Config.bEnableSound = true;
g_Config.bFirstRun = false;
@ -112,7 +113,8 @@ int main(int argc, const char* argv[])
std::string error_string;
if (!PSP_Init(coreParameter, &error_string)) {
fprintf(stderr, "Failed to start PSP executable. Error: %s\n", error_string.c_str());
fprintf(stderr, "Failed to start %s. Error: %s\n", coreParameter.fileToStart.c_str(), error_string.c_str());
printf("TESTERROR\n");
return 1;
}

47
test.py
View File

@ -14,14 +14,13 @@ TEST_ROOT = "pspautotests/tests/"
# These have worked and should keep working always - regression tests.
tests_good = [
"cpu/cpu/cpu",
"cpu/fpu/fpu",
"cpu/icache/icache",
"cpu/lsu/lsu",
]
# These are the next tests up for fixing.
tests_next = [
"cpu/fpu/fpu",
]
# These are the tests we ignore (not important, or impossible to run)
@ -54,8 +53,8 @@ def init():
def run_tests(test_list):
global PPSSPP_EXE
tests_passed = 0
tests_failed = 0
tests_passed = []
tests_failed = []
flags = ""
@ -64,28 +63,46 @@ def run_tests(test_list):
expected_filename = TEST_ROOT + test + ".expected"
if not os.path.exists(expected_filename):
print("WARNING: expects file missing, failing test: " + expected_filename)
tests_failed += 1
tests_failed.append(test)
continue
expected_output = open(expected_filename).read()
cmdline = PPSSPP_EXE + " " + test + ".elf"
cmdline = PPSSPP_EXE + " " + elf_filename
#print "Cmdline: " + cmdline
proc = subprocess.Popen(cmdline, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
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()
output = proc.stdout.read()
print output
if output == expected_output:
print "Test passed!"
for i in range(0, len(expected_lines)):
if output_lines[i] != expected_lines[i]:
different = True
if not different:
print " " + test + " - passed!"
tests_passed.append(test)
else:
print "Test failed ============== output:"
print test + " failed ============== output:"
print output
print "============== expected output:"
print expected_output
print "==============================="
tests_failed.append(test)
tests_passed += 1
print "%i tests passed, %i tests failed" % (tests_passed, tests_failed)
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
def main():
init()