Exemplo n.º 1
0
    def _do_execute(self, tests, args, options):
        jobs = options.j

        print '>>> Running with test processors'
        loader = LoadProc(tests)
        results = self._create_result_tracker(options)
        indicators = self._create_progress_indicators(
            tests.test_count_estimate, options)

        outproc_factory = None
        if self.build_config.predictable:
            outproc_factory = predictable.get_outproc
        execproc = ExecutionProc(jobs, outproc_factory)
        sigproc = self._create_signal_proc()

        procs = [
            loader,
            NameFilterProc(args) if args else None,
            StatusFileFilterProc(options.slow_tests, options.pass_fail_tests),
            VariantProc(self._variants),
            StatusFileFilterProc(options.slow_tests, options.pass_fail_tests),
            self._create_predictable_filter(),
            self._create_shard_proc(options),
            self._create_seed_proc(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=options.j * 2)

        # 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 - results.remaining)

        exit_code = utils.EXIT_CODE_PASS
        if results.failed:
            exit_code = utils.EXIT_CODE_FAILURES
        if not results.total:
            exit_code = utils.EXIT_CODE_NO_TESTS

        # Indicate if a SIGINT or SIGTERM happened.
        exit_code = max(exit_code, sigproc.exit_code)

        if exit_code == utils.EXIT_CODE_FAILURES and options.json_test_results:
            print(
                "Force exit code 0 after failures. Json test results file "
                "generated with failure information.")
            exit_code = utils.EXIT_CODE_PASS
        return exit_code
Exemplo n.º 2
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
Exemplo n.º 3
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
Exemplo n.º 4
0
    def _do_execute(self, tests, args, options):
        jobs = options.j

        print('>>> Running with test processors')
        loader = LoadProc(tests)
        results = self._create_result_tracker(options)
        indicators = self._create_progress_indicators(
            tests.test_count_estimate, options)

        outproc_factory = None
        if self.build_config.predictable:
            outproc_factory = predictable.get_outproc
        execproc = ExecutionProc(jobs, outproc_factory)
        sigproc = self._create_signal_proc()

        procs = [
            loader,
            NameFilterProc(args) if args else None,
            StatusFileFilterProc(options.slow_tests, options.pass_fail_tests),
            VariantProc(self._variants),
            StatusFileFilterProc(options.slow_tests, options.pass_fail_tests),
            self._create_predictable_filter(),
            self._create_shard_proc(options),
            self._create_seed_proc(options),
            self._create_sequence_proc(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=options.j * 2)

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

        for indicator in indicators:
            indicator.finished()

        if tests.test_count_estimate:
            percentage = float(results.total) / tests.test_count_estimate * 100
        else:
            percentage = 0

        print(('>>> %d base tests produced %d (%d%s)'
               ' non-filtered tests') %
              (tests.test_count_estimate, results.total, percentage, '%'))

        print('>>> %d tests ran' % (results.total - results.remaining))

        exit_code = utils.EXIT_CODE_PASS
        if results.failed:
            exit_code = utils.EXIT_CODE_FAILURES
        if not results.total:
            exit_code = utils.EXIT_CODE_NO_TESTS

        if options.time:
            self._print_durations(options)

        # Indicate if a SIGINT or SIGTERM happened.
        return max(exit_code, sigproc.exit_code)
Exemplo n.º 5
0
    def _do_execute(self, tests, args, options):
      jobs = options.j

      print '>>> Running with test processors'
      loader = LoadProc()
      tests_counter = TestsCounter()
      results = self._create_result_tracker(options)
      indicators = self._create_progress_indicators(options)

      outproc_factory = None
      if self.build_config.predictable:
        outproc_factory = predictable.get_outproc
      execproc = ExecutionProc(jobs, outproc_factory)
      sigproc = self._create_signal_proc()

      procs = [
        loader,
        NameFilterProc(args) if args else None,
        StatusFileFilterProc(options.slow_tests, options.pass_fail_tests),
        self._create_shard_proc(options),
        tests_counter,
        VariantProc(self._variants),
        StatusFileFilterProc(options.slow_tests, options.pass_fail_tests),
        self._create_predictable_filter(),
        self._create_seed_proc(options),
        sigproc,
      ] + indicators + [
        results,
        self._create_timeout_proc(options),
        self._create_rerun_proc(options),
        execproc,
      ]

      self._prepare_procs(procs)
      tests.sort(key=lambda t: t.is_slow, reverse=True)

      loader.load_tests(tests)

      print '>>> Running %d base tests' % tests_counter.total
      tests_counter.remove_from_chain()

      # 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 - results.remaining)

      exit_code = utils.EXIT_CODE_PASS
      if results.failed:
        exit_code = utils.EXIT_CODE_FAILURES
      if not results.total:
        exit_code = utils.EXIT_CODE_NO_TESTS

      # Indicate if a SIGINT or SIGTERM happened.
      exit_code = max(exit_code, sigproc.exit_code)

      if exit_code == utils.EXIT_CODE_FAILURES and options.json_test_results:
        print("Force exit code 0 after failures. Json test results file "
              "generated with failure information.")
        exit_code = utils.EXIT_CODE_PASS
      return exit_code
Exemplo n.º 6
0
    def _do_execute(self, tests, args, options):
      jobs = options.j

      print('>>> Running with test processors')
      loader = LoadProc(tests)
      results = self._create_result_tracker(options)
      indicators = self._create_progress_indicators(
          tests.test_count_estimate, options)

      outproc_factory = None
      if self.build_config.predictable:
        outproc_factory = predictable.get_outproc
      execproc = ExecutionProc(jobs, outproc_factory)
      sigproc = self._create_signal_proc()

      procs = [
        loader,
        NameFilterProc(args) if args else None,
        StatusFileFilterProc(options.slow_tests, options.pass_fail_tests),
        VariantProc(self._variants),
        StatusFileFilterProc(options.slow_tests, options.pass_fail_tests),
        self._create_predictable_filter(),
        self._create_shard_proc(options),
        self._create_seed_proc(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=options.j*2)

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

      for indicator in indicators:
        indicator.finished()


      if tests.test_count_estimate:
        percentage = float(results.total) / tests.test_count_estimate * 100
      else:
        percentage = 0

      print (('>>> %d base tests produced %d (%d%s)'
             ' non-filtered tests') % (
          tests.test_count_estimate, results.total, percentage, '%'))

      print('>>> %d tests ran' % (results.total - results.remaining))

      exit_code = utils.EXIT_CODE_PASS
      if results.failed:
        exit_code = utils.EXIT_CODE_FAILURES
      if not results.total:
        exit_code = utils.EXIT_CODE_NO_TESTS

      # Indicate if a SIGINT or SIGTERM happened.
      return max(exit_code, sigproc.exit_code)