コード例 #1
0
def process_testcase(request, _):
    """Process testcase."""
    tool_name_map = {
        untrusted_runner_pb2.ProcessTestcaseRequest.MINIMIZE: "minimize",
        untrusted_runner_pb2.ProcessTestcaseRequest.CLEANSE: "cleanse",
    }

    # TODO(ochang): Support other engines.
    if request.engine != "libFuzzer":
        raise AssertionError
    if request.operation not in tool_name_map:
        raise AssertionError

    result = minimize_task.run_libfuzzer_engine(
        tool_name_map[request.operation],
        request.target_name,
        request.arguments,
        request.testcase_path,
        request.output_path,
        request.timeout,
    )

    return untrusted_runner_pb2.EngineReproduceResult(
        return_code=result.return_code,
        time_executed=result.time_executed,
        output=result.output,
    )
コード例 #2
0
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)
コード例 #3
0
def process_testcase(request, _):
  """Process testcase."""
  tool_name_map = {
      untrusted_runner_pb2.ProcessTestcaseRequest.MINIMIZE: 'minimize',
      untrusted_runner_pb2.ProcessTestcaseRequest.CLEANSE: 'cleanse',
  }

  # TODO(ochang): Support other engines.
  assert request.engine == 'libFuzzer'
  assert request.operation in tool_name_map

  result = minimize_task.run_libfuzzer_engine(
      tool_name_map[request.operation], request.target_name, request.arguments,
      request.testcase_path, request.output_path, request.timeout)

  return untrusted_runner_pb2.EngineReproduceResult(
      return_code=result.return_code,
      time_executed=result.time_executed,
      output=result.output)