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

Side by Side Diff: client/site_tests/network_WiFiCaps/network_WiFiCaps.py

Issue 6894013: Rewrite pipe (remove one stage) and remove reference to wlan0 (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/autotest.git@master
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved. 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 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, string 5 import logging, os, re, string
6 6
7 from autotest_lib.client.bin import test, utils 7 from autotest_lib.client.bin import test, utils
8 from autotest_lib.client.common_lib import error 8 from autotest_lib.client.common_lib import error
9 9
10 class network_WiFiCaps(test.test): 10 class network_WiFiCaps(test.test):
(...skipping 20 matching lines...) Expand all
31 continue 31 continue
32 return results 32 return results
33 33
34 34
35 def __run_iwcap(self, phy, caps): 35 def __run_iwcap(self, phy, caps):
36 dir = os.path.join(self.autodir, 'deps', 'iwcap', 'iwcap') 36 dir = os.path.join(self.autodir, 'deps', 'iwcap', 'iwcap')
37 iwcap = utils.run(dir + ' ' + phy + ' ' + string.join(caps)) 37 iwcap = utils.run(dir + ' ' + phy + ' ' + string.join(caps))
38 return self.__parse_iwcap(iwcap.stdout) 38 return self.__parse_iwcap(iwcap.stdout)
39 39
40 def run_once(self): 40 def run_once(self):
41 phy = utils.system_output("iw list | grep Wiphy |" 41 phy = utils.system_output("iw list | awk '/^WiPhy/ {print $2}'")
42 " awk {'NR==1; print $2'}")
43 if not phy or 'phy' not in phy: 42 if not phy or 'phy' not in phy:
44 raise error.TestFail('Physical interface for wlan0 not found') 43 raise error.TestFail('WiFi Physical interface not found')
45 44
46 requiredCaps = { 45 requiredCaps = {
47 'sta' : 'true', # station mode 46 'sta' : 'true', # station mode
48 47
49 '24ghz' : 'true', # 2.4GHz band 48 '24ghz' : 'true', # 2.4GHz band
50 '11b' : 'true', 49 '11b' : 'true',
51 '11g' : 'true', 50 '11g' : 'true',
52 51
53 '5ghz' : 'true', # 5GHz band 52 '5ghz' : 'true', # 5GHz band
54 '11a' : 'true', 53 '11a' : 'true',
55 54
56 '11n' : 'true', # 802.11n (both bands) 55 '11n' : 'true', # 802.11n (both bands)
57 'ht40' : 'true', # HT40 56 'ht40' : 'true', # HT40
58 'sgi40' : 'true', # Short GI in HT40 57 'sgi40' : 'true', # Short GI in HT40
59 } 58 }
60 59
61 dep = 'iwcap' 60 dep = 'iwcap'
62 dep_dir = os.path.join(self.autodir, 'deps', dep) 61 dep_dir = os.path.join(self.autodir, 'deps', dep)
63 self.job.install_pkg(dep, 'dep', dep_dir) 62 self.job.install_pkg(dep, 'dep', dep_dir)
64 63
65 results = self.__run_iwcap(phy, requiredCaps.keys()) 64 results = self.__run_iwcap(phy, requiredCaps.keys())
66 for cap in requiredCaps: 65 for cap in requiredCaps:
67 if not cap in results: 66 if not cap in results:
68 raise error.TestFail('Internal error, ' + 67 raise error.TestFail('Internal error, ' +
69 'capability "%s" not handled' % cap) 68 'capability "%s" not handled' % cap)
70 if results[cap] != requiredCaps[cap]: 69 if results[cap] != requiredCaps[cap]:
71 raise error.TestFail('Requirement not met: ' + 70 raise error.TestFail('Requirement not met: ' +
72 'cap "%s" is "%s" but expected "%s"' 71 'cap "%s" is "%s" but expected "%s"'
73 % (cap, results[cap], requiredCaps[cap])) 72 % (cap, results[cap], requiredCaps[cap]))
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698