Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(135)

Side by Side Diff: fuzz/fuzz.cpp

Issue 1589563002: Add new fuzz binary. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: simplify gyp Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * Copyright 2016 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #include "Fuzz.h"
9 #include "SkCommandLineFlags.h"
10
11 DEFINE_string2(match, m, "", "The usual match patterns, applied to name.");
12 DEFINE_string2(bytes, b, "", "Path to file containing fuzzed bytes.");
13
14 int main(int argc, char** argv) {
15 SkCommandLineFlags::Parse(argc, argv);
16 SkAutoTUnref<SkData> bytes;
17 if (!FLAGS_bytes.isEmpty()) {
18 bytes.reset(SkData::NewFromFileName(FLAGS_bytes[0]));
19 }
20
21 for (auto r = SkTRegistry<Fuzzable>::Head(); r; r = r->next()) {
22 auto fuzzable = r->factory();
23 if (!SkCommandLineFlags::ShouldSkip(FLAGS_match, fuzzable.name)) {
24 SkDebugf("Running %s...\n", fuzzable.name);
25 Fuzz fuzz(bytes);
26 fuzzable.fn(&fuzz);
27 }
28 }
29 return 0;
30 }
31
32
33 Fuzz::Fuzz(SkData* bytes) : fBytes(SkSafeRef(bytes)) {}
34
35 // These methods are all TODO(kjlubick).
36 uint32_t Fuzz::nextU() { return 0; }
37 float Fuzz::nextF() { return 0.0f; }
38 uint32_t Fuzz::nextURange(uint32_t min, uint32_t max) { return min; }
39 float Fuzz::nextFRange(float min, float max) { return min; }
40
OLDNEW
« fuzz/Fuzz.h ('K') | « fuzz/FuzzPaeth.cpp ('k') | gyp/fuzz.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698