Index: scripts/slave/unittests/results_dashboard_test.py |
diff --git a/scripts/slave/unittests/results_dashboard_test.py b/scripts/slave/unittests/results_dashboard_test.py |
index e0041cb4e093d3888108c005d4bceb56a9a7c7bb..550d16e275fa439cd15f4778b32eb4b1b6534f0c 100755 |
--- a/scripts/slave/unittests/results_dashboard_test.py |
+++ b/scripts/slave/unittests/results_dashboard_test.py |
@@ -54,7 +54,7 @@ class ResultsDashboardTest(unittest.TestCase): |
self.mox.UnsetStubs() |
shutil.rmtree(self.build_dir) |
- def _SendResults(self, send_results_args, expected_new_json, errors, |
+ def _TestSendResults(self, send_results_args, expected_new_json, errors, |
mock_timestamp=False, webkit_master=False): |
"""Test one call of SendResults with the given set of arguments. |
@@ -97,10 +97,13 @@ class ResultsDashboardTest(unittest.TestCase): |
def test_SingleLogLine(self): |
args = [ |
- 'bar-summary.dat', |
- ['{"traces": {"baz": ["100.0", "5.0"]},' |
- ' "rev": "12345", "webkit_rev": "6789", "webrtc_rev": "3456",' |
- ' "v8_rev": "2345"}'], |
+ { |
+ 'bar-summary.dat': [ |
+ '{"traces": {"baz": ["100.0", "5.0"]},' |
+ ' "rev": "12345", "webkit_rev": "6789", "webrtc_rev": "3456",' |
+ ' "v8_rev": "2345"}' |
+ ], |
+ }, |
'linux-release', |
'foo', |
'https://chrome-perf.googleplex.com', |
@@ -125,14 +128,17 @@ class ResultsDashboardTest(unittest.TestCase): |
'r_v8_rev': '2345', |
}}])] |
errors = [None] |
- self._SendResults(args, expected_new_json, errors) |
+ self._TestSendResults(args, expected_new_json, errors) |
def test_SupplementalColumns(self): |
args = [ |
- 'bar-summary.dat', |
- ['{"traces": {"baz": ["100.0", "5.0"]},' |
- ' "rev": "12345", "webkit_rev": "6789", "webrtc_rev": "3456",' |
- ' "v8_rev": "2345"}'], |
+ { |
+ 'bar-summary.dat': [ |
+ '{"traces": {"baz": ["100.0", "5.0"]},' |
+ ' "rev": "12345", "webkit_rev": "6789", "webrtc_rev": "3456",' |
+ ' "v8_rev": "2345"}' |
+ ], |
+ }, |
'linux-release', |
'foo', |
'https://chrome-perf.googleplex.com', |
@@ -164,17 +170,20 @@ class ResultsDashboardTest(unittest.TestCase): |
'r_bar': 'SHA2', |
}}])] |
errors = [None] |
- self._SendResults(args, expected_new_json, errors) |
+ self._TestSendResults(args, expected_new_json, errors) |
def test_UnitsLogLine(self): |
args = [ |
- 'bar-summary.dat', |
- ['{"traces": {"baz": ["100.0", "5.0"]},' |
- ' "rev": "12345", "webkit_rev": "6789", "webrtc_rev": "3456", ' |
- ' "v8_rev": "2345", "units": "ms"}', |
- '{"traces": {"bam": ["100.0", "5.0"]},' |
- ' "rev": "12345", "webkit_rev": "6789", "webrtc_rev": "3456", ' |
- ' "v8_rev": "2345", "units": ""}'], |
+ { |
+ 'bar-summary.dat': [ |
+ '{"traces": {"baz": ["100.0", "5.0"]},' |
+ ' "rev": "12345", "webkit_rev": "6789", "webrtc_rev": "3456", ' |
+ ' "v8_rev": "2345", "units": "ms"}', |
+ '{"traces": {"bam": ["100.0", "5.0"]},' |
+ ' "rev": "12345", "webkit_rev": "6789", "webrtc_rev": "3456", ' |
+ ' "v8_rev": "2345", "units": ""}' |
+ ], |
+ }, |
'linux-release', |
'foo', |
'https://chrome-perf.googleplex.com', |
@@ -214,15 +223,18 @@ class ResultsDashboardTest(unittest.TestCase): |
'r_v8_rev': '2345', |
}}])] |
errors = [None] |
- self._SendResults(args, expected_new_json, errors) |
+ self._TestSendResults(args, expected_new_json, errors) |
def test_ImportantLogLine(self): |
args = [ |
- 'bar-summary.dat', |
- ['{"traces": {"one": ["1.0", "5.0"], "two": ["2.0", "0.0"]},' |
- ' "rev": "12345", "webkit_rev": "6789", "webrtc_rev": "3456",' |
- ' "v8_rev": "2345", "units": "ms", ' |
- '"important": ["one"]}'], |
+ { |
+ 'bar-summary.dat': [ |
+ '{"traces": {"one": ["1.0", "5.0"], "two": ["2.0", "0.0"]},' |
+ ' "rev": "12345", "webkit_rev": "6789", "webrtc_rev": "3456",' |
+ ' "v8_rev": "2345", "units": "ms", ' |
+ '"important": ["one"]}' |
+ ], |
+ }, |
'linux-release', |
'foo', |
'https://chrome-perf.googleplex.com', |
@@ -264,17 +276,20 @@ class ResultsDashboardTest(unittest.TestCase): |
'r_v8_rev': '2345', |
}}])] |
errors = [None] |
- self._SendResults(args, expected_new_json, errors) |
+ self._TestSendResults(args, expected_new_json, errors) |
def test_MultipleLogLines(self): |
args = [ |
- 'bar-summary.dat', [ |
- '{"traces": {"baz": ["100.0", "5.0"]},' |
- ' "rev": "12345", "webkit_rev": "6789", "webrtc_rev": "3456",' |
- ' "v8_rev": "2345"}', |
- '{"traces": {"box": ["101.0", "4.0"]},' |
- ' "rev": "12345", "webkit_rev": "6789", "webrtc_rev": "3456",' |
- ' "v8_rev": "2345"}'], |
+ { |
+ 'bar-summary.dat': [ |
+ '{"traces": {"baz": ["100.0", "5.0"]},' |
+ ' "rev": "12345", "webkit_rev": "6789", "webrtc_rev": "3456",' |
+ ' "v8_rev": "2345"}', |
+ '{"traces": {"box": ["101.0", "4.0"]},' |
+ ' "rev": "12345", "webkit_rev": "6789", "webrtc_rev": "3456",' |
+ ' "v8_rev": "2345"}' |
+ ], |
+ }, |
'linux-release', |
'foo', |
'https://chrome-perf.googleplex.com', |
@@ -313,15 +328,19 @@ class ResultsDashboardTest(unittest.TestCase): |
'r_v8_rev': '2345', |
}}])] |
errors = [None] |
- self._SendResults(args, expected_new_json, errors) |
+ self._TestSendResults(args, expected_new_json, errors) |
def test_ModifiedTraceNames(self): |
args = [ |
- 'bar-summary.dat', |
- ['{"traces": {"bar": ["100.0", "5.0"], "bar_ref": ["99.0", "2.0"],' |
- ' "baz/y": ["101.0", "3.0"], "notchanged": ["102.0", "1.0"]},' |
- ' "rev": "12345", "webkit_rev": "6789", "webrtc_rev": "3456",' |
- ' "v8_rev": "2345"}'], |
+ { |
+ 'bar-summary.dat': [ |
+ '{"traces": {"bar": ["100.0", "5.0"],' |
+ ' "bar_ref": ["99.0", "2.0"],' |
+ ' "baz/y": ["101.0", "3.0"], "notchanged": ["102.0", "1.0"]},' |
+ ' "rev": "12345", "webkit_rev": "6789", "webrtc_rev": "3456",' |
+ ' "v8_rev": "2345"}' |
+ ], |
+ }, |
'linux-release', |
'foo', |
'https://chrome-perf.googleplex.com', |
@@ -388,21 +407,24 @@ class ResultsDashboardTest(unittest.TestCase): |
'r_v8_rev': '2345', |
}}])] |
errors = [None] |
- self._SendResults(args, expected_new_json, errors) |
+ self._TestSendResults(args, expected_new_json, errors) |
def test_MultiValueRowUpload(self): |
args = [ |
- 'my_endure_graph-summary.dat', |
- ['{"traces": {' |
- '"total_dom_nodes": [["10", "123"], ["20.5", "234"]],' |
- '"event_listeners": [["10", "12"], ["20.5", "40"]]},' |
- ' "rev": "12345",' |
- ' "webkit_rev": "6789",' |
- ' "webrtc_rev": "3456",' |
- ' "v8_rev": "2345",' |
- ' "units": "count",' |
- ' "units_x": "seconds",' |
- ' "stack": false}'], |
+ { |
+ 'my_endure_graph-summary.dat': [ |
+ '{"traces": {' |
+ '"total_dom_nodes": [["10", "123"], ["20.5", "234"]],' |
+ '"event_listeners": [["10", "12"], ["20.5", "40"]]},' |
+ ' "rev": "12345",' |
+ ' "webkit_rev": "6789",' |
+ ' "webrtc_rev": "3456",' |
+ ' "v8_rev": "2345",' |
+ ' "units": "count",' |
+ ' "units_x": "seconds",' |
+ ' "stack": false}' |
+ ], |
+ }, |
'linux-release', |
'endure/test_name', |
'https://chrome-perf.googleplex.com', |
@@ -443,14 +465,17 @@ class ResultsDashboardTest(unittest.TestCase): |
'r_v8_rev': '2345' |
}}])] |
errors = [None, None] |
- self._SendResults(args, expected_new_json, errors) |
+ self._TestSendResults(args, expected_new_json, errors) |
def test_ByUrlGraph(self): |
args = [ |
- 'bar_by_url-summary.dat', |
- ['{"traces": {"baz": ["100.0", "5.0"]},' |
- ' "rev": "12345", "webkit_rev": "6789", "webrtc_rev": "3456",' |
- '"v8_rev": "2345"}'], |
+ { |
+ 'bar_by_url-summary.dat': [ |
+ '{"traces": {"baz": ["100.0", "5.0"]},' |
+ ' "rev": "12345", "webkit_rev": "6789", "webrtc_rev": "3456",' |
+ '"v8_rev": "2345"}' |
+ ], |
+ }, |
'linux-release', |
'foo', |
'https://chrome-perf.googleplex.com', |
@@ -475,18 +500,22 @@ class ResultsDashboardTest(unittest.TestCase): |
'r_v8_rev': '2345', |
}}])] |
errors = [None] |
- self._SendResults(args, expected_new_json, errors) |
+ self._TestSendResults(args, expected_new_json, errors) |
def test_GitHashToTimestamp(self): |
args = [ |
- 'mean_frame_time-summary.dat', |
- ['{"traces": {"mean_frame_time": ["77.0964285714", "138.142773233"]},' |
- ' "rev": "2eca27b067e3e57c70e40b8b95d0030c5d7c1a7f",' |
- ' "webkit_rev": "bf9aa8d62561bb2e4d7bc09e9d9e8c6a665ddc88",' |
- ' "webrtc_rev": "bf9aa8d62561bb2e4d7bc09e9d9e8c6a665ddc86",' |
- ' "v8_rev": "bf9aa8d62561bb2e4d7bc09e9d9e8c6a665ddc87",' |
- ' "ver": "undefined", "chan": "undefined", "units": "ms",' |
- ' "important": ["mean_frame_time"]}'], |
+ { |
+ 'mean_frame_time-summary.dat': [ |
+ '{"traces":' |
+ ' {"mean_frame_time": ["77.0964285714", "138.142773233"]},' |
+ ' "rev": "2eca27b067e3e57c70e40b8b95d0030c5d7c1a7f",' |
+ ' "webkit_rev": "bf9aa8d62561bb2e4d7bc09e9d9e8c6a665ddc88",' |
+ ' "webrtc_rev": "bf9aa8d62561bb2e4d7bc09e9d9e8c6a665ddc86",' |
+ ' "v8_rev": "bf9aa8d62561bb2e4d7bc09e9d9e8c6a665ddc87",' |
+ ' "ver": "undefined", "chan": "undefined", "units": "ms",' |
+ ' "important": ["mean_frame_time"]}' |
+ ], |
+ }, |
'linux-release', |
'smoothness_measurement', |
'https://chrome-perf.googleplex.com', |
@@ -514,18 +543,22 @@ class ResultsDashboardTest(unittest.TestCase): |
'r_v8_rev': 'bf9aa8d62561bb2e4d7bc09e9d9e8c6a665ddc87', |
}}])] |
errors = [None] |
- self._SendResults(args, expected_new_json, errors, mock_timestamp=True) |
+ self._TestSendResults(args, expected_new_json, errors, mock_timestamp=True) |
def test_WebkitUsesTimestamp(self): |
args = [ |
- 'mean_frame_time-summary.dat', |
- ['{"traces": {"mean_frame_time": ["77.0964285714", "138.142773233"]},' |
- ' "rev": "12345",' |
- ' "webkit_rev": "23456",' |
- ' "webrtc_rev": "3456",' |
- ' "v8_rev": "34567",' |
- ' "ver": "undefined", "chan": "undefined", "units": "ms",' |
- ' "important": ["mean_frame_time"]}'], |
+ { |
+ 'mean_frame_time-summary.dat': [ |
+ '{"traces":' |
+ ' {"mean_frame_time": ["77.0964285714", "138.142773233"]},' |
+ ' "rev": "12345",' |
+ ' "webkit_rev": "23456",' |
+ ' "webrtc_rev": "3456",' |
+ ' "v8_rev": "34567",' |
+ ' "ver": "undefined", "chan": "undefined", "units": "ms",' |
+ ' "important": ["mean_frame_time"]}' |
+ ], |
+ }, |
'linux-release', |
'smoothness_measurement', |
'https://chrome-perf.googleplex.com', |
@@ -553,15 +586,18 @@ class ResultsDashboardTest(unittest.TestCase): |
'r_v8_rev': '34567', |
}}])] |
errors = [None] |
- self._SendResults(args, expected_new_json, errors, mock_timestamp=True, |
+ self._TestSendResults(args, expected_new_json, errors, mock_timestamp=True, |
webkit_master=True) |
def test_FailureRetried(self): |
args = [ |
- 'bar-summary.dat', |
- ['{"traces": {"baz": ["100.0", "5.0"]},' |
- ' "rev": "12345", "webkit_rev": "6789", "webrtc_rev": "3456",' |
- ' "v8_rev": "2345"}'], |
+ { |
+ 'bar-summary.dat': [ |
+ '{"traces": {"baz": ["100.0", "5.0"]},' |
+ ' "rev": "12345", "webkit_rev": "6789", "webrtc_rev": "3456",' |
+ ' "v8_rev": "2345"}' |
+ ], |
+ }, |
'linux-release', |
'foo', |
'https://chrome-perf.googleplex.com', |
@@ -586,12 +622,15 @@ class ResultsDashboardTest(unittest.TestCase): |
'r_v8_rev': '2345', |
}}])] |
errors = [urllib2.URLError('reason')] |
- self._SendResults(args, expected_new_json, errors) |
+ self._TestSendResults(args, expected_new_json, errors) |
args2 = [ |
- 'bar-summary.dat', |
- ['{"traces": {"baz": ["101.0", "6.0"]},' |
- ' "rev": "12346", "webkit_rev": "6790", "webrtc_rev": "3456",' |
- ' "v8_rev": "2345"}'], |
+ { |
+ 'bar-summary.dat': [ |
+ '{"traces": {"baz": ["101.0", "6.0"]},' |
+ ' "rev": "12346", "webkit_rev": "6790", "webrtc_rev": "3456",' |
+ ' "v8_rev": "2345"}' |
+ ], |
+ }, |
'linux-release', |
'foo', |
'https://chrome-perf.googleplex.com', |
@@ -617,14 +656,17 @@ class ResultsDashboardTest(unittest.TestCase): |
} |
}])) |
errors = [None, None] |
- self._SendResults(args2, expected_new_json, errors) |
+ self._TestSendResults(args2, expected_new_json, errors) |
def test_SuccessNotRetried(self): |
args = [ |
- 'bar-summary.dat', |
- ['{"traces": {"baz": ["100.0", "5.0"]},' |
- ' "rev": "12345", "webkit_rev": "6789", "webrtc_rev": "3456",' |
- ' "v8_rev": "2345"}'], |
+ { |
+ 'bar-summary.dat': [ |
+ '{"traces": {"baz": ["100.0", "5.0"]},' |
+ ' "rev": "12345", "webkit_rev": "6789", "webrtc_rev": "3456",' |
+ ' "v8_rev": "2345"}' |
+ ], |
+ }, |
'linux-release', |
'foo', |
'https://chrome-perf.googleplex.com', |
@@ -649,12 +691,15 @@ class ResultsDashboardTest(unittest.TestCase): |
'r_v8_rev': '2345', |
}}])] |
errors = [None] |
- self._SendResults(args, expected_new_json, errors) |
+ self._TestSendResults(args, expected_new_json, errors) |
args2 = [ |
- 'bar-summary.dat', |
- ['{"traces": {"baz": ["101.0", "6.0"]},' |
- ' "rev": "12346", "webkit_rev": "6790", "webrtc_rev": "3456",' |
- ' "v8_rev": "2345"}'], |
+ { |
+ 'bar-summary.dat': [ |
+ '{"traces": {"baz": ["101.0", "6.0"]},' |
+ ' "rev": "12346", "webkit_rev": "6790", "webrtc_rev": "3456",' |
+ ' "v8_rev": "2345"}' |
+ ], |
+ }, |
'linux-release', |
'foo', |
'https://chrome-perf.googleplex.com', |
@@ -680,14 +725,17 @@ class ResultsDashboardTest(unittest.TestCase): |
} |
}])] |
errors = [None] |
- self._SendResults(args2, expected_new_json2, errors) |
+ self._TestSendResults(args2, expected_new_json2, errors) |
def test_FailureCached(self): |
args = [ |
- 'bar-summary.dat', |
- ['{"traces": {"baz": ["100.0", "5.0"]},' |
- ' "rev": "12345", "webkit_rev": "6789", "webrtc_rev": "3456",' |
- ' "v8_rev": "2345"}'], |
+ { |
+ 'bar-summary.dat': [ |
+ '{"traces": {"baz": ["100.0", "5.0"]},' |
+ ' "rev": "12345", "webkit_rev": "6789", "webrtc_rev": "3456",' |
+ ' "v8_rev": "2345"}' |
+ ], |
+ }, |
'linux-release', |
'foo', |
'https://chrome-perf.googleplex.com', |
@@ -712,7 +760,7 @@ class ResultsDashboardTest(unittest.TestCase): |
'r_v8_rev': '2345', |
}}])] |
errors = [urllib2.URLError('reason')] |
- self._SendResults(args, expected_new_json, errors) |
+ self._TestSendResults(args, expected_new_json, errors) |
cache_file = open(self.cache_filename, 'rb') |
actual_cache = cache_file.read() |
cache_file.close() |
@@ -772,9 +820,12 @@ class ResultsDashboardTest(unittest.TestCase): |
cache_file.write(previous_lines) |
cache_file.close() |
args = [ |
- 'bar-summary.dat', |
- ['{"traces": {"baz": ["102.0", "5.0"]},' |
- ' "rev": "12348", "webkit_rev": "6789", "v8_rev": "2345"}'], |
+ { |
+ 'bar-summary.dat': [ |
+ '{"traces": {"baz": ["102.0", "5.0"]},' |
+ ' "rev": "12348", "webkit_rev": "6789", "v8_rev": "2345"}' |
+ ], |
+ }, |
'linux-release', |
'foo', |
'https://chrome-perf.googleplex.com', |
@@ -799,7 +850,7 @@ class ResultsDashboardTest(unittest.TestCase): |
'r_v8_rev': '2345', |
}}])] |
errors = [urllib2.URLError('reason')] |
- self._SendResults(args, expected_new_json, errors) |
+ self._TestSendResults(args, expected_new_json, errors) |
cache_file = open(self.cache_filename, 'rb') |
actual_cache_lines = [l.strip() for l in cache_file.readlines()] |
cache_file.close() |