Esempio n. 1
0
def main():
  """CLI frontend to validate arguments."""
  run_test_cases.run_isolated.disable_buffering()
  parser = run_test_cases.OptionParserTestCases(
      usage='%prog <options> --isolated <.isolated>')
  parser.format_description = lambda *_: parser.description
  isolate.add_variable_option(parser)
  # TODO(maruel): Add support for options.timeout.
  parser.remove_option('--timeout')
  options, args = parser.parse_args()
  if args:
    parser.error('Unsupported arg: %s' % args)
  isolate.parse_isolated_option(parser, options, os.getcwd(), True)
  isolate.parse_variable_option(options)

  try:
    config, command, test_cases = safely_load_isolated(parser, options)
    if not command:
      parser.error('A command must be defined')
    if not test_cases:
      parser.error('No test case to run with command: %s' % ' '.join(command))

    config.saved_state.variables.update(options.variables)
    return isolate_test_cases(
        command,
        test_cases,
        options.jobs,
        config.isolated_filepath,
        config.saved_state.isolate_filepath,
        config.root_dir,
        config.saved_state.relative_cwd,
        config.saved_state.variables)
  except isolate.ExecutionError, e:
    print >> sys.stderr, str(e)
    return 1
Esempio n. 2
0
def main():
    """CLI frontend to validate arguments."""
    run_test_cases.run_isolated.disable_buffering()
    parser = run_test_cases.OptionParserTestCases(
        usage='%prog <options> --isolated <.isolated>')
    parser.format_description = lambda *_: parser.description
    isolate.add_variable_option(parser)
    # TODO(maruel): Add support for options.timeout.
    parser.remove_option('--timeout')
    options, args = parser.parse_args()
    if args:
        parser.error('Unsupported arg: %s' % args)
    isolate.parse_isolated_option(parser, options, os.getcwd(), True)
    isolate.parse_variable_option(options)

    try:
        config, command, test_cases = safely_load_isolated(parser, options)
        if not command:
            parser.error('A command must be defined')
        if not test_cases:
            parser.error('No test case to run with command: %s' %
                         ' '.join(command))

        config.saved_state.variables.update(options.variables)
        return isolate_test_cases(command, test_cases, options.jobs,
                                  config.isolated_filepath,
                                  config.saved_state.isolate_filepath,
                                  config.root_dir,
                                  config.saved_state.relative_cwd,
                                  config.saved_state.variables)
    except isolate.ExecutionError, e:
        print >> sys.stderr, str(e)
        return 1
Esempio n. 3
0
def main():
  """CLI frontend to validate arguments."""
  parser = run_test_cases.OptionParserTestCases(
      usage='%prog <options> --isolated <.isolated>')
  parser.format_description = lambda *_: parser.description
  isolate.add_variable_option(parser)
  # TODO(maruel): Add support for options.timeout.
  parser.remove_option('--timeout')
  options, args = parser.parse_args()
  if args:
    parser.error('Unsupported arg: %s' % args)
  isolate.parse_variable_option(parser, options, True)

  try:
    config = isolate.CompleteState.load_files(options.isolated)
    reldir = os.path.join(config.root_dir, config.isolated.relative_cwd)
    command = run_test_cases.fix_python_path(config.isolated.command)
    test_xvfb(command, reldir)
    test_cases = parser.process_gtest_options(command, reldir, options)
    if not test_cases:
      print >> sys.stderr, 'No test case to run'
      return 1

    config.saved_state.variables.update(options.variables)
    return isolate_test_cases(
        command,
        test_cases,
        options.jobs,
        config.isolated_filepath,
        config.saved_state.isolate_file,
        config.root_dir,
        config.isolated.relative_cwd,
        config.saved_state.variables)
  except isolate.ExecutionError, e:
    print >> sys.stderr, str(e)
    return 1