OLD | NEW |
(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 |
OLD | NEW |