Пример #1
0
 def test_fuzzer_without_suffix(self):
     path = self._create_file('abc',
                              contents=b'anything\nLLVMFuzzerTestOneInput')
     self.assertTrue(utils.is_fuzz_target_local(path))
Пример #2
0
 def test_fuzzer_without_file_string_and_without_name_regex_match(self):
     environment.set_value('FUZZER_NAME_REGEX', '.*_custom$')
     path = self._create_file('nomatch', contents=b'anything')
     self.assertFalse(utils.is_fuzz_target_local(path))
Пример #3
0
 def test_fuzzer_py(self):
     path = self._create_file('abc_fuzzer.par', contents=b'anything')
     self.assertTrue(utils.is_fuzz_target_local(path))
Пример #4
0
 def test_fuzzer_not_exist(self):
     self.assertFalse(utils.is_fuzz_target_local('/not_exist_fuzzer'))
Пример #5
0
 def test_not_a_fuzzer_without_extension(self):
     path = self._create_file('abc', contents=b'anything')
     self.assertFalse(utils.is_fuzz_target_local(path))
Пример #6
0
 def test_not_a_fuzzer_with_extension_and_suffix(self):
     path = self._create_file('abc_fuzzer.dict',
                              contents=b'LLVMFuzzerTestOneInput')
     self.assertFalse(utils.is_fuzz_target_local(path))
Пример #7
0
 def test_not_a_fuzzer_blocklisted_name(self):
     path = self._create_file('jazzer_driver',
                              contents=b'LLVMFuzzerTestOneInput')
     self.assertFalse(utils.is_fuzz_target_local(path))
Пример #8
0
 def test_not_a_fuzzer_invalid_name(self):
     path = self._create_file('abc$_fuzzer',
                              contents=b'LLVMFuzzerTestOneInput')
     self.assertFalse(utils.is_fuzz_target_local(path))
Пример #9
0
 def test_file_handle(self):
     """Test with a file handle."""
     path = self._create_file('abc',
                              contents=b'anything\nLLVMFuzzerTestOneInput')
     with open(path, 'rb') as f:
         self.assertTrue(utils.is_fuzz_target_local('name', f))
Пример #10
0
 def test_fuzzer_with_fuzzer_name_and_without_name_regex_match(self):
     environment.set_value('FUZZER_NAME_REGEX', '.*_custom$')
     path = self._create_file('a_fuzzer',
                              contents=b'anything\nLLVMFuzzerTestOneInput')
     self.assertTrue(utils.is_fuzz_target_local(path))
Пример #11
0
def is_fuzz_target(file_path, file_handle=None):
    """Returns whether |file_path| is a fuzz target."""
    return utils.is_fuzz_target_local(file_path, file_handle)