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

Side by Side Diff: Tools/TestResultServer/handlers/testfilehandler.py

Issue 467453002: Take two at fixing android bots still using testlistjson. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | Tools/TestResultServer/handlers/testfilehandler_test.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 PARAM_MASTER = "master" 44 PARAM_MASTER = "master"
45 PARAM_BUILDER = "builder" 45 PARAM_BUILDER = "builder"
46 PARAM_BUILD_NUMBER = "buildnumber" 46 PARAM_BUILD_NUMBER = "buildnumber"
47 PARAM_DIR = "dir" 47 PARAM_DIR = "dir"
48 PARAM_FILE = "file" 48 PARAM_FILE = "file"
49 PARAM_NAME = "name" 49 PARAM_NAME = "name"
50 PARAM_BEFORE = "before" 50 PARAM_BEFORE = "before"
51 PARAM_NUM_FILES = "numfiles" 51 PARAM_NUM_FILES = "numfiles"
52 PARAM_KEY = "key" 52 PARAM_KEY = "key"
53 PARAM_TEST_TYPE = "testtype" 53 PARAM_TEST_TYPE = "testtype"
54 PARAM_TEST_LIST_JSON = "testlistjson"
54 PARAM_CALLBACK = "callback" 55 PARAM_CALLBACK = "callback"
55 56
56 57
57 def _replace_jsonp_callback(json, callback_name): 58 def _replace_jsonp_callback(json, callback_name):
58 if callback_name and re.search(r"^[A-Za-z0-9_]+$", callback_name): 59 if callback_name and re.search(r"^[A-Za-z0-9_]+$", callback_name):
59 if re.search(r"^[A-Za-z0-9_]+[(]", json): 60 if re.search(r"^[A-Za-z0-9_]+[(]", json):
60 return re.sub(r"^[A-Za-z0-9_]+[(]", callback_name + "(", json) 61 return re.sub(r"^[A-Za-z0-9_]+[(]", callback_name + "(", json)
61 return callback_name + "(" + json + ")" 62 return callback_name + "(" + json + ")"
62 63
63 return json 64 return json
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 174
174 def get(self): 175 def get(self):
175 key = self.request.get(PARAM_KEY) 176 key = self.request.get(PARAM_KEY)
176 master = self.request.get(PARAM_MASTER) 177 master = self.request.get(PARAM_MASTER)
177 builder = self.request.get(PARAM_BUILDER) 178 builder = self.request.get(PARAM_BUILDER)
178 test_type = self.request.get(PARAM_TEST_TYPE) 179 test_type = self.request.get(PARAM_TEST_TYPE)
179 build_number = self.request.get(PARAM_BUILD_NUMBER, default_value=None) 180 build_number = self.request.get(PARAM_BUILD_NUMBER, default_value=None)
180 name = self.request.get(PARAM_NAME) 181 name = self.request.get(PARAM_NAME)
181 before = self.request.get(PARAM_BEFORE) 182 before = self.request.get(PARAM_BEFORE)
182 num_files = self.request.get(PARAM_NUM_FILES) 183 num_files = self.request.get(PARAM_NUM_FILES)
184 test_list_json = self.request.get(PARAM_TEST_LIST_JSON)
183 callback_name = self.request.get(PARAM_CALLBACK) 185 callback_name = self.request.get(PARAM_CALLBACK)
184 186
185 logging.debug( 187 logging.debug(
186 "Getting files, master %s, builder: %s, test_type: %s, build_number: %s, name: %s, before: %s.", 188 "Getting files, master %s, builder: %s, test_type: %s, build_number: %s, name: %s, before: %s.",
187 master, builder, test_type, build_number, name, before) 189 master, builder, test_type, build_number, name, before)
188 190
189 if key: 191 if key:
190 json, date = self._get_file_content_from_key(key) 192 json, date = self._get_file_content_from_key(key)
191 elif num_files or not master or not builder or not test_type or (not bui ld_number and not JsonResults.is_aggregate_file(name)) or not name: 193 elif num_files or not master or not builder or not test_type or (not bui ld_number and not JsonResults.is_aggregate_file(name)) or not name:
192 limit = int(num_files) if num_files else 100 194 limit = int(num_files) if num_files else 100
193 self._get_file_list(master, builder, test_type, build_number, name, before, limit, callback_name) 195 self._get_file_list(master, builder, test_type, build_number, name, before, limit, callback_name)
194 return 196 return
195 else: 197 else:
196 # FIXME: Stop using the old master name style after all files have b een updated. 198 # FIXME: Stop using the old master name style after all files have b een updated.
197 master_data = master_config.getMaster(master) 199 master_data = master_config.getMaster(master)
198 if not master_data: 200 if not master_data:
199 master_data = master_config.getMasterByMasterName(master) 201 master_data = master_config.getMasterByMasterName(master)
200 if not master_data: 202 if not master_data:
201 self.error(404) 203 self.error(404)
202 return 204 return
205
203 json, date = self._get_file_content(master_data['url_name'], builder , test_type, build_number, name) 206 json, date = self._get_file_content(master_data['url_name'], builder , test_type, build_number, name)
204 if json is None: 207 if json is None:
205 json, date = self._get_file_content(master_data['name'], builder , test_type, build_number, name) 208 json, date = self._get_file_content(master_data['name'], builder , test_type, build_number, name)
206 209
210 if test_list_json:
211 json = JsonResults.get_test_list(builder, json)
212
207 if json: 213 if json:
208 json = _replace_jsonp_callback(json, callback_name) 214 json = _replace_jsonp_callback(json, callback_name)
209 215
210 self._serve_json(json, date) 216 self._serve_json(json, date)
211 217
212 218
213 class Upload(webapp2.RequestHandler): 219 class Upload(webapp2.RequestHandler):
214 """Upload test results file to datastore.""" 220 """Upload test results file to datastore."""
215 221
216 def post(self): 222 def post(self):
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 303
298 class UploadForm(webapp2.RequestHandler): 304 class UploadForm(webapp2.RequestHandler):
299 """Show a form so user can upload a file.""" 305 """Show a form so user can upload a file."""
300 306
301 def get(self): 307 def get(self):
302 template_values = { 308 template_values = {
303 "upload_url": "/testfile/upload", 309 "upload_url": "/testfile/upload",
304 } 310 }
305 self.response.out.write(template.render("templates/uploadform.html", 311 self.response.out.write(template.render("templates/uploadform.html",
306 template_values)) 312 template_values))
OLDNEW
« no previous file with comments | « no previous file | Tools/TestResultServer/handlers/testfilehandler_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698