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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 import logging, os, re, string
6
7 from autotest_lib.client.bin import test, utils
8 from autotest_lib.client.common_lib import error
9
10 class network_WiFiCaps(test.test):
11 version = 1
12
13 def setup(self):
14 self.job.setup_dep(['iwcap'])
15 # create a empty srcdir to prevent the error that checks .version
16 if not os.path.exists(self.srcdir):
17 os.mkdir(self.srcdir)
18
19
20 def __parse_iwcap(self, lines):
21 """Parse the iwcap output"""
22
23 results = {}
24 parse_re = re.compile(r'([a-z0-9]*):[ ]*(.*)')
25 for line in lines.split('\n'):
26 line = line.rstrip()
27 logging.info('==> %s' %line)
28 match = parse_re.search(line)
29 if match:
30 results[match.group(1)] = match.group(2)
31 continue
32 return results
33
34
35 def __run_iwcap(self, phy, caps):
36 dir = os.path.join(self.autodir, 'deps', 'iwcap', 'iwcap')
37 iwcap = utils.run(dir + ' ' + phy + ' ' + string.join(caps))
38 return self.__parse_iwcap(iwcap.stdout)
39
40
41 def run_once(self):
42 phy = 'phy0'
43 requiredCaps = {
44 'sta' : 'true', # station mode
45
46 '24ghz' : 'true', # 2.4GHz band
47 '11b' : 'true',
48 '11g' : 'true',
49
50 '5ghz' : 'true', # 5GHz band
51 '11a' : 'true',
52
53 '11n' : 'true', # 802.11n (both bands)
54 'ht40' : 'true', # HT40
55 'sgi40' : 'true', # Short GI in HT40
56 }
57
58 dep = 'iwcap'
59 dep_dir = os.path.join(self.autodir, 'deps', dep)
60 self.job.install_pkg(dep, 'dep', dep_dir)
61
62 results = self.__run_iwcap(phy, requiredCaps.keys())
63 for cap in requiredCaps:
64 if not cap in results:
65 raise error.TestFail('Internal error, ' +
66 'capability "%s" not handled' % cap)
67 if results[cap] != requiredCaps[cap]:
68 raise error.TestFail('Requirement not met: ' +
69 'cap "%s" is "%s" but expected "%s"'
70 % (cap, results[cap], requiredCaps[cap]))
OLDNEW
« 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