Merge pull request #3818 from unknownbrackets/headless

Headless - use auto compare, just build test list in test.py
This commit is contained in:
Henrik Rydgård 2013-09-17 09:08:20 -07:00
commit 2de4db3e31
6 changed files with 21 additions and 95 deletions

View File

@ -312,6 +312,7 @@ void __CtrlInit()
memset(&ctrlCurrent, 0, sizeof(ctrlCurrent));
memset(ctrlCurrent.analog, CTRL_ANALOG_CENTER, sizeof(ctrlCurrent.analog));
analogEnabled = false;
for (u32 i = 0; i < NUM_CTRL_BUFFERS; i++)
memcpy(&ctrlBufs[i], &ctrlCurrent, sizeof(_ctrl_data));

View File

@ -424,7 +424,7 @@ u32 sceKernelIcacheClearAll()
KernelObjectPool::KernelObjectPool()
{
memset(occupied, 0, sizeof(bool)*maxCount);
nextID = 16;
nextID = initialNextID;
}
SceUID KernelObjectPool::Create(KernelObject *obj, int rangeBottom, int rangeTop)
@ -470,6 +470,7 @@ void KernelObjectPool::Clear()
occupied[i]=false;
}
memset(pool, 0, sizeof(KernelObject*)*maxCount);
nextID = initialNextID;
}
KernelObject *&KernelObjectPool::operator [](SceUID handle)

View File

@ -427,7 +427,7 @@ public:
~KernelObjectPool() {}
// Allocates a UID within the range and inserts the object into the map.
SceUID Create(KernelObject *obj, int rangeBottom = 16, int rangeTop = 0x7fffffff);
SceUID Create(KernelObject *obj, int rangeBottom = initialNextID, int rangeTop = 0x7fffffff);
void DoState(PointerWrap &p);
static KernelObject *CreateByIDType(int type);
@ -520,8 +520,9 @@ public:
private:
enum {
maxCount=4096,
handleOffset=0x100
maxCount = 4096,
handleOffset = 0x100,
initialNextID = 0x10
};
KernelObject *pool[maxCount];
bool occupied[maxCount];

View File

@ -79,7 +79,7 @@ LinkedShader::LinkedShader(Shader *vs, Shader *fs, bool useHWTransform)
glAttachShader(program, fs->shader);
glLinkProgram(program);
GLint linkStatus;
GLint linkStatus = GL_FALSE;
glGetProgramiv(program, GL_LINK_STATUS, &linkStatus);
if (linkStatus != GL_TRUE) {
GLint bufLength = 0;
@ -98,6 +98,8 @@ LinkedShader::LinkedShader(Shader *vs, Shader *fs, bool useHWTransform)
#endif
delete [] buf; // we're dead!
}
// Prevent a buffer overflow.
numBones = 0;
return;
}

View File

@ -352,7 +352,7 @@ int main(int argc, const char* argv[])
{
printf("Failed tests:\n");
for (int i = 0; i < failedTests.size(); ++i) {
printf(" %s", failedTests[i].c_str());
printf(" %s\n", failedTests[i].c_str());
}
}
}

99
test.py
View File

@ -38,9 +38,8 @@ class Command(object):
def run(self, timeout):
def target():
self.process = subprocess.Popen(self.cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
self.output, _ = self.process.communicate()
self.output = self.output.decode("utf-8")
self.process = subprocess.Popen(self.cmd, stdin=subprocess.PIPE)
self.process.communicate()
thread = threading.Thread(target=target)
thread.start()
@ -295,103 +294,25 @@ def run_tests(test_list, args):
tests_passed = []
tests_failed = []
test_filenames = []
for test in test_list:
# Try prx first
expected_filename = TEST_ROOT + test + ".expected"
elf_filename = TEST_ROOT + test + ".prx"
print(elf_filename)
if not os.path.exists(elf_filename):
print("WARNING: no prx, trying elf")
elf_filename = TEST_ROOT + test + ".elf"
if not os.path.exists(elf_filename):
print("ERROR: PRX/ELF file missing, failing test: " + test)
tests_failed.append(test)
tcprint("##teamcity[testIgnored name='%s' message='PRX/ELF missing']" % test)
continue
test_filenames.append(elf_filename)
if not os.path.exists(expected_filename):
print("WARNING: expects file missing, failing test: " + test)
tests_failed.append(test)
tcprint("##teamcity[testIgnored name='%s' message='Expects file missing']" % test)
continue
expected_output = open(expected_filename).read().strip()
tcprint("##teamcity[testStarted name='%s' captureStandardOutput='true']" % test)
cmdline = [PPSSPP_EXE, elf_filename]
cmdline.extend([i for i in args if i not in ['-v', '-g']])
if os.path.exists(expected_filename + ".bmp"):
cmdline.extend(["--screenshot=" + expected_filename + ".bmp", "--graphics"])
if len(test_filenames):
# TODO: Maybe --compare should detect --graphics?
cmdline = [PPSSPP_EXE, '--graphics', '--compare', '--timeout=' + str(TIMEOUT)] + test_filenames
cmdline.extend([i for i in args if i not in ['-g']])
c = Command(cmdline)
c.run(TIMEOUT)
c.run(TIMEOUT * len(test_filenames))
output = c.output.strip()
if c.timeout:
print(output)
print("Test exceded limit of %d seconds." % TIMEOUT)
tests_failed.append(test)
tcprint("##teamcity[testFailed name='%s' message='Test timeout']" % test)
tcprint("##teamcity[testFinished name='%s']" % test)
continue
if output.startswith("TESTERROR"):
print("Failed to run test " + elf_filename + "!")
tests_failed.append(test)
tcprint("##teamcity[testFailed name='%s' message='Failed to run test']" % test)
tcprint("##teamcity[testFinished name='%s']" % test)
continue
different = False
expected_lines = [x.strip() for x in expected_output.splitlines()]
output_lines = [x.strip() for x in output.splitlines()]
for i in range(0, min(len(output_lines), len(expected_lines))):
if output_lines[i] != expected_lines[i]:
print("E%i < %s" % (i + 1, expected_lines[i]))
print("O%i > %s" % (i + 1, output_lines[i]))
different = True
if len(output_lines) != len(expected_lines):
for i in range(len(output_lines), len(expected_lines)):
print("E%i < %s" % (i + 1, expected_lines[i]))
for i in range(len(expected_lines), len(output_lines)):
print("O%i > %s" % (i + 1, output_lines[i]))
print("*** Different number of lines!")
different = True
if not different:
if '-v' in args:
print("++++++++++++++ The Equal Output +++++++++++++")
print("\n".join(output_lines))
print("+++++++++++++++++++++++++++++++++++++++++++++")
print(" " + test + " - passed!")
tests_passed.append(test)
tcprint("##teamcity[testFinished name='%s']" % test)
else:
if '-v' in args:
print("============== output from failed " + test + " :")
print(output)
print("============== expected output:")
print(expected_output)
print("===============================")
tests_failed.append(test)
tcprint("##teamcity[testFailed name='%s' message='Output different from expected file']" % test)
tcprint("##teamcity[testFinished name='%s']" % 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)
print("Ran " + PPSSPP_EXE)
def main():