tools/android/find_annotated_tests.py
def _GetReportMeta(utc_script_runtime_string, total_test_count):
  """Returns a dictionary of the report's metadata"""
  revision = cmd_helper.GetCmdOutput(['git', 'rev-parse', 'HEAD']).strip()
  raw_string = cmd_helper.GetCmdOutput(
      ['git', 'log', '--pretty=format:%at', '--max-count=1', 'HEAD'])
  time_string_search = re.search(_GIT_LOG_TIME_PATTERN, raw_string)
  if time_string_search is None:
    raise Exception('Timestamp format incorrect, expected all digits, got %s'
                    % raw_string)

  raw_string = cmd_helper.GetCmdOutput(
      ['git', 'log', '--pretty=format:%b', '--max-count=1', 'HEAD'])
  commit_pos_search = re.search(_GIT_LOG_MESSAGE_PATTERN, raw_string)
  if commit_pos_search is None:
    raise Exception('Cr-Commit-Position is not found, potentially running with '
                    'uncommited HEAD')
  commit_pos = int(commit_pos_search.group(1))

  utc_revision_time = datetime.datetime.utcfromtimestamp(
      int(time_string_search.group(0)))
  utc_revision_time = utc_revision_time.strftime(_EXPORT_TIME_FORMAT)
  logging.info(
      'revision is %s, revision time is %s', revision, utc_revision_time)

  return {
      'revision': revision,
      'commit_pos': commit_pos,
      'script_runtime': utc_script_runtime_string,
      'revision_time': utc_revision_time,
      'platform': 'android',
      'total_test_count': total_test_count
  }
Returns a dictionary of the report's metadata
Returns a dictionary of the report's metadata
Returns a dictionary of the report ' s metadata
def _GetReportMeta(utc_script_runtime_string, total_test_count):
  revision = cmd_helper.GetCmdOutput(['git', 'rev-parse', 'HEAD']).strip()
  raw_string = cmd_helper.GetCmdOutput(
      ['git', 'log', '--pretty=format:%at', '--max-count=1', 'HEAD'])
  time_string_search = re.search(_GIT_LOG_TIME_PATTERN, raw_string)
  if time_string_search is None:
    raise Exception('Timestamp format incorrect, expected all digits, got %s'
                    % raw_string)
  raw_string = cmd_helper.GetCmdOutput(
      ['git', 'log', '--pretty=format:%b', '--max-count=1', 'HEAD'])
  commit_pos_search = re.search(_GIT_LOG_MESSAGE_PATTERN, raw_string)
  if commit_pos_search is None:
    raise Exception('Cr-Commit-Position is not found, potentially running with '
                    'uncommited HEAD')
  commit_pos = int(commit_pos_search.group(1))
  utc_revision_time = datetime.datetime.utcfromtimestamp(
      int(time_string_search.group(0)))
  utc_revision_time = utc_revision_time.strftime(_EXPORT_TIME_FORMAT)
  logging.info(
      'revision is %s, revision time is %s', revision, utc_revision_time)
  return {
      'revision': revision,
      'commit_pos': commit_pos,
      'script_runtime': utc_script_runtime_string,
      'revision_time': utc_revision_time,
      'platform': 'android',
      'total_test_count': total_test_count
  }
def _GetReportMeta ( utc_script_runtime_string , total_test_count ) : revision = cmd_helper . GetCmdOutput ( [ 'git' , 'rev-parse' , 'HEAD' ] ) . strip ( ) raw_string = cmd_helper . GetCmdOutput ( [ 'git' , 'log' , '--pretty=format:%at' , '--max-count=1' , 'HEAD' ] ) time_string_search = re . search ( _GIT_LOG_TIME_PATTERN , raw_string ) if time_string_search is None : raise Exception ( 'Timestamp format incorrect, expected all digits, got %s' % raw_string ) raw_string = cmd_helper . GetCmdOutput ( [ 'git' , 'log' , '--pretty=format:%b' , '--max-count=1' , 'HEAD' ] ) commit_pos_search = re . search ( _GIT_LOG_MESSAGE_PATTERN , raw_string ) if commit_pos_search is None : raise Exception ( 'Cr-Commit-Position is not found, potentially running with ' 'uncommited HEAD' ) commit_pos = int ( commit_pos_search . group ( 1 ) ) utc_revision_time = datetime . datetime . utcfromtimestamp ( int ( time_string_search . group ( 0 ) ) ) utc_revision_time = utc_revision_time . strftime ( _EXPORT_TIME_FORMAT ) logging . info ( 'revision is %s, revision time is %s' , revision , utc_revision_time ) return { 'revision' : revision , 'commit_pos' : commit_pos , 'script_runtime' : utc_script_runtime_string , 'revision_time' : utc_revision_time , 'platform' : 'android' , 'total_test_count' : total_test_count }
Returns a dictionary of the report's metadata
Returns a dictionary of the report ' s metadata
"""Returns a dictionary of the report's metadata"""
utc_script_runtime_string
total_test_count