def PrintPartialResults(self, bisect_state): revision_states = bisect_state.GetRevisionStates() first_working_rev, last_broken_rev = BisectResults.FindBreakingRevRange( revision_states) self._PrintTestedCommitsTable(revision_states, first_working_rev, last_broken_rev, 100, final_step=False)
def testWarningForZeroConfidence(self): revision_states = self.mock_bisect_state.mock_revision_states revision_states[2].value = {'values': [100, 105, 95]} revision_states[3].value = {'values': [100, 105, 95]} revision_states[4].value = {'values': [100, 105, 95]} results = BisectResults(self.mock_bisect_state, self.mock_depot_registry, self.mock_opts, self.mock_warnings) self.assertEqual(0, results.confidence) self.assertEqual(1, len(results.warnings))
def testWarningForTooLowConfidence(self): revision_states = self.mock_bisect_state.mock_revision_states revision_states[2].value = {'values': [95, 90, 90]} revision_states[3].value = {'values': [95, 90, 90]} revision_states[4].value = {'values': [95, 90, 90]} results = BisectResults(self.mock_bisect_state, self.mock_depot_registry, self.mock_opts, self.mock_warnings) self.assertGreater(results.confidence, 0) self.assertEqual(1, len(results.warnings))
def testFindsCulpritRevisions(self): revision_states = self.mock_bisect_state.mock_revision_states revision_states[1].depot = 'chromium' revision_states[2].depot = 'webkit' results = BisectResults(self.mock_bisect_state, self.mock_depot_registry, self.mock_opts, self.mock_warnings) self.assertEqual(1, len(results.culprit_revisions)) self.assertEqual(('b', {'test': 'b'}, 'chromium'), results.culprit_revisions[0])
def testFindBreakingRangeNonePassed(self): revision_states = self.mock_bisect_state.mock_revision_states revision_states[0].passed = 0 revision_states[1].passed = 0 revision_states[2].passed = 0 revision_states[3].passed = 0 revision_states[4].passed = 0 results = BisectResults(self.mock_bisect_state, self.mock_depot_registry, self.mock_opts, self.mock_warnings) self.assertIsNone(results.first_working_revision) self.assertEqual(revision_states[4], results.last_broken_revision)
def testCorrectlyFindsBreakingRangeIncompleteBisect(self): revision_states = self.mock_bisect_state.mock_revision_states revision_states[0].passed = 0 revision_states[1].passed = 0 revision_states[2].passed = '?' revision_states[3].passed = 1 revision_states[4].passed = 1 results = BisectResults(self.mock_bisect_state, self.mock_depot_registry, self.mock_opts, self.mock_warnings) self.assertEqual(revision_states[3], results.first_working_revision) self.assertEqual(revision_states[1], results.last_broken_revision)
def _AssertConfidence(self, score, bad_values, good_values): """Checks whether the given sets of values have a given confidence score. The score represents our confidence that the two sets of values wouldn't be as different as they are just by chance; that is, that some real change occurred between the two sets of values. Args: score: Expected confidence score. bad_values: First list of numbers. good_values: Second list of numbers. """ confidence = BisectResults.ConfidenceScore(bad_values, good_values) self.assertEqual(score, confidence)
def testFindsOtherRegressions(self): revision_states = self.mock_bisect_state.mock_revision_states revision_states[0].passed = 0 revision_states[0].value = {'values': [100, 100, 100]} revision_states[1].passed = 0 revision_states[1].value = {'values': [100, 100, 100]} revision_states[2].passed = 1 revision_states[2].value = {'values': [10, 10, 10]} revision_states[3].passed = 1 revision_states[3].value = {'values': [100, 100, 100]} revision_states[4].passed = 1 revision_states[4].value = {'values': [60, 60, 60]} results = BisectResults(self.mock_bisect_state, self.mock_depot_registry, self.mock_opts, self.mock_warnings) expected_regressions = [[revision_states[2], revision_states[1], 99.9], [revision_states[4], revision_states[3], 80.0]] self.assertEqual(expected_regressions, results.other_regressions)
def testCorrectlyComputesRegressionStatistics(self): revision_states = self.mock_bisect_state.mock_revision_states revision_states[0].passed = 0 revision_states[0].value = {'values': [1000, 999, 998]} revision_states[1].passed = 0 revision_states[1].value = {'values': [980, 1000, 999]} revision_states[2].passed = 1 revision_states[2].value = {'values': [50, 45, 55]} revision_states[3].passed = 1 revision_states[3].value = {'values': [45, 56, 45]} revision_states[4].passed = 1 revision_states[4].value = {'values': [51, 41, 58]} results = BisectResults(self.mock_bisect_state, self.mock_depot_registry, self.mock_opts, self.mock_warnings) self.assertAlmostEqual(99.9, results.confidence) self.assertAlmostEqual(1909.86547085, results.regression_size) self.assertAlmostEqual(7.16625904, results.regression_std_err)
def testWarningForTooLowRetryLimit(self): self.mock_opts.repeat_test_count = 1 results = BisectResults(self.mock_bisect_state, self.mock_depot_registry, self.mock_opts, self.mock_warnings) self.assertEqual(1, len(results.warnings))
def testWarningForMultipleCulpritRevisions(self): self.mock_bisect_state.mock_revision_states[2].passed = 'Skipped' results = BisectResults(self.mock_bisect_state, self.mock_depot_registry, self.mock_opts, self.mock_warnings) self.assertEqual(1, len(results.warnings))
def testNoResultBasedWarningsForNormalState(self): results = BisectResults(self.mock_bisect_state, self.mock_depot_registry, self.mock_opts, self.mock_warnings) self.assertEqual(0, len(results.warnings))