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

Side by Side Diff: build/android/provision_devices.py

Issue 1334973002: Add date mismatch logging. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update logging syntax. Created 5 years, 3 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
« 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/env python 1 #!/usr/bin/env python
2 # 2 #
3 # Copyright (c) 2013 The Chromium Authors. All rights reserved. 3 # Copyright (c) 2013 The Chromium 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 """Provisions Android devices with settings required for bots. 7 """Provisions Android devices with settings required for bots.
8 8
9 Usage: 9 Usage:
10 ./provision_devices.py [-d <device serial number>] 10 ./provision_devices.py [-d <device serial number>]
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 device_time = device.RunShellCommand( 312 device_time = device.RunShellCommand(
313 ['date', '+"%Y%m%d.%H%M%S"'], as_root=True, 313 ['date', '+"%Y%m%d.%H%M%S"'], as_root=True,
314 single_line=True).replace('"', '') 314 single_line=True).replace('"', '')
315 device_time = datetime.datetime.strptime(device_time, "%Y%m%d.%H%M%S") 315 device_time = datetime.datetime.strptime(device_time, "%Y%m%d.%H%M%S")
316 correct_time = datetime.datetime.strptime(strgmtime, date_format) 316 correct_time = datetime.datetime.strptime(strgmtime, date_format)
317 tdelta = (correct_time - device_time).seconds 317 tdelta = (correct_time - device_time).seconds
318 if tdelta <= 1: 318 if tdelta <= 1:
319 logging.info('Date/time successfully set on %s', device) 319 logging.info('Date/time successfully set on %s', device)
320 return True 320 return True
321 else: 321 else:
322 logging.error('Date mismatch. Device: %s Correct: %s',
323 device_time.isoformat(), correct_time.isoformat())
322 return False 324 return False
323 325
324 # Sometimes the date is not set correctly on the devices. Retry on failure. 326 # Sometimes the date is not set correctly on the devices. Retry on failure.
325 if not timeout_retry.WaitFor(_set_and_verify_date, wait_period=1, 327 if not timeout_retry.WaitFor(_set_and_verify_date, wait_period=1,
326 max_tries=2): 328 max_tries=2):
327 raise device_errors.CommandFailedError( 329 raise device_errors.CommandFailedError(
328 'Failed to set date & time.', device_serial=str(device)) 330 'Failed to set date & time.', device_serial=str(device))
329 331
330 props = device.RunShellCommand('getprop', check_return=True) 332 props = device.RunShellCommand('getprop', check_return=True)
331 for prop in props: 333 for prop in props:
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 args = parser.parse_args() 452 args = parser.parse_args()
451 constants.SetBuildType(args.target) 453 constants.SetBuildType(args.target)
452 454
453 run_tests_helper.SetLogLevel(args.verbose) 455 run_tests_helper.SetLogLevel(args.verbose)
454 456
455 return ProvisionDevices(args) 457 return ProvisionDevices(args)
456 458
457 459
458 if __name__ == '__main__': 460 if __name__ == '__main__':
459 sys.exit(main()) 461 sys.exit(main())
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