| OLD | NEW |
| 1 # Copyright (C) 2014 Google Inc. All rights reserved. | 1 # Copyright (C) 2014 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 def _initialize(self): | 113 def _initialize(self): |
| 114 file_list = self._filesystem.listdir(self._results_directory_path) | 114 file_list = self._filesystem.listdir(self._results_directory_path) |
| 115 results_directories = [] | 115 results_directories = [] |
| 116 for dir in file_list: | 116 for dir in file_list: |
| 117 full_dir_path = self._filesystem.join(self._results_directory_path,
dir) | 117 full_dir_path = self._filesystem.join(self._results_directory_path,
dir) |
| 118 if self._filesystem.isdir(full_dir_path): | 118 if self._filesystem.isdir(full_dir_path): |
| 119 if self._results_directory in full_dir_path: | 119 if self._results_directory in full_dir_path: |
| 120 results_directories.append(full_dir_path) | 120 results_directories.append(full_dir_path) |
| 121 results_directories.sort(reverse=True, key=lambda x: self._filesystem.mt
ime(x)) | 121 results_directories.sort(reverse=True, key=lambda x: self._filesystem.mt
ime(x)) |
| 122 current_failing_results_json_file = self._filesystem.join(results_direct
ories[0], 'failing_results.json') | 122 current_failing_results_json_file = self._filesystem.join(results_direct
ories[0], 'failing_results.json') |
| 123 with self._filesystem.open_text_file_for_reading(current_failing_results
_json_file) as file: | 123 input_json_string = self._filesystem.read_text_file(current_failing_resu
lts_json_file) |
| 124 input_json_string = file.readline() | |
| 125 input_json_string = input_json_string[12:-2] # Remove preceeding strin
g ADD_RESULTS( and ); at the end | 124 input_json_string = input_json_string[12:-2] # Remove preceeding strin
g ADD_RESULTS( and ); at the end |
| 126 self._current_result_json_dict['tests'] = json.loads(input_json_string)[
'tests'] | 125 self._current_result_json_dict['tests'] = json.loads(input_json_string)[
'tests'] |
| 127 results_directories = results_directories[1:] | 126 results_directories = results_directories[1:] |
| 128 | 127 |
| 129 # To add hyperlink to individual results.html | 128 # To add hyperlink to individual results.html |
| 130 self._add_individual_result_links(results_directories) | 129 self._add_individual_result_links(results_directories) |
| 131 | 130 |
| 132 # Load the remaining stale layout test results Json's to create the dash
board | 131 # Load the remaining stale layout test results Json's to create the dash
board |
| 133 for json_file in results_directories: | 132 for json_file in results_directories: |
| 134 failing_json_file_path = self._filesystem.join(json_file, 'failing_r
esults.json') | 133 failing_json_file_path = self._filesystem.join(json_file, 'failing_r
esults.json') |
| 135 full_json_file_path = self._filesystem.join(json_file, 'full_results
.json') | 134 full_json_file_path = self._filesystem.join(json_file, 'full_results
.json') |
| 136 with self._filesystem.open_text_file_for_reading(failing_json_file_p
ath) as file: | 135 json_string = self._filesystem.read_text_file(failing_json_file_path
) |
| 137 json_string = file.readline() | |
| 138 json_string = json_string[12:-2] # Remove preceeding string ADD_RE
SULTS( and ); at the end | 136 json_string = json_string[12:-2] # Remove preceeding string ADD_RE
SULTS( and ); at the end |
| 139 self._old_failing_results_list.append(json.loads(json_string)) | 137 self._old_failing_results_list.append(json.loads(json_string)) |
| 140 | 138 json_string_full_result = self._filesystem.read_text_file(full_json_
file_path) |
| 141 with self._filesystem.open_text_file_for_reading(full_json_file_path
) as full_file: | |
| 142 json_string_full_result = full_file.readline() | |
| 143 self._old_full_results_list.append(json.loads(json_string_full_resul
t)) | 139 self._old_full_results_list.append(json.loads(json_string_full_resul
t)) |
| 144 self._copy_dashboard_html() | 140 self._copy_dashboard_html() |
| 145 | 141 |
| 146 def generate(self): | 142 def generate(self): |
| 147 self._initialize() | 143 self._initialize() |
| 148 | 144 |
| 149 # There must be atleast one archived result to be processed | 145 # There must be atleast one archived result to be processed |
| 150 if self._current_result_json_dict: | 146 if self._current_result_json_dict: |
| 151 process_json_data = ProcessJsonData(self._current_result_json_dict,
self._old_failing_results_list, self._old_full_results_list) | 147 process_json_data = ProcessJsonData(self._current_result_json_dict,
self._old_failing_results_list, self._old_full_results_list) |
| 152 self._final_result = process_json_data.generate_archived_result() | 148 self._final_result = process_json_data.generate_archived_result() |
| 153 final_json = json.dumps(self._final_result) | 149 final_json = json.dumps(self._final_result) |
| 154 final_json = 'ADD_RESULTS(' + final_json + ');' | 150 final_json = 'ADD_RESULTS(' + final_json + ');' |
| 155 with self._filesystem.open_text_file_for_writing(self._filesystem.jo
in(self._results_directory, 'archived_results.json')) as file: | 151 with self._filesystem.open_text_file_for_writing(self._filesystem.jo
in(self._results_directory, 'archived_results.json')) as file: |
| 156 file.write(final_json) | 152 file.write(final_json) |
| OLD | NEW |