Add --resourcePath flag to the test program.
Review URL: https://codereview.chromium.org/12521016 git-svn-id: http://skia.googlecode.com/svn/trunk@8252 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
c4de776101
commit
cb62650ecf
@ -155,8 +155,8 @@ static void TestWStream(skiatest::Reporter* reporter) {
|
||||
}
|
||||
delete[] dst;
|
||||
|
||||
if (skiatest::Test::GetTmpDir()) {
|
||||
test_filestreams(reporter, skiatest::Test::GetTmpDir());
|
||||
if (!skiatest::Test::GetTmpDir().isEmpty()) {
|
||||
test_filestreams(reporter, skiatest::Test::GetTmpDir().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,9 @@ namespace skiatest {
|
||||
const char* getName();
|
||||
bool run(); // returns true on success
|
||||
|
||||
static const char* GetTmpDir();
|
||||
static const SkString& GetTmpDir();
|
||||
|
||||
static const SkString& GetResourcePath();
|
||||
|
||||
protected:
|
||||
virtual void onGetName(SkString*) = 0;
|
||||
|
@ -99,12 +99,18 @@ static const char* make_canonical_dir_path(const char* path, SkString* storage)
|
||||
return path;
|
||||
}
|
||||
|
||||
static const char* gTmpDir;
|
||||
static SkString gTmpDir;
|
||||
|
||||
const char* Test::GetTmpDir() {
|
||||
const SkString& Test::GetTmpDir() {
|
||||
return gTmpDir;
|
||||
}
|
||||
|
||||
static SkString gResourcePath;
|
||||
|
||||
const SkString& Test::GetResourcePath() {
|
||||
return gResourcePath;
|
||||
}
|
||||
|
||||
int tool_main(int argc, char** argv);
|
||||
int tool_main(int argc, char** argv) {
|
||||
#if SK_ENABLE_INST_COUNT
|
||||
@ -127,24 +133,30 @@ int tool_main(int argc, char** argv) {
|
||||
} else if (0 == strcmp(*argv, "--tmpDir")) {
|
||||
++argv;
|
||||
if (argv < stop && **argv) {
|
||||
gTmpDir = *argv;
|
||||
make_canonical_dir_path(*argv, &gTmpDir);
|
||||
} else {
|
||||
SkDebugf("no following argument to --tmpDir\n");
|
||||
return -1;
|
||||
}
|
||||
} else if ((0 == strcmp(*argv, "--resourcePath")) ||
|
||||
(0 == strcmp(*argv, "-i"))) {
|
||||
argv++;
|
||||
if (argv < stop && **argv) {
|
||||
make_canonical_dir_path(*argv, &gResourcePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SkString tmpDirStorage;
|
||||
gTmpDir = make_canonical_dir_path(gTmpDir, &tmpDirStorage);
|
||||
|
||||
{
|
||||
SkString header("Skia UnitTests:");
|
||||
if (matchStr) {
|
||||
header.appendf(" --match %s", matchStr);
|
||||
}
|
||||
if (gTmpDir) {
|
||||
header.appendf(" --tmpDir %s", gTmpDir);
|
||||
if (!gTmpDir.isEmpty()) {
|
||||
header.appendf(" --tmpDir %s", gTmpDir.c_str());
|
||||
}
|
||||
if (!gResourcePath.isEmpty()) {
|
||||
header.appendf(" --resourcePath %s", gResourcePath.c_str());
|
||||
}
|
||||
#ifdef SK_DEBUG
|
||||
header.append(" SK_DEBUG");
|
||||
|
Loading…
Reference in New Issue
Block a user