Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Unified Diff: tools/auto_bisect/bisect_perf_regression_test.py

Issue 1625573004: Update legacy bisect to post results to perf dashboard. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fix_import_path
Patch Set: update Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/auto_bisect/bisect_perf_regression.py ('k') | tools/auto_bisect/bisect_results.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/auto_bisect/bisect_perf_regression_test.py
diff --git a/tools/auto_bisect/bisect_perf_regression_test.py b/tools/auto_bisect/bisect_perf_regression_test.py
index 33f733a7332641521a58b226afa48b69f74f382c..918334b2ac5fb5de23620344ecfc64b7fc1ba1a5 100644
--- a/tools/auto_bisect/bisect_perf_regression_test.py
+++ b/tools/auto_bisect/bisect_perf_regression_test.py
@@ -12,6 +12,8 @@ SRC = os.path.join(os.path.dirname(__file__), os.path.pardir, os.path.pardir)
sys.path.append(os.path.join(SRC, 'third_party', 'pymock'))
import bisect_perf_regression
+import bisect_results
+import bisect_state
import bisect_utils
import fetch_build
import mock
@@ -131,6 +133,47 @@ def _FakeTestResult(values, bisect_mode_is_return_code):
return (result_dict, success_code)
+def _SampleBisecResult(opts):
+ revisions = [
+ 'ae7ef14ba2d9b5ef0d2c1c092ec98a417e44740d'
+ 'ab55ead638496b061c9de61685b982f7cea38ca7',
+ '89aa0c99e4b977b9a4f992ac14da0d6624f7316e']
+ state = bisect_state.BisectState(depot='chromium', revisions=revisions)
+ depot_registry = bisect_perf_regression.DepotDirectoryRegistry('/mock/src')
+ results = bisect_results.BisectResults(
+ bisect_state=state, depot_registry=depot_registry, opts=opts,
+ runtime_warnings=[])
+ results.confidence = 99.9
+ results.culprit_revisions = [(
+ 'ab55ead638496b061c9de61685b982f7cea38ca7',
+ {
+ 'date': 'Thu, 26 Jun 2014 14:29:49 +0000',
+ 'body': 'Fix',
+ 'author': 'author@chromium.org',
+ 'subject': 'Fix',
+ 'email': 'author@chromium.org',
+ },
+ 'chromium')]
+ return results
+
+
+def _GetMockCallArg(function_mock, call_index):
+ """Gets the list of called arguments for call at |call_index|.
+
+ Args:
+ function_mock: A Mock object.
+ call_index: The index at which the mocked function was called.
+
+ Returns:
+ The called argument list.
+ """
+ call_args_list = function_mock.call_args_list
+ if not call_args_list or len(call_args_list) <= call_index:
+ return None
+ args, _ = call_args_list[call_index]
+ return args
+
+
def _GetBisectPerformanceMetricsInstance(options_dict):
"""Returns an instance of the BisectPerformanceMetrics class."""
opts = bisect_perf_regression.BisectOptions.FromDict(options_dict)
@@ -319,6 +362,21 @@ class BisectPerfRegressionTest(unittest.TestCase):
results = _GenericDryRun(_GetExtendedOptions(1, -100))
self.assertIsNone(results.error)
+ @mock.patch('urllib2.urlopen')
+ def testBisectResultsPosted(self, mock_urlopen):
+ options_dict = dict(DEFAULT_OPTIONS)
+ options_dict.update({
+ 'bisect_mode': bisect_utils.BISECT_MODE_MEAN,
+ 'try_job_id': 1234,
+ })
+ opts = bisect_perf_regression.BisectOptions.FromDict(options_dict)
+ results = _SampleBisecResult(opts)
+ bisect_perf_regression._PostBisectResults(results, opts, os.getcwd())
+
+ call_args = _GetMockCallArg(mock_urlopen, 0)
+ self.assertIsNotNone(call_args)
+ self.assertIn('"try_job_id": 1234', call_args[1])
+
def _CheckAbortsEarly(self, results, **extra_opts):
"""Returns True if the bisect job would abort early."""
global _MockResultsGenerator
« no previous file with comments | « tools/auto_bisect/bisect_perf_regression.py ('k') | tools/auto_bisect/bisect_results.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698