Optionally read test filenames from stdin.

This way we don't hit command line length limits.
This commit is contained in:
Unknown W. Brackets 2013-09-18 00:17:30 -07:00
parent d17df4a79a
commit 48eef19538
2 changed files with 18 additions and 4 deletions

View File

@ -123,7 +123,7 @@ bool RunAutoTest(HeadlessHost *headlessHost, CoreParameter &coreParameter, bool
fprintf(stderr, "Failed to start %s. Error: %s\n", coreParameter.fileToStart.c_str(), error_string.c_str());
printf("TESTERROR\n");
TeamCityPrint("##teamcity[testIgnored name='%s' message='PRX/ELF missing']\n", teamCityName.c_str());
return 1;
return false;
}
TeamCityPrint("##teamcity[testStarted name='%s' captureStandardOutput='true']\n", teamCityName.c_str());
@ -241,6 +241,17 @@ int main(int argc, const char* argv[])
testFilenames.push_back(argv[i]);
}
// TODO: Allow a filename here?
if (testFilenames.size() == 1 && testFilenames[0] == "@-")
{
testFilenames.clear();
char temp[2048];
temp[2047] = '\0';
while (scanf("%2047s", temp) == 1)
testFilenames.push_back(temp);
}
if (readMount)
{
printUsage(argv[0], "Missing argument after -m");

View File

@ -30,8 +30,9 @@ teamcity_mode = False
TIMEOUT = 5
class Command(object):
def __init__(self, cmd):
def __init__(self, cmd, data = None):
self.cmd = cmd
self.data = data
self.process = None
self.output = None
self.timeout = False
@ -39,6 +40,8 @@ class Command(object):
def run(self, timeout):
def target():
self.process = subprocess.Popen(self.cmd, bufsize=1, stdin=subprocess.PIPE, stdout=sys.stdout, stderr=subprocess.STDOUT)
self.process.stdin.write(self.data)
self.process.stdin.close()
self.process.communicate()
thread = threading.Thread(target=target)
@ -306,10 +309,10 @@ def run_tests(test_list, args):
if len(test_filenames):
# TODO: Maybe --compare should detect --graphics?
cmdline = [PPSSPP_EXE, '--graphics', '--compare', '--timeout=' + str(TIMEOUT)] + test_filenames
cmdline = [PPSSPP_EXE, '--graphics', '--compare', '--timeout=' + str(TIMEOUT), '@-']
cmdline.extend([i for i in args if i not in ['-g']])
c = Command(cmdline)
c = Command(cmdline, '\n'.join(test_filenames))
c.run(TIMEOUT * len(test_filenames))
print("Ran " + PPSSPP_EXE)