tools/fuchsia/comparative_tester/test_results.py
def TargetResultFromStdout(lines: List[str], name: str) -> TargetResult:
  """TargetResultFromStdout attempts to associate GTest names to the lines of
  output that they produce. Example input looks something like the following:

  [ RUN      ] TestNameFoo
  INFO measurement units
  ...
  [       OK ] TestNameFoo (measurement units)
  ...

  Unfortunately, Because the results of output from perftest targets is not
  necessarily consistent between test targets, this makes a best-effort to parse
  as much information from them as possible.

  Args:
    lines (List[str]): The entire list of lines from the standard output to be
        parsed.
    name (str): The name of the Target that generated the output. Necessary to
        be able to give the TargetResult a meaningful name.

  Returns:
    TargetResult: The TargetResult object parsed from the input lines.
  """

  test_line_lists = []  # type: List[List[str]]
  test_line_accum = []  # type: List[str]
  read_lines = False
  for line in lines:
    # We're starting a test suite
    if line.startswith("[ RUN      ]"):
      read_lines = True
      # We have a prior suite that needs to be added
      if len(test_line_accum) > 0:
        test_line_lists.append(test_line_accum)
        test_line_accum = []
    elif read_lines:
      # We don't actually care about the data in the RUN line, just its
      # presence. the OK line contains the same info, as well as the total test
      # run time
      test_line_accum.append(line)
      if line.startswith("[       OK ]"):
        read_lines = False

  test_cases = [
      TaggedTestFromLines(test_lines) for test_lines in test_line_lists
  ]
  return TargetResult(name, test_cases)
TargetResultFromStdout attempts to associate GTest names to the lines of
  output that they produce. Example input looks something like the following:

  [ RUN      ] TestNameFoo
  INFO measurement units
  ...
  [       OK ] TestNameFoo (measurement units)
  ...

  Unfortunately, Because the results of output from perftest targets is not
  necessarily consistent between test targets, this makes a best-effort to parse
  as much information from them as possible.

  Args:
    lines (List[str]): The entire list of lines from the standard output to be
        parsed.
    name (str): The name of the Target that generated the output. Necessary to
        be able to give the TargetResult a meaningful name.

  Returns:
    TargetResult: The TargetResult object parsed from the input lines.
  
TargetResultFromStdout attempts to associate GTest names to the lines of
output that they produce. Example input looks something like the following.

[ RUN      ] TestNameFoo
INFO measurement units

[       OK ] TestNameFoo (measurement units)

Unfortunately, Because the results of output from perftest targets is not
necessarily consistent between test targets, this makes a best-effort to parse
as much information from them as possible.
TargetResultFromStdout attempts to associate GTest names to the lines of output that they produce . Example input looks something like the following . [ RUN ] TestNameFoo INFO measurement units [ OK ] TestNameFoo ( measurement units ) Unfortunately Because the results of output from perftest targets is not necessarily consistent between test targets this makes a best - effort to parse as much information from them as possible .
def TargetResultFromStdout(lines: List[str], name: str) -> TargetResult:
  test_line_lists = []  
  test_line_accum = []  
  read_lines = False
  for line in lines:
    if line.startswith("[ RUN      ]"):
      read_lines = True
      if len(test_line_accum) > 0:
        test_line_lists.append(test_line_accum)
        test_line_accum = []
    elif read_lines:
      test_line_accum.append(line)
      if line.startswith("[       OK ]"):
        read_lines = False
  test_cases = [
      TaggedTestFromLines(test_lines) for test_lines in test_line_lists
  ]
  return TargetResult(name, test_cases)
def TargetResultFromStdout ( lines : List [ str ] , name : str ) -> TargetResult : test_line_lists = [ ] test_line_accum = [ ] read_lines = False for line in lines : if line . startswith ( "[ RUN      ]" ) : read_lines = True if len ( test_line_accum ) > 0 : test_line_lists . append ( test_line_accum ) test_line_accum = [ ] elif read_lines : test_line_accum . append ( line ) if line . startswith ( "[       OK ]" ) : read_lines = False test_cases = [ TaggedTestFromLines ( test_lines ) for test_lines in test_line_lists ] return TargetResult ( name , test_cases )
TargetResultFromStdout attempts to associate GTest names to the lines of
output that they produce.
TargetResultFromStdout attempts to associate GTest names to the lines of output that they produce .
"""TargetResultFromStdout attempts to associate GTest names to the lines of
  output that they produce. Example input looks something like the following:

  [ RUN      ] TestNameFoo
  INFO measurement units
  ...
  [       OK ] TestNameFoo (measurement units)
  ...

  Unfortunately, Because the results of output from perftest targets is not
  necessarily consistent between test targets, this makes a best-effort to parse
  as much information from them as possible.

  Args:
    lines (List[str]): The entire list of lines from the standard output to be
        parsed.
    name (str): The name of the Target that generated the output. Necessary to
        be able to give the TargetResult a meaningful name.

  Returns:
    TargetResult: The TargetResult object parsed from the input lines.
  """ # type: List[List[str]] # type: List[str] # We're starting a test suite # We have a prior suite that needs to be added # We don't actually care about the data in the RUN line, just its # presence. the OK line contains the same info, as well as the total test # run time
The TargetResult object parsed from the input lines.
The TargetResult object parsed from the input lines .
TargetResult
lines
List[str]
The entire list of lines from the standard output to be
parsed.
The entire list of lines from the standard output to be parsed .
name
str
The name of the Target that generated the output. Necessary to
be able to give the TargetResult a meaningful name.
The name of the Target that generated the output . Necessary to be able to give the TargetResult a meaningful name .