def _test_run_with_sanitizer(self, fuzzer_dir, sanitizer): """Calls run_fuzzers on fuzzer_dir and |sanitizer| and asserts the run succeeded and that no bug was found.""" with test_helpers.temp_dir_copy(fuzzer_dir) as fuzzer_dir_copy: run_success, bug_found = run_fuzzers.run_fuzzers( 10, fuzzer_dir_copy, 'curl', sanitizer=sanitizer) self.assertTrue(run_success) self.assertFalse(bug_found)
def _test_run_with_sanitizer(self, fuzzer_dir, sanitizer): """Calls run_fuzzers on fuzzer_dir and |sanitizer| and asserts the run succeeded and that no bug was found.""" with test_helpers.temp_dir_copy(fuzzer_dir) as fuzzer_dir_copy: config = test_helpers.create_run_config(fuzz_seconds=FUZZ_SECONDS, workspace=fuzzer_dir_copy, project_name='curl', sanitizer=sanitizer) result = run_fuzzers.run_fuzzers(config) self.assertEqual(result, run_fuzzers.RunFuzzersResult.NO_BUG_FOUND)
def _test_run_with_sanitizer(self, fuzzer_dir, sanitizer): """Calls run_fuzzers on fuzzer_dir and |sanitizer| and asserts the run succeeded and that no bug was found.""" with test_helpers.temp_dir_copy(fuzzer_dir) as fuzzer_dir_copy: config = _create_config(fuzz_seconds=FUZZ_SECONDS, workspace=fuzzer_dir_copy, project_name='curl', sanitizer=sanitizer) run_success, bug_found = run_fuzzers.run_fuzzers(config) self.assertTrue(run_success) self.assertFalse(bug_found)
def test_timeout_reported(self, report_timeouts, expect_crash): """Tests that timeouts are not reported.""" with test_helpers.temp_dir_copy(TEST_DATA_PATH) as temp_dir: fuzz_target_path = os.path.join(temp_dir, 'build-out', self.TIMEOUT_FUZZER_NAME) shutil.copy(os.path.join(temp_dir, self.TIMEOUT_FUZZER_NAME), fuzz_target_path) deployment = _create_deployment(workspace=temp_dir, report_timeouts=report_timeouts) config = deployment.config fuzz_target_obj = fuzz_target.FuzzTarget( fuzz_target_path, fuzz_target.REPRODUCE_ATTEMPTS, deployment.workspace, deployment, config) with mock.patch('clusterfuzz._internal.bot.fuzzers.libfuzzer.' 'fix_timeout_argument_for_reproduction') as _: with mock.patch( 'clusterfuzz._internal.bot.fuzzers.libFuzzer.fuzzer.get_arguments', return_value=['-timeout=1', '-rss_limit_mb=2560']): fuzz_result = fuzz_target_obj.fuzz() self.assertEqual(bool(fuzz_result.testcase), expect_crash)