Merge pull request #91 from unknownbrackets/linux-fix

Fix tests on Linux to behave more like Android.
This commit is contained in:
Henrik Rydgård 2012-11-25 02:11:05 -08:00
commit 85c9a43dc1
4 changed files with 43 additions and 12 deletions

View file

@ -69,11 +69,20 @@ public:
}
};
void printUsage()
void printUsage(const char *progname, const char *reason)
{
if (reason != NULL)
fprintf(stderr, "Error: %s\n\n", reason);
fprintf(stderr, "PPSSPP Headless\n");
fprintf(stderr, "Usage: ppsspp-headless file.elf [-c] [-m] [-j] [-c]\n");
fprintf(stderr, "See headless.txt for details.\n");
fprintf(stderr, "This is primarily meant for non-inactive test tool.\n\n");
fprintf(stderr, "Usage: %s [options] file.elf\n\n", progname);
fprintf(stderr, "Options:\n");
fprintf(stderr, " -m, --mount umd.cso mount iso on umd:\n");
fprintf(stderr, " -l, --log full log output, not just emulated printfs\n");
fprintf(stderr, " -f use the fast interpreter\n");
fprintf(stderr, " -j use jit (overrides -f)\n");
fprintf(stderr, " -c, --compare compare with output in file.expected\n");
fprintf(stderr, "\nSee headless.txt for details.\n");
}
int main(int argc, const char* argv[])
@ -83,11 +92,11 @@ int main(int argc, const char* argv[])
bool fastInterpreter = false;
bool autoCompare = false;
const char *bootFilename = argc > 1 ? argv[1] : 0;
const char *bootFilename = 0;
const char *mountIso = 0;
bool readMount = false;
for (int i = 2; i < argc; i++)
for (int i = 1; i < argc; i++)
{
if (readMount)
{
@ -95,21 +104,39 @@ int main(int argc, const char* argv[])
readMount = false;
continue;
}
if (!strcmp(argv[i], "-m"))
if (!strcmp(argv[i], "-m") || !strcmp(argv[i], "--mount"))
readMount = true;
else if (!strcmp(argv[i], "-l"))
else if (!strcmp(argv[i], "-l") || !strcmp(argv[i], "--log"))
fullLog = true;
else if (!strcmp(argv[i], "-j"))
useJit = true;
else if (!strcmp(argv[i], "-f"))
fastInterpreter = true;
else if (!strcmp(argv[i], "-c"))
else if (!strcmp(argv[i], "-c") || !strcmp(argv[i], "--compare"))
autoCompare = true;
else if (bootFilename == 0)
bootFilename = argv[i];
else
{
if (!strcmp(argv[i], "--help") || !strcmp(argv[i], "-h"))
printUsage(argv[0], NULL);
else
{
std::string reason = "Unexpected argument " + std::string(argv[i]);
printUsage(argv[0], reason.c_str());
}
return 1;
}
}
if (readMount)
{
printUsage(argv[0], "Missing argument after -m");
return 1;
}
if (!bootFilename)
{
printUsage();
printUsage(argv[0], argc <= 1 ? NULL : "No executable specified");
return 1;
}
@ -158,6 +185,10 @@ int main(int argc, const char* argv[])
u64 nowTicks = CoreTiming::GetTicks();
u64 frameTicks = usToCycles(1000000/60);
mipsr4k.RunLoopUntil(nowTicks + frameTicks);
// If we were rendering, this might be a nice time to do something about it.
if (coreState == CORE_NEXTFRAME)
coreState = CORE_RUNNING;
}
// NOTE: we won't get here until I've gotten rid of the exit(0) in sceExitProcess or whatever it's called

View file

@ -11,4 +11,4 @@ ppsspp-headless test.elf [-m testdata.cso] [-j] [-l]
-l : Print full log output, instead of just the "emulator printfs"
This is primarily intended to run non-graphical unit tests of the emulation engine, such as
those in http://code.google.com/p/pspautotests/ .
those in https://github.com/hrydgard/pspautotests/ .

2
native

@ -1 +1 @@
Subproject commit 275331061efb16786b8ba792e004275a64ced5ab
Subproject commit 62b5bc46d01fd0f79c7f54273d6a09c7ae17c17f

View file

@ -191,7 +191,7 @@ def run_tests(test_list, args):
tcprint("##teamcity[testStarted name='%s' captureStandardOutput='true']" % test)
cmdline = [PPSSPP_EXE, elf_filename]
cmdline.extend(args)
cmdline.extend([i for i in args if i not in ['-v', '-g']])
c = Command(cmdline)
c.run(TIMEOUT)