jcgregorio | 3b27ade | 2014-11-13 08:06:40 -0800 | [diff] [blame] | 1 | #include "CrashHandler.h" |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 2 | #include "DMJsonWriter.h" |
| 3 | #include "DMSrcSink.h" |
tomhudson | eebc39a | 2015-02-23 12:18:05 -0800 | [diff] [blame] | 4 | #include "DMSrcSinkAndroid.h" |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 5 | #include "OverwriteLine.h" |
| 6 | #include "ProcStats.h" |
| 7 | #include "SkBBHFactory.h" |
mtklein | 62bd1a6 | 2015-01-27 14:46:26 -0800 | [diff] [blame] | 8 | #include "SkChecksum.h" |
caryclark | 17f0b6d | 2014-07-22 10:15:34 -0700 | [diff] [blame] | 9 | #include "SkCommonFlags.h" |
mtklein@google.com | d36522d | 2013-10-16 13:02:15 +0000 | [diff] [blame] | 10 | #include "SkForceLinking.h" |
| 11 | #include "SkGraphics.h" |
mtklein | e67164d | 2015-02-02 13:24:37 -0800 | [diff] [blame] | 12 | #include "SkInstCnt.h" |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 13 | #include "SkMD5.h" |
mtklein | 1d0f164 | 2014-09-08 08:05:18 -0700 | [diff] [blame] | 14 | #include "SkOSFile.h" |
mtklein | a82f562 | 2015-02-20 12:30:19 -0800 | [diff] [blame] | 15 | #include "SkTHash.h" |
mtklein | 406654b | 2014-09-03 15:34:37 -0700 | [diff] [blame] | 16 | #include "SkTaskGroup.h" |
mtklein | de6fc2b | 2015-03-12 06:28:54 -0700 | [diff] [blame^] | 17 | #include "SkThreadUtils.h" |
commit-bot@chromium.org | 0dc5bd1 | 2014-02-26 16:31:22 +0000 | [diff] [blame] | 18 | #include "Test.h" |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 19 | #include "Timer.h" |
mtklein@google.com | d36522d | 2013-10-16 13:02:15 +0000 | [diff] [blame] | 20 | |
mtklein | edc93bc | 2015-01-30 13:22:23 -0800 | [diff] [blame] | 21 | DEFINE_string(src, "tests gm skp image subset", "Source types to test."); |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 22 | DEFINE_bool(nameByHash, false, |
| 23 | "If true, write to FLAGS_writePath[0]/<hash>.png instead of " |
| 24 | "to FLAGS_writePath[0]/<config>/<sourceType>/<name>.png"); |
| 25 | DEFINE_bool2(pathOpsExtended, x, false, "Run extended pathOps tests."); |
mtklein | d603b22 | 2015-02-17 11:13:33 -0800 | [diff] [blame] | 26 | DEFINE_string(matrix, "1 0 0 1", |
| 27 | "2x2 scale+skew matrix to apply or upright when using " |
| 28 | "'matrix' or 'upright' in config."); |
mtklein | 82d2843 | 2015-01-15 12:46:02 -0800 | [diff] [blame] | 29 | DEFINE_bool(gpu_threading, false, "Allow GPU work to run on multiple threads?"); |
mtklein@google.com | d36522d | 2013-10-16 13:02:15 +0000 | [diff] [blame] | 30 | |
mtklein | a2ef642 | 2015-01-15 13:44:22 -0800 | [diff] [blame] | 31 | DEFINE_string(blacklist, "", |
| 32 | "Space-separated config/src/name triples to blacklist. '_' matches anything. E.g. \n" |
| 33 | "'--blacklist gpu skp _' will blacklist all SKPs drawn into the gpu config.\n" |
| 34 | "'--blacklist gpu skp _ 8888 gm aarects' will also blacklist the aarects GM on 8888."); |
| 35 | |
mtklein | 62bd1a6 | 2015-01-27 14:46:26 -0800 | [diff] [blame] | 36 | DEFINE_string2(readPath, r, "", "If set check for equality with golden results in this directory."); |
| 37 | |
mtklein@google.com | d36522d | 2013-10-16 13:02:15 +0000 | [diff] [blame] | 38 | __SK_FORCE_IMAGE_DECODER_LINKING; |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 39 | using namespace DM; |
mtklein@google.com | d36522d | 2013-10-16 13:02:15 +0000 | [diff] [blame] | 40 | |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 41 | /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ |
| 42 | |
| 43 | SK_DECLARE_STATIC_MUTEX(gFailuresMutex); |
| 44 | static SkTArray<SkString> gFailures; |
| 45 | |
| 46 | static void fail(ImplicitString err) { |
| 47 | SkAutoMutexAcquire lock(gFailuresMutex); |
| 48 | SkDebugf("\n\nFAILURE: %s\n\n", err.c_str()); |
| 49 | gFailures.push_back(err); |
halcanary | 9e398f7 | 2015-01-10 11:18:04 -0800 | [diff] [blame] | 50 | } |
| 51 | |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 52 | static int32_t gPending = 0; // Atomic. |
| 53 | |
mtklein | b9eb4ac | 2015-02-02 18:26:03 -0800 | [diff] [blame] | 54 | static void done(double ms, |
| 55 | ImplicitString config, ImplicitString src, ImplicitString name, |
| 56 | ImplicitString log) { |
| 57 | if (!log.isEmpty()) { |
| 58 | log.prepend("\n"); |
| 59 | } |
mtklein | 6dee2ad | 2015-02-05 09:53:44 -0800 | [diff] [blame] | 60 | auto pending = sk_atomic_dec(&gPending)-1; |
mtklein | b9eb4ac | 2015-02-02 18:26:03 -0800 | [diff] [blame] | 61 | SkDebugf("%s(%4dMB %5d) %s\t%s %s %s%s", FLAGS_verbose ? "\n" : kSkOverwriteLine |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 62 | , sk_tools::getMaxResidentSetSizeMB() |
mtklein | a17241b | 2015-01-23 05:48:00 -0800 | [diff] [blame] | 63 | , pending |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 64 | , HumanizeMs(ms).c_str() |
| 65 | , config.c_str() |
| 66 | , src.c_str() |
mtklein | b9eb4ac | 2015-02-02 18:26:03 -0800 | [diff] [blame] | 67 | , name.c_str() |
| 68 | , log.c_str()); |
mtklein | a17241b | 2015-01-23 05:48:00 -0800 | [diff] [blame] | 69 | // We write our dm.json file every once in a while in case we crash. |
| 70 | // Notice this also handles the final dm.json when pending == 0. |
| 71 | if (pending % 500 == 0) { |
| 72 | JsonWriter::DumpJson(); |
| 73 | } |
mtklein@google.com | d36522d | 2013-10-16 13:02:15 +0000 | [diff] [blame] | 74 | } |
| 75 | |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 76 | /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ |
mtklein | 114c3cd | 2015-01-15 10:15:02 -0800 | [diff] [blame] | 77 | |
mtklein | 62bd1a6 | 2015-01-27 14:46:26 -0800 | [diff] [blame] | 78 | struct Gold : public SkString { |
mtklein | a82f562 | 2015-02-20 12:30:19 -0800 | [diff] [blame] | 79 | Gold() : SkString("") {} |
mtklein | 62bd1a6 | 2015-01-27 14:46:26 -0800 | [diff] [blame] | 80 | Gold(ImplicitString sink, ImplicitString src, ImplicitString name, ImplicitString md5) |
| 81 | : SkString("") { |
| 82 | this->append(sink); |
| 83 | this->append(src); |
| 84 | this->append(name); |
| 85 | this->append(md5); |
| 86 | while (this->size() % 4) { |
| 87 | this->append("!"); // Pad out if needed so we can pass this to Murmur3. |
| 88 | } |
| 89 | } |
mtklein | 62bd1a6 | 2015-01-27 14:46:26 -0800 | [diff] [blame] | 90 | static uint32_t Hash(const Gold& g) { |
| 91 | return SkChecksum::Murmur3((const uint32_t*)g.c_str(), g.size()); |
| 92 | } |
| 93 | }; |
mtklein | a82f562 | 2015-02-20 12:30:19 -0800 | [diff] [blame] | 94 | static SkTHashSet<Gold, Gold::Hash> gGold; |
mtklein | 62bd1a6 | 2015-01-27 14:46:26 -0800 | [diff] [blame] | 95 | |
| 96 | static void add_gold(JsonWriter::BitmapResult r) { |
mtklein | a82f562 | 2015-02-20 12:30:19 -0800 | [diff] [blame] | 97 | gGold.add(Gold(r.config, r.sourceType, r.name, r.md5)); |
mtklein | 62bd1a6 | 2015-01-27 14:46:26 -0800 | [diff] [blame] | 98 | } |
| 99 | |
| 100 | static void gather_gold() { |
| 101 | if (!FLAGS_readPath.isEmpty()) { |
| 102 | SkString path(FLAGS_readPath[0]); |
| 103 | path.append("/dm.json"); |
| 104 | if (!JsonWriter::ReadJson(path.c_str(), add_gold)) { |
| 105 | fail(SkStringPrintf("Couldn't read %s for golden results.", path.c_str())); |
| 106 | } |
| 107 | } |
| 108 | } |
| 109 | |
| 110 | /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ |
| 111 | |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 112 | template <typename T> |
| 113 | struct Tagged : public SkAutoTDelete<T> { const char* tag; }; |
| 114 | |
| 115 | static const bool kMemcpyOK = true; |
| 116 | |
| 117 | static SkTArray<Tagged<Src>, kMemcpyOK> gSrcs; |
| 118 | static SkTArray<Tagged<Sink>, kMemcpyOK> gSinks; |
| 119 | |
| 120 | static void push_src(const char* tag, Src* s) { |
| 121 | SkAutoTDelete<Src> src(s); |
| 122 | if (FLAGS_src.contains(tag) && |
| 123 | !SkCommandLineFlags::ShouldSkip(FLAGS_match, src->name().c_str())) { |
| 124 | Tagged<Src>& s = gSrcs.push_back(); |
| 125 | s.reset(src.detach()); |
| 126 | s.tag = tag; |
mtklein | 114c3cd | 2015-01-15 10:15:02 -0800 | [diff] [blame] | 127 | } |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 128 | } |
mtklein | 114c3cd | 2015-01-15 10:15:02 -0800 | [diff] [blame] | 129 | |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 130 | static void gather_srcs() { |
| 131 | for (const skiagm::GMRegistry* r = skiagm::GMRegistry::Head(); r; r = r->next()) { |
| 132 | push_src("gm", new GMSrc(r->factory())); |
| 133 | } |
halcanary | fc37ad1 | 2015-01-30 07:31:19 -0800 | [diff] [blame] | 134 | for (int i = 0; i < FLAGS_skps.count(); i++) { |
| 135 | const char* path = FLAGS_skps[i]; |
| 136 | if (sk_isdir(path)) { |
| 137 | SkOSFile::Iter it(path, "skp"); |
| 138 | for (SkString file; it.next(&file); ) { |
| 139 | push_src("skp", new SKPSrc(SkOSPath::Join(path, file.c_str()))); |
| 140 | } |
| 141 | } else { |
mtklein | 8d17a13 | 2015-01-30 11:42:31 -0800 | [diff] [blame] | 142 | push_src("skp", new SKPSrc(path)); |
mtklein | 114c3cd | 2015-01-15 10:15:02 -0800 | [diff] [blame] | 143 | } |
| 144 | } |
halcanary | 23b03c3 | 2015-01-30 09:58:58 -0800 | [diff] [blame] | 145 | static const char* const exts[] = { |
| 146 | "bmp", "gif", "jpg", "jpeg", "png", "webp", "ktx", "astc", "wbmp", "ico", |
| 147 | "BMP", "GIF", "JPG", "JPEG", "PNG", "WEBP", "KTX", "ASTC", "WBMP", "ICO", |
| 148 | }; |
| 149 | for (int i = 0; i < FLAGS_images.count(); i++) { |
| 150 | const char* flag = FLAGS_images[i]; |
| 151 | if (sk_isdir(flag)) { |
| 152 | for (size_t j = 0; j < SK_ARRAY_COUNT(exts); j++) { |
| 153 | SkOSFile::Iter it(flag, exts[j]); |
| 154 | for (SkString file; it.next(&file); ) { |
| 155 | SkString path = SkOSPath::Join(flag, file.c_str()); |
| 156 | push_src("image", new ImageSrc(path)); // Decode entire image. |
mtklein | edc93bc | 2015-01-30 13:22:23 -0800 | [diff] [blame] | 157 | push_src("subset", new ImageSrc(path, 2)); // Decode into 2 x 2 subsets |
halcanary | 23b03c3 | 2015-01-30 09:58:58 -0800 | [diff] [blame] | 158 | } |
mtklein | 114c3cd | 2015-01-15 10:15:02 -0800 | [diff] [blame] | 159 | } |
halcanary | 23b03c3 | 2015-01-30 09:58:58 -0800 | [diff] [blame] | 160 | } else if (sk_exists(flag)) { |
| 161 | // assume that FLAGS_images[i] is a valid image if it is a file. |
mtklein | 8d17a13 | 2015-01-30 11:42:31 -0800 | [diff] [blame] | 162 | push_src("image", new ImageSrc(flag)); // Decode entire image. |
mtklein | edc93bc | 2015-01-30 13:22:23 -0800 | [diff] [blame] | 163 | push_src("subset", new ImageSrc(flag, 2)); // Decode into 2 x 2 subsets |
mtklein | 709d2c3 | 2015-01-15 08:30:25 -0800 | [diff] [blame] | 164 | } |
mtklein | 709d2c3 | 2015-01-15 08:30:25 -0800 | [diff] [blame] | 165 | } |
| 166 | } |
| 167 | |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 168 | static GrGLStandard get_gpu_api() { |
| 169 | if (FLAGS_gpuAPI.contains("gl")) { return kGL_GrGLStandard; } |
| 170 | if (FLAGS_gpuAPI.contains("gles")) { return kGLES_GrGLStandard; } |
| 171 | return kNone_GrGLStandard; |
mtklein | 709d2c3 | 2015-01-15 08:30:25 -0800 | [diff] [blame] | 172 | } |
| 173 | |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 174 | static void push_sink(const char* tag, Sink* s) { |
| 175 | SkAutoTDelete<Sink> sink(s); |
| 176 | if (!FLAGS_config.contains(tag)) { |
| 177 | return; |
mtklein | 114c3cd | 2015-01-15 10:15:02 -0800 | [diff] [blame] | 178 | } |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 179 | // Try a noop Src as a canary. If it fails, skip this sink. |
| 180 | struct : public Src { |
| 181 | Error draw(SkCanvas*) const SK_OVERRIDE { return ""; } |
| 182 | SkISize size() const SK_OVERRIDE { return SkISize::Make(16, 16); } |
| 183 | Name name() const SK_OVERRIDE { return "noop"; } |
| 184 | } noop; |
mtklein | 114c3cd | 2015-01-15 10:15:02 -0800 | [diff] [blame] | 185 | |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 186 | SkBitmap bitmap; |
| 187 | SkDynamicMemoryWStream stream; |
mtklein | b9eb4ac | 2015-02-02 18:26:03 -0800 | [diff] [blame] | 188 | SkString log; |
| 189 | Error err = sink->draw(noop, &bitmap, &stream, &log); |
mtklein | 4089ef7 | 2015-03-05 08:40:28 -0800 | [diff] [blame] | 190 | if (err.isFatal()) { |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 191 | SkDebugf("Skipping %s: %s\n", tag, err.c_str()); |
mtklein | 114c3cd | 2015-01-15 10:15:02 -0800 | [diff] [blame] | 192 | return; |
| 193 | } |
| 194 | |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 195 | Tagged<Sink>& ts = gSinks.push_back(); |
| 196 | ts.reset(sink.detach()); |
| 197 | ts.tag = tag; |
| 198 | } |
| 199 | |
| 200 | static bool gpu_supported() { |
| 201 | #if SK_SUPPORT_GPU |
| 202 | return FLAGS_gpu; |
| 203 | #else |
| 204 | return false; |
| 205 | #endif |
| 206 | } |
| 207 | |
| 208 | static Sink* create_sink(const char* tag) { |
| 209 | #define SINK(t, sink, ...) if (0 == strcmp(t, tag)) { return new sink(__VA_ARGS__); } |
| 210 | if (gpu_supported()) { |
mtklein | 82d2843 | 2015-01-15 12:46:02 -0800 | [diff] [blame] | 211 | typedef GrContextFactory Gr; |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 212 | const GrGLStandard api = get_gpu_api(); |
mtklein | 82d2843 | 2015-01-15 12:46:02 -0800 | [diff] [blame] | 213 | SINK("gpunull", GPUSink, Gr::kNull_GLContextType, api, 0, false, FLAGS_gpu_threading); |
| 214 | SINK("gpudebug", GPUSink, Gr::kDebug_GLContextType, api, 0, false, FLAGS_gpu_threading); |
| 215 | SINK("gpu", GPUSink, Gr::kNative_GLContextType, api, 0, false, FLAGS_gpu_threading); |
| 216 | SINK("gpudft", GPUSink, Gr::kNative_GLContextType, api, 0, true, FLAGS_gpu_threading); |
| 217 | SINK("msaa4", GPUSink, Gr::kNative_GLContextType, api, 4, false, FLAGS_gpu_threading); |
| 218 | SINK("msaa16", GPUSink, Gr::kNative_GLContextType, api, 16, false, FLAGS_gpu_threading); |
| 219 | SINK("nvprmsaa4", GPUSink, Gr::kNVPR_GLContextType, api, 4, false, FLAGS_gpu_threading); |
| 220 | SINK("nvprmsaa16", GPUSink, Gr::kNVPR_GLContextType, api, 16, false, FLAGS_gpu_threading); |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 221 | #if SK_ANGLE |
mtklein | 82d2843 | 2015-01-15 12:46:02 -0800 | [diff] [blame] | 222 | SINK("angle", GPUSink, Gr::kANGLE_GLContextType, api, 0, false, FLAGS_gpu_threading); |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 223 | #endif |
| 224 | #if SK_MESA |
mtklein | 82d2843 | 2015-01-15 12:46:02 -0800 | [diff] [blame] | 225 | SINK("mesa", GPUSink, Gr::kMESA_GLContextType, api, 0, false, FLAGS_gpu_threading); |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 226 | #endif |
mtklein | 114c3cd | 2015-01-15 10:15:02 -0800 | [diff] [blame] | 227 | } |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 228 | |
tomhudson | eebc39a | 2015-02-23 12:18:05 -0800 | [diff] [blame] | 229 | #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK |
| 230 | SINK("hwui", HWUISink); |
| 231 | #endif |
| 232 | |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 233 | if (FLAGS_cpu) { |
| 234 | SINK("565", RasterSink, kRGB_565_SkColorType); |
| 235 | SINK("8888", RasterSink, kN32_SkColorType); |
mtklein | 19f3060 | 2015-01-20 13:34:39 -0800 | [diff] [blame] | 236 | SINK("pdf", PDFSink); |
mtklein | 9c3f17d | 2015-01-28 11:35:18 -0800 | [diff] [blame] | 237 | SINK("skp", SKPSink); |
mtklein | 8a4527e | 2015-01-31 20:00:58 -0800 | [diff] [blame] | 238 | SINK("svg", SVGSink); |
| 239 | SINK("null", NullSink); |
halcanary | 47ef4d5 | 2015-03-03 09:13:09 -0800 | [diff] [blame] | 240 | SINK("xps", XPSSink); |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 241 | } |
| 242 | #undef SINK |
| 243 | return NULL; |
mtklein | 114c3cd | 2015-01-15 10:15:02 -0800 | [diff] [blame] | 244 | } |
| 245 | |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 246 | static Sink* create_via(const char* tag, Sink* wrapped) { |
| 247 | #define VIA(t, via, ...) if (0 == strcmp(t, tag)) { return new via(__VA_ARGS__); } |
mtklein | 7edca21 | 2015-01-21 13:18:51 -0800 | [diff] [blame] | 248 | VIA("pipe", ViaPipe, wrapped); |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 249 | VIA("serialize", ViaSerialization, wrapped); |
mtklein | 7edca21 | 2015-01-21 13:18:51 -0800 | [diff] [blame] | 250 | VIA("tiles", ViaTiles, 256, 256, NULL, wrapped); |
| 251 | VIA("tiles_rt", ViaTiles, 256, 256, new SkRTreeFactory, wrapped); |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 252 | |
mtklein | d603b22 | 2015-02-17 11:13:33 -0800 | [diff] [blame] | 253 | if (FLAGS_matrix.count() == 4) { |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 254 | SkMatrix m; |
mtklein | d603b22 | 2015-02-17 11:13:33 -0800 | [diff] [blame] | 255 | m.reset(); |
| 256 | m.setScaleX((SkScalar)atof(FLAGS_matrix[0])); |
| 257 | m.setSkewX ((SkScalar)atof(FLAGS_matrix[1])); |
| 258 | m.setSkewY ((SkScalar)atof(FLAGS_matrix[2])); |
| 259 | m.setScaleY((SkScalar)atof(FLAGS_matrix[3])); |
| 260 | VIA("matrix", ViaMatrix, m, wrapped); |
| 261 | VIA("upright", ViaUpright, m, wrapped); |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 262 | } |
tomhudson | 64de1e1 | 2015-03-05 08:01:07 -0800 | [diff] [blame] | 263 | |
| 264 | #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK |
| 265 | VIA("androidsdk", ViaAndroidSDK, wrapped); |
| 266 | #endif |
| 267 | |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 268 | #undef VIA |
| 269 | return NULL; |
mtklein | 114c3cd | 2015-01-15 10:15:02 -0800 | [diff] [blame] | 270 | } |
| 271 | |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 272 | static void gather_sinks() { |
| 273 | for (int i = 0; i < FLAGS_config.count(); i++) { |
| 274 | const char* config = FLAGS_config[i]; |
| 275 | SkTArray<SkString> parts; |
| 276 | SkStrSplit(config, "-", &parts); |
| 277 | |
| 278 | Sink* sink = NULL; |
| 279 | for (int i = parts.count(); i-- > 0;) { |
| 280 | const char* part = parts[i].c_str(); |
| 281 | Sink* next = (sink == NULL) ? create_sink(part) : create_via(part, sink); |
| 282 | if (next == NULL) { |
| 283 | SkDebugf("Skipping %s: Don't understand '%s'.\n", config, part); |
| 284 | delete sink; |
| 285 | sink = NULL; |
| 286 | break; |
| 287 | } |
| 288 | sink = next; |
| 289 | } |
| 290 | if (sink) { |
| 291 | push_sink(config, sink); |
mtklein | 114c3cd | 2015-01-15 10:15:02 -0800 | [diff] [blame] | 292 | } |
| 293 | } |
| 294 | } |
mtklein | 709d2c3 | 2015-01-15 08:30:25 -0800 | [diff] [blame] | 295 | |
mtklein | a2ef642 | 2015-01-15 13:44:22 -0800 | [diff] [blame] | 296 | static bool match(const char* needle, const char* haystack) { |
| 297 | return 0 == strcmp("_", needle) || NULL != strstr(haystack, needle); |
| 298 | } |
| 299 | |
| 300 | static ImplicitString is_blacklisted(const char* sink, const char* src, const char* name) { |
| 301 | for (int i = 0; i < FLAGS_blacklist.count() - 2; i += 3) { |
| 302 | if (match(FLAGS_blacklist[i+0], sink) && |
| 303 | match(FLAGS_blacklist[i+1], src) && |
| 304 | match(FLAGS_blacklist[i+2], name)) { |
| 305 | return SkStringPrintf("%s %s %s", |
| 306 | FLAGS_blacklist[i+0], FLAGS_blacklist[i+1], FLAGS_blacklist[i+2]); |
| 307 | } |
| 308 | } |
| 309 | return ""; |
| 310 | } |
| 311 | |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 312 | // The finest-grained unit of work we can run: draw a single Src into a single Sink, |
| 313 | // report any errors, and perhaps write out the output: a .png of the bitmap, or a raw stream. |
| 314 | struct Task { |
| 315 | Task(const Tagged<Src>& src, const Tagged<Sink>& sink) : src(src), sink(sink) {} |
| 316 | const Tagged<Src>& src; |
| 317 | const Tagged<Sink>& sink; |
| 318 | |
| 319 | static void Run(Task* task) { |
mtklein | a2ef642 | 2015-01-15 13:44:22 -0800 | [diff] [blame] | 320 | SkString name = task->src->name(); |
| 321 | SkString whyBlacklisted = is_blacklisted(task->sink.tag, task->src.tag, name.c_str()); |
mtklein | b9eb4ac | 2015-02-02 18:26:03 -0800 | [diff] [blame] | 322 | SkString log; |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 323 | WallTimer timer; |
| 324 | timer.start(); |
mtklein | a2ef642 | 2015-01-15 13:44:22 -0800 | [diff] [blame] | 325 | if (!FLAGS_dryRun && whyBlacklisted.isEmpty()) { |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 326 | SkBitmap bitmap; |
| 327 | SkDynamicMemoryWStream stream; |
mtklein | b9eb4ac | 2015-02-02 18:26:03 -0800 | [diff] [blame] | 328 | Error err = task->sink->draw(*task->src, &bitmap, &stream, &log); |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 329 | if (!err.isEmpty()) { |
mtklein | 4089ef7 | 2015-03-05 08:40:28 -0800 | [diff] [blame] | 330 | timer.end(); |
| 331 | if (err.isFatal()) { |
| 332 | fail(SkStringPrintf("%s %s %s: %s", |
| 333 | task->sink.tag, |
| 334 | task->src.tag, |
| 335 | name.c_str(), |
| 336 | err.c_str())); |
mtklein | a6def47 | 2015-03-11 07:19:15 -0700 | [diff] [blame] | 337 | } else if (FLAGS_verbose) { |
mtklein | 4089ef7 | 2015-03-05 08:40:28 -0800 | [diff] [blame] | 338 | name.appendf(" (skipped: %s)", err.c_str()); |
| 339 | } |
| 340 | done(timer.fWall, task->sink.tag, task->src.tag, name, log); |
| 341 | return; |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 342 | } |
mtklein | 62bd1a6 | 2015-01-27 14:46:26 -0800 | [diff] [blame] | 343 | SkAutoTDelete<SkStreamAsset> data(stream.detachAsStream()); |
| 344 | |
| 345 | SkString md5; |
| 346 | if (!FLAGS_writePath.isEmpty() || !FLAGS_readPath.isEmpty()) { |
| 347 | SkMD5 hash; |
| 348 | if (data->getLength()) { |
| 349 | hash.writeStream(data, data->getLength()); |
| 350 | data->rewind(); |
| 351 | } else { |
| 352 | hash.write(bitmap.getPixels(), bitmap.getSize()); |
| 353 | } |
| 354 | SkMD5::Digest digest; |
| 355 | hash.finish(digest); |
| 356 | for (int i = 0; i < 16; i++) { |
| 357 | md5.appendf("%02x", digest.data[i]); |
| 358 | } |
| 359 | } |
| 360 | |
| 361 | if (!FLAGS_readPath.isEmpty() && |
mtklein | a82f562 | 2015-02-20 12:30:19 -0800 | [diff] [blame] | 362 | !gGold.contains(Gold(task->sink.tag, task->src.tag, name, md5))) { |
mtklein | 62bd1a6 | 2015-01-27 14:46:26 -0800 | [diff] [blame] | 363 | fail(SkStringPrintf("%s not found for %s %s %s in %s", |
| 364 | md5.c_str(), |
| 365 | task->sink.tag, |
| 366 | task->src.tag, |
| 367 | name.c_str(), |
| 368 | FLAGS_readPath[0])); |
| 369 | } |
| 370 | |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 371 | if (!FLAGS_writePath.isEmpty()) { |
| 372 | const char* ext = task->sink->fileExtension(); |
mtklein | 62bd1a6 | 2015-01-27 14:46:26 -0800 | [diff] [blame] | 373 | if (data->getLength()) { |
| 374 | WriteToDisk(*task, md5, ext, data, data->getLength(), NULL); |
halcanary | 022afb8 | 2015-01-30 11:00:12 -0800 | [diff] [blame] | 375 | SkASSERT(bitmap.drawsNothing()); |
| 376 | } else if (!bitmap.drawsNothing()) { |
mtklein | 62bd1a6 | 2015-01-27 14:46:26 -0800 | [diff] [blame] | 377 | WriteToDisk(*task, md5, ext, NULL, 0, &bitmap); |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 378 | } |
| 379 | } |
| 380 | } |
| 381 | timer.end(); |
mtklein | a6def47 | 2015-03-11 07:19:15 -0700 | [diff] [blame] | 382 | if (FLAGS_verbose && !whyBlacklisted.isEmpty()) { |
mtklein | a2ef642 | 2015-01-15 13:44:22 -0800 | [diff] [blame] | 383 | name.appendf(" (--blacklist, %s)", whyBlacklisted.c_str()); |
| 384 | } |
mtklein | b9eb4ac | 2015-02-02 18:26:03 -0800 | [diff] [blame] | 385 | done(timer.fWall, task->sink.tag, task->src.tag, name, log); |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 386 | } |
| 387 | |
| 388 | static void WriteToDisk(const Task& task, |
mtklein | 62bd1a6 | 2015-01-27 14:46:26 -0800 | [diff] [blame] | 389 | SkString md5, |
| 390 | const char* ext, |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 391 | SkStream* data, size_t len, |
mtklein | 62bd1a6 | 2015-01-27 14:46:26 -0800 | [diff] [blame] | 392 | const SkBitmap* bitmap) { |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 393 | JsonWriter::BitmapResult result; |
| 394 | result.name = task.src->name(); |
| 395 | result.config = task.sink.tag; |
| 396 | result.sourceType = task.src.tag; |
| 397 | result.ext = ext; |
mtklein | 62bd1a6 | 2015-01-27 14:46:26 -0800 | [diff] [blame] | 398 | result.md5 = md5; |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 399 | JsonWriter::AddBitmapResult(result); |
| 400 | |
| 401 | const char* dir = FLAGS_writePath[0]; |
| 402 | if (0 == strcmp(dir, "@")) { // Needed for iOS. |
| 403 | dir = FLAGS_resourcePath[0]; |
| 404 | } |
| 405 | sk_mkdir(dir); |
| 406 | |
| 407 | SkString path; |
| 408 | if (FLAGS_nameByHash) { |
| 409 | path = SkOSPath::Join(dir, result.md5.c_str()); |
| 410 | path.append("."); |
| 411 | path.append(ext); |
| 412 | if (sk_exists(path.c_str())) { |
| 413 | return; // Content-addressed. If it exists already, we're done. |
| 414 | } |
| 415 | } else { |
| 416 | path = SkOSPath::Join(dir, task.sink.tag); |
| 417 | sk_mkdir(path.c_str()); |
| 418 | path = SkOSPath::Join(path.c_str(), task.src.tag); |
| 419 | sk_mkdir(path.c_str()); |
| 420 | path = SkOSPath::Join(path.c_str(), task.src->name().c_str()); |
| 421 | path.append("."); |
| 422 | path.append(ext); |
| 423 | } |
| 424 | |
| 425 | SkFILEWStream file(path.c_str()); |
| 426 | if (!file.isValid()) { |
| 427 | fail(SkStringPrintf("Can't open %s for writing.\n", path.c_str())); |
| 428 | return; |
| 429 | } |
| 430 | |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 431 | if (bitmap) { |
| 432 | // We can't encode A8 bitmaps as PNGs. Convert them to 8888 first. |
| 433 | SkBitmap converted; |
| 434 | if (bitmap->info().colorType() == kAlpha_8_SkColorType) { |
| 435 | if (!bitmap->copyTo(&converted, kN32_SkColorType)) { |
| 436 | fail("Can't convert A8 to 8888.\n"); |
| 437 | return; |
| 438 | } |
| 439 | bitmap = &converted; |
| 440 | } |
| 441 | if (!SkImageEncoder::EncodeStream(&file, *bitmap, SkImageEncoder::kPNG_Type, 100)) { |
| 442 | fail(SkStringPrintf("Can't encode PNG to %s.\n", path.c_str())); |
| 443 | return; |
| 444 | } |
| 445 | } else { |
| 446 | if (!file.writeStream(data, len)) { |
| 447 | fail(SkStringPrintf("Can't write to %s.\n", path.c_str())); |
| 448 | return; |
| 449 | } |
| 450 | } |
| 451 | } |
| 452 | }; |
| 453 | |
| 454 | // Run all tasks in the same enclave serially on the same thread. |
| 455 | // They can't possibly run concurrently with each other. |
| 456 | static void run_enclave(SkTArray<Task>* tasks) { |
| 457 | for (int i = 0; i < tasks->count(); i++) { |
| 458 | Task::Run(tasks->begin() + i); |
| 459 | } |
| 460 | } |
| 461 | |
| 462 | /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ |
| 463 | |
| 464 | // Unit tests don't fit so well into the Src/Sink model, so we give them special treatment. |
| 465 | |
mtklein | 55e88b2 | 2015-01-21 15:50:13 -0800 | [diff] [blame] | 466 | static SkTDArray<skiatest::Test> gThreadedTests, gGPUTests; |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 467 | |
| 468 | static void gather_tests() { |
mtklein | 6c5fed2 | 2015-01-20 13:47:23 -0800 | [diff] [blame] | 469 | if (!FLAGS_src.contains("tests")) { |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 470 | return; |
| 471 | } |
halcanary | 87f3ba4 | 2015-01-20 09:30:20 -0800 | [diff] [blame] | 472 | for (const skiatest::TestRegistry* r = skiatest::TestRegistry::Head(); r; |
| 473 | r = r->next()) { |
| 474 | // Despite its name, factory() is returning a reference to |
| 475 | // link-time static const POD data. |
| 476 | const skiatest::Test& test = r->factory(); |
| 477 | if (SkCommandLineFlags::ShouldSkip(FLAGS_match, test.name)) { |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 478 | continue; |
| 479 | } |
halcanary | 87f3ba4 | 2015-01-20 09:30:20 -0800 | [diff] [blame] | 480 | if (test.needsGpu && gpu_supported()) { |
mtklein | 55e88b2 | 2015-01-21 15:50:13 -0800 | [diff] [blame] | 481 | (FLAGS_gpu_threading ? gThreadedTests : gGPUTests).push(test); |
halcanary | 87f3ba4 | 2015-01-20 09:30:20 -0800 | [diff] [blame] | 482 | } else if (!test.needsGpu && FLAGS_cpu) { |
mtklein | 55e88b2 | 2015-01-21 15:50:13 -0800 | [diff] [blame] | 483 | gThreadedTests.push(test); |
mtklein | 82d2843 | 2015-01-15 12:46:02 -0800 | [diff] [blame] | 484 | } |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 485 | } |
| 486 | } |
| 487 | |
halcanary | 87f3ba4 | 2015-01-20 09:30:20 -0800 | [diff] [blame] | 488 | static void run_test(skiatest::Test* test) { |
| 489 | struct : public skiatest::Reporter { |
| 490 | void reportFailed(const skiatest::Failure& failure) SK_OVERRIDE { |
| 491 | fail(failure.toString()); |
| 492 | JsonWriter::AddTestFailure(failure); |
| 493 | } |
| 494 | bool allowExtendedTest() const SK_OVERRIDE { |
| 495 | return FLAGS_pathOpsExtended; |
| 496 | } |
| 497 | bool verbose() const SK_OVERRIDE { return FLAGS_veryVerbose; } |
| 498 | } reporter; |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 499 | WallTimer timer; |
| 500 | timer.start(); |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 501 | if (!FLAGS_dryRun) { |
mtklein | 55e88b2 | 2015-01-21 15:50:13 -0800 | [diff] [blame] | 502 | GrContextFactory factory; |
| 503 | test->proc(&reporter, &factory); |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 504 | } |
| 505 | timer.end(); |
mtklein | b9eb4ac | 2015-02-02 18:26:03 -0800 | [diff] [blame] | 506 | done(timer.fWall, "unit", "test", test->name, ""); |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 507 | } |
| 508 | |
| 509 | /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ |
| 510 | |
mtklein | 55e88b2 | 2015-01-21 15:50:13 -0800 | [diff] [blame] | 511 | // If we're isolating all GPU-bound work to one thread (the default), this function runs all that. |
| 512 | static void run_enclave_and_gpu_tests(SkTArray<Task>* tasks) { |
| 513 | run_enclave(tasks); |
| 514 | for (int i = 0; i < gGPUTests.count(); i++) { |
| 515 | run_test(&gGPUTests[i]); |
| 516 | } |
| 517 | } |
| 518 | |
mtklein | de6fc2b | 2015-03-12 06:28:54 -0700 | [diff] [blame^] | 519 | // Some runs (mostly, Valgrind) are so slow that the bot framework thinks we've hung. |
| 520 | // This prints something every once in a while so that it knows we're still working. |
| 521 | static void keep_alive(void*) { |
| 522 | for (;;) { |
| 523 | static const int kSec = 300; |
| 524 | #if defined(SK_BUILD_FOR_WIN) |
| 525 | Sleep(kSec * 1000); |
| 526 | #else |
| 527 | sleep(kSec); |
| 528 | #endif |
| 529 | SkDebugf("\nStill alive: doing science, reticulating splines...\n"); |
| 530 | } |
| 531 | } |
| 532 | |
jcgregorio | 3b27ade | 2014-11-13 08:06:40 -0800 | [diff] [blame] | 533 | int dm_main(); |
caryclark | 17f0b6d | 2014-07-22 10:15:34 -0700 | [diff] [blame] | 534 | int dm_main() { |
jcgregorio | 3b27ade | 2014-11-13 08:06:40 -0800 | [diff] [blame] | 535 | SetupCrashHandler(); |
commit-bot@chromium.org | 39e8d93 | 2014-05-29 20:14:48 +0000 | [diff] [blame] | 536 | SkAutoGraphics ag; |
mtklein | 406654b | 2014-09-03 15:34:37 -0700 | [diff] [blame] | 537 | SkTaskGroup::Enabler enabled(FLAGS_threads); |
mtklein | e67164d | 2015-02-02 13:24:37 -0800 | [diff] [blame] | 538 | if (FLAGS_leaks) { |
| 539 | SkInstCountPrintLeaksOnExit(); |
| 540 | } |
commit-bot@chromium.org | a65e2fd | 2014-05-30 17:23:31 +0000 | [diff] [blame] | 541 | |
mtklein | de6fc2b | 2015-03-12 06:28:54 -0700 | [diff] [blame^] | 542 | SkThread keepAlive(keep_alive); // This thread will just be killed by processes shutdown. |
| 543 | keepAlive.start(); |
| 544 | |
mtklein | 62bd1a6 | 2015-01-27 14:46:26 -0800 | [diff] [blame] | 545 | gather_gold(); |
| 546 | |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 547 | gather_srcs(); |
| 548 | gather_sinks(); |
| 549 | gather_tests(); |
commit-bot@chromium.org | 0dc5bd1 | 2014-02-26 16:31:22 +0000 | [diff] [blame] | 550 | |
mtklein | 55e88b2 | 2015-01-21 15:50:13 -0800 | [diff] [blame] | 551 | gPending = gSrcs.count() * gSinks.count() + gThreadedTests.count() + gGPUTests.count(); |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 552 | SkDebugf("%d srcs * %d sinks + %d tests == %d tasks\n", |
mtklein | 55e88b2 | 2015-01-21 15:50:13 -0800 | [diff] [blame] | 553 | gSrcs.count(), gSinks.count(), gThreadedTests.count() + gGPUTests.count(), gPending); |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 554 | |
| 555 | // We try to exploit as much parallelism as is safe. Most Src/Sink pairs run on any thread, |
| 556 | // but Sinks that identify as part of a particular enclave run serially on a single thread. |
mtklein | 82d2843 | 2015-01-15 12:46:02 -0800 | [diff] [blame] | 557 | // CPU tests run on any thread. GPU tests depend on --gpu_threading. |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 558 | SkTArray<Task> enclaves[kNumEnclaves]; |
| 559 | for (int j = 0; j < gSinks.count(); j++) { |
| 560 | SkTArray<Task>& tasks = enclaves[gSinks[j]->enclave()]; |
| 561 | for (int i = 0; i < gSrcs.count(); i++) { |
| 562 | tasks.push_back(Task(gSrcs[i], gSinks[j])); |
| 563 | } |
commit-bot@chromium.org | 38aeb0f | 2014-02-26 23:01:57 +0000 | [diff] [blame] | 564 | } |
| 565 | |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 566 | SkTaskGroup tg; |
mtklein | 55e88b2 | 2015-01-21 15:50:13 -0800 | [diff] [blame] | 567 | tg.batch(run_test, gThreadedTests.begin(), gThreadedTests.count()); |
| 568 | for (int i = 0; i < kNumEnclaves; i++) { |
| 569 | switch(i) { |
| 570 | case kAnyThread_Enclave: |
| 571 | tg.batch(Task::Run, enclaves[i].begin(), enclaves[i].count()); |
| 572 | break; |
| 573 | case kGPU_Enclave: |
| 574 | tg.add(run_enclave_and_gpu_tests, &enclaves[i]); |
| 575 | break; |
| 576 | default: |
| 577 | tg.add(run_enclave, &enclaves[i]); |
| 578 | break; |
mtklein | 82d2843 | 2015-01-15 12:46:02 -0800 | [diff] [blame] | 579 | } |
mtklein | 55e88b2 | 2015-01-21 15:50:13 -0800 | [diff] [blame] | 580 | } |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 581 | tg.wait(); |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 582 | // At this point we're back in single-threaded land. |
mtklein@google.com | d36522d | 2013-10-16 13:02:15 +0000 | [diff] [blame] | 583 | |
mtklein | 2f64eec | 2015-01-15 14:20:41 -0800 | [diff] [blame] | 584 | SkDebugf("\n"); |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 585 | if (gFailures.count() > 0) { |
| 586 | SkDebugf("Failures:\n"); |
| 587 | for (int i = 0; i < gFailures.count(); i++) { |
mtklein | 9dc0910 | 2015-01-15 15:47:33 -0800 | [diff] [blame] | 588 | SkDebugf("\t%s\n", gFailures[i].c_str()); |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 589 | } |
| 590 | SkDebugf("%d failures\n", gFailures.count()); |
| 591 | return 1; |
mtklein | 114c3cd | 2015-01-15 10:15:02 -0800 | [diff] [blame] | 592 | } |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 593 | if (gPending > 0) { |
| 594 | SkDebugf("Hrm, we didn't seem to run everything we intended to! Please file a bug.\n"); |
| 595 | return 1; |
mtklein | 114c3cd | 2015-01-15 10:15:02 -0800 | [diff] [blame] | 596 | } |
mtklein | 748ca3b | 2015-01-15 10:56:12 -0800 | [diff] [blame] | 597 | return 0; |
mtklein@google.com | d36522d | 2013-10-16 13:02:15 +0000 | [diff] [blame] | 598 | } |
jcgregorio | 3b27ade | 2014-11-13 08:06:40 -0800 | [diff] [blame] | 599 | |
| 600 | #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) |
| 601 | int main(int argc, char** argv) { |
| 602 | SkCommandLineFlags::Parse(argc, argv); |
| 603 | return dm_main(); |
| 604 | } |
| 605 | #endif |