From 47d158eb3c50578cf0b2e74d72f8a7d7a73a1aab Mon Sep 17 00:00:00 2001 From: kjlubick Date: Mon, 1 Feb 2016 08:23:50 -0800 Subject: Make fuzz broadcast when it terminates via return. This helps analysis figure out things like timeouts and unexpected, uncaught exits. TBR=mtkelin@google.com BUG=skia:4438 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1657743002 Review URL: https://codereview.chromium.org/1657743002 --- fuzz/fuzz.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'fuzz/fuzz.cpp') diff --git a/fuzz/fuzz.cpp b/fuzz/fuzz.cpp index 042b3ca9a4..02bf76e665 100644 --- a/fuzz/fuzz.cpp +++ b/fuzz/fuzz.cpp @@ -66,7 +66,7 @@ int fuzz_api(SkData* bytes) { SkDebugf("Fuzzing %s...\n", fuzzable.name); Fuzz fuzz(bytes); fuzzable.fn(&fuzz); - SkDebugf("Success!"); + SkDebugf("[terminated] Success!\n"); return 0; } } @@ -87,9 +87,10 @@ static void dump_png(SkBitmap bitmap) { } int fuzz_img(SkData* bytes) { + SkDebugf("Decoding\n"); SkAutoTDelete codec(SkCodec::NewFromData(bytes)); if (nullptr == codec.get()) { - SkDebugf("Couldn't create codec."); + SkDebugf("[terminated] Couldn't create codec.\n"); return 3; } @@ -112,7 +113,7 @@ int fuzz_img(SkData* bytes) { options.fZeroInitialized = SkCodec::kYes_ZeroInitialized; if (!bitmap.tryAllocPixels(decodeInfo, &zeroFactory, nullptr)) { - SkDebugf("Could not allocate memory. Image might be too large (%d x %d)", + SkDebugf("[terminated] Could not allocate memory. Image might be too large (%d x %d)", decodeInfo.width(), decodeInfo.height()); return 4; } @@ -120,17 +121,17 @@ int fuzz_img(SkData* bytes) { switch (codec->getPixels(decodeInfo, bitmap.getPixels(), bitmap.rowBytes(), &options, colorPtr, colorCountPtr)) { case SkCodec::kSuccess: - SkDebugf("Success!\n"); + SkDebugf("[terminated] Success!\n"); break; case SkCodec::kIncompleteInput: - SkDebugf("Partial Success\n"); + SkDebugf("[terminated] Partial Success\n"); break; case SkCodec::kInvalidConversion: - SkDebugf("Incompatible colortype conversion"); + SkDebugf("[terminated] Incompatible colortype conversion\n"); return 5; default: // Everything else is considered a failure. - SkDebugf("Couldn't getPixels."); + SkDebugf("[terminated] Couldn't getPixels.\n"); return 6; } @@ -143,7 +144,7 @@ int fuzz_skp(SkData* bytes) { SkDebugf("Decoding\n"); SkAutoTUnref pic(SkPicture::CreateFromStream(&stream)); if (!pic) { - SkDebugf("Couldn't decode as a picture.\n"); + SkDebugf("[terminated] Couldn't decode as a picture.\n"); return 3; } SkDebugf("Rendering\n"); @@ -154,7 +155,7 @@ int fuzz_skp(SkData* bytes) { } SkCanvas canvas(bitmap); canvas.drawPicture(pic); - SkDebugf("Success! Decoded and rendered an SkPicture!\n"); + SkDebugf("[terminated] Success! Decoded and rendered an SkPicture!\n"); dump_png(bitmap); return 0; } -- cgit v1.2.3