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

Side by Side Diff: ctest/ctest.py

Issue 6775011: Generate public key from update engine private key. (Closed) Base URL: http://git.chromium.org/git/crostestutils.git@master
Patch Set: Created 9 years, 8 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # 2 #
3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """Wrapper for tests that are run on builders.""" 7 """Wrapper for tests that are run on builders."""
8 8
9 import fileinput 9 import fileinput
10 import optparse 10 import optparse
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 fh.close() 200 fh.close()
201 201
202 version = zip_url.split('/')[-2] 202 version = zip_url.split('/')[-2]
203 if not _GreaterVersion(version, _NEW_STYLE_VERSION) == version: 203 if not _GreaterVersion(version, _NEW_STYLE_VERSION) == version:
204 # If the version isn't ready for new style, touch file to use old style. 204 # If the version isn't ready for new style, touch file to use old style.
205 old_style_touch_path = os.path.join(download_folder, '.use_e1000') 205 old_style_touch_path = os.path.join(download_folder, '.use_e1000')
206 fh = open(old_style_touch_path, 'w+') 206 fh = open(old_style_touch_path, 'w+')
207 fh.close() 207 fh.close()
208 208
209 209
210 def GeneratePublicKey(private_key_path):
211 """Returns the path to a generate public key from given private key."""
petkov 2011/03/29 23:16:48 s/generate/generated/
212 # Just output to local directory.
213 public_key_path = 'public_key.pem'
214 cros_lib.Info('Generating public key from private key.')
215 cros_lib.RunCommand(['/usr/bin/openssl',
216 'rsa',
217 '-in', private_key_path,
218 '-pubout',
219 '-out', public_key_path,
220 ], print_cmd=False)
221 return public_key_path
222
223
224
210 def RunAUTestHarness(board, channel, zip_server_base, 225 def RunAUTestHarness(board, channel, zip_server_base,
211 no_graphics, type, remote, clean, test_results_root): 226 no_graphics, type, remote, clean, test_results_root):
212 """Runs the auto update test harness. 227 """Runs the auto update test harness.
213 228
214 The auto update test harness encapsulates testing the auto-update mechanism 229 The auto update test harness encapsulates testing the auto-update mechanism
215 for the latest image against the latest official image from the channel. This 230 for the latest image against the latest official image from the channel. This
216 also tests images with suite_Smoke (built-in as part of its verification 231 also tests images with suite_Smoke (built-in as part of its verification
217 process). 232 process).
218 233
219 Args: 234 Args:
(...skipping 14 matching lines...) Expand all
234 # Tests go here. 249 # Tests go here.
235 return_object = cros_lib.RunCommand( 250 return_object = cros_lib.RunCommand(
236 ['./get_latest_image.sh', '--board=%s' % board], cwd=crosutils_root, 251 ['./get_latest_image.sh', '--board=%s' % board], cwd=crosutils_root,
237 redirect_stdout=True, print_cmd=True) 252 redirect_stdout=True, print_cmd=True)
238 253
239 latest_image = return_object.output.strip() 254 latest_image = return_object.output.strip()
240 255
241 update_engine_path = os.path.join(crosutils_root, '..', 'platform', 256 update_engine_path = os.path.join(crosutils_root, '..', 'platform',
242 'update_engine') 257 'update_engine')
243 258
259 private_key_path = os.path.join(update_engine_path, 'unittest_key.pem')
260 public_key_path = GeneratePublicKey(private_key_path)
261
244 cmd = ['bin/cros_au_test_harness', 262 cmd = ['bin/cros_au_test_harness',
245 '--base_image=%s' % os.path.join(download_folder, 263 '--base_image=%s' % os.path.join(download_folder,
246 _IMAGE_TO_EXTRACT), 264 _IMAGE_TO_EXTRACT),
247 '--target_image=%s' % os.path.join(latest_image, 265 '--target_image=%s' % os.path.join(latest_image,
248 _IMAGE_TO_EXTRACT), 266 _IMAGE_TO_EXTRACT),
249 '--board=%s' % board, 267 '--board=%s' % board,
250 '--type=%s' % type, 268 '--type=%s' % type,
251 '--remote=%s' % remote, 269 '--remote=%s' % remote,
252 '--private_key=%s' % os.path.join(update_engine_path, 270 '--private_key=%s' % private_key_path,
253 'unittest_key.pem'), 271 '--public_key=%s' % public_key_path,
254 '--public_key=%s' % os.path.join(update_engine_path,
255 'unittest_key.pub.pem'),
256 ] 272 ]
257 if test_results_root: cmd.append('--test_results_root=%s' % test_results_root) 273 if test_results_root: cmd.append('--test_results_root=%s' % test_results_root)
258 if no_graphics: cmd.append('--no_graphics') 274 if no_graphics: cmd.append('--no_graphics')
259 if clean: cmd.append('--clean') 275 if clean: cmd.append('--clean')
260 276
261 cros_lib.RunCommand(cmd, cwd=crosutils_root) 277 cros_lib.RunCommand(cmd, cwd=crosutils_root)
262 278
263 279
264 def main(): 280 def main():
265 parser = optparse.OptionParser() 281 parser = optparse.OptionParser()
(...skipping 25 matching lines...) Expand all
291 if not options.zipbase: parser.error('Need zip url base to get images.') 307 if not options.zipbase: parser.error('Need zip url base to get images.')
292 308
293 RunAUTestHarness(options.board, options.channel, options.zipbase, 309 RunAUTestHarness(options.board, options.channel, options.zipbase,
294 options.no_graphics, options.type, options.remote, 310 options.no_graphics, options.type, options.remote,
295 not options.cache, options.test_results_root) 311 not options.cache, options.test_results_root)
296 312
297 313
298 if __name__ == '__main__': 314 if __name__ == '__main__':
299 main() 315 main()
300 316
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698