def test_target_not_found(self): """Test target not found.""" testcase_file_path = os.path.join(self.temp_dir, 'testcase') with open(testcase_file_path, 'wb') as f: f.write(b'EEE') self._setup_env(job_type='libfuzzer_asan_job') build_manager.setup_build() with self.assertRaises(testcase_manager.TargetNotFoundError): testcase_manager.engine_reproduce( libfuzzer_engine.LibFuzzerEngine(), 'does_not_exist', testcase_file_path, [], 30)
def test_reproduce(self): """Test reproduce.""" testcase_file_path = os.path.join(self.temp_dir, 'testcase') with open(testcase_file_path, 'wb') as f: f.write(b'EEE') self._setup_env(job_type='libfuzzer_asan_job') build_manager.setup_build() result = testcase_manager.engine_reproduce( libfuzzer_engine.LibFuzzerEngine(), 'test_fuzzer', testcase_file_path, [], 30) self.assertEqual([ os.path.join(environment.get_value('BUILD_DIR'), 'test_fuzzer'), '-runs=100', file_host.rebase_to_worker_root(testcase_file_path) ], result.command) self.assertEqual(result.return_code, libfuzzer_constants.TARGET_ERROR_EXITCODE) self.assertGreater(result.time_executed, 0) self.assertIn('Running 1 inputs 100 time(s) each', result.output) self.assertIn( 'AddressSanitizer: SEGV on unknown address 0x000000000000', result.output)
def engine_reproduce(request, _): """Run engine reproduce.""" engine_impl = engine.get(request.engine) result = testcase_manager.engine_reproduce(engine_impl, request.target_name, request.testcase_path, request.arguments, request.timeout) return untrusted_runner_pb2.EngineReproduceResult( command=result.command, return_code=result.return_code, time_executed=result.time_executed, output=result.output)
def test_reproduce(self): """Test reproduce.""" testcase_file_path = os.path.join(self.temp_dir, 'testcase') with open(testcase_file_path, 'wb') as f: f.write('EEE') self._setup_env(job_type='libfuzzer_asan_job') build_manager.setup_build() result = testcase_manager.engine_reproduce( libfuzzer_engine.LibFuzzerEngine(), 'test_fuzzer', testcase_file_path, [], 30) self.assertIn('Running 1 inputs 100 time(s) each', result.output) self.assertIn('AddressSanitizer: SEGV on unknown address 0x000000000000', result.output)