Chromium Code Reviews| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 57 "'--blacklist gpu skp _ _ 8888 gm _ aarects' will also blacklist the aar ects GM on 8888."); | 57 "'--blacklist gpu skp _ _ 8888 gm _ aarects' will also blacklist the aar ects GM on 8888."); |
| 58 | 58 |
| 59 DEFINE_string2(readPath, r, "", "If set check for equality with golden results i n this directory."); | 59 DEFINE_string2(readPath, r, "", "If set check for equality with golden results i n this directory."); |
| 60 | 60 |
| 61 DEFINE_string(uninterestingHashesFile, "", | 61 DEFINE_string(uninterestingHashesFile, "", |
| 62 "File containing a list of uninteresting hashes. If a result hashes to s omething in " | 62 "File containing a list of uninteresting hashes. If a result hashes to s omething in " |
| 63 "this list, no image is written for that result."); | 63 "this list, no image is written for that result."); |
| 64 | 64 |
| 65 DEFINE_int32(shards, 1, "We're splitting source data into this many shards."); | 65 DEFINE_int32(shards, 1, "We're splitting source data into this many shards."); |
| 66 DEFINE_int32(shard, 0, "Which shard do I run?"); | 66 DEFINE_int32(shard, 0, "Which shard do I run?"); |
| 67 DEFINE_bool2(pre_log, p, false, "Log before running each test. May be incomprehe nsible when threading"); | |
| 68 | 67 |
| 69 __SK_FORCE_IMAGE_DECODER_LINKING; | 68 __SK_FORCE_IMAGE_DECODER_LINKING; |
| 70 using namespace DM; | 69 using namespace DM; |
| 71 | 70 |
| 72 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~*/ | 71 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~*/ |
| 73 | 72 |
| 74 static double now_ms() { return SkTime::GetNSecs() * 1e-6; } | 73 static double now_ms() { return SkTime::GetNSecs() * 1e-6; } |
| 75 | 74 |
| 76 SK_DECLARE_STATIC_MUTEX(gFailuresMutex); | 75 SK_DECLARE_STATIC_MUTEX(gFailuresMutex); |
| 77 static SkTArray<SkString> gFailures; | 76 static SkTArray<SkString> gFailures; |
| (...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 840 if (!whyBlacklisted.isEmpty()) { | 839 if (!whyBlacklisted.isEmpty()) { |
| 841 note.appendf(" (--blacklist %s)", whyBlacklisted.c_str()); | 840 note.appendf(" (--blacklist %s)", whyBlacklisted.c_str()); |
| 842 } | 841 } |
| 843 | 842 |
| 844 SkString log; | 843 SkString log; |
| 845 auto timerStart = now_ms(); | 844 auto timerStart = now_ms(); |
| 846 if (!FLAGS_dryRun && note.isEmpty()) { | 845 if (!FLAGS_dryRun && note.isEmpty()) { |
| 847 SkBitmap bitmap; | 846 SkBitmap bitmap; |
| 848 SkDynamicMemoryWStream stream; | 847 SkDynamicMemoryWStream stream; |
| 849 if (FLAGS_pre_log) { | 848 if (FLAGS_pre_log) { |
| 850 SkDebugf("\nRunning %s->%s", name.c_str(), task->sink.tag.c_str( )); | 849 SkDebugf("%sRunning %s->%s", |
| 850 FLAGS_verbose ? "\n" : "\t", | |
| 851 name.c_str(), | |
| 852 task->sink.tag.c_str()); | |
| 851 } | 853 } |
| 852 start(task->sink.tag.c_str(), task->src.tag, task->src.options, name .c_str()); | 854 start(task->sink.tag.c_str(), task->src.tag, task->src.options, name .c_str()); |
| 853 Error err = task->sink->draw(*task->src, &bitmap, &stream, &log); | 855 Error err = task->sink->draw(*task->src, &bitmap, &stream, &log); |
| 854 if (!err.isEmpty()) { | 856 if (!err.isEmpty()) { |
| 855 if (err.isFatal()) { | 857 if (err.isFatal()) { |
| 856 fail(SkStringPrintf("%s %s %s %s: %s", | 858 fail(SkStringPrintf("%s %s %s %s: %s", |
| 857 task->sink.tag.c_str(), | 859 task->sink.tag.c_str(), |
| 858 task->src.tag.c_str(), | 860 task->src.tag.c_str(), |
| 859 task->src.options.c_str(), | 861 task->src.options.c_str(), |
| 860 name.c_str(), | 862 name.c_str(), |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1049 SkString whyBlacklisted = is_blacklisted("_", "tests", "_", test->name); | 1051 SkString whyBlacklisted = is_blacklisted("_", "tests", "_", test->name); |
| 1050 if (!whyBlacklisted.isEmpty()) { | 1052 if (!whyBlacklisted.isEmpty()) { |
| 1051 note.appendf(" (--blacklist %s)", whyBlacklisted.c_str()); | 1053 note.appendf(" (--blacklist %s)", whyBlacklisted.c_str()); |
| 1052 } | 1054 } |
| 1053 | 1055 |
| 1054 auto timerStart = now_ms(); | 1056 auto timerStart = now_ms(); |
| 1055 if (!FLAGS_dryRun && whyBlacklisted.isEmpty()) { | 1057 if (!FLAGS_dryRun && whyBlacklisted.isEmpty()) { |
| 1056 start("unit", "test", "", test->name); | 1058 start("unit", "test", "", test->name); |
| 1057 GrContextFactory factory; | 1059 GrContextFactory factory; |
| 1058 if (FLAGS_pre_log) { | 1060 if (FLAGS_pre_log) { |
| 1059 SkDebugf("\nRunning test %s", test->name); | 1061 SkDebugf("%sRunning test %s", |
| 1062 FLAGS_verbose ? "\n" : "\t", | |
| 1063 test->name); | |
| 1060 } | 1064 } |
| 1061 test->proc(&reporter, &factory); | 1065 test->proc(&reporter, &factory); |
| 1062 } | 1066 } |
| 1063 done(now_ms()-timerStart, "unit", "test", "", test->name, note, ""); | 1067 done(now_ms()-timerStart, "unit", "test", "", test->name, note, ""); |
| 1064 } | 1068 } |
| 1065 | 1069 |
| 1066 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~*/ | 1070 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~*/ |
| 1067 | 1071 |
| 1068 // If we're isolating all GPU-bound work to one thread (the default), this funct ion runs all that. | 1072 // If we're isolating all GPU-bound work to one thread (the default), this funct ion runs all that. |
| 1069 static void run_enclave_and_gpu_tests(SkTArray<Task>* tasks) { | 1073 static void run_enclave_and_gpu_tests(SkTArray<Task>* tasks) { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1115 extern SkTypeface* (*gCreateTypefaceDelegate)(const char [], SkTypeface::Style ) ; | 1119 extern SkTypeface* (*gCreateTypefaceDelegate)(const char [], SkTypeface::Style ) ; |
| 1116 | 1120 |
| 1117 int dm_main(); | 1121 int dm_main(); |
| 1118 int dm_main() { | 1122 int dm_main() { |
| 1119 SetupCrashHandler(); | 1123 SetupCrashHandler(); |
| 1120 JsonWriter::DumpJson(); // It's handy for the bots to assume this is ~never missing. | 1124 JsonWriter::DumpJson(); // It's handy for the bots to assume this is ~never missing. |
| 1121 SkAutoGraphics ag; | 1125 SkAutoGraphics ag; |
| 1122 SkTaskGroup::Enabler enabled(FLAGS_threads); | 1126 SkTaskGroup::Enabler enabled(FLAGS_threads); |
| 1123 gCreateTypefaceDelegate = &create_from_name; | 1127 gCreateTypefaceDelegate = &create_from_name; |
| 1124 | 1128 |
| 1129 if (FLAGS_verbose) { | |
| 1130 FLAGS_pre_log = true; | |
|
mtklein
2016/01/25 19:44:35
? Let's let people set independent things indepen
dogben
2016/01/25 20:18:00
Done.
| |
| 1131 } | |
| 1132 | |
| 1125 start_keepalive(); | 1133 start_keepalive(); |
| 1126 | 1134 |
| 1127 gather_gold(); | 1135 gather_gold(); |
| 1128 gather_uninteresting_hashes(); | 1136 gather_uninteresting_hashes(); |
| 1129 | 1137 |
| 1130 gather_srcs(); | 1138 gather_srcs(); |
| 1131 gather_sinks(); | 1139 gather_sinks(); |
| 1132 gather_tests(); | 1140 gather_tests(); |
| 1133 | 1141 |
| 1134 gPending = gSrcs.count() * gSinks.count() + gThreadedTests.count() + gGPUTes ts.count(); | 1142 gPending = gSrcs.count() * gSinks.count() + gThreadedTests.count() + gGPUTes ts.count(); |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1282 Reporter* reporter, | 1290 Reporter* reporter, |
| 1283 GrContextFactory* fac tory); | 1291 GrContextFactory* fac tory); |
| 1284 } // namespace skiatest | 1292 } // namespace skiatest |
| 1285 | 1293 |
| 1286 #if !defined(SK_BUILD_FOR_IOS) | 1294 #if !defined(SK_BUILD_FOR_IOS) |
| 1287 int main(int argc, char** argv) { | 1295 int main(int argc, char** argv) { |
| 1288 SkCommandLineFlags::Parse(argc, argv); | 1296 SkCommandLineFlags::Parse(argc, argv); |
| 1289 return dm_main(); | 1297 return dm_main(); |
| 1290 } | 1298 } |
| 1291 #endif | 1299 #endif |
| OLD | NEW |