def test_strategy_probabilities(self): """Ensure that the expected probabilities are being set for various methods.""" fuzz_strategy_selection._query_and_upload_strategy_probabilities() row1 = data_types.FuzzStrategyProbability.query( data_types.FuzzStrategyProbability.strategy_name == 'corpus_mutations_ml_rnn,fork,').get() self.assertEqual(row1.probability_medium_temperature, 0.008804204757789548) self.assertEqual(row1.probability_high_temperature, 0.009414508234686947) self.assertEqual(row1.probability_low_temperature, 0.006647206496077975) row2 = data_types.FuzzStrategyProbability.query( data_types.FuzzStrategyProbability.strategy_name == 'corpus_mutations_ml_rnn,fork,corpus_subset,').get() self.assertEqual(row2.probability_medium_temperature, 0.008321279434105579) self.assertEqual(row2.probability_high_temperature, 0.009067014025766948) self.assertEqual(row2.probability_low_temperature, 0.005937985244578106) row3 = data_types.FuzzStrategyProbability.query( data_types.FuzzStrategyProbability.strategy_name == 'random_max_len,corpus_mutations_ml_rnn,recommended_dict,').get() self.assertEqual(row3.probability_medium_temperature, 0.0241049918676138) self.assertEqual(row3.probability_high_temperature, 0.018425058537190255) self.assertEqual(row3.probability_low_temperature, 0.04982793398153658)
def test_delete_from_table(self): """Ensures that ndb datastore table is properly being cleared before being updated.""" fuzz_strategy_selection._query_and_upload_strategy_probabilities() count1 = data_types.FuzzStrategyProbability.query().count() fuzz_strategy_selection._query_and_upload_strategy_probabilities() count2 = data_types.FuzzStrategyProbability.query().count() self.assertEqual(count1, count2)
def test_delete_from_table(self): """Ensures that ndb datastore table is properly being cleared before being updated.""" # We pass an empty list as the query is patched out. fuzz_strategy_selection._query_and_upload_strategy_probabilities( fuzz_strategy_selection.LIBFUZZER_ENGINE) count1 = data_types.FuzzStrategyProbability.query().count() fuzz_strategy_selection._query_and_upload_strategy_probabilities( fuzz_strategy_selection.LIBFUZZER_ENGINE) count2 = data_types.FuzzStrategyProbability.query().count() self.assertEqual(count1, count2)
def test_strategy_probabilities(self): """Ensure that the expected probabilities are being set for various methods.""" fuzz_strategy_selection._query_and_upload_strategy_probabilities() row1 = data_types.FuzzStrategyProbability.query( data_types.FuzzStrategyProbability.strategy_name == 'corpus_mutations_ml_rnn,fork,').get() self.assertEqual(row1.probability, 0.008598047115941681) row2 = data_types.FuzzStrategyProbability.query( data_types.FuzzStrategyProbability.strategy_name == 'corpus_mutations_ml_rnn,fork,corpus_subset,').get() self.assertEqual(row2.probability, 0.008077518169652463) row3 = data_types.FuzzStrategyProbability.query( data_types.FuzzStrategyProbability.strategy_name == 'random_max_len,corpus_mutations_ml_rnn,recommended_dict,').get() self.assertEqual(row3.probability, 0.03168990475186747)
def test_strategy_probabilities(self): """Ensure that the expected probabilities are being set for various methods.""" fuzz_strategy_selection._query_and_upload_strategy_probabilities() row1 = data_types.FuzzStrategyProbability.query( data_types.FuzzStrategyProbability.strategy_name == 'ml rnn,fork,').get() self.assertEqual(row1.probability, 0.00843939359881144) row2 = data_types.FuzzStrategyProbability.query( data_types.FuzzStrategyProbability.strategy_name == 'ml rnn,fork,subset,').get() self.assertEqual(row2.probability, 0.007949692658367058) row3 = data_types.FuzzStrategyProbability.query( data_types.FuzzStrategyProbability.strategy_name == 'max len,ml rnn,dict,').get() self.assertEqual(row3.probability, 0.03372520353666355)
def test_strategy_probabilities(self): """Ensure that the expected probabilities are being set for various methods.""" # We pass an empty list as the query is patched out. fuzz_strategy_selection._query_and_upload_strategy_probabilities( fuzz_strategy_selection.LIBFUZZER_ENGINE) row1 = data_types.FuzzStrategyProbability.query( data_types.FuzzStrategyProbability.strategy_name == 'corpus_mutations_ml_rnn,fork,').get() self.assertEqual(row1.probability, 0.0061753988734031835) self.assertEqual(row1.engine, 'libFuzzer') row2 = data_types.FuzzStrategyProbability.query( data_types.FuzzStrategyProbability.strategy_name == 'corpus_mutations_ml_rnn,fork,corpus_subset,').get() self.assertEqual(row2.probability, 0.005077124089195762) self.assertEqual(row2.engine, 'libFuzzer') row3 = data_types.FuzzStrategyProbability.query( data_types.FuzzStrategyProbability.strategy_name == 'random_max_len,corpus_mutations_ml_rnn,recommended_dict,').get() self.assertEqual(row3.probability, 0.011855451527667878) self.assertEqual(row3.engine, 'libFuzzer')