def test_fuzzer_can_boot_and_run_reproducer(self):
    """Tests running a testcase that should cause a fast, predictable crash."""
    build_manager.setup_fuchsia_build()
    testcase_path, _ = setup_testcase_and_corpus('fuchsia_crash',
                                                 'empty_corpus')
    engine_impl = engine.LibFuzzerEngine()
    result = engine_impl.reproduce('example_fuzzers/toy_fuzzer', testcase_path,
                                   ['-timeout=25', '-rss_limit_mb=2048'], 30)

    self.assertIn('ERROR: AddressSanitizer: heap-buffer-overflow on address',
                  result.output)
    self.assertIn('Running: data/fuchsia_crash', result.output)
Exemple #2
0
 def test_fuzzer_can_boot_and_run_reproducer(self):
     """Tests running a testcase that should cause a fast, predictable crash."""
     build_manager.setup_fuchsia_build()
     testcase_path = setup_testcase_and_corpus('fuchsia_crash',
                                               'empty_corpus')
     output = run_launcher(testcase_path, 'example_fuzzers/toy_fuzzer')
     self.assertIn((
         'run fuchsia-pkg://fuchsia.com/example_fuzzers#meta/toy_fuzzer.cmx'
         ' -artifact_prefix=data/ data/fuchsia_crash'), output)
     self.assertIn(
         'ERROR: AddressSanitizer: heap-buffer-overflow on address', output)
     self.assertIn('Running: data/fuchsia_crash', output)
Exemple #3
0
 def test_fuzzer_can_boot_and_run(self):
   """Tests running a single round of fuzzing on a Fuchsia target, using
   'echo' in place of a fuzzing command."""
   # TODO(flowerhack): Fuchsia's `fuzz` only calls 'echo running on fuchsia!'
   # right now by default, but we'll call it explicitly in here as we
   # diversity `fuzz`'s functionality
   build_manager.setup_fuchsia_build()
   environment.set_value('FUZZ_TARGET', 'example_fuzzers/toy_fuzzer')
   testcase_path = setup_testcase_and_corpus('aaaa', 'empty_corpus', fuzz=True)
   output = run_launcher(testcase_path, 'test_fuzzer')
   self.assertIn(
       'localhost run \'fuchsia-pkg://fuchsia.com/example_fuzzers#meta/'
       'toy_fuzzer.cmx\'', output)
Exemple #4
0
 def test_fuzzer_can_boot_and_run(self):
     """Tests running a single round of fuzzing on a Fuchsia target, using
 a toy fuzzer that should crash very quickly."""
     build_manager.setup_fuchsia_build()
     testcase_path = setup_testcase_and_corpus('aaaa',
                                               'empty_corpus',
                                               fuzz=True)
     output = run_launcher(testcase_path, 'example_fuzzers/toy_fuzzer')
     self.assertIn(
         'localhost run \'fuchsia-pkg://fuchsia.com/example_fuzzers#meta/'
         'toy_fuzzer.cmx\'', output)
     self.assertIn(
         'ERROR: AddressSanitizer: heap-buffer-overflow on address', output)
  def test_fuzzer_can_boot_and_run(self):
    """Tests running a single round of fuzzing on a Fuchsia target, using
    a toy fuzzer that should crash very quickly."""
    build_manager.setup_fuchsia_build()

    _, corpus_path = setup_testcase_and_corpus('aaaa', 'empty_corpus')
    engine_impl = engine.LibFuzzerEngine()

    options = engine_impl.prepare(corpus_path, 'example_fuzzers/toy_fuzzer',
                                  DATA_DIR)
    results = engine_impl.fuzz('example_fuzzers/toy_fuzzer', options, TEMP_DIR,
                               10)

    self.assertIn('Test unit written to', results.logs)
    self.assertIn('ERROR: AddressSanitizer: heap-buffer-overflow on address',
                  results.logs)