Exemplo n.º 1
0
    def test_default_pool_deterministic(self):
        """Deterministically tests the default strategy pool generator."""
        strategy_pool = strategy_selection.generate_default_strategy_pool(
            strategy_list=strategy.LIBFUZZER_STRATEGY_LIST, use_generator=True)

        # Ml rnn and radamsa strategies are mutually exclusive. Because of how we
        # patch, ml rnn will evaluate to false, however this depends on the
        # implementation.
        self.assertTrue(
            strategy_pool.do_strategy(
                strategy.CORPUS_MUTATION_RADAMSA_STRATEGY))
        self.assertFalse(
            strategy_pool.do_strategy(
                strategy.CORPUS_MUTATION_ML_RNN_STRATEGY))
        self.assertTrue(
            strategy_pool.do_strategy(strategy.CORPUS_SUBSET_STRATEGY))
        self.assertTrue(
            strategy_pool.do_strategy(strategy.RANDOM_MAX_LENGTH_STRATEGY))
        self.assertTrue(
            strategy_pool.do_strategy(
                strategy.RECOMMENDED_DICTIONARY_STRATEGY))
        self.assertTrue(
            strategy_pool.do_strategy(strategy.VALUE_PROFILE_STRATEGY))
        self.assertTrue(strategy_pool.do_strategy(strategy.FORK_STRATEGY))
        self.assertTrue(
            strategy_pool.do_strategy(strategy.MUTATOR_PLUGIN_STRATEGY))
Exemplo n.º 2
0
 def setUp(self):
     self.pool = strategy_selection.generate_default_strategy_pool(
         strategy_list=strategy.LIBFUZZER_STRATEGY_LIST, use_generator=True)
     test_helpers.patch(self, [
         'bot.fuzzers.engine_common.is_lpm_fuzz_target',
         'bot.fuzzers.strategy_selection.StrategyPool.do_strategy'
     ])
     self.mock.do_strategy.return_value = True
     self.mock.is_lpm_fuzz_target.return_value = True
Exemplo n.º 3
0
  def test_default_pool_deterministic(self):
    """Deterministically tests the default strategy pool generator."""
    strategy_pool = strategy_selection.generate_default_strategy_pool(
        strategy_list=strategy.AFL_STRATEGY_LIST, use_generator=True)

    # Ml rnn and radamsa strategies are mutually exclusive. Because of how we
    # patch, ml rnn will evaluate to false, however this depends on the
    # implementation.
    self.assertTrue(
        strategy_pool.do_strategy(strategy.CORPUS_MUTATION_RADAMSA_STRATEGY))
    self.assertFalse(
        strategy_pool.do_strategy(strategy.CORPUS_MUTATION_ML_RNN_STRATEGY))
    self.assertTrue(strategy_pool.do_strategy(strategy.CORPUS_SUBSET_STRATEGY))
Exemplo n.º 4
0
 def test_default_pool_generator(self):
     """Ensures that a call to generate_default_strategy_pool does not yield an
 exception. Deterministic behaviors are tested in the previous test."""
     strategy_selection.generate_default_strategy_pool(
         strategy_list=strategy.LIBFUZZER_STRATEGY_LIST, use_generator=True)