예제 #1
0
def main():
  parser = argparse.ArgumentParser()
  AddRunnerCommandLineArguments(parser)
  parser.add_argument('--extra-file', action='append', default=[],
                      help='Extra file to add to bootfs, '
                           '<bootfs_path>=<local_path>')
  parser.add_argument('--no-autorun', action='store_true',
                      help='Disable generating an autorun file')
  args, child_args = parser.parse_known_args()

  runtime_deps = ReadRuntimeDeps(args.runtime_deps_path, args.output_directory)
  for extra_file in args.extra_file:
    parts = extra_file.split("=", 1)
    if len(parts) < 2:
      print 'Invalid --extra-file: ', extra_file
      print 'Expected format: --extra-file <bootfs_path>=<local_path>'
      return 2
    runtime_deps.append(tuple(parts))

  image_creation_data = ImageCreationData(
      output_directory=args.output_directory,
      exe_name=args.exe_name,
      runtime_deps=runtime_deps,
      target_cpu=args.target_cpu,
      dry_run=args.dry_run,
      child_args=child_args,
      use_device=args.device,
      bootdata=args.bootdata,
      wait_for_network=True,
      use_autorun=not args.no_autorun)
  bootfs = BuildBootfs(image_creation_data)
  if not bootfs:
    return 2

  return RunFuchsia(bootfs, args.device, args.kernel, args.dry_run, None)
예제 #2
0
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument('--dry-run',
                        '-n',
                        action='store_true',
                        default=False,
                        help='Just print commands, don\'t execute them.')
    parser.add_argument('--output-directory',
                        type=os.path.realpath,
                        help=('Path to the directory in which build files are'
                              ' located (must include build type).'))
    parser.add_argument('--runtime-deps-path',
                        type=os.path.realpath,
                        help='Runtime data dependency file from GN.')
    parser.add_argument('--exe-name',
                        type=os.path.realpath,
                        help='Name of the the binary executable.')
    parser.add_argument('-d',
                        '--device',
                        action='store_true',
                        default=False,
                        help='Run on hardware device instead of QEMU.')
    args, child_args = parser.parse_known_args()

    bootfs = BuildBootfs(args.output_directory,
                         ReadRuntimeDeps(args.runtime_deps_path,
                                         args.output_directory),
                         args.exe_name,
                         child_args,
                         args.dry_run,
                         power_off=False)
    if not bootfs:
        return 2

    return RunFuchsia(bootfs, args.device, args.dry_run)
예제 #3
0
def main():
    parser = argparse.ArgumentParser()
    AddCommonCommandLineArguments(parser)
    args, child_args = parser.parse_known_args()

    data = ImageCreationData(output_directory=args.output_directory,
                             exe_name=args.exe_name,
                             runtime_deps=ReadRuntimeDeps(
                                 args.runtime_deps_path,
                                 args.output_directory),
                             target_cpu=args.target_cpu)
    BuildArchive(
        data, '%s_archive_%s.tar.gz' %
        (os.path.basename(args.exe_name), args.target_cpu))
예제 #4
0
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument('--dry-run',
                        '-n',
                        action='store_true',
                        default=False,
                        help='Just print commands, don\'t execute them.')
    parser.add_argument('--output-directory',
                        type=os.path.realpath,
                        help=('Path to the directory in which build files are'
                              ' located (must include build type).'))
    parser.add_argument('--runtime-deps-path',
                        type=os.path.realpath,
                        help='Runtime data dependency file from GN.')
    parser.add_argument('--exe-name',
                        type=os.path.realpath,
                        help='Name of the the test')
    parser.add_argument('--enable-test-server',
                        action='store_true',
                        default=False,
                        help='Enable testserver spawner.')
    parser.add_argument('--gtest_filter',
                        help='GTest filter to use in place of any default.')
    parser.add_argument(
        '--gtest_repeat',
        help='GTest repeat value to use. This also disables the '
        'test launcher timeout.')
    parser.add_argument('--gtest_break_on_failure',
                        action='store_true',
                        default=False,
                        help='Should GTest break on failure; useful with '
                        '--gtest_repeat.')
    parser.add_argument('--single-process-tests',
                        action='store_true',
                        default=False,
                        help='Runs the tests and the launcher in the same '
                        'process. Useful for debugging.')
    parser.add_argument('--test-launcher-batch-limit',
                        type=int,
                        help='Sets the limit of test batch to run in a single '
                        'process.')
    # --test-launcher-filter-file is specified relative to --output-directory,
    # so specifying type=os.path.* will break it.
    parser.add_argument('--test-launcher-filter-file',
                        help='Pass filter file through to target process.')
    parser.add_argument('--test-launcher-jobs',
                        type=int,
                        help='Sets the number of parallel test jobs.')
    parser.add_argument('--test-launcher-summary-output',
                        '--test_launcher_summary_output',
                        help='Where the test launcher will output its json.')
    parser.add_argument('child_args',
                        nargs='*',
                        help='Arguments for the test process.')
    parser.add_argument('-d',
                        '--device',
                        action='store_true',
                        default=False,
                        help='Run on hardware device instead of QEMU.')
    args = parser.parse_args()

    child_args = ['--test-launcher-retry-limit=0']

    if args.single_process_tests:
        child_args.append('--single-process-tests')

    if args.test_launcher_batch_limit:
        child_args.append('--test-launcher-batch-limit=%d' %
                          args.test_launcher_batch_limit)

    test_concurrency = args.test_launcher_jobs \
        if args.test_launcher_jobs else DEFAULT_TEST_CONCURRENCY
    child_args.append('--test-launcher-jobs=%d' % test_concurrency)

    if args.gtest_filter:
        child_args.append('--gtest_filter=' + args.gtest_filter)
    if args.gtest_repeat:
        child_args.append('--gtest_repeat=' + args.gtest_repeat)
        child_args.append('--test-launcher-timeout=-1')
    if args.gtest_break_on_failure:
        child_args.append('--gtest_break_on_failure')
    if args.child_args:
        child_args.extend(args.child_args)

    runtime_deps = ReadRuntimeDeps(args.runtime_deps_path,
                                   args.output_directory)

    spawning_server = None

    # Start test server spawner for tests that need it.
    if args.enable_test_server:
        spawning_server = chrome_test_server_spawner.SpawningServer(
            0, PortForwarderNoop(), test_concurrency)
        spawning_server.Start()

        # Generate test server config.
        config_file = tempfile.NamedTemporaryFile()
        config_file.write(
            json.dumps({
                'name':
                'testserver',
                'address':
                HOST_IP_ADDRESS,
                'spawner_url_base':
                'http://%s:%d' % (HOST_IP_ADDRESS, spawning_server.server_port)
            }))
        config_file.flush()
        runtime_deps.append(('net-test-server-config', config_file.name))

    if args.test_launcher_filter_file:
        # Bundle the filter file in the runtime deps and compose the command-line
        # flag which references it.
        test_launcher_filter_file = os.path.normpath(
            os.path.join(args.output_directory,
                         args.test_launcher_filter_file))
        runtime_deps.append(('test_filter_file', test_launcher_filter_file))
        child_args.append(
            '--test-launcher-filter-file=/system/test_filter_file')

    try:
        bootfs = BuildBootfs(args.output_directory,
                             runtime_deps,
                             args.exe_name,
                             child_args,
                             args.dry_run,
                             summary_output=args.test_launcher_summary_output,
                             power_off=not args.device)
        if not bootfs:
            return 2

        return RunFuchsia(bootfs, args.device, args.dry_run,
                          args.test_launcher_summary_output)
    finally:
        # Stop the spawner to make sure it doesn't leave testserver running, in
        # case some tests failed.
        if spawning_server:
            spawning_server.Stop()
예제 #5
0
def main():
    parser = argparse.ArgumentParser()
    AddRunnerCommandLineArguments(parser)
    parser.add_argument('--enable-test-server',
                        action='store_true',
                        default=False,
                        help='Enable testserver spawner.')
    parser.add_argument('--gtest_filter',
                        help='GTest filter to use in place of any default.')
    parser.add_argument(
        '--gtest_repeat',
        help='GTest repeat value to use. This also disables the '
        'test launcher timeout.')
    parser.add_argument('--gtest_break_on_failure',
                        action='store_true',
                        default=False,
                        help='Should GTest break on failure; useful with '
                        '--gtest_repeat.')
    parser.add_argument('--single-process-tests',
                        action='store_true',
                        default=False,
                        help='Runs the tests and the launcher in the same '
                        'process. Useful for debugging.')
    parser.add_argument('--test-launcher-batch-limit',
                        type=int,
                        help='Sets the limit of test batch to run in a single '
                        'process.')
    # --test-launcher-filter-file is specified relative to --output-directory,
    # so specifying type=os.path.* will break it.
    parser.add_argument(
        '--test-launcher-filter-file',
        default=None,
        help='Override default filter file passed to target test '
        'process. Set an empty path to disable filtering.')
    parser.add_argument('--test-launcher-jobs',
                        type=int,
                        help='Sets the number of parallel test jobs.')
    parser.add_argument('--test-launcher-summary-output',
                        '--test_launcher_summary_output',
                        help='Where the test launcher will output its json.')
    parser.add_argument('child_args',
                        nargs='*',
                        help='Arguments for the test process.')
    args = parser.parse_args()

    child_args = ['--test-launcher-retry-limit=0']

    if args.single_process_tests:
        child_args.append('--single-process-tests')

    if args.test_launcher_batch_limit:
        child_args.append('--test-launcher-batch-limit=%d' %
                          args.test_launcher_batch_limit)

    test_concurrency = args.test_launcher_jobs \
        if args.test_launcher_jobs else DEFAULT_TEST_CONCURRENCY
    child_args.append('--test-launcher-jobs=%d' % test_concurrency)

    if args.gtest_filter:
        child_args.append('--gtest_filter=' + args.gtest_filter)
    if args.gtest_repeat:
        child_args.append('--gtest_repeat=' + args.gtest_repeat)
        child_args.append('--test-launcher-timeout=-1')
    if args.gtest_break_on_failure:
        child_args.append('--gtest_break_on_failure')
    if args.child_args:
        child_args.extend(args.child_args)

    runtime_deps = ReadRuntimeDeps(args.runtime_deps_path,
                                   args.output_directory)

    spawning_server = None

    # Start test server spawner for tests that need it.
    if args.enable_test_server:
        spawning_server = chrome_test_server_spawner.SpawningServer(
            0, PortForwarderNoop(), test_concurrency)
        spawning_server.Start()

        # Generate test server config.
        config_file = tempfile.NamedTemporaryFile()
        config_file.write(
            json.dumps({
                'name':
                'testserver',
                'address':
                HOST_IP_ADDRESS,
                'spawner_url_base':
                'http://%s:%d' % (HOST_IP_ADDRESS, spawning_server.server_port)
            }))
        config_file.flush()
        runtime_deps.append(('net-test-server-config', config_file.name))

    # If no --test-launcher-filter-file is specified, use the default filter path.
    if args.test_launcher_filter_file == None:
        exe_base_name = os.path.basename(args.exe_name)
        test_launcher_filter_file = os.path.normpath(
            os.path.join(
                args.output_directory,
                '../../testing/buildbot/filters/fuchsia.%s.filter' %
                exe_base_name))
        if os.path.exists(test_launcher_filter_file):
            args.test_launcher_filter_file = test_launcher_filter_file

    # Copy the test-launcher-filter-file to the bootfs, if set.
    if args.test_launcher_filter_file:
        # Bundle the filter file in the runtime deps and compose the command-line
        # flag which references it.
        test_launcher_filter_file = os.path.normpath(
            os.path.join(args.output_directory,
                         args.test_launcher_filter_file))
        runtime_deps.append(('test_filter_file', test_launcher_filter_file))
        child_args.append(
            '--test-launcher-filter-file=/system/test_filter_file')

    if args.dry_run:
        print 'Filter file is %s' % (args.test_launcher_filter_file
                                     if args.test_launcher_filter_file else
                                     'not applied.')

    try:
        image_creation_data = ImageCreationData(
            output_directory=args.output_directory,
            exe_name=args.exe_name,
            runtime_deps=runtime_deps,
            target_cpu=args.target_cpu,
            dry_run=args.dry_run,
            child_args=child_args,
            use_device=args.device,
            bootdata=args.bootdata,
            summary_output=args.test_launcher_summary_output,
            shutdown_machine=True,
            wait_for_network=args.wait_for_network,
            use_autorun=True)
        bootfs = BuildBootfs(image_creation_data)
        if not bootfs:
            return 2

        return RunFuchsia(
            bootfs,
            args.device,
            args.kernel,
            args.dry_run,
            test_launcher_summary_output=args.test_launcher_summary_output)
    finally:
        # Stop the spawner to make sure it doesn't leave testserver running, in
        # case some tests failed.
        if spawning_server:
            spawning_server.Stop()
예제 #6
0
def main():
  parser = argparse.ArgumentParser()
  AddRunnerCommandLineArguments(parser)
  parser.add_argument('--enable-test-server', action='store_true',
                      default=False,
                      help='Enable testserver spawner.')
  parser.add_argument('--gtest_filter',
                      help='GTest filter to use in place of any default.')
  parser.add_argument('--gtest_repeat',
                      help='GTest repeat value to use. This also disables the '
                           'test launcher timeout.')
  parser.add_argument('--gtest_break_on_failure', action='store_true',
                      default=False,
                      help='Should GTest break on failure; useful with '
                           '--gtest_repeat.')
  parser.add_argument('--single-process-tests', action='store_true',
                      default=False,
                      help='Runs the tests and the launcher in the same '
                      'process. Useful for debugging.')
  parser.add_argument('--test-launcher-batch-limit',
                      type=int,
                      help='Sets the limit of test batch to run in a single '
                      'process.')
  # --test-launcher-filter-file is specified relative to --output-directory,
  # so specifying type=os.path.* will break it.
  parser.add_argument('--test-launcher-filter-file',
                      default=None,
                      help='Override default filter file passed to target test '
                      'process. Set an empty path to disable filtering.')
  parser.add_argument('--test-launcher-jobs',
                      type=int,
                      help='Sets the number of parallel test jobs.')
  parser.add_argument('--test-launcher-summary-output',
                      '--test_launcher_summary_output',
                      help='Where the test launcher will output its json.')
  parser.add_argument('child_args', nargs='*',
                      help='Arguments for the test process.')
  args = parser.parse_args()

  child_args = ['--test-launcher-retry-limit=0']

  if args.single_process_tests:
    child_args.append('--single-process-tests')

  if args.test_launcher_batch_limit:
    child_args.append('--test-launcher-batch-limit=%d' %
                       args.test_launcher_batch_limit)

  # By default run the same number of test jobs as there are CPU cores.
  # If running tests on a device then the caller should provide the
  # test-launcher-jobs limit explicitly, since we can't count the CPU cores.
  test_concurrency = args.test_launcher_jobs \
      if args.test_launcher_jobs else args.vm_cpu_cores
  child_args.append('--test-launcher-jobs=%d' % test_concurrency)

  if args.gtest_filter:
    child_args.append('--gtest_filter=' + args.gtest_filter)
  if args.gtest_repeat:
    child_args.append('--gtest_repeat=' + args.gtest_repeat)
    child_args.append('--test-launcher-timeout=-1')
  if args.gtest_break_on_failure:
    child_args.append('--gtest_break_on_failure')
  if args.child_args:
    child_args.extend(args.child_args)

  runtime_deps = ReadRuntimeDeps(args.runtime_deps_path, args.output_directory)

  spawning_server = None

  # Start test server spawner for tests that need it.
  if args.enable_test_server:
    spawning_server = chrome_test_server_spawner.SpawningServer(
        0, PortForwarderNoop(), test_concurrency)
    spawning_server.Start()

    # Generate test server config.
    config_file = tempfile.NamedTemporaryFile()
    config_file.write(json.dumps({
      'name': 'testserver',
      'address': HOST_IP_ADDRESS,
      'spawner_url_base': 'http://%s:%d' %
          (HOST_IP_ADDRESS, spawning_server.server_port)
    }))
    config_file.flush()
    runtime_deps.append(('net-test-server-config', config_file.name))

  # If no --test-launcher-filter-file is specified, use the default filter path.
  if args.test_launcher_filter_file == None:
    exe_base_name = os.path.basename(args.exe_name)
    test_launcher_filter_file = os.path.normpath(os.path.join(
        args.output_directory,
        '../../testing/buildbot/filters/fuchsia.%s.filter' % exe_base_name))
    if os.path.exists(test_launcher_filter_file):
      args.test_launcher_filter_file = test_launcher_filter_file

  # Copy the test-launcher-filter-file to the bootfs, if set.
  if args.test_launcher_filter_file:
    # Bundle the filter file in the runtime deps and compose the command-line
    # flag which references it.
    test_launcher_filter_file = os.path.normpath(
        os.path.join(args.output_directory, args.test_launcher_filter_file))
    runtime_deps.append(('test_filter_file', test_launcher_filter_file))
    child_args.append('--test-launcher-filter-file=/system/test_filter_file')

  if args.dry_run:
    print 'Filter file is %s' % (args.test_launcher_filter_file if
                                 args.test_launcher_filter_file else
                                 'not applied.')

  try:
    image_creation_data = ImageCreationData(
        output_directory=args.output_directory,
        exe_name=args.exe_name,
        runtime_deps=runtime_deps,
        target_cpu=args.target_cpu,
        dry_run=args.dry_run,
        child_args=child_args,
        use_device=args.device,
        bootdata=args.bootdata,
        summary_output=args.test_launcher_summary_output,
        shutdown_machine=True,
        wait_for_network=args.wait_for_network,
        use_autorun=True)
    bootfs = BuildBootfs(image_creation_data)
    if not bootfs:
      return 2

    return RunFuchsia(bootfs, args.device, args.kernel, args.dry_run,
                      test_launcher_summary_output=
                          args.test_launcher_summary_output,
                      vm_cpu_cores = args.vm_cpu_cores)
  finally:
    # Stop the spawner to make sure it doesn't leave testserver running, in
    # case some tests failed.
    if spawning_server:
      spawning_server.Stop()
예제 #7
0
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument('--dry-run',
                        '-n',
                        action='store_true',
                        default=False,
                        help='Just print commands, don\'t execute them.')
    parser.add_argument('--output-directory',
                        type=os.path.realpath,
                        help=('Path to the directory in which build files are'
                              ' located (must include build type).'))
    parser.add_argument('--runtime-deps-path',
                        type=os.path.realpath,
                        help='Runtime data dependency file from GN.')
    parser.add_argument('--exe-name',
                        type=os.path.realpath,
                        help='Name of the the test')
    parser.add_argument('--enable-test-server',
                        action='store_true',
                        default=False,
                        help='Enable testserver spawner.')
    parser.add_argument('--gtest_filter',
                        help='GTest filter to use in place of any default.')
    parser.add_argument('--gtest_repeat', help='GTest repeat value to use.')
    parser.add_argument('--single-process-tests',
                        action='store_true',
                        default=False,
                        help='Runs the tests and the launcher in the same '
                        'process. Useful for debugging.')
    parser.add_argument('--test-launcher-batch-limit',
                        type=int,
                        help='Sets the limit of test batch to run in a single '
                        'process.')
    # --test-launcher-filter-file is specified relative to --output-directory,
    # so specifying type=os.path.* will break it.
    parser.add_argument('--test-launcher-filter-file',
                        help='Pass filter file through to target process.')
    parser.add_argument('--test-launcher-jobs',
                        type=int,
                        help='Sets the number of parallel test jobs.')
    parser.add_argument('--test_launcher_summary_output',
                        help='Currently ignored for 2-sided roll.')
    parser.add_argument('child_args',
                        nargs='*',
                        help='Arguments for the test process.')
    parser.add_argument('-d',
                        '--device',
                        action='store_true',
                        default=False,
                        help='Run on hardware device instead of QEMU.')
    args = parser.parse_args()

    child_args = ['--test-launcher-retry-limit=0']

    if int(os.environ.get('CHROME_HEADLESS', 0)) != 0:
        # When running on bots (without KVM) execution is quite slow. The test
        # launcher times out a subprocess after 45s which can be too short. Make the
        # timeout twice as long.
        child_args.append('--test-launcher-timeout=90000')

    if args.single_process_tests:
        child_args.append('--single-process-tests')

    if args.test_launcher_batch_limit:
        child_args.append('--test-launcher-batch-limit=%d' %
                          args.test_launcher_batch_limit)
    if args.test_launcher_jobs:
        child_args.append('--test-launcher-jobs=%d' % args.test_launcher_jobs)
    if args.gtest_filter:
        child_args.append('--gtest_filter=' + args.gtest_filter)
    if args.gtest_repeat:
        child_args.append('--gtest_repeat=' + args.gtest_repeat)
    if args.child_args:
        child_args.extend(args.child_args)

    runtime_deps = ReadRuntimeDeps(args.runtime_deps_path,
                                   args.output_directory)

    # Start test server spawner for tests that need it.
    if args.enable_test_server:
        spawning_server = chrome_test_server_spawner.SpawningServer(
            TEST_SERVER_PORT, PortForwarderNoop())
        spawning_server.Start()

        # Generate test server config.
        config_file = tempfile.NamedTemporaryFile()
        config_file.write(
            str(TEST_SERVER_PORT) + ':' + str(TEST_SERVER_PORT + 1))
        config_file.flush()
        runtime_deps.append(('net-test-server-ports', config_file.name))

    if args.test_launcher_filter_file:
        # Bundle the filter file in the runtime deps and compose the command-line
        # flag which references it.
        test_launcher_filter_file = os.path.normpath(
            os.path.join(args.output_directory,
                         args.test_launcher_filter_file))
        runtime_deps.append(('test_filter_file', test_launcher_filter_file))
        child_args.append(
            '--test-launcher-filter-file=/system/test_filter_file')

    bootfs = BuildBootfs(args.output_directory,
                         runtime_deps,
                         args.exe_name,
                         child_args,
                         args.dry_run,
                         power_off=not args.device)
    if not bootfs:
        return 2

    return RunFuchsia(bootfs, args.device, args.dry_run, interactive=False)
예제 #8
0
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument('--dry-run',
                        '-n',
                        action='store_true',
                        default=False,
                        help='Just print commands, don\'t execute them.')
    parser.add_argument('--output-directory',
                        type=os.path.realpath,
                        help=('Path to the directory in which build files are'
                              ' located (must include build type).'))
    parser.add_argument('--runtime-deps-path',
                        type=os.path.realpath,
                        help='Runtime data dependency file from GN.')
    parser.add_argument('--target-cpu',
                        help='GN target_cpu setting for the build.')
    parser.add_argument('--exe-name',
                        type=os.path.realpath,
                        help='Name of the the binary executable.')
    parser.add_argument('-d',
                        '--device',
                        action='store_true',
                        default=False,
                        help='Run on hardware device instead of QEMU.')
    parser.add_argument(
        '--bootdata',
        type=os.path.realpath,
        help='Path to a bootdata to use instead of the default '
        'one from the SDK')
    parser.add_argument('--kernel',
                        type=os.path.realpath,
                        help='Path to a kernel to use instead of the default '
                        'one from the SDK')
    parser.add_argument('--no-autorun',
                        action='store_true',
                        help='Disable generating an autorun file')
    parser.add_argument('--extra-file',
                        action='append',
                        default=[],
                        help='Extra file to add to bootfs, '
                        '<bootfs_path>=<local_path>')
    args, child_args = parser.parse_known_args()

    runtime_deps = ReadRuntimeDeps(args.runtime_deps_path,
                                   args.output_directory)
    for extra_file in args.extra_file:
        parts = extra_file.split("=", 1)
        if len(parts) < 2:
            print 'Invalid --extra-file: ', extra_file
            print 'Expected format: --extra-file <bootfs_path>=<local_path>'
            return 2
        runtime_deps.append(tuple(parts))

    bootfs = BuildBootfs(args.output_directory,
                         runtime_deps,
                         args.exe_name,
                         child_args,
                         args.dry_run,
                         args.bootdata,
                         summary_output=None,
                         shutdown_machine=False,
                         target_cpu=args.target_cpu,
                         use_device=args.device,
                         wait_for_network=True,
                         use_autorun=not args.no_autorun)
    if not bootfs:
        return 2

    return RunFuchsia(bootfs, args.device, args.kernel, args.dry_run, None)