| OLD | NEW |
| 1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import logging, os, re | 5 import logging, os, re |
| 6 from autotest_lib.client.bin import site_crash_test, site_utils, test | 6 from autotest_lib.client.bin import site_crash_test, site_utils, test |
| 7 from autotest_lib.client.common_lib import error, utils | 7 from autotest_lib.client.common_lib import error, utils |
| 8 | 8 |
| 9 _25_HOURS_AGO = -25 * 60 * 60 | 9 _25_HOURS_AGO = -25 * 60 * 60 |
| 10 _CRASH_SENDER_CRON_PATH = '/etc/cron.hourly/crash_sender.hourly' | 10 _CRASH_SENDER_CRON_PATH = '/etc/cron.hourly/crash_sender.hourly' |
| 11 _DAILY_RATE_LIMIT = 32 | 11 _DAILY_RATE_LIMIT = 32 |
| 12 _MIN_UNIQUE_TIMES = 4 | 12 _MIN_UNIQUE_TIMES = 4 |
| 13 _HWCLASS_PATH = '/sys/devices/platform/chromeos_acpi/HWID' | 13 _HWCLASS_PATH = '/sys/devices/platform/chromeos_acpi/HWID' |
| 14 _SECONDS_SEND_SPREAD = 3600 | 14 _SECONDS_SEND_SPREAD = 3600 |
| 15 | 15 |
| 16 class logging_CrashSender(site_crash_test.CrashTest): | 16 class logging_CrashSender(site_crash_test.CrashTest): |
| 17 version = 1 | 17 version = 1 |
| 18 | 18 |
| 19 | 19 |
| 20 def _check_hardware_info(self, result): | 20 def _check_hardware_info(self, result): |
| 21 # Get board name | 21 # Get board name |
| 22 lsb_release = utils.read_file('/etc/lsb-release') | 22 lsb_release = utils.read_file('/etc/lsb-release') |
| 23 board_match = re.search(r'CHROMEOS_RELEASE_BOARD=(.*)', lsb_release) | 23 board_match = re.search(r'CHROMEOS_RELEASE_BOARD=(.*)', lsb_release) |
| 24 if not ('Board: %s' % board_match.group(1)) in result['output']: | 24 if not ('Board: %s' % board_match.group(1)) in result['output']: |
| 25 raise error.TestFail('Missing board name %s in output' % | 25 raise error.TestFail('Missing board name %s in output' % |
| 26 board_match.group(1)) | 26 board_match.group(1)) |
| 27 # Get hwid | 27 # Get hwid |
| 28 hwclass = 'unknown' | 28 hwclass = 'undefined' |
| 29 if os.path.exists(_HWCLASS_PATH): | 29 if os.path.exists(_HWCLASS_PATH): |
| 30 hwclass = utils.read_file(_HWCLASS_PATH) | 30 hwclass = utils.read_file(_HWCLASS_PATH) |
| 31 if not ('HWClass: %s' % hwclass) in result['output']: | 31 if not ('HWClass: %s' % hwclass) in result['output']: |
| 32 raise error.TestFail('Missing hwclass %s in output' % hwclass) | 32 raise error.TestFail('Expected hwclass %s in output' % hwclass) |
| 33 | 33 |
| 34 | 34 |
| 35 def _check_simple_minidump_send(self, report): | 35 def _check_simple_minidump_send(self, report): |
| 36 result = self._call_sender_one_crash(report=report) | 36 result = self._call_sender_one_crash(report=report) |
| 37 if (result['report_exists'] or | 37 if (result['report_exists'] or |
| 38 result['rate_count'] != 1 or | 38 result['rate_count'] != 1 or |
| 39 not result['send_attempt'] or | 39 not result['send_attempt'] or |
| 40 not result['send_success'] or | 40 not result['send_success'] or |
| 41 result['sleep_time'] < 0 or | 41 result['sleep_time'] < 0 or |
| 42 result['sleep_time'] >= _SECONDS_SEND_SPREAD or | 42 result['sleep_time'] >= _SECONDS_SEND_SPREAD or |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 'sender_simple_kernel_crash', | 265 'sender_simple_kernel_crash', |
| 266 'sender_pausing', | 266 'sender_pausing', |
| 267 'sender_reports_disabled', | 267 'sender_reports_disabled', |
| 268 'sender_rate_limiting', | 268 'sender_rate_limiting', |
| 269 'sender_single_instance', | 269 'sender_single_instance', |
| 270 'sender_send_fails', | 270 'sender_send_fails', |
| 271 'sender_orphaned_files', | 271 'sender_orphaned_files', |
| 272 'sender_incomplete_metadata', | 272 'sender_incomplete_metadata', |
| 273 'sender_missing_payload', | 273 'sender_missing_payload', |
| 274 'cron_runs']) | 274 'cron_runs']) |
| OLD | NEW |