Add SkFUZZF to help whitelist imagefilter fuzz failures
authorrobertphillips <robertphillips@google.com>
Fri, 8 Apr 2016 21:03:06 +0000 (14:03 -0700)
committerCommit bot <commit-bot@chromium.org>
Fri, 8 Apr 2016 21:03:06 +0000 (14:03 -0700)
The current use case for this is whitelisting MergeImageFilter failures when the number of inputs is too big. Presumably there will be other whitelisting use cases as we progress.

GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1873463002

Review URL: https://codereview.chromium.org/1873463002

gyp/core.gypi
src/core/SkFuzzLogging.h [new file with mode: 0644]
src/core/SkImageFilter.cpp

index 98996ec182fa0acb3c2f6209d3187ca309f586d2..24b9e770212961fb249bb847139dc60e41e06d60 100644 (file)
         '<(skia_src_path)/core/SkFontDescriptor.h',
         '<(skia_src_path)/core/SkFontStream.cpp',
         '<(skia_src_path)/core/SkFontStream.h',
+        '<(skia_src_path)/core/SkFuzzLogging.h',
         '<(skia_src_path)/core/SkGeometry.cpp',
         '<(skia_src_path)/core/SkGeometry.h',
         '<(skia_src_path)/core/SkGlobalInitialization_core.cpp',
diff --git a/src/core/SkFuzzLogging.h b/src/core/SkFuzzLogging.h
new file mode 100644 (file)
index 0000000..8e546e3
--- /dev/null
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2016 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkFuzzLogging_DEFINED
+#define SkFuzzLogging_DEFINED
+
+// Utilities for Skia's fuzzer
+
+// When SK_FUZZ_LOGGING is defined SkDebugfs relevant to image filter fuzzing
+// will be enabled. This allows the filter fuzzing code to white list fuzzer
+// failures based on the output logs.
+// Define this flag in your SkUserConfig.h or in your Make/Build system.
+#ifdef SK_FUZZ_LOGGING
+    #define SkFUZZF(args) SkDebugf("SkFUZZ: "); SkDebugf args
+#else
+    #define SkFUZZF(args)
+#endif
+
+#endif
index fb5c9157b67da79a996cd50b8d7856d4f984ad9d..4af335ef4104b3b8c7da93b7f2932b9b7f494372 100644 (file)
@@ -12,6 +12,7 @@
 #include "SkBitmapDevice.h"
 #include "SkChecksum.h"
 #include "SkDevice.h"
+#include "SkFuzzLogging.h"
 #include "SkLocalMatrixImageFilter.h"
 #include "SkMatrixImageFilter.h"
 #include "SkOncePtr.h"
@@ -137,6 +138,7 @@ bool SkImageFilter::Common::unflatten(SkReadBuffer& buffer, int expectedCount) {
         return false;
     }
 
+    SkFUZZF(("allocInputs: %d\n", count));
     this->allocInputs(count);
     for (int i = 0; i < count; i++) {
         if (buffer.readBool()) {