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, platform, time | 5 import logging, os, platform, time |
6 from autotest_lib.client.common_lib import error | 6 from autotest_lib.client.common_lib import error |
7 | 7 |
8 | 8 |
9 class TimeoutError(error.TestError): | 9 class TimeoutError(error.TestError): |
10 """Error raised when we time out when waiting on a condition.""" | 10 """Error raised when we time out when waiting on a condition.""" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 """ | 54 """ |
55 # The QEMU monitor has been redirected to the guest serial port located at | 55 # The QEMU monitor has been redirected to the guest serial port located at |
56 # /dev/ttyUSB0. To save the state of the VM, we just send the 'savevm' | 56 # /dev/ttyUSB0. To save the state of the VM, we just send the 'savevm' |
57 # command to the serial port. | 57 # command to the serial port. |
58 proc = platform.processor() | 58 proc = platform.processor() |
59 if 'QEMU' in proc and os.path.exists('/dev/ttyUSB0'): | 59 if 'QEMU' in proc and os.path.exists('/dev/ttyUSB0'): |
60 logging.info('Saving VM state "%s"' % checkpoint) | 60 logging.info('Saving VM state "%s"' % checkpoint) |
61 serial = open('/dev/ttyUSB0', 'w') | 61 serial = open('/dev/ttyUSB0', 'w') |
62 serial.write("savevm %s\r\n" % checkpoint) | 62 serial.write("savevm %s\r\n" % checkpoint) |
63 logging.info('Done saving VM state "%s"' % checkpoint) | 63 logging.info('Done saving VM state "%s"' % checkpoint) |
| 64 |
| 65 |
| 66 def check_raw_dmesg(dmesg, message_level, whitelist): |
| 67 """Checks dmesg for unexpected warnings. |
| 68 |
| 69 This function parses dmesg for message with message_level <= message_level |
| 70 which do not appear in the whitelist. |
| 71 |
| 72 Arguments: |
| 73 dmesg - string containing raw dmesg buffer |
| 74 message_level - minimum message priority to check |
| 75 whitelist - messages to ignore |
| 76 |
| 77 Returns: |
| 78 List of unexpected warnings |
| 79 """ |
| 80 |
| 81 unexpected = [] |
| 82 for line in dmesg.splitlines(): |
| 83 if int(line[1]) <= message_level: |
| 84 if not 'used greatest stack depth' in line: |
| 85 stripped_line = line.split('] ', 1)[1] |
| 86 if not stripped_line in whitelist: |
| 87 unexpected.append(stripped_line) |
| 88 return unexpected |
OLD | NEW |