build/fuchsia/run_test_package.py
def RunTestPackage(output_dir, target, package_paths, package_name,
                   package_args, args):
  """Installs the Fuchsia package at |package_path| on the target,
  executes it with |package_args|, and symbolizes its output.

  output_dir: The path containing the build output files.
  target: The deployment Target object that will run the package.
  package_paths: The paths to the .far packages to be installed.
  package_name: The name of the primary package to run.
  package_args: The arguments which will be passed to the Fuchsia process.
  args: RunTestPackageArgs instance configuring how the package will be run.

  Returns the exit code of the remote package process."""

  with target.GetPkgRepo():
    start_time = time.time()
    target.InstallPackage(package_paths)
    logging.info('Test installed in {:.2f} seconds.'.format(time.time() -
                                                            start_time))

    # TODO(crbug.com/1156768): Deprecate runtests.
    if args.code_coverage:
      # runtests requires specifying an output directory and a double dash
      # before the argument list.
      command = ['runtests', '-o', '/tmp', _GetComponentUri(package_name)]
      if args.test_realm_label:
        command += ['--realm-label', args.test_realm_label]
      command += ['--']
    elif args.use_run_test_component:
      command = ['run-test-component']
      if args.test_realm_label:
        command += ['--realm-label=%s' % args.test_realm_label]
      command.append(_GetComponentUri(package_name))
      command.append('--')
    else:
      command = ['run', _GetComponentUri(package_name)]

    command.extend(package_args)

    process = target.RunCommandPiped(command,
                                     stdin=open(os.devnull, 'r'),
                                     stdout=subprocess.PIPE,
                                     stderr=subprocess.STDOUT,
                                     text=True)

    # Print the test process' symbolized standard output.
    for next_line in SymbolizerFilter(process.stdout,
                                      BuildIdsPaths(package_paths)):
      print(next_line.rstrip())

    process.wait()
    if process.returncode == 0:
      logging.info('Process exited normally with status code 0.')
    else:
      # The test runner returns an error status code if *any* tests fail,
      # so we should proceed anyway.
      logging.warning('Process exited with status code %d.' %
                      process.returncode)

  return process.returncode
Installs the Fuchsia package at |package_path| on the target,
  executes it with |package_args|, and symbolizes its output.

  output_dir: The path containing the build output files.
  target: The deployment Target object that will run the package.
  package_paths: The paths to the .far packages to be installed.
  package_name: The name of the primary package to run.
  package_args: The arguments which will be passed to the Fuchsia process.
  args: RunTestPackageArgs instance configuring how the package will be run.

  Returns the exit code of the remote package process.
Installs the Fuchsia package at |package_path| on the target,
executes it with |package_args|, and symbolizes its output.

The path containing the build output files.
target: The deployment Target object that will run the package.
package_paths: The paths to the .far packages to be installed.
package_name: The name of the primary package to run.
package_args: The arguments which will be passed to the Fuchsia process.
args: RunTestPackageArgs instance configuring how the package will be run.

Returns the exit code of the remote package process.
Installs the Fuchsia package at |package_path| on the target executes it with |package_args| and symbolizes its output . The path containing the build output files . target : The deployment Target object that will run the package . package_paths : The paths to the . far packages to be installed . package_name : The name of the primary package to run . package_args : The arguments which will be passed to the Fuchsia process . args : RunTestPackageArgs instance configuring how the package will be run . Returns the exit code of the remote package process .
def RunTestPackage(output_dir, target, package_paths, package_name,
                   package_args, args):
  with target.GetPkgRepo():
    start_time = time.time()
    target.InstallPackage(package_paths)
    logging.info('Test installed in {:.2f} seconds.'.format(time.time() -
                                                            start_time))
    if args.code_coverage:
      command = ['runtests', '-o', '/tmp', _GetComponentUri(package_name)]
      if args.test_realm_label:
        command += ['--realm-label', args.test_realm_label]
      command += ['--']
    elif args.use_run_test_component:
      command = ['run-test-component']
      if args.test_realm_label:
        command += ['--realm-label=%s' % args.test_realm_label]
      command.append(_GetComponentUri(package_name))
      command.append('--')
    else:
      command = ['run', _GetComponentUri(package_name)]
    command.extend(package_args)
    process = target.RunCommandPiped(command,
                                     stdin=open(os.devnull, 'r'),
                                     stdout=subprocess.PIPE,
                                     stderr=subprocess.STDOUT,
                                     text=True)
    for next_line in SymbolizerFilter(process.stdout,
                                      BuildIdsPaths(package_paths)):
      print(next_line.rstrip())
    process.wait()
    if process.returncode == 0:
      logging.info('Process exited normally with status code 0.')
    else:
      logging.warning('Process exited with status code %d.' %
                      process.returncode)
  return process.returncode
def RunTestPackage ( output_dir , target , package_paths , package_name , package_args , args ) : with target . GetPkgRepo ( ) : start_time = time . time ( ) target . InstallPackage ( package_paths ) logging . info ( 'Test installed in {:.2f} seconds.' . format ( time . time ( ) - start_time ) ) if args . code_coverage : command = [ 'runtests' , '-o' , '/tmp' , _GetComponentUri ( package_name ) ] if args . test_realm_label : command += [ '--realm-label' , args . test_realm_label ] command += [ '--' ] elif args . use_run_test_component : command = [ 'run-test-component' ] if args . test_realm_label : command += [ '--realm-label=%s' % args . test_realm_label ] command . append ( _GetComponentUri ( package_name ) ) command . append ( '--' ) else : command = [ 'run' , _GetComponentUri ( package_name ) ] command . extend ( package_args ) process = target . RunCommandPiped ( command , stdin = open ( os . devnull , 'r' ) , stdout = subprocess . PIPE , stderr = subprocess . STDOUT , text = True ) for next_line in SymbolizerFilter ( process . stdout , BuildIdsPaths ( package_paths ) ) : print ( next_line . rstrip ( ) ) process . wait ( ) if process . returncode == 0 : logging . info ( 'Process exited normally with status code 0.' ) else : logging . warning ( 'Process exited with status code %d.' % process . returncode ) return process . returncode
Installs the Fuchsia package at |package_path| on the target,
executes it with |package_args|, and symbolizes its output.
Installs the Fuchsia package at |package_path| on the target executes it with |package_args| and symbolizes its output .
"""Installs the Fuchsia package at |package_path| on the target,
  executes it with |package_args|, and symbolizes its output.

  output_dir: The path containing the build output files.
  target: The deployment Target object that will run the package.
  package_paths: The paths to the .far packages to be installed.
  package_name: The name of the primary package to run.
  package_args: The arguments which will be passed to the Fuchsia process.
  args: RunTestPackageArgs instance configuring how the package will be run.

  Returns the exit code of the remote package process.""" # TODO(crbug.com/1156768): Deprecate runtests. # runtests requires specifying an output directory and a double dash # before the argument list. # Print the test process' symbolized standard output. # The test runner returns an error status code if *any* tests fail, # so we should proceed anyway.
output_dir
target
package_paths
package_name
package_args
args