Chromium Code Reviews| Index: dm/DM.cpp |
| diff --git a/dm/DM.cpp b/dm/DM.cpp |
| index 5dd8a6f63e96a28387e78ebbd445006ec0dabce3..659ba037eea7e0ffb6a0ae9bce92c9badca19643 100644 |
| --- a/dm/DM.cpp |
| +++ b/dm/DM.cpp |
| @@ -71,6 +71,10 @@ DEFINE_string(uninterestingHashesFile, "", |
| DEFINE_int32(shards, 1, "We're splitting source data into this many shards."); |
| DEFINE_int32(shard, 0, "Which shard do I run?"); |
| +DEFINE_string2(serial, s, nullptr, |
|
mtklein
2016/08/16 23:54:06
Why don't we call this flag and the array and so o
msarett
2016/08/17 12:40:45
sgtm was struggling for a name.
|
| + "Run the specified tests in serial, before creating multiple threads.\n" |
| + "Test names must match exactly. Multiple tests may be separated by spaces."); |
| + |
| DEFINE_string(mskps, "", "Directory to read mskps from, or a single mskp file."); |
| DEFINE_string(svgs, "", "Directory to read SVGs from, or a single SVG file."); |
| @@ -1206,7 +1210,17 @@ struct Task { |
| // Unit tests don't fit so well into the Src/Sink model, so we give them special treatment. |
| -static SkTDArray<skiatest::Test> gParallelTests, gSerialTests; |
| +static SkTDArray<skiatest::Test> gParallelTests, gSerialTests, gSerialRunAloneTests; |
| + |
| +static bool name_in_string_array(const SkCommandLineFlags::StringArray& strings, const char* name) { |
| + for (int i = 0; i < strings.count(); i++) { |
| + const char* string = strings[i]; |
| + if (0 == strcmp(string, name)) { |
| + return true; |
| + } |
| + } |
| + return false; |
| +} |
| static void gather_tests() { |
| if (!FLAGS_src.contains("tests")) { |
| @@ -1222,6 +1236,10 @@ static void gather_tests() { |
| if (SkCommandLineFlags::ShouldSkip(FLAGS_match, test.name)) { |
| continue; |
| } |
| + if (name_in_string_array(FLAGS_serial, test.name)) { |
|
mtklein
2016/08/16 23:54:06
Probably better as
if (FLAGS_serial.contains(test
msarett
2016/08/17 12:40:45
Ahh yes, done.
|
| + gSerialRunAloneTests.push(test); |
| + continue; |
| + } |
| if (test.needsGpu && gpu_supported()) { |
| (FLAGS_gpu_threading ? gParallelTests : gSerialTests).push(test); |
| } else if (!test.needsGpu && FLAGS_cpu) { |
| @@ -1317,6 +1335,13 @@ int dm_main() { |
| return 1; |
| } |
| gather_tests(); |
| + |
| + // First, run memory intensive tests serially. |
| + if (gSerialRunAloneTests.count() > 0) { |
| + info("Running %d tests serially...\n", gSerialRunAloneTests.count()); |
| + for (auto test : gSerialRunAloneTests) { run_test(test); } |
| + } |
| + |
| gPending = gSrcs.count() * gSinks.count() + gParallelTests.count() + gSerialTests.count(); |
| info("%d srcs * %d sinks + %d tests == %d tasks", |
| gSrcs.count(), gSinks.count(), gParallelTests.count() + gSerialTests.count(), gPending); |