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

Unified Diff: client/bin/site_utils.py

Issue 6810022: Fix kernel testing and make it target specific. (Closed) Base URL: ssh://gitrw.chromium.org:9222/autotest.git@0.11.257.B
Patch Set: Address review comments. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | server/site_tests/kernel_BootMessagesServer/kernel_BootMessagesServer.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/bin/site_utils.py
diff --git a/client/bin/site_utils.py b/client/bin/site_utils.py
index b6cc26fc0a2ae75cafa475477430773e0dc06246..61a9e1423a7ef7aa8d47925c510972eef9da32ec 100644
--- a/client/bin/site_utils.py
+++ b/client/bin/site_utils.py
@@ -2,14 +2,47 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-import logging, os, platform, time
+import logging, os, platform, re, tempfile, time
from autotest_lib.client.common_lib import error
+from autotest_lib.client.common_lib import utils
class TimeoutError(error.TestError):
"""Error raised when we time out when waiting on a condition."""
+class Crossystem(object):
+ """A wrapper for the crossystem utility."""
+
+ def __init__(self, client):
+ self.cros_system_data = {}
+ self._client = client
+
+ def init(self):
+ self.cros_system_data = {}
+ (_, fname) = tempfile.mkstemp()
+ f = open(fname, 'w')
+ self._client.run('crossystem', stdout_tee=f)
+ f.close()
+ text = utils.read_file(fname)
+ for line in text.splitlines():
+ assignment_string = line.split('#')[0]
+ if not assignment_string.count('='):
+ continue
+ (name, value) = assignment_string.split('=', 1)
+ self.cros_system_data[name.strip()] = value.strip()
+ os.remove(fname)
+
+ def __getattr__(self, name):
+ """
+ Retrieve a crosssystem attribute.
+
+ The call crossystemobject.name() will return the crossystem reported
+ string.
+ """
+ return lambda : self.cros_system_data[name]
+
+
def poll_for_condition(
condition, exception=None, timeout=10, sleep_interval=0.1, desc=None):
"""Poll until a condition becomes true.
@@ -77,12 +110,12 @@ def check_raw_dmesg(dmesg, message_level, whitelist):
Returns:
List of unexpected warnings
"""
-
+ whitelist_re = re.compile(r'(%s)' % '|'.join(whitelist))
unexpected = []
for line in dmesg.splitlines():
if int(line[1]) <= message_level:
- if not 'used greatest stack depth' in line:
- stripped_line = line.split('] ', 1)[1]
- if not stripped_line in whitelist:
- unexpected.append(stripped_line)
+ stripped_line = line.split('] ', 1)[1]
+ if whitelist_re.search(stripped_line):
+ continue
+ unexpected.append(stripped_line)
return unexpected
« no previous file with comments | « no previous file | server/site_tests/kernel_BootMessagesServer/kernel_BootMessagesServer.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698