aboutsummaryrefslogtreecommitdiffhomepage
path: root/fuzz/fuzz.cpp
diff options
context:
space:
mode:
authorGravatar kjlubick <kjlubick@google.com>2016-02-01 08:23:50 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2016-02-01 08:23:50 -0800
commit47d158eb3c50578cf0b2e74d72f8a7d7a73a1aab (patch)
tree8149d1cdad29ae63e9dd65ad50a3598161272292 /fuzz/fuzz.cpp
parent975765c60a1a754dc0723cb76bd962eb3cbadbff (diff)
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
Diffstat (limited to 'fuzz/fuzz.cpp')
-rw-r--r--fuzz/fuzz.cpp19
1 files changed, 10 insertions, 9 deletions
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<SkCodec> 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<SkPicture> 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;
}