• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1AUTHOR = 'Ashwin Ganti (aganti@google.com)'
2TIME ='SHORT'
3DEPENDENCIES = 'STANDARD'
4NAME = 'Parallel Sleeptest'
5TEST_TYPE = 'server'
6TEST_CATEGORY = 'Functional'
7DOC = """\
8This control file executes multiple sleeptest tests on a machine
9starting at the same time. Multiple machines can also be specified
10wherein the specified set of tests are executed in parallel
11on each of the machines.
12
13To run a different set of tests do the following:
141. Replace the sleeptest control files with the required test control files
152. Give tag names for each of the tests
163. Run the control file through autoserv using
17   server/autoserv <this control file path> -m <machines> -r <subdir to contain the run results>
18"""
19
20from autotest_lib.client.common_lib import utils
21
22# Specify the path to the client control files and the tag names
23# for the respective jobs here.
24tests = [("client/tests/sleeptest/control", "sleeptag0"),
25         ("client/tests/sleeptest/control", "sleeptag1"),
26         ]
27
28def run_client(at, machine_name, machine_num, instance):
29    control = open(os.path.join(job.autodir,tests[instance][0])).read()
30    '''
31    The get_sync_control_file method basically does the setup of the barriers
32    required to start these multiple tests at the same time and returns the
33    modified control file (that contains the barrier code added to it)
34    Check client/common_lib/utils.py for detailed documentation of how this
35    method sets up the barriers.
36    '''
37    control_new = utils.get_sync_control_file(control, machine_name,
38                                    machine_num, instance, len(tests))
39    '''
40    This control file is now simply passed in to the run method along with
41    a tag name of the test and a 'parallel_flag' that identifies this scenario
42    of running multiple tests on the same machine at the same time.
43    '''
44    at.run(control_new, tag='%s' % tests[instance][1], parallel_flag=True)
45
46def main(machine_name, machine_num):
47    host = hosts.create_host(machine_name)
48    at = autotest.Autotest(host)
49    at.install()
50
51    parallel([subcommand(run_client, [at, machine_name, machine_num, i])
52              for i in range(len(tests))])
53
54parallel([subcommand(main, [machines[i], i], machines[i])
55          for i in range(len(machines))])
56