OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "CrashHandler.h" | 8 #include "CrashHandler.h" |
9 #include "DMJsonWriter.h" | 9 #include "DMJsonWriter.h" |
10 #include "DMSrcSink.h" | 10 #include "DMSrcSink.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 "Space-separated config/src/srcOptions/name quadruples to blacklist. '_
' matches anything. E.g. \n" | 39 "Space-separated config/src/srcOptions/name quadruples to blacklist. '_
' matches anything. E.g. \n" |
40 "'--blacklist gpu skp _ _' will blacklist all SKPs drawn into the gpu co
nfig.\n" | 40 "'--blacklist gpu skp _ _' will blacklist all SKPs drawn into the gpu co
nfig.\n" |
41 "'--blacklist gpu skp _ _ 8888 gm _ aarects' will also blacklist the aar
ects GM on 8888."); | 41 "'--blacklist gpu skp _ _ 8888 gm _ aarects' will also blacklist the aar
ects GM on 8888."); |
42 | 42 |
43 DEFINE_string2(readPath, r, "", "If set check for equality with golden results i
n this directory."); | 43 DEFINE_string2(readPath, r, "", "If set check for equality with golden results i
n this directory."); |
44 | 44 |
45 DEFINE_string(uninterestingHashesFile, "", | 45 DEFINE_string(uninterestingHashesFile, "", |
46 "File containing a list of uninteresting hashes. If a result hashes to s
omething in " | 46 "File containing a list of uninteresting hashes. If a result hashes to s
omething in " |
47 "this list, no image is written for that result."); | 47 "this list, no image is written for that result."); |
48 | 48 |
| 49 DEFINE_int32(shards, 1, "We're splitting source data into this many shards."); |
| 50 DEFINE_int32(shard, 0, "Which shard do I run?"); |
| 51 |
49 __SK_FORCE_IMAGE_DECODER_LINKING; | 52 __SK_FORCE_IMAGE_DECODER_LINKING; |
50 using namespace DM; | 53 using namespace DM; |
51 | 54 |
52 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~*/ | 55 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~*/ |
53 | 56 |
54 SK_DECLARE_STATIC_MUTEX(gFailuresMutex); | 57 SK_DECLARE_STATIC_MUTEX(gFailuresMutex); |
55 static SkTArray<SkString> gFailures; | 58 static SkTArray<SkString> gFailures; |
56 | 59 |
57 static void fail(ImplicitString err) { | 60 static void fail(ImplicitString err) { |
58 SkAutoMutexAcquire lock(gFailuresMutex); | 61 SkAutoMutexAcquire lock(gFailuresMutex); |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 struct Tagged : public SkAutoTDelete<T> { | 163 struct Tagged : public SkAutoTDelete<T> { |
161 const char* tag; | 164 const char* tag; |
162 const char* options; | 165 const char* options; |
163 }; | 166 }; |
164 | 167 |
165 static const bool kMemcpyOK = true; | 168 static const bool kMemcpyOK = true; |
166 | 169 |
167 static SkTArray<Tagged<Src>, kMemcpyOK> gSrcs; | 170 static SkTArray<Tagged<Src>, kMemcpyOK> gSrcs; |
168 static SkTArray<Tagged<Sink>, kMemcpyOK> gSinks; | 171 static SkTArray<Tagged<Sink>, kMemcpyOK> gSinks; |
169 | 172 |
| 173 static bool in_shard() { |
| 174 static int N = 0; |
| 175 return N++ % FLAGS_shards == FLAGS_shard; |
| 176 } |
| 177 |
170 static void push_src(const char* tag, const char* options, Src* s) { | 178 static void push_src(const char* tag, const char* options, Src* s) { |
171 SkAutoTDelete<Src> src(s); | 179 SkAutoTDelete<Src> src(s); |
172 if (FLAGS_src.contains(tag) && | 180 if (in_shard() && |
| 181 FLAGS_src.contains(tag) && |
173 !SkCommandLineFlags::ShouldSkip(FLAGS_match, src->name().c_str())) { | 182 !SkCommandLineFlags::ShouldSkip(FLAGS_match, src->name().c_str())) { |
174 Tagged<Src>& s = gSrcs.push_back(); | 183 Tagged<Src>& s = gSrcs.push_back(); |
175 s.reset(src.detach()); | 184 s.reset(src.detach()); |
176 s.tag = tag; | 185 s.tag = tag; |
177 s.options = options; | 186 s.options = options; |
178 } | 187 } |
179 } | 188 } |
180 | 189 |
181 static void push_codec_srcs(Path path) { | 190 static void push_codec_srcs(Path path) { |
182 SkAutoTUnref<SkData> encoded(SkData::NewFromFileName(path.c_str())); | 191 SkAutoTUnref<SkData> encoded(SkData::NewFromFileName(path.c_str())); |
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
596 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~*/ | 605 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~*/ |
597 | 606 |
598 // Unit tests don't fit so well into the Src/Sink model, so we give them special
treatment. | 607 // Unit tests don't fit so well into the Src/Sink model, so we give them special
treatment. |
599 | 608 |
600 static SkTDArray<skiatest::Test> gThreadedTests, gGPUTests; | 609 static SkTDArray<skiatest::Test> gThreadedTests, gGPUTests; |
601 | 610 |
602 static void gather_tests() { | 611 static void gather_tests() { |
603 if (!FLAGS_src.contains("tests")) { | 612 if (!FLAGS_src.contains("tests")) { |
604 return; | 613 return; |
605 } | 614 } |
606 for (const skiatest::TestRegistry* r = skiatest::TestRegistry::Head(); r; | 615 for (const skiatest::TestRegistry* r = skiatest::TestRegistry::Head(); r; r
= r->next()) { |
607 r = r->next()) { | 616 if (!in_shard()) { |
| 617 continue; |
| 618 } |
608 // Despite its name, factory() is returning a reference to | 619 // Despite its name, factory() is returning a reference to |
609 // link-time static const POD data. | 620 // link-time static const POD data. |
610 const skiatest::Test& test = r->factory(); | 621 const skiatest::Test& test = r->factory(); |
611 if (SkCommandLineFlags::ShouldSkip(FLAGS_match, test.name)) { | 622 if (SkCommandLineFlags::ShouldSkip(FLAGS_match, test.name)) { |
612 continue; | 623 continue; |
613 } | 624 } |
614 if (test.needsGpu && gpu_supported()) { | 625 if (test.needsGpu && gpu_supported()) { |
615 (FLAGS_gpu_threading ? gThreadedTests : gGPUTests).push(test); | 626 (FLAGS_gpu_threading ? gThreadedTests : gGPUTests).push(test); |
616 } else if (!test.needsGpu && FLAGS_cpu) { | 627 } else if (!test.needsGpu && FLAGS_cpu) { |
617 gThreadedTests.push(test); | 628 gThreadedTests.push(test); |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
744 } | 755 } |
745 return 0; | 756 return 0; |
746 } | 757 } |
747 | 758 |
748 #if !defined(SK_BUILD_FOR_IOS) | 759 #if !defined(SK_BUILD_FOR_IOS) |
749 int main(int argc, char** argv) { | 760 int main(int argc, char** argv) { |
750 SkCommandLineFlags::Parse(argc, argv); | 761 SkCommandLineFlags::Parse(argc, argv); |
751 return dm_main(); | 762 return dm_main(); |
752 } | 763 } |
753 #endif | 764 #endif |
OLD | NEW |