Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Side by Side Diff: dm/DM.cpp

Issue 1059363002: Add --uninterestingHashesFile to DM (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Better script Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | tools/get_uploaded_hashes.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "DMSrcSinkAndroid.h" 11 #include "DMSrcSinkAndroid.h"
12 #include "OverwriteLine.h" 12 #include "OverwriteLine.h"
13 #include "ProcStats.h" 13 #include "ProcStats.h"
14 #include "SkBBHFactory.h" 14 #include "SkBBHFactory.h"
15 #include "SkChecksum.h" 15 #include "SkChecksum.h"
16 #include "SkCommonFlags.h" 16 #include "SkCommonFlags.h"
17 #include "SkForceLinking.h" 17 #include "SkForceLinking.h"
18 #include "SkGraphics.h" 18 #include "SkGraphics.h"
19 #include "SkInstCnt.h" 19 #include "SkInstCnt.h"
20 #include "SkJSONCPP.h"
mtklein 2015/04/03 20:35:47 Die?
borenet 2015/04/03 20:40:15 Done.
20 #include "SkMD5.h" 21 #include "SkMD5.h"
21 #include "SkOSFile.h" 22 #include "SkOSFile.h"
23 #include "SkTDict.h"
mtklein 2015/04/03 20:35:47 Die?
borenet 2015/04/03 20:40:15 Done.
22 #include "SkTHash.h" 24 #include "SkTHash.h"
23 #include "SkTaskGroup.h" 25 #include "SkTaskGroup.h"
24 #include "SkThreadUtils.h" 26 #include "SkThreadUtils.h"
25 #include "Test.h" 27 #include "Test.h"
26 #include "Timer.h" 28 #include "Timer.h"
27 29
28 DEFINE_string(src, "tests gm skp image", "Source types to test."); 30 DEFINE_string(src, "tests gm skp image", "Source types to test.");
29 DEFINE_bool(nameByHash, false, 31 DEFINE_bool(nameByHash, false,
30 "If true, write to FLAGS_writePath[0]/<hash>.png instead of " 32 "If true, write to FLAGS_writePath[0]/<hash>.png instead of "
31 "to FLAGS_writePath[0]/<config>/<sourceType>/<sourceOptions>/<name>. png"); 33 "to FLAGS_writePath[0]/<config>/<sourceType>/<sourceOptions>/<name>. png");
32 DEFINE_bool2(pathOpsExtended, x, false, "Run extended pathOps tests."); 34 DEFINE_bool2(pathOpsExtended, x, false, "Run extended pathOps tests.");
33 DEFINE_string(matrix, "1 0 0 1", 35 DEFINE_string(matrix, "1 0 0 1",
34 "2x2 scale+skew matrix to apply or upright when using " 36 "2x2 scale+skew matrix to apply or upright when using "
35 "'matrix' or 'upright' in config."); 37 "'matrix' or 'upright' in config.");
36 DEFINE_bool(gpu_threading, false, "Allow GPU work to run on multiple threads?"); 38 DEFINE_bool(gpu_threading, false, "Allow GPU work to run on multiple threads?");
37 39
38 DEFINE_string(blacklist, "", 40 DEFINE_string(blacklist, "",
39 "Space-separated config/src/srcOptions/name quadruples to blacklist. '_ ' matches anything. E.g. \n" 41 "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" 42 "'--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."); 43 "'--blacklist gpu skp _ _ 8888 gm _ aarects' will also blacklist the aar ects GM on 8888.");
42 44
43 DEFINE_string2(readPath, r, "", "If set check for equality with golden results i n this directory."); 45 DEFINE_string2(readPath, r, "", "If set check for equality with golden results i n this directory.");
44 46
47 DEFINE_string(uninterestingHashesFile, "",
48 "JSON file containing a list of uninteresting hashes. If a result hashes to something in "
mtklein 2015/04/03 20:35:47 Update?
borenet 2015/04/03 20:40:15 Done.
49 "this list, no image is written for that result.");
50
45 __SK_FORCE_IMAGE_DECODER_LINKING; 51 __SK_FORCE_IMAGE_DECODER_LINKING;
46 using namespace DM; 52 using namespace DM;
47 53
48 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~*/ 54 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~*/
49 55
50 SK_DECLARE_STATIC_MUTEX(gFailuresMutex); 56 SK_DECLARE_STATIC_MUTEX(gFailuresMutex);
51 static SkTArray<SkString> gFailures; 57 static SkTArray<SkString> gFailures;
52 58
53 static void fail(ImplicitString err) { 59 static void fail(ImplicitString err) {
54 SkAutoMutexAcquire lock(gFailuresMutex); 60 SkAutoMutexAcquire lock(gFailuresMutex);
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 SkString path(FLAGS_readPath[0]); 136 SkString path(FLAGS_readPath[0]);
131 path.append("/dm.json"); 137 path.append("/dm.json");
132 if (!JsonWriter::ReadJson(path.c_str(), add_gold)) { 138 if (!JsonWriter::ReadJson(path.c_str(), add_gold)) {
133 fail(SkStringPrintf("Couldn't read %s for golden results.", path.c_s tr())); 139 fail(SkStringPrintf("Couldn't read %s for golden results.", path.c_s tr()));
134 } 140 }
135 } 141 }
136 } 142 }
137 143
138 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~*/ 144 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~*/
139 145
146 static SkTHashSet<SkString> gUninterestingHashes;
147
148 static void gather_uninteresting_hashes() {
149 if (!FLAGS_uninterestingHashesFile.isEmpty()) {
150 SkString path(FLAGS_uninterestingHashesFile[0]);
151 SkData* data = SkData::NewFromFileName(path.c_str());
borenet 2015/04/03 20:26:50 Am I leaking this?
mtklein 2015/04/03 20:35:47 Yep. SkAutoTUnref<SkData> data(SkData::NewFromFil
borenet 2015/04/03 20:40:15 Done.
152 SkTArray<SkString> hashes;
153 SkStrSplit((const char*)data->data(), "\n", &hashes);
154 for (const SkString& hash : hashes) {
155 gUninterestingHashes.add(hash);
156 }
157 }
158 }
159
160 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~*/
161
140 template <typename T> 162 template <typename T>
141 struct Tagged : public SkAutoTDelete<T> { 163 struct Tagged : public SkAutoTDelete<T> {
142 const char* tag; 164 const char* tag;
143 const char* options; 165 const char* options;
144 }; 166 };
145 167
146 static const bool kMemcpyOK = true; 168 static const bool kMemcpyOK = true;
147 169
148 static SkTArray<Tagged<Src>, kMemcpyOK> gSrcs; 170 static SkTArray<Tagged<Src>, kMemcpyOK> gSrcs;
149 static SkTArray<Tagged<Sink>, kMemcpyOK> gSinks; 171 static SkTArray<Tagged<Sink>, kMemcpyOK> gSinks;
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 task->src.options, name, md5))) { 450 task->src.options, name, md5))) {
429 fail(SkStringPrintf("%s not found for %s %s %s %s in %s", 451 fail(SkStringPrintf("%s not found for %s %s %s %s in %s",
430 md5.c_str(), 452 md5.c_str(),
431 task->sink.tag, 453 task->sink.tag,
432 task->src.tag, 454 task->src.tag,
433 task->src.options, 455 task->src.options,
434 name.c_str(), 456 name.c_str(),
435 FLAGS_readPath[0])); 457 FLAGS_readPath[0]));
436 } 458 }
437 459
438 if (!FLAGS_writePath.isEmpty()) { 460 if (!FLAGS_writePath.isEmpty() && !gUninterestingHashes.contains(md5 )) {
439 const char* ext = task->sink->fileExtension(); 461 const char* ext = task->sink->fileExtension();
440 if (data->getLength()) { 462 if (data->getLength()) {
441 WriteToDisk(*task, md5, ext, data, data->getLength(), NULL); 463 WriteToDisk(*task, md5, ext, data, data->getLength(), NULL);
442 SkASSERT(bitmap.drawsNothing()); 464 SkASSERT(bitmap.drawsNothing());
443 } else if (!bitmap.drawsNothing()) { 465 } else if (!bitmap.drawsNothing()) {
444 WriteToDisk(*task, md5, ext, NULL, 0, &bitmap); 466 WriteToDisk(*task, md5, ext, NULL, 0, &bitmap);
445 } 467 }
446 } 468 }
447 } 469 }
448 timer.end(); 470 timer.end();
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 SetupCrashHandler(); 640 SetupCrashHandler();
619 SkAutoGraphics ag; 641 SkAutoGraphics ag;
620 SkTaskGroup::Enabler enabled(FLAGS_threads); 642 SkTaskGroup::Enabler enabled(FLAGS_threads);
621 if (FLAGS_leaks) { 643 if (FLAGS_leaks) {
622 SkInstCountPrintLeaksOnExit(); 644 SkInstCountPrintLeaksOnExit();
623 } 645 }
624 646
625 start_keepalive(); 647 start_keepalive();
626 648
627 gather_gold(); 649 gather_gold();
650 gather_uninteresting_hashes();
628 651
629 gather_srcs(); 652 gather_srcs();
630 gather_sinks(); 653 gather_sinks();
631 gather_tests(); 654 gather_tests();
632 655
633 gPending = gSrcs.count() * gSinks.count() + gThreadedTests.count() + gGPUTes ts.count(); 656 gPending = gSrcs.count() * gSinks.count() + gThreadedTests.count() + gGPUTes ts.count();
634 SkDebugf("%d srcs * %d sinks + %d tests == %d tasks\n", 657 SkDebugf("%d srcs * %d sinks + %d tests == %d tasks\n",
635 gSrcs.count(), gSinks.count(), gThreadedTests.count() + gGPUTests.c ount(), gPending); 658 gSrcs.count(), gSinks.count(), gThreadedTests.count() + gGPUTests.c ount(), gPending);
636 659
637 // We try to exploit as much parallelism as is safe. Most Src/Sink pairs ru n on any thread, 660 // We try to exploit as much parallelism as is safe. Most Src/Sink pairs ru n on any thread,
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 } 701 }
679 return 0; 702 return 0;
680 } 703 }
681 704
682 #if !defined(SK_BUILD_FOR_IOS) 705 #if !defined(SK_BUILD_FOR_IOS)
683 int main(int argc, char** argv) { 706 int main(int argc, char** argv) {
684 SkCommandLineFlags::Parse(argc, argv); 707 SkCommandLineFlags::Parse(argc, argv);
685 return dm_main(); 708 return dm_main();
686 } 709 }
687 #endif 710 #endif
OLDNEW
« no previous file with comments | « no previous file | tools/get_uploaded_hashes.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698