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

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: Fix bioot messages autotest 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..3d6f858496478f619b992f01522eb6334b58c8e3 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 = {}
+ (fd, fname) = tempfile.mkstemp()
+ f = open(fname, 'w')
Mandeep Singh Baines 2011/04/07 21:15:42 Why not use the fd from above?
vb 2011/04/07 21:34:59 It gets messy with files opened on client/host, et
+ self._client.run('crossystem', stdout_tee=f)
+ f.close()
+ text = open(fname).read()
Mandeep Singh Baines 2011/04/07 21:15:42 Use utils.read_file() instead.
vb 2011/04/07 21:34:59 Done.
+ for line in text.splitlines():
+ assignment_string = line.strip().split('#')[0]
Mandeep Singh Baines 2011/04/07 21:15:42 The strip here seems unnecessary.
vb 2011/04/07 21:34:59 true, done.
+ 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