| OLD | NEW |
| 1 # Copyright (c) 2011 The Chromium OS Authors. All rights reserved. | 1 # Copyright (c) 2011 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 | 6 |
| 7 from autotest_lib.client.bin import utils | 7 from autotest_lib.client.bin import utils |
| 8 from autotest_lib.client.common_lib import error | 8 from autotest_lib.client.common_lib import error |
| 9 from autotest_lib.server import test | 9 from autotest_lib.server import test |
| 10 | 10 |
| 11 _KERN_WARNING = 4 | 11 _KERN_WARNING = 4 |
| 12 | 12 |
| 13 _WHITELIST = [ | 13 _WHITELIST_COMMON = [ |
| 14 r"used greatest stack depth: \d+ bytes left", |
| 14 "Kernel-defined memdesc doesn't match the one from EFI!", | 15 "Kernel-defined memdesc doesn't match the one from EFI!", |
| 15 "Warning only 1919MB will be used.", | |
| 16 "Use a HIGHMEM enabled kernel.", | 16 "Use a HIGHMEM enabled kernel.", |
| 17 "pnp 00:01: io resource (0x164e-0x164f) overlaps 0000:00:1c.0 " | 17 "GPT: Use GNU Parted to correct GPT errors.", |
| 18 "BAR 7 (0x1000-0x1fff), disabling", | 18 r"GPT:\d+ != \d+", |
| 19 "i915 0000:00:02.0: Invalid ROM contents", | 19 "GPT:Alternate GPT header not at the end of the disk.", |
| 20 "[drm:intel_init_bios] *ERROR* VBT signature missing", | 20 "GPT:Primary header thinks Alt. header is not at the end of the disk.", |
| 21 "usb 1-2: config 1 has an invalid interface number: 1 but max is 0", | 21 r"GPT:partition_entry_array_crc32 values don't match: 0x[\da-f]+ !=" |
| 22 "usb 1-2: config 1 has no interface number 0", | 22 " 0x[\da-f]+", |
| 23 "device-mapper: verity: Failed to acquire device 'ROOT_DEV': -1", | 23 r"Warning only \d+MB will be used.", |
| 24 "device-mapper: table: 254:0: verity: Device lookup failed", | 24 "\[drm:intel_init_bios\] \*ERROR\* VBT signature missing", |
| 25 "dm: starting dm-0 (vroot) failed", | |
| 26 "EXT3-fs warning: maximal mount count reached, running e2fsck is " | |
| 27 "recommended", | |
| 28 "i2c i2c-2: The new_device interface is still experimental and may change " | 25 "i2c i2c-2: The new_device interface is still experimental and may change " |
| 29 "in a near future", | 26 "in a near future", |
| 30 "industrialio: module is from the staging directory, " | 27 "i915 0000:00:02.0: Invalid ROM contents", |
| 31 "the quality is unknown, you have been warned.", | 28 "industrialio: module is from the staging directory, the quality is " |
| 32 "tsl2563: module is from the staging directory, the quality is unknown, " | 29 "unknown, you have been warned.", |
| 33 "you have been warned.", | 30 "pnp 00:01: io resource \(0x164e-0x164f\) overlaps 0000:00:1c.0 " |
| 31 "BAR 7 \(0x1000-0x1fff\), disabling", |
| 32 r"sd \d:\d:\d:\d: \[sd[a-z]\] Assuming drive cache: write through", |
| 33 "tsl[\da-z]+: module is from the staging directory, the quality is " |
| 34 "unknown, you have been warned.", |
| 34 ] | 35 ] |
| 35 | 36 |
| 37 _WHITELIST_TARGETS = { |
| 38 'Alex' : [ |
| 39 r"CE: hpet increasing min_delta_ns to \d+ nsec", |
| 40 r"Measured \d+ cycles TSC warp between CPUs, turning off TSC clock.", |
| 41 "pci 0000:01:00.0: BAR 6: no parent found for of device " |
| 42 "\[0xffff0000-0xffffffff]", |
| 43 "tsl258x 2-0029: taos_get_lux data not valid", |
| 44 "usb 1-2: config 1 has an invalid interface number: 1 but max is 0", |
| 45 "usb 1-2: config 1 has no interface number 0", |
| 46 ], |
| 47 'Mario' : [ |
| 48 "chromeos_acpi: failed to retrieve MLST \(5\)", |
| 49 r"btusb_[a-z]{4}_complete: hci\d urb [\da-f]+ failed to resubmit \(1\)", |
| 50 ] |
| 51 } |
| 52 |
| 36 """ Interesting fields from meminfo that we want to log | 53 """ Interesting fields from meminfo that we want to log |
| 37 If you add fields here, you must add them to the constraints | 54 If you add fields here, you must add them to the constraints |
| 38 in the control file | 55 in the control file |
| 39 """ | 56 """ |
| 40 _meminfo_fields = { 'MemFree' : 'coldboot_memfree_mb', | 57 _meminfo_fields = { 'MemFree' : 'coldboot_memfree_mb', |
| 41 'AnonPages' : 'coldboot_anonpages_mb', | 58 'AnonPages' : 'coldboot_anonpages_mb', |
| 42 'Buffers' : 'coldboot_buffers_mb', | 59 'Buffers' : 'coldboot_buffers_mb', |
| 43 'Cached' : 'coldboot_cached_mb', | 60 'Cached' : 'coldboot_cached_mb', |
| 44 'Active' : 'coldboot_active_mb', | 61 'Active' : 'coldboot_active_mb', |
| 45 'Inactive' : 'coldboot_inactive_mb', | 62 'Inactive' : 'coldboot_inactive_mb', |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 perf_vals[metric] = value | 116 perf_vals[metric] = value |
| 100 | 117 |
| 101 def run_once(self, host=None): | 118 def run_once(self, host=None): |
| 102 """Run the test. | 119 """Run the test. |
| 103 | 120 |
| 104 @param host: The client machine to connect to; should be a Host object. | 121 @param host: The client machine to connect to; should be a Host object. |
| 105 """ | 122 """ |
| 106 assert host is not None, "The host must be specified." | 123 assert host is not None, "The host must be specified." |
| 107 | 124 |
| 108 self._client = host | 125 self._client = host |
| 126 |
| 127 # get the firmware identifier from Crossystem |
| 128 cs = utils.Crossystem(self._client) |
| 129 cs.init() |
| 130 fwid = cs.fwid().split('.')[0] |
| 131 |
| 109 dmesg_filename = os.path.join(self.resultsdir, 'dmesg') | 132 dmesg_filename = os.path.join(self.resultsdir, 'dmesg') |
| 110 meminfo_filename = os.path.join(self.resultsdir, 'meminfo') | 133 meminfo_filename = os.path.join(self.resultsdir, 'meminfo') |
| 111 perf_vals = {} | 134 perf_vals = {} |
| 112 | 135 |
| 113 self._reboot_machine() | 136 self._reboot_machine() |
| 114 meminfo = self._read_meminfo(meminfo_filename) | 137 meminfo = self._read_meminfo(meminfo_filename) |
| 115 self._parse_meminfo(meminfo, perf_vals) | 138 self._parse_meminfo(meminfo, perf_vals) |
| 116 dmesg = self._read_dmesg(dmesg_filename) | 139 dmesg = self._read_dmesg(dmesg_filename) |
| 117 unexpected = utils.check_raw_dmesg(dmesg, _KERN_WARNING, _WHITELIST) | 140 unexpected = utils.check_raw_dmesg( |
| 141 dmesg, _KERN_WARNING, _WHITELIST_COMMON + _WHITELIST_TARGETS[fwid]) |
| 118 | 142 |
| 119 if unexpected: | 143 if unexpected: |
| 120 f = open(os.path.join(self.resultsdir, 'dmesg.err'), 'w') | 144 f = open(os.path.join(self.resultsdir, 'dmesg.err'), 'w') |
| 121 for line in unexpected: | 145 for line in unexpected: |
| 122 logging.error('UNEXPECTED DMESG: %s' % line) | 146 logging.error('UNEXPECTED DMESG: %s' % line) |
| 123 f.write('%s\n' % line) | 147 f.write('%s\n' % line) |
| 124 f.close() | 148 f.close() |
| 125 raise error.TestFail("Unexpected dmesg warnings and/or errors.") | 149 raise error.TestFail("Unexpected dmesg warnings and/or errors.") |
| 126 | 150 |
| 127 self.write_perf_keyval(perf_vals) | 151 self.write_perf_keyval(perf_vals) |
| OLD | NEW |