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

Unified Diff: client/site_tests/network_WiFiCaps/network_WiFiCaps.py

Issue 563022: wifi h/w capabilities test (Closed)
Patch Set: fix tarball Created 10 years, 10 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 | « client/site_tests/network_WiFiCaps/control ('k') | client/site_tests/setup/control » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/site_tests/network_WiFiCaps/network_WiFiCaps.py
diff --git a/client/site_tests/network_WiFiCaps/network_WiFiCaps.py b/client/site_tests/network_WiFiCaps/network_WiFiCaps.py
new file mode 100644
index 0000000000000000000000000000000000000000..c06d6b0957a664d8afd39cacaa592b5db0dcb246
--- /dev/null
+++ b/client/site_tests/network_WiFiCaps/network_WiFiCaps.py
@@ -0,0 +1,70 @@
+# Copyright (c) 2009 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import logging, os, re, string
+
+from autotest_lib.client.bin import test, utils
+from autotest_lib.client.common_lib import error
+
+class network_WiFiCaps(test.test):
+ version = 1
+
+ def setup(self):
+ self.job.setup_dep(['iwcap'])
+ # create a empty srcdir to prevent the error that checks .version
+ if not os.path.exists(self.srcdir):
+ os.mkdir(self.srcdir)
+
+
+ def __parse_iwcap(self, lines):
+ """Parse the iwcap output"""
+
+ results = {}
+ parse_re = re.compile(r'([a-z0-9]*):[ ]*(.*)')
+ for line in lines.split('\n'):
+ line = line.rstrip()
+ logging.info('==> %s' %line)
+ match = parse_re.search(line)
+ if match:
+ results[match.group(1)] = match.group(2)
+ continue
+ return results
+
+
+ def __run_iwcap(self, phy, caps):
+ dir = os.path.join(self.autodir, 'deps', 'iwcap', 'iwcap')
+ iwcap = utils.run(dir + ' ' + phy + ' ' + string.join(caps))
+ return self.__parse_iwcap(iwcap.stdout)
+
+
+ def run_once(self):
+ phy = 'phy0'
+ requiredCaps = {
+ 'sta' : 'true', # station mode
+
+ '24ghz' : 'true', # 2.4GHz band
+ '11b' : 'true',
+ '11g' : 'true',
+
+ '5ghz' : 'true', # 5GHz band
+ '11a' : 'true',
+
+ '11n' : 'true', # 802.11n (both bands)
+ 'ht40' : 'true', # HT40
+ 'sgi40' : 'true', # Short GI in HT40
+ }
+
+ dep = 'iwcap'
+ dep_dir = os.path.join(self.autodir, 'deps', dep)
+ self.job.install_pkg(dep, 'dep', dep_dir)
+
+ results = self.__run_iwcap(phy, requiredCaps.keys())
+ for cap in requiredCaps:
+ if not cap in results:
+ raise error.TestFail('Internal error, ' +
+ 'capability "%s" not handled' % cap)
+ if results[cap] != requiredCaps[cap]:
+ raise error.TestFail('Requirement not met: ' +
+ 'cap "%s" is "%s" but expected "%s"'
+ % (cap, results[cap], requiredCaps[cap]))
« no previous file with comments | « client/site_tests/network_WiFiCaps/control ('k') | client/site_tests/setup/control » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698