import json


def ReadMeasurements(test_result):
  """Read ad hoc measurements recorded on a test result."""
  try:
    artifact = test_result['outputArtifacts']['measurements.json']
  except KeyError:
    return {}
  with open(artifact['filePath']) as f:
    return json.load(f)['measurements']