Reland "Add --skip_cpu and --skip_gpu options to tests"
NOTRY=true BUG=skia:2074 R=djsollen@google.com, mtklein@google.com Author: borenet@google.com Review URL: https://codereview.chromium.org/135163004 git-svn-id: http://skia.googlecode.com/svn/trunk@13237 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
9f94b9104a
commit
5a47b09fe8
@ -64,7 +64,7 @@ namespace skiatest {
|
||||
|
||||
static SkString GetResourcePath();
|
||||
|
||||
virtual bool isThreadsafe() const { return true; }
|
||||
virtual bool isGPUTest() const { return false; }
|
||||
|
||||
protected:
|
||||
virtual void onGetName(SkString*) = 0;
|
||||
@ -82,7 +82,7 @@ namespace skiatest {
|
||||
GpuTest() : Test() {}
|
||||
static GrContextFactory* GetGrContextFactory();
|
||||
static void DestroyContexts();
|
||||
virtual bool isThreadsafe() const { return false; }
|
||||
virtual bool isGPUTest() const { return true; }
|
||||
private:
|
||||
};
|
||||
|
||||
|
@ -36,6 +36,8 @@ DEFINE_bool2(leaks, l, false, "show leaked ref cnt'd objects.");
|
||||
DEFINE_bool2(single, z, false, "run tests on a single thread internally.");
|
||||
DEFINE_bool2(verbose, v, false, "enable verbose output from the test driver.");
|
||||
DEFINE_bool2(veryVerbose, V, false, "tell individual tests to be verbose.");
|
||||
DEFINE_bool(cpu, true, "whether or not to run CPU tests.");
|
||||
DEFINE_bool(gpu, true, "whether or not to run GPU tests.");
|
||||
DEFINE_int32(threads, SkThreadPool::kThreadPerCore,
|
||||
"Run threadsafe tests on a threadpool with this many threads.");
|
||||
|
||||
@ -125,6 +127,19 @@ private:
|
||||
int32_t* fFailCount;
|
||||
};
|
||||
|
||||
static bool should_run(const char* testName, bool isGPUTest) {
|
||||
if (SkCommandLineFlags::ShouldSkip(FLAGS_match, testName)) {
|
||||
return false;
|
||||
}
|
||||
if (!FLAGS_cpu && !isGPUTest) {
|
||||
return false;
|
||||
}
|
||||
if (!FLAGS_gpu && isGPUTest) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
int tool_main(int argc, char** argv);
|
||||
int tool_main(int argc, char** argv) {
|
||||
SkCommandLineFlags::SetUsage("");
|
||||
@ -172,8 +187,7 @@ int tool_main(int argc, char** argv) {
|
||||
Iter iter;
|
||||
while ((test = iter.next(NULL/*reporter not needed*/)) != NULL) {
|
||||
SkAutoTDelete<Test> owned(test);
|
||||
|
||||
if(!SkCommandLineFlags::ShouldSkip(FLAGS_match, test->getName())) {
|
||||
if (should_run(test->getName(), test->isGPUTest())) {
|
||||
toRun++;
|
||||
}
|
||||
total++;
|
||||
@ -190,9 +204,9 @@ int tool_main(int argc, char** argv) {
|
||||
DebugfReporter reporter(toRun);
|
||||
for (int i = 0; i < total; i++) {
|
||||
SkAutoTDelete<Test> test(iter.next(&reporter));
|
||||
if (SkCommandLineFlags::ShouldSkip(FLAGS_match, test->getName())) {
|
||||
if (!should_run(test->getName(), test->isGPUTest())) {
|
||||
++skipCount;
|
||||
} else if (!test->isThreadsafe()) {
|
||||
} else if (test->isGPUTest()) {
|
||||
unsafeTests.push_back() = test.detach();
|
||||
} else {
|
||||
threadpool.add(SkNEW_ARGS(SkTestRunnable, (test.detach(), &failCount)));
|
||||
|
Loading…
Reference in New Issue
Block a user