From 5683acd9092e95479da28269b8a26f7914b21050 Mon Sep 17 00:00:00 2001 From: "commit-bot@chromium.org" Date: Tue, 28 Jan 2014 20:02:45 +0000 Subject: Add --skip_cpu and --skip_gpu options to tests BUG=skia:2074 R=djsollen@google.com, mtklein@google.com Author: borenet@google.com Review URL: https://codereview.chromium.org/144343004 git-svn-id: http://skia.googlecode.com/svn/trunk@13223 2bbb7eff-a529-9590-31e7-b0007b416f81 --- tests/skia_test.cpp | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'tests/skia_test.cpp') diff --git a/tests/skia_test.cpp b/tests/skia_test.cpp index fd7f3a356b..76bb3cc499 100644 --- a/tests/skia_test.cpp +++ b/tests/skia_test.cpp @@ -35,6 +35,8 @@ DEFINE_bool2(extendedTest, x, false, "run extended tests for pathOps."); 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."); +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."); @@ -124,6 +126,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(""); @@ -171,8 +186,7 @@ int tool_main(int argc, char** argv) { Iter iter; while ((test = iter.next(NULL/*reporter not needed*/)) != NULL) { SkAutoTDelete owned(test); - - if(!SkCommandLineFlags::ShouldSkip(FLAGS_match, test->getName())) { + if (should_run(test->getName(), test->isGPUTest())) { toRun++; } total++; @@ -189,9 +203,9 @@ int tool_main(int argc, char** argv) { DebugfReporter reporter(toRun); for (int i = 0; i < total; i++) { SkAutoTDelete 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))); -- cgit v1.2.3