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

Side by Side Diff: server/site_wifitest.py

Issue 1812002: More work on wifi tests (Closed)
Patch Set: Created 10 years, 7 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 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
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.client.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 got = result.stdout.rstrip() # NB: chop \n 339 got = result.stdout.rstrip() # NB: chop \n
340 if got != want: 340 if got != want:
341 logging.error("client_check_%s: wanted %s got %s", 341 raise error.TestFail("client_check_%s: wanted %s got %s",
342 param, want, got) 342 param, want, got)
343 raise AssertionError
344 343
345 344
346 def client_check_bintval(self, params): 345 def client_check_bintval(self, params):
347 """ Verify negotiated beacon interval """ 346 """ Verify negotiated beacon interval """
348 self.__client_check("beacon_int", params[0]) 347 self.__client_check("beacon_int", params[0])
349 348
350 349
351 def client_check_dtimperiod(self, params): 350 def client_check_dtimperiod(self, params):
352 """ Verify negotiated DTIM period """ 351 """ Verify negotiated DTIM period """
353 self.__client_check("dtim_period", params[0]) 352 self.__client_check("dtim_period", params[0])
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 640
642 641
643 def __byfile(a, b): 642 def __byfile(a, b):
644 if a['file'] < b['file']: 643 if a['file'] < b['file']:
645 return -1 644 return -1
646 elif a['file'] > b['file']: 645 elif a['file'] > b['file']:
647 return 1 646 return 1
648 else: 647 else:
649 return 0 648 return 0
650 649
651 def read_tests(dir, pat): 650 def read_tests(dir, *args):
652 """ 651 """
653 Collect WiFi test tuples from files. File names are used to 652 Collect WiFi test tuples from files. File names are used to
654 sort the test objects so the convention is to name them NNN<test> 653 sort the test objects so the convention is to name them NNN<test>
655 where NNN is a decimal number used to sort and <test> is an 654 where NNN is a decimal number used to sort and <test> is an
656 identifying name for the test; e.g. 000Check11b 655 identifying name for the test; e.g. 000Check11b
657 """ 656 """
658 tests = [] 657 tests = []
659 for file in os.listdir(dir): 658 for file in os.listdir(dir):
660 if fnmatch.fnmatch(file, pat): 659 if any(fnmatch.fnmatch(file, pat) for pat in args):
661 fd = open(os.path.join(dir, file)); 660 fd = open(os.path.join(dir, file));
662 try: 661 try:
663 test = eval(fd.read()) 662 test = eval(fd.read())
664 except Exception, e: 663 except Exception, e:
665 logging.error("%s: %s", os.path.join(dir, file), str(e)) 664 logging.error("%s: %s", os.path.join(dir, file), str(e))
666 raise e 665 raise e
667 test['file'] = file 666 test['file'] = file
668 tests.append(test) 667 tests.append(test)
669 # use filenames to sort 668 # use filenames to sort
670 return sorted(tests, cmp=__byfile) 669 return sorted(tests, cmp=__byfile)
(...skipping 17 matching lines...) Expand all
688 687
689 server = config['server'] 688 server = config['server']
690 if server_addr is not None: 689 if server_addr is not None:
691 server['addr'] = server_addr; 690 server['addr'] = server_addr;
692 # TODO(sleffler) check for wifi_addr when no control address 691 # TODO(sleffler) check for wifi_addr when no control address
693 692
694 # tag jobs w/ the router's address on the control network 693 # tag jobs w/ the router's address on the control network
695 config['tagname'] = router['addr'] 694 config['tagname'] = router['addr']
696 695
697 return config 696 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