OLD | NEW |
1 # Copyright (C) 2010 Google Inc. All rights reserved. | 1 # Copyright (C) 2010 Google Inc. All rights reserved. |
2 # | 2 # |
3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
5 # met: | 5 # met: |
6 # | 6 # |
7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 incremental_json, _ = JsonResults._get_incremental_json(self._builder, J
sonResults._load_json(aggregated_results), is_full_results_format=False) | 257 incremental_json, _ = JsonResults._get_incremental_json(self._builder, J
sonResults._load_json(aggregated_results), is_full_results_format=False) |
258 merged_results, status_code = JsonResults.merge(self._builder, aggregate
d_results, JsonResults._load_json(incremental_results), num_runs=max_builds, sor
t_keys=True) | 258 merged_results, status_code = JsonResults.merge(self._builder, aggregate
d_results, JsonResults._load_json(incremental_results), num_runs=max_builds, sor
t_keys=True) |
259 | 259 |
260 if expected_data: | 260 if expected_data: |
261 expected_results = self._make_test_json(expected_data, builder_name=
self._builder) | 261 expected_results = self._make_test_json(expected_data, builder_name=
self._builder) |
262 self.assert_json_equal(merged_results, expected_results) | 262 self.assert_json_equal(merged_results, expected_results) |
263 self.assertEqual(status_code, 200) | 263 self.assertEqual(status_code, 200) |
264 else: | 264 else: |
265 self.assertTrue(status_code != 200) | 265 self.assertTrue(status_code != 200) |
266 | 266 |
| 267 def _test_get_test_list(self, input_data, expected_data): |
| 268 input_results = self._make_test_json(input_data) |
| 269 expected_results = JSON_RESULTS_TEST_LIST_TEMPLATE.replace("{[TESTDATA_T
ESTS]}", json.dumps(expected_data, separators=(',', ':'))) |
| 270 actual_results = JsonResults.get_test_list(self._builder, input_results) |
| 271 self.assert_json_equal(actual_results, expected_results) |
| 272 |
267 def test_update_files_empty_aggregate_data(self): | 273 def test_update_files_empty_aggregate_data(self): |
268 small_file = MockFile(name='results-small.json') | 274 small_file = MockFile(name='results-small.json') |
269 large_file = MockFile(name='results.json') | 275 large_file = MockFile(name='results.json') |
270 | 276 |
271 incremental_data = { | 277 incremental_data = { |
272 "builds": ["2", "1"], | 278 "builds": ["2", "1"], |
273 "tests": { | 279 "tests": { |
274 "001.html": { | 280 "001.html": { |
275 "results": [[200, TEXT]], | 281 "results": [[200, TEXT]], |
276 "times": [[200, 0]], | 282 "times": [[200, 0]], |
(...skipping 736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1013 "times": [[1, 0]]}}, | 1019 "times": [[1, 0]]}}, |
1014 "foo": { | 1020 "foo": { |
1015 "001.html": { | 1021 "001.html": { |
1016 "results": [[51, TEXT]], | 1022 "results": [[51, TEXT]], |
1017 "times": [[51, 0]]}, | 1023 "times": [[51, 0]]}, |
1018 "002.html": { | 1024 "002.html": { |
1019 "results": [[101, IMAGE]], | 1025 "results": [[101, IMAGE]], |
1020 "times": [[101, 0]]}}}, | 1026 "times": [[101, 0]]}}}, |
1021 "version": 4}) | 1027 "version": 4}) |
1022 | 1028 |
| 1029 # FIXME(aboxhall): Add some tests for xhtml/svg test results. |
| 1030 |
| 1031 def test_get_test_name_list(self): |
| 1032 # Get test name list only. Don't include non-test-list data and |
| 1033 # of test result details. |
| 1034 # FIXME: This also tests a temporary bug in the data where directory-lev
el |
| 1035 # results have a results and times values. Once that bug is fixed, |
| 1036 # remove this test-case and assert we don't ever hit it. |
| 1037 self._test_get_test_list( |
| 1038 # Input results |
| 1039 {"builds": ["3", "2", "1"], |
| 1040 "tests": {"foo": { |
| 1041 "001.html": { |
| 1042 "results": [[200, PASS]], |
| 1043 "times": [[200, 0]]}, |
| 1044 "results": [[1, NO_DATA]], |
| 1045 "times": [[1, 0]]}, |
| 1046 "002.html": { |
| 1047 "results": [[10, TEXT]], |
| 1048 "times": [[10, 0]]}}}, |
| 1049 # Expected results |
| 1050 {"foo": {"001.html": {}}, "002.html": {}}) |
| 1051 |
1023 def test_gtest(self): | 1052 def test_gtest(self): |
1024 self._test_merge( | 1053 self._test_merge( |
1025 # Aggregated results | 1054 # Aggregated results |
1026 {"builds": ["2", "1"], | 1055 {"builds": ["2", "1"], |
1027 "tests": {"foo.bar": { | 1056 "tests": {"foo.bar": { |
1028 "results": [[50, TEXT]], | 1057 "results": [[50, TEXT]], |
1029 "times": [[50, 0]]}, | 1058 "times": [[50, 0]]}, |
1030 "foo.bar2": { | 1059 "foo.bar2": { |
1031 "results": [[100, IMAGE]], | 1060 "results": [[100, IMAGE]], |
1032 "times": [[100, 0]]}, | 1061 "times": [[100, 0]]}, |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1128 files = TestFile.get_files(master['url_name'], builder, test_type, None,
None, limit=3) | 1157 files = TestFile.get_files(master['url_name'], builder, test_type, None,
None, limit=3) |
1129 self.assertEqual(len(files), 2) | 1158 self.assertEqual(len(files), 2) |
1130 for f in files: | 1159 for f in files: |
1131 j = json.loads(f.data) | 1160 j = json.loads(f.data) |
1132 self.assertItemsEqual(j[builder]['blinkRevision'], ['12345', '54321'
]) | 1161 self.assertItemsEqual(j[builder]['blinkRevision'], ['12345', '54321'
]) |
1133 | 1162 |
1134 tb.deactivate() | 1163 tb.deactivate() |
1135 | 1164 |
1136 if __name__ == '__main__': | 1165 if __name__ == '__main__': |
1137 unittest.main() | 1166 unittest.main() |
OLD | NEW |