Merge pull request #3823 from unknownbrackets/headless

Fix headless on buildbot (command line length), speed up further
This commit is contained in:
Henrik Rydgård 2013-09-18 00:48:17 -07:00
commit 198434c6eb
7 changed files with 27 additions and 9 deletions

View file

@ -73,6 +73,7 @@ public:
#endif #endif
// Used for headless. // Used for headless.
virtual bool ShouldSkipUI() { return false; }
virtual void SendDebugOutput(const std::string &output) {} virtual void SendDebugOutput(const std::string &output) {}
virtual void SendDebugScreenshot(const u8 *pixbuf, u32 w, u32 h) {} virtual void SendDebugScreenshot(const u8 *pixbuf, u32 w, u32 h) {}
}; };

View file

@ -103,7 +103,6 @@ void Clear();
struct Opcode { struct Opcode {
Opcode() { Opcode() {
encoding = 0;
} }
explicit Opcode(u32 v) : encoding (v) { explicit Opcode(u32 v) : encoding (v) {

View file

@ -135,7 +135,8 @@ static u32 __PPGeDoAlloc(u32 &size, bool fromTop, const char *name) {
void __PPGeInit() void __PPGeInit()
{ {
if (PSP_CoreParameter().gpuCore == GPU_NULL) { // PPGe isn't really important for headless, and LoadZIM takes a long time.
if (PSP_CoreParameter().gpuCore == GPU_NULL || host->ShouldSkipUI()) {
// Let's just not bother. // Let's just not bother.
dlPtr = 0; dlPtr = 0;
NOTICE_LOG(SCEGE, "Not initializing PPGe - GPU is NullGpu"); NOTICE_LOG(SCEGE, "Not initializing PPGe - GPU is NullGpu");

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()); fprintf(stderr, "Failed to start %s. Error: %s\n", coreParameter.fileToStart.c_str(), error_string.c_str());
printf("TESTERROR\n"); printf("TESTERROR\n");
TeamCityPrint("##teamcity[testIgnored name='%s' message='PRX/ELF missing']\n", teamCityName.c_str()); 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()); TeamCityPrint("##teamcity[testStarted name='%s' captureStandardOutput='true']\n", teamCityName.c_str());
@ -160,7 +160,6 @@ bool RunAutoTest(HeadlessHost *headlessHost, CoreParameter &coreParameter, bool
} }
} }
host->ShutdownGL();
PSP_Shutdown(); PSP_Shutdown();
headlessHost->FlushDebugOutput(); headlessHost->FlushDebugOutput();
@ -242,6 +241,17 @@ int main(int argc, const char* argv[])
testFilenames.push_back(argv[i]); 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) if (readMount)
{ {
printUsage(argv[0], "Missing argument after -m"); printUsage(argv[0], "Missing argument after -m");
@ -357,10 +367,10 @@ int main(int argc, const char* argv[])
} }
} }
host->ShutdownGL();
delete host; delete host;
host = NULL; host = NULL;
headlessHost = NULL; headlessHost = NULL;
return 0; return 0;
} }

View file

@ -46,6 +46,8 @@ public:
virtual bool IsDebuggingEnabled() {return false;} virtual bool IsDebuggingEnabled() {return false;}
virtual bool AttemptLoadSymbolMap() {return false;} virtual bool AttemptLoadSymbolMap() {return false;}
virtual bool ShouldSkipUI() { return true; }
virtual void SendDebugOutput(const std::string &output) { virtual void SendDebugOutput(const std::string &output) {
if (output.find('\n') != output.npos) { if (output.find('\n') != output.npos) {
DoFlushDebugOutput(); DoFlushDebugOutput();

View file

@ -37,6 +37,8 @@ public:
virtual void SendDebugScreenshot(const u8 *pixbuf, u32 w, u32 h); virtual void SendDebugScreenshot(const u8 *pixbuf, u32 w, u32 h);
virtual void SetComparisonScreenshot(const std::string &filename); virtual void SetComparisonScreenshot(const std::string &filename);
virtual bool ShouldSkipUI() { return false; }
private: private:
bool ResizeGL(); bool ResizeGL();
void LoadNativeAssets(); void LoadNativeAssets();

11
test.py
View file

@ -30,15 +30,18 @@ teamcity_mode = False
TIMEOUT = 5 TIMEOUT = 5
class Command(object): class Command(object):
def __init__(self, cmd): def __init__(self, cmd, data = None):
self.cmd = cmd self.cmd = cmd
self.data = data
self.process = None self.process = None
self.output = None self.output = None
self.timeout = False self.timeout = False
def run(self, timeout): def run(self, timeout):
def target(): def target():
self.process = subprocess.Popen(self.cmd, stdin=subprocess.PIPE) 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() self.process.communicate()
thread = threading.Thread(target=target) thread = threading.Thread(target=target)
@ -306,10 +309,10 @@ def run_tests(test_list, args):
if len(test_filenames): if len(test_filenames):
# TODO: Maybe --compare should detect --graphics? # 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']]) 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)) c.run(TIMEOUT * len(test_filenames))
print("Ran " + PPSSPP_EXE) print("Ran " + PPSSPP_EXE)