diff options
author | Kevin Lubick <kjlubick@google.com> | 2018-01-09 12:47:33 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-01-09 18:07:27 +0000 |
commit | 9ff5dc9c9f222059a9e191b528fbb86999ecebf5 (patch) | |
tree | e1d9bd0de7271e91033638d5170c2c7ebfeeeeb1 /fuzz/fuzz.cpp | |
parent | db38573ca0592bc9f564a1d5798c07b6c9ee507c (diff) |
Make commandline flags nicer for fuzz executable
This cleans up the build so commandline flags defined in tools/*.cpp
don't get globbed into the fuzzer's.
Bug: skia:
Change-Id: I5994aa5bf75686641baf0cf97fd81141f0ac6f3a
Reviewed-on: https://skia-review.googlesource.com/92680
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Diffstat (limited to 'fuzz/fuzz.cpp')
-rw-r--r-- | fuzz/fuzz.cpp | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/fuzz/fuzz.cpp b/fuzz/fuzz.cpp index 75f87c14e3..0d19027d6e 100644 --- a/fuzz/fuzz.cpp +++ b/fuzz/fuzz.cpp @@ -35,22 +35,28 @@ #include <signal.h> #include "sk_tool_utils.h" - DEFINE_string2(bytes, b, "", "A path to a file or a directory. If a file, the " "contents will be used as the fuzz bytes. If a directory, all files " "in the directory will be used as fuzz bytes for the fuzzer, one at a " "time."); DEFINE_string2(name, n, "", "If --type is 'api', fuzz the API with this name."); - -DEFINE_string2(type, t, "api", "How to interpret --bytes, either 'image_scale'" - ", 'image_mode', 'skp', 'icc', or 'api'."); DEFINE_string2(dump, d, "", "If not empty, dump 'image*' or 'skp' types as a " "PNG with this name."); +DEFINE_bool2(verbose, v, false, "Print more information while fuzzing."); +DEFINE_string2(type, t, "", "How to interpret --bytes, one of:\n" + "api\n" + "color_deserialize\n" + "filter_fuzz (equivalent to Chrome's filter_fuzz_stub)\n" + "icc\n" + "image_mode\n" + "image_scale\n" + "path_deserialize\n" + "pipe\n" + "region_deserialize\n" + "skp\n" + "sksl2glsl\n" + "textblob"); -static int printUsage() { - SkDebugf("Usage: fuzz -t <type> -b <path/to/file> [-n api-to-fuzz]\n"); - return 1; -} static int fuzz_file(const char* path); static uint8_t calculate_option(SkData*); @@ -70,6 +76,8 @@ static void fuzz_sksl2glsl(sk_sp<SkData>); #endif int main(int argc, char** argv) { + SkCommandLineFlags::SetUsage("Usage: fuzz -t <type> -b <path/to/file> [-n api-to-fuzz]\n" + "--help lists the valid types\n"); SkCommandLineFlags::Parse(argc, argv); const char* path = FLAGS_bytes.isEmpty() ? argv[0] : FLAGS_bytes[0]; @@ -151,7 +159,8 @@ static int fuzz_file(const char* path) { } #endif } - return printUsage(); + SkCommandLineFlags::PrintUsage(); + return 1; } // This adds up the first 1024 bytes and returns it as an 8 bit integer. This allows afl-fuzz to |