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

Side by Side Diff: server/site_wifitest.py

Issue 1763012: more WiFi testing fixes (Closed)
Patch Set: use rstrip to chop \n's Created 10 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
« no previous file with comments | « server/site_linux_router.py ('k') | 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) 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, hosts, subcommand 7 from autotest_lib.server import autotest, hosts, 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
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 raise error.TestFail("No inet address found") 257 raise error.TestFail("No inet address found")
258 return m.group(1) 258 return m.group(1)
259 259
260 260
261 def connect(self, params): 261 def connect(self, params):
262 """ Connect client to AP/router """ 262 """ Connect client to AP/router """
263 if 'ssid' not in params: 263 if 'ssid' not in params:
264 params['ssid'] = self.defssid 264 params['ssid'] = self.defssid
265 script = self.__get_connect_script(params) 265 script = self.__get_connect_script(params)
266 result = self.client.run("python<<'EOF'\n%s\nEOF\n" % script) 266 result = self.client.run("python<<'EOF'\n%s\nEOF\n" % script)
267 print "%s: %s" % (self.name, result.stdout[0:-1]) 267 print "%s: %s" % (self.name, result.stdout.rstrip())
268 268
269 # fetch IP address of wireless device 269 # fetch IP address of wireless device
270 self.client_wifi_ip = self.__get_ipaddr(self.client, self.client_wlanif) 270 self.client_wifi_ip = self.__get_ipaddr(self.client, self.client_wlanif)
271 logging.info("%s: client WiFi-IP is %s", self.name, self.client_wifi_ip) 271 logging.info("%s: client WiFi-IP is %s", self.name, self.client_wifi_ip)
272 # TODO(sleffler) not right for non-mac80211 devices 272 # TODO(sleffler) not right for non-mac80211 devices
273 # TODO(sleffler) verify debugfs is mounted @ /sys/kernel/debug 273 # TODO(sleffler) verify debugfs is mounted @ /sys/kernel/debug
274 self.client_debugfs_path = "/sys/kernel/debug/ieee80211/%s/netdev:%s" \ 274 self.client_debugfs_path = "/sys/kernel/debug/ieee80211/%s/netdev:%s" \
275 % ("phy0", self.client_wlanif) 275 % ("phy0", self.client_wlanif)
276 276
277 277
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 sys.exit(0)''' 312 sys.exit(0)'''
313 313
314 314
315 def disconnect(self, params): 315 def disconnect(self, params):
316 """ Disconnect previously connected client """ 316 """ Disconnect previously connected client """
317 if 'ssid' not in params: 317 if 'ssid' not in params:
318 params['ssid'] = self.defssid 318 params['ssid'] = self.defssid
319 self.client_ping_bg_stop({}) 319 self.client_ping_bg_stop({})
320 script = self.__get_disconnect_script(params) 320 script = self.__get_disconnect_script(params)
321 result = self.client.run("python<<'EOF'\n%s\nEOF\n" % script) 321 result = self.client.run("python<<'EOF'\n%s\nEOF\n" % script)
322 print "%s: %s" % (self.name, result.stdout[0:-1]) 322 print "%s: %s" % (self.name, result.stdout.rstrip())
323 323
324 324
325 def client_powersave_on(self, params): 325 def client_powersave_on(self, params):
326 """ Enable power save operation """ 326 """ Enable power save operation """
327 self.client.run("iwconfig %s power on" % self.client_wlanif) 327 self.client.run("iwconfig %s power on" % self.client_wlanif)
328 328
329 329
330 def client_powersave_off(self, params): 330 def client_powersave_off(self, params):
331 """ Disable power save operation """ 331 """ Disable power save operation """
332 self.client.run("iwconfig %s power off" % self.client_wlanif) 332 self.client.run("iwconfig %s power off" % self.client_wlanif)
333 333
334 334
335 def __client_check(self, param, want): 335 def __client_check(self, param, want):
336 """ Verify negotiated station mode parameter """ 336 """ Verify negotiated station mode parameter """
337 result = self.router.run("cat %s/%s" % 337 result = self.client.run("cat '%s/%s'" %
338 (self.client_debugfs_path, param_)) 338 (self.client_debugfs_path, param))
339 if result != want: 339 got = result.stdout.rstrip() # NB: chop \n
seano 2010/04/28 19:05:53 unnecessary comment..
340 if got != want:
340 logging.error("client_check_%s: wanted %s got %s", 341 logging.error("client_check_%s: wanted %s got %s",
341 param, want, result) 342 param, want, got)
342 raise AssertionError 343 raise AssertionError
343 344
344 345
345 def client_check_bintval(self, params): 346 def client_check_bintval(self, params):
346 """ Verify negotiated beacon interval """ 347 """ Verify negotiated beacon interval """
347 _self._client_check("beacon_int", params[0]) 348 self.__client_check("beacon_int", params[0])
348 349
349 350
350 def client_check_dtimperiod(self, params): 351 def client_check_dtimperiod(self, params):
351 """ Verify negotiated DTIM period """ 352 """ Verify negotiated DTIM period """
352 _self._client_check("dtim_period", params[0]) 353 self.__client_check("dtim_period", params[0])
353 354
354 355
355 def client_check_rifs(self, params): 356 def client_check_rifs(self, params):
356 """ Verify negotiated RIFS setting """ 357 """ Verify negotiated RIFS setting """
357 _self._client_check("rifs", params[0]) 358 self.__client_check("rifs", params[0])
358 359
359 360
360 def client_check_shortgi20(self, params): 361 def client_check_shortgi20(self, params):
361 """ Verify negotiated Short GI setting """ 362 """ Verify negotiated Short GI setting """
362 _self._client_check("sgi20", params[0]) 363 self.__client_check("sgi20", params[0])
363 364
364 365
365 def client_check_shortgi40(self, params): 366 def client_check_shortgi40(self, params):
366 """ Verify negotiated Short GI setting """ 367 """ Verify negotiated Short GI setting """
367 _self._client_check("sgi40", params[0]) 368 self.__client_check("sgi40", params[0])
368 369
369 370
370 def client_check_shortslot(self, params): 371 def client_check_shortslot(self, params):
371 """ Verify negotiated Short Slot setting """ 372 """ Verify negotiated Short Slot setting """
372 _self._client_check("short_slot", params[0]) 373 self.__client_check("short_slot", params[0])
373 374
374 375
375 def client_check_protection(self, params): 376 def client_check_protection(self, params):
376 """ Verify negotiated CTS protection setting """ 377 """ Verify negotiated CTS protection setting """
377 _self._client_check("cts_prot", params[0]) 378 self.__client_check("cts_prot", params[0])
378 379
379 380
380 def client_monitor_start(self, params): 381 def client_monitor_start(self, params):
381 """ Start monitoring system events """ 382 """ Start monitoring system events """
382 raise NotImplemented("client_monitor_start") 383 raise NotImplemented("client_monitor_start")
383 384
384 385
385 def client_monitor_stop(self, params): 386 def client_monitor_stop(self, params):
386 """ Stop monitoring system events """ 387 """ Stop monitoring system events """
387 raise NotImplemented("client_monitor_stop") 388 raise NotImplemented("client_monitor_stop")
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
687 688
688 server = config['server'] 689 server = config['server']
689 if server_addr is not None: 690 if server_addr is not None:
690 server['addr'] = server_addr; 691 server['addr'] = server_addr;
691 # TODO(sleffler) check for wifi_addr when no control address 692 # TODO(sleffler) check for wifi_addr when no control address
692 693
693 # tag jobs w/ the router's address on the control network 694 # tag jobs w/ the router's address on the control network
694 config['tagname'] = router['addr'] 695 config['tagname'] = router['addr']
695 696
696 return config 697 return config
OLDNEW
« no previous file with comments | « server/site_linux_router.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698