2014-02-26 16:31:22 +00:00
|
|
|
#include "DMTestTask.h"
|
|
|
|
#include "DMUtil.h"
|
|
|
|
#include "SkCommandLineFlags.h"
|
|
|
|
|
2014-04-30 14:56:29 +00:00
|
|
|
// When PathOps threaded tests get going, they're briefly a big consumer of lots of RAM.
|
|
|
|
// We disable the internal threading there by default on 32-bit builds.
|
|
|
|
static const bool is32Bit = sizeof(void*) == 4;
|
|
|
|
|
2014-02-26 16:31:22 +00:00
|
|
|
DEFINE_bool2(pathOpsExtended, x, false, "Run extended pathOps tests.");
|
2014-04-30 14:56:29 +00:00
|
|
|
DEFINE_bool2(pathOpsSingleThread, z, is32Bit, "Disallow pathOps tests from using threads.");
|
2014-02-26 16:31:22 +00:00
|
|
|
DEFINE_bool2(pathOpsVerbose, V, false, "Tell pathOps tests to be verbose.");
|
|
|
|
|
|
|
|
namespace DM {
|
|
|
|
|
2014-02-28 20:31:31 +00:00
|
|
|
bool TestReporter::allowExtendedTest() const { return FLAGS_pathOpsExtended; }
|
|
|
|
bool TestReporter::allowThreaded() const { return !FLAGS_pathOpsSingleThread; }
|
|
|
|
bool TestReporter::verbose() const { return FLAGS_pathOpsVerbose; }
|
|
|
|
|
2014-02-26 23:01:57 +00:00
|
|
|
static SkString test_name(const char* name) {
|
|
|
|
SkString result("test ");
|
|
|
|
result.append(name);
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2014-02-28 20:31:31 +00:00
|
|
|
CpuTestTask::CpuTestTask(Reporter* reporter,
|
|
|
|
TaskRunner* taskRunner,
|
|
|
|
skiatest::TestRegistry::Factory factory)
|
|
|
|
: CpuTask(reporter, taskRunner)
|
2014-02-26 16:31:22 +00:00
|
|
|
, fTest(factory(NULL))
|
2014-02-26 23:01:57 +00:00
|
|
|
, fName(test_name(fTest->getName())) {}
|
2014-02-26 16:31:22 +00:00
|
|
|
|
2014-02-28 20:31:31 +00:00
|
|
|
GpuTestTask::GpuTestTask(Reporter* reporter,
|
|
|
|
TaskRunner* taskRunner,
|
|
|
|
skiatest::TestRegistry::Factory factory)
|
|
|
|
: GpuTask(reporter, taskRunner)
|
|
|
|
, fTest(factory(NULL))
|
|
|
|
, fName(test_name(fTest->getName())) {}
|
|
|
|
|
|
|
|
|
|
|
|
void CpuTestTask::draw() {
|
2014-02-26 16:31:22 +00:00
|
|
|
fTest->setReporter(&fTestReporter);
|
|
|
|
fTest->run();
|
|
|
|
if (!fTest->passed()) {
|
|
|
|
this->fail(fTestReporter.failure());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-02-28 20:31:31 +00:00
|
|
|
void GpuTestTask::draw(GrContextFactory* grFactory) {
|
|
|
|
fTest->setGrContextFactory(grFactory);
|
|
|
|
fTest->setReporter(&fTestReporter);
|
|
|
|
fTest->run();
|
|
|
|
if (!fTest->passed()) {
|
|
|
|
this->fail(fTestReporter.failure());
|
|
|
|
}
|
|
|
|
}
|
2014-02-26 16:31:22 +00:00
|
|
|
|
2014-03-26 21:26:15 +00:00
|
|
|
bool GpuTestTask::shouldSkip() const {
|
|
|
|
return kGPUDisabled;
|
|
|
|
}
|
|
|
|
|
2014-02-26 16:31:22 +00:00
|
|
|
} // namespace DM
|