tools/fuchsia/comparative_tester/comparative_tester.py
def GenerateTestData(do_config: bool, do_build: bool, num_reps: int,
                     is_debug: bool, filter_flag: str):
  """Initializes directories, builds test targets, and repeatedly executes them
  on both operating systems

  Args:
    do_config (bool): Whether or not to run GN for the output directories
    do_build (bool): Whether or not to run ninja for the test targets.
    num_reps (int): How many times to run each test on a given device.
    is_debug (bool): Whether or not this should be a debug build of the tests.
    filter_flag (str): The --gtest_filter flag, to be parsed as such.
  """
  # Find and make the necessary directories
  DIR_SOURCE_ROOT = os.path.abspath(
      os.path.join(os.path.dirname(__file__), *([os.pardir] * 3)))
  os.chdir(DIR_SOURCE_ROOT)
  os.makedirs(target_spec.results_dir, exist_ok=True)
  os.makedirs(target_spec.raw_linux_dir, exist_ok=True)
  os.makedirs(target_spec.raw_fuchsia_dir, exist_ok=True)

  # Grab parameters from config file.
  linux_dir = target_spec.linux_out_dir
  fuchsia_dir = target_spec.fuchsia_out_dir

  # Parse filters passed in by flag
  pos_filter_chunk, neg_filter_chunk = filter_flag.split("-", 1)
  pos_filters = pos_filter_chunk.split(":")
  neg_filters = neg_filter_chunk.split(":")

  test_input = []  # type: List[TestTarget]
  for target in target_spec.test_targets:
    test_input.append(TestTarget(target, pos_filters, neg_filters))
  print("Test targets collected:\n{}".format(",".join(
      [test._target for test in test_input])))
  if do_config:
    RunGnForDirectory(linux_dir, "linux", is_debug)
    RunGnForDirectory(fuchsia_dir, "fuchsia", is_debug)
    print("Ran GN")
  elif is_debug:
    logging.warning("The --is_debug flag is ignored unless --do_config is also \
                     specified")

  if do_build:
    # Build test targets in both output directories.
    for directory in [linux_dir, fuchsia_dir]:
      build_command = ["autoninja", "-C", directory] \
                    + [test._target for test in test_input]
      RunCommand(build_command,
                 "autoninja failed in directory {}".format(directory))
    print("Builds completed.")

  # Execute the tests, one at a time, per system, and collect their results.
  for i in range(0, num_reps):
    print("Running Test set {}".format(i))
    for test_target in test_input:
      print("Running Target {}".format(test_target._name))
      RunTest(test_target)
      print("Finished {}".format(test_target._name))

  print("Tests Completed")
Initializes directories, builds test targets, and repeatedly executes them
  on both operating systems

  Args:
    do_config (bool): Whether or not to run GN for the output directories
    do_build (bool): Whether or not to run ninja for the test targets.
    num_reps (int): How many times to run each test on a given device.
    is_debug (bool): Whether or not this should be a debug build of the tests.
    filter_flag (str): The --gtest_filter flag, to be parsed as such.
  
Initializes directories, builds test targets, and repeatedly executes them
on both operating systems
Initializes directories builds test targets and repeatedly executes them on both operating systems
def GenerateTestData(do_config: bool, do_build: bool, num_reps: int,
                     is_debug: bool, filter_flag: str):
  DIR_SOURCE_ROOT = os.path.abspath(
      os.path.join(os.path.dirname(__file__), *([os.pardir] * 3)))
  os.chdir(DIR_SOURCE_ROOT)
  os.makedirs(target_spec.results_dir, exist_ok=True)
  os.makedirs(target_spec.raw_linux_dir, exist_ok=True)
  os.makedirs(target_spec.raw_fuchsia_dir, exist_ok=True)
  linux_dir = target_spec.linux_out_dir
  fuchsia_dir = target_spec.fuchsia_out_dir
  pos_filter_chunk, neg_filter_chunk = filter_flag.split("-", 1)
  pos_filters = pos_filter_chunk.split(":")
  neg_filters = neg_filter_chunk.split(":")
  test_input = []  
  for target in target_spec.test_targets:
    test_input.append(TestTarget(target, pos_filters, neg_filters))
  print("Test targets collected:\n{}".format(",".join(
      [test._target for test in test_input])))
  if do_config:
    RunGnForDirectory(linux_dir, "linux", is_debug)
    RunGnForDirectory(fuchsia_dir, "fuchsia", is_debug)
    print("Ran GN")
  elif is_debug:
    logging.warning("The --is_debug flag is ignored unless --do_config is also \
                     specified")
  if do_build:
    for directory in [linux_dir, fuchsia_dir]:
      build_command = ["autoninja", "-C", directory] \
                    + [test._target for test in test_input]
      RunCommand(build_command,
                 "autoninja failed in directory {}".format(directory))
    print("Builds completed.")
  for i in range(0, num_reps):
    print("Running Test set {}".format(i))
    for test_target in test_input:
      print("Running Target {}".format(test_target._name))
      RunTest(test_target)
      print("Finished {}".format(test_target._name))
  print("Tests Completed")
def GenerateTestData ( do_config : bool , do_build : bool , num_reps : int , is_debug : bool , filter_flag : str ) : DIR_SOURCE_ROOT = os . path . abspath ( os . path . join ( os . path . dirname ( __file__ ) , * ( [ os . pardir ] * 3 ) ) ) os . chdir ( DIR_SOURCE_ROOT ) os . makedirs ( target_spec . results_dir , exist_ok = True ) os . makedirs ( target_spec . raw_linux_dir , exist_ok = True ) os . makedirs ( target_spec . raw_fuchsia_dir , exist_ok = True ) linux_dir = target_spec . linux_out_dir fuchsia_dir = target_spec . fuchsia_out_dir pos_filter_chunk , neg_filter_chunk = filter_flag . split ( "-" , 1 ) pos_filters = pos_filter_chunk . split ( ":" ) neg_filters = neg_filter_chunk . split ( ":" ) test_input = [ ] for target in target_spec . test_targets : test_input . append ( TestTarget ( target , pos_filters , neg_filters ) ) print ( "Test targets collected:\n{}" . format ( "," . join ( [ test . _target for test in test_input ] ) ) ) if do_config : RunGnForDirectory ( linux_dir , "linux" , is_debug ) RunGnForDirectory ( fuchsia_dir , "fuchsia" , is_debug ) print ( "Ran GN" ) elif is_debug : logging . warning ( "The --is_debug flag is ignored unless --do_config is also \
                     specified" ) if do_build : for directory in [ linux_dir , fuchsia_dir ] : build_command = [ "autoninja" , "-C" , directory ] + [ test . _target for test in test_input ] RunCommand ( build_command , "autoninja failed in directory {}" . format ( directory ) ) print ( "Builds completed." ) for i in range ( 0 , num_reps ) : print ( "Running Test set {}" . format ( i ) ) for test_target in test_input : print ( "Running Target {}" . format ( test_target . _name ) ) RunTest ( test_target ) print ( "Finished {}" . format ( test_target . _name ) ) print ( "Tests Completed" )
Initializes directories, builds test targets, and repeatedly executes them
on both operating systems
Initializes directories builds test targets and repeatedly executes them on both operating systems
"""Initializes directories, builds test targets, and repeatedly executes them
  on both operating systems

  Args:
    do_config (bool): Whether or not to run GN for the output directories
    do_build (bool): Whether or not to run ninja for the test targets.
    num_reps (int): How many times to run each test on a given device.
    is_debug (bool): Whether or not this should be a debug build of the tests.
    filter_flag (str): The --gtest_filter flag, to be parsed as such.
  """ # Find and make the necessary directories # Grab parameters from config file. # Parse filters passed in by flag # type: List[TestTarget] # Build test targets in both output directories. # Execute the tests, one at a time, per system, and collect their results.
do_config
bool
Whether or not to run GN for the output directories
Whether or not to run GN for the output directories
do_build
bool
Whether or not to run ninja for the test targets.
Whether or not to run ninja for the test targets .
num_reps
int
None
is_debug
bool
Whether or not this should be a debug build of the tests.
Whether or not this should be a debug build of the tests .
filter_flag
str
-gtest_filter flag, to be parsed as such.
- gtest_filter flag to be parsed as such .