| OLD | NEW |
| (Empty) |
| 1 AUTHOR = "gps@google.com (Gregory P. Smith)" | |
| 2 TIME = "SHORT" | |
| 3 NAME = "barrier_2client" | |
| 4 TEST_CATEGORY = "Functional" | |
| 5 TEST_CLASS = 'Network' | |
| 6 TEST_TYPE = "Server" | |
| 7 EXPERIMENTAL = True # This is functional a test of autotest itself. | |
| 8 SYNC_COUNT = 2 | |
| 9 DOC = """ | |
| 10 A functional test of autotest's Barrier mechanisms for synchronizing | |
| 11 events between two clients without the help of the server. | |
| 12 """ | |
| 13 | |
| 14 from autotest_lib.server import utils | |
| 15 | |
| 16 def run(pair): | |
| 17 logging.info('Running on %s and %s', pair[0], pair[1]) | |
| 18 host_objs = [hosts.create_host(machine) for machine in pair] | |
| 19 host_at_objs = [autotest.Autotest(host) for host in host_objs] | |
| 20 | |
| 21 client_control_template = """ | |
| 22 import logging, platform, socket, traceback | |
| 23 try: | |
| 24 client_hostnames = %r | |
| 25 master_hostname = client_hostnames[0] | |
| 26 client_hostname = client_hostnames[1] | |
| 27 | |
| 28 logging.info('Testing hostname only barrier') | |
| 29 barrier = job.barrier(platform.node(), 'barriertest_2client', 120) | |
| 30 logging.info('rendezvous-ing') | |
| 31 barrier.rendezvous(master_hostname, client_hostname) | |
| 32 logging.info('done.') | |
| 33 | |
| 34 logging.info('Testing local identifier barrier') | |
| 35 barrier = job.barrier(platform.node() + '#id0', 'barriertest_2client', 120) | |
| 36 logging.info('rendezvous-ing') | |
| 37 barrier.rendezvous(master_hostname + '#id0', | |
| 38 client_hostname + '#id0') | |
| 39 logging.info('done.') | |
| 40 | |
| 41 logging.info('Testing IP@ barrier') | |
| 42 barrier = job.barrier(socket.gethostbyname(platform.node()), | |
| 43 'barriertest_2client', 120) | |
| 44 logging.info('rendezvous-ing') | |
| 45 barrier.rendezvous(socket.gethostbyname(master_hostname), | |
| 46 socket.gethostbyname(client_hostname)) | |
| 47 logging.info('done.') | |
| 48 | |
| 49 logging.info('Testing IP@ barrier with ids') | |
| 50 barrier = job.barrier(socket.gethostbyname(platform.node()) + '#42', | |
| 51 'barriertest_2client', 120) | |
| 52 logging.info('rendezvous-ing') | |
| 53 barrier.rendezvous(socket.gethostbyname(master_hostname) + '#42', | |
| 54 socket.gethostbyname(client_hostname) + '#42') | |
| 55 logging.info('done.') | |
| 56 except: | |
| 57 traceback.print_exc() | |
| 58 raise | |
| 59 """ | |
| 60 client_controls = [client_control_template % (pair,) for host in host_objs] | |
| 61 | |
| 62 subcommand_list = [] | |
| 63 for host, host_at, control in zip(host_objs, host_at_objs, client_controls): | |
| 64 subcommand_list.append(subcommand(host_at.run, | |
| 65 (control, host.hostname))) | |
| 66 | |
| 67 parallel(subcommand_list) | |
| 68 | |
| 69 | |
| 70 # grab the pairs (and failures) | |
| 71 (pairs, failures) = utils.form_ntuples_from_machines(machines, 2) | |
| 72 | |
| 73 # log the failures | |
| 74 for failure in failures: | |
| 75 job.record("FAIL", failure[0], "barrier_2client", failure[1]) | |
| 76 | |
| 77 # now run through each pair and run | |
| 78 job.parallel_simple(run, pairs, log=False) | |
| OLD | NEW |