tools/perf/run_gtest_benchmark.py
def _MapDeviceTracePath(trace_dir, result_json):
  """Maps trace file paths to |trace_dir|. It is needed when gtest runs
  on a real device and trace file is the absolute path on the device. If
  gtest runs on a bot, the returned result should be the same as input.

  Args:
    result_json: JSON string of a test result.

  Returns the JSON string of a LUCI test result with trace file path mapped.
  """
  result = json.loads(result_json)
  test_result = result.get('testResult', {})
  artifacts = test_result.get('outputArtifacts', {})
  trace_names = [name for name in artifacts if name.startswith('trace/')]
  for name in trace_names:
    trace_file = artifacts[name]['filePath']
    trace_file = os.path.join(trace_dir, os.path.basename(trace_file))
    artifacts[name]['filePath'] = trace_file

  if artifacts:
    result['testResult']['outputArtifacts'] = artifacts

  return json.dumps(result)
Maps trace file paths to |trace_dir|. It is needed when gtest runs
  on a real device and trace file is the absolute path on the device. If
  gtest runs on a bot, the returned result should be the same as input.

  Args:
    result_json: JSON string of a test result.

  Returns the JSON string of a LUCI test result with trace file path mapped.
  
Maps trace file paths to |trace_dir|. It is needed when gtest runs
on a real device and trace file is the absolute path on the device. If
gtest runs on a bot, the returned result should be the same as input.
Maps trace file paths to |trace_dir| . It is needed when gtest runs on a real device and trace file is the absolute path on the device . If gtest runs on a bot the returned result should be the same as input .
def _MapDeviceTracePath(trace_dir, result_json):
  result = json.loads(result_json)
  test_result = result.get('testResult', {})
  artifacts = test_result.get('outputArtifacts', {})
  trace_names = [name for name in artifacts if name.startswith('trace/')]
  for name in trace_names:
    trace_file = artifacts[name]['filePath']
    trace_file = os.path.join(trace_dir, os.path.basename(trace_file))
    artifacts[name]['filePath'] = trace_file
  if artifacts:
    result['testResult']['outputArtifacts'] = artifacts
  return json.dumps(result)
def _MapDeviceTracePath ( trace_dir , result_json ) : result = json . loads ( result_json ) test_result = result . get ( 'testResult' , { } ) artifacts = test_result . get ( 'outputArtifacts' , { } ) trace_names = [ name for name in artifacts if name . startswith ( 'trace/' ) ] for name in trace_names : trace_file = artifacts [ name ] [ 'filePath' ] trace_file = os . path . join ( trace_dir , os . path . basename ( trace_file ) ) artifacts [ name ] [ 'filePath' ] = trace_file if artifacts : result [ 'testResult' ] [ 'outputArtifacts' ] = artifacts return json . dumps ( result )
Maps trace file paths to |trace_dir|.
Maps trace file paths to |trace_dir| .
"""Maps trace file paths to |trace_dir|. It is needed when gtest runs
  on a real device and trace file is the absolute path on the device. If
  gtest runs on a bot, the returned result should be the same as input.

  Args:
    result_json: JSON string of a test result.

  Returns the JSON string of a LUCI test result with trace file path mapped.
  """
trace_dir
result_json
JSON string of a test result.
JSON string of a test result .