static SkString GetResourcePath();
- virtual bool isGPUTest() const { return false; }
+ virtual bool isThreadsafe() const { return true; }
protected:
virtual void onGetName(SkString*) = 0;
GpuTest() : Test() {}
static GrContextFactory* GetGrContextFactory();
static void DestroyContexts();
- virtual bool isGPUTest() const { return true; }
+ virtual bool isThreadsafe() const { return false; }
private:
};
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.");
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("");
Iter iter;
while ((test = iter.next(NULL/*reporter not needed*/)) != NULL) {
SkAutoTDelete<Test> owned(test);
- if (should_run(test->getName(), test->isGPUTest())) {
+
+ if(!SkCommandLineFlags::ShouldSkip(FLAGS_match, test->getName())) {
toRun++;
}
total++;
DebugfReporter reporter(toRun);
for (int i = 0; i < total; i++) {
SkAutoTDelete<Test> test(iter.next(&reporter));
- if (!should_run(test->getName(), test->isGPUTest())) {
+ if (SkCommandLineFlags::ShouldSkip(FLAGS_match, test->getName())) {
++skipCount;
- } else if (!test->isGPUTest()) {
+ } else if (!test->isThreadsafe()) {
unsafeTests.push_back() = test.detach();
} else {
threadpool.add(SkNEW_ARGS(SkTestRunnable, (test.detach(), &failCount)));