OLD | NEW |
1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 # Copyright (c) 2010 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 common, fnmatch, logging, os, re, string, threading, time | 5 import common, fnmatch, logging, os, re, string, threading, time |
6 | 6 |
7 from autotest_lib.server import autotest, subcommand | 7 from autotest_lib.server import autotest, subcommand |
8 from autotest_lib.server import site_bsd_router | 8 from autotest_lib.server import site_bsd_router |
9 #from autotest_lib.server import site_linux_router | 9 from autotest_lib.server import site_linux_router |
10 | 10 |
11 class NotImplemented(Exception): | 11 class NotImplemented(Exception): |
12 def __init__(self, what): | 12 def __init__(self, what): |
13 self.what = what | 13 self.what = what |
14 | 14 |
15 | 15 |
16 def __str__(self): | 16 def __str__(self): |
17 return repr("Test method '%s' not implemented" % self.what) | 17 return repr("Test method '%s' not implemented" % self.what) |
18 | 18 |
19 | 19 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 self.server_wifi_ip = getattr(server, 'wifi_addr', self.server.ip) | 87 self.server_wifi_ip = getattr(server, 'wifi_addr', self.server.ip) |
88 else: | 88 else: |
89 # NB: must be set if not reachable from control | 89 # NB: must be set if not reachable from control |
90 self.server_wifi_ip = server['wifi_addr'] | 90 self.server_wifi_ip = server['wifi_addr'] |
91 | 91 |
92 # NB: truncate SSID to 32 characters | 92 # NB: truncate SSID to 32 characters |
93 self.defssid = self.__get_defssid()[0:32] | 93 self.defssid = self.__get_defssid()[0:32] |
94 # interface name on client | 94 # interface name on client |
95 self.wlanif = "wlan0" | 95 self.wlanif = "wlan0" |
96 | 96 |
97 # XXX auto-detect router type | 97 # auto-detect router type |
98 self.wifi = site_bsd_router.BSDRouter(self.router, router, self.defssid) | 98 router_uname = self.router.run('uname').stdout |
| 99 if re.search('Linux', router_uname): |
| 100 self.wifi = site_linux_router.LinuxRouter(self.router, router, self.
defssid) |
| 101 elif re.search('BSD', router_uname): |
| 102 self.wifi = site_bsd_router.BSDRouter(self.router, router, self.defs
sid) |
| 103 else: |
| 104 raise Exception('Unsupported router') |
99 | 105 |
100 # potential bg thread for ping untilstop | 106 # potential bg thread for ping untilstop |
101 self.ping_thread = None | 107 self.ping_thread = None |
102 | 108 |
103 | 109 |
104 def setup(self): | 110 def setup(self): |
105 self.job.setup_dep(['netperf']) | 111 self.job.setup_dep(['netperf']) |
106 # XXX enable once iperf is built by build_autotest | 112 # XXX enable once iperf is built by build_autotest |
107 # self.job.setup_dep(['iperf']) | 113 # self.job.setup_dep(['iperf']) |
108 # create a empty srcdir to prevent the error that checks .version | 114 # create a empty srcdir to prevent the error that checks .version |
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
607 try: | 613 try: |
608 test = eval(fd.read()) | 614 test = eval(fd.read()) |
609 except Exception, e: | 615 except Exception, e: |
610 logging.error("%s: %s", os.path.join(dir, file), str(e)) | 616 logging.error("%s: %s", os.path.join(dir, file), str(e)) |
611 raise e | 617 raise e |
612 test['file'] = file | 618 test['file'] = file |
613 tests.append(test) | 619 tests.append(test) |
614 # use filenames to sort | 620 # use filenames to sort |
615 return sorted(tests, cmp=__byfile) | 621 return sorted(tests, cmp=__byfile) |
616 | 622 |
OLD | NEW |