allow tests to optionally use multiple threads
modify threaded path ops tests to check
Background: this CL came out of a conversation with Eric where I learned that 10s of machines host 100s of bots. Since the bot hosting tests may be shared with many other tasks, it seems unwise for path ops to launch multiple test threads.
The change here is to make launching multiple threads "opt-in" and by default, bots can run path ops in a single thread.
Review URL: https://codereview.chromium.org/14002007
git-svn-id: http://skia.googlecode.com/svn/trunk@8750 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/tests/skia_test.cpp b/tests/skia_test.cpp
index 0851f8e..fd56cc7 100644
--- a/tests/skia_test.cpp
+++ b/tests/skia_test.cpp
@@ -62,10 +62,11 @@
class DebugfReporter : public Reporter {
public:
- DebugfReporter(bool allowExtendedTest)
+ DebugfReporter(bool allowExtendedTest, bool allowThreaded)
: fIndex(0)
, fTotal(0)
- , fAllowExtendedTest(allowExtendedTest) {
+ , fAllowExtendedTest(allowExtendedTest)
+ , fAllowThreaded(allowThreaded) {
}
void setIndexOfTotal(int index, int total) {
@@ -77,6 +78,10 @@
return fAllowExtendedTest;
}
+ virtual bool allowThreaded() const {
+ return fAllowThreaded;
+ }
+
protected:
virtual void onStart(Test* test) {
SkDebugf("[%d/%d] %s...\n", fIndex+1, fTotal, test->getName());
@@ -92,6 +97,7 @@
private:
int fIndex, fTotal;
bool fAllowExtendedTest;
+ bool fAllowThreaded;
};
static const char* make_canonical_dir_path(const char* path, SkString* storage) {
@@ -126,6 +132,7 @@
DEFINE_string2(tmpDir, t, NULL, "tmp directory for tests to use.");
DEFINE_string2(resourcePath, i, NULL, "directory for test resources.");
DEFINE_bool2(extendedTest, x, false, "run extended tests for pathOps.");
+DEFINE_bool2(threaded, z, false, "allow tests to use multiple threads.");
DEFINE_bool2(verbose, v, false, "enable verbose output.");
int tool_main(int argc, char** argv);
@@ -170,7 +177,7 @@
SkDebugf("%s\n", header.c_str());
}
- DebugfReporter reporter(FLAGS_extendedTest);
+ DebugfReporter reporter(FLAGS_extendedTest, FLAGS_threaded);
Iter iter(&reporter);
Test* test;