Esempio n. 1
0
    def _do_execute(self, tests, args, options):
        loader = LoadProc(tests)
        fuzzer_rng = random.Random(options.fuzzer_random_seed)

        combiner = self._create_combiner(fuzzer_rng, options)
        results = self._create_result_tracker(options)
        execproc = ExecutionProc(options.j)
        sigproc = self._create_signal_proc()
        indicators = self._create_progress_indicators(
            tests.test_count_estimate, options)
        procs = [
            loader,
            NameFilterProc(args) if args else None,
            StatusFileFilterProc(None, None),
            # TODO(majeski): Improve sharding when combiner is present. Maybe select
            # different random seeds for shards instead of splitting tests.
            self._create_shard_proc(options),
            ForgiveTimeoutProc(),
            combiner,
            self._create_fuzzer(fuzzer_rng, options),
            sigproc,
        ] + indicators + [
            results,
            self._create_timeout_proc(options),
            self._create_rerun_proc(options),
            execproc,
        ]
        self._prepare_procs(procs)
        loader.load_initial_tests(initial_batch_size=float('inf'))

        # TODO(majeski): maybe some notification from loader would be better?
        if combiner:
            combiner.generate_initial_tests(options.j * 4)

        # This starts up worker processes and blocks until all tests are
        # processed.
        execproc.run()

        for indicator in indicators:
            indicator.finished()

        print('>>> %d tests ran' % results.total)
        if results.failed:
            return utils.EXIT_CODE_FAILURES

        # Indicate if a SIGINT or SIGTERM happened.
        return sigproc.exit_code
Esempio n. 2
0
  def _do_execute(self, tests, args, options):
    loader = LoadProc()
    fuzzer_rng = random.Random(options.fuzzer_random_seed)

    combiner = self._create_combiner(fuzzer_rng, options)
    results = ResultsTracker()
    execproc = ExecutionProc(options.j)
    indicators = self._create_progress_indicators(options)
    procs = [
      loader,
      NameFilterProc(args) if args else None,
      StatusFileFilterProc(None, None),
      # TODO(majeski): Improve sharding when combiner is present. Maybe select
      # different random seeds for shards instead of splitting tests.
      self._create_shard_proc(options),
      ForgiveTimeoutProc(),
      combiner,
      self._create_fuzzer(fuzzer_rng, options),
      self._create_signal_proc(),
    ] + indicators + [
      results,
      self._create_timeout_proc(options),
      self._create_rerun_proc(options),
      execproc,
    ]
    self._prepare_procs(procs)
    loader.load_tests(tests)

    # TODO(majeski): maybe some notification from loader would be better?
    if combiner:
      combiner.generate_initial_tests(options.j * 4)
    execproc.start()

    for indicator in indicators:
      indicator.finished()

    print '>>> %d tests ran' % results.total
    if results.failed:
      print '>>> %d tests failed' % results.failed

    if results.failed:
      return 1
    return 0