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 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 return status_string, status_code | 496 return status_string, status_code |
497 | 497 |
498 return cls.update_file(builder, large_file, incremental_json, JSON_RESUL
TS_MAX_BUILDS) | 498 return cls.update_file(builder, large_file, incremental_json, JSON_RESUL
TS_MAX_BUILDS) |
499 | 499 |
500 @classmethod | 500 @classmethod |
501 def update_file(cls, builder, file, incremental_json, num_runs): | 501 def update_file(cls, builder, file, incremental_json, num_runs): |
502 new_results, status_code = cls.merge(builder, file.data, incremental_jso
n, num_runs) | 502 new_results, status_code = cls.merge(builder, file.data, incremental_jso
n, num_runs) |
503 if status_code != 200: | 503 if status_code != 200: |
504 return new_results, status_code | 504 return new_results, status_code |
505 return TestFile.save_file(file, new_results) | 505 return TestFile.save_file(file, new_results) |
| 506 |
| 507 @classmethod |
| 508 def _delete_results_and_times(cls, tests): |
| 509 for key in tests.keys(): |
| 510 if key in (RESULTS_KEY, TIMES_KEY): |
| 511 del tests[key] |
| 512 else: |
| 513 cls._delete_results_and_times(tests[key]) |
| 514 |
| 515 @classmethod |
| 516 def get_test_list(cls, builder, json_file_data): |
| 517 logging.debug("Loading test results json...") |
| 518 json = cls._load_json(json_file_data) |
| 519 if not json: |
| 520 return None |
| 521 |
| 522 logging.debug("Checking test results json...") |
| 523 |
| 524 check_json_error_string = cls._check_json(builder, json) |
| 525 if check_json_error_string: |
| 526 return None |
| 527 |
| 528 test_list_json = {} |
| 529 tests = json[builder][TESTS_KEY] |
| 530 cls._delete_results_and_times(tests) |
| 531 test_list_json[builder] = {TESTS_KEY: tests} |
| 532 return cls._generate_file_data(test_list_json) |
OLD | NEW |