Adds a barriertest_2client server side test that tests barrier
functionality between two client tests without any server involvement.

Signed-off-by: Gregory Smith <[email protected]>

--- /dev/null   2009-12-17 12:29:38.000000000 -0800
+++ autotest/server/tests/barriertest_2client/control.srv       2010-11-04 
22:55:21.000000000 -0700
@@ -0,0 +1,44 @@
+AUTHOR = "[email protected] (Gregory P. Smith)"
+TIME = "SHORT"
+NAME = "barrier_2client"
+TEST_CATEGORY = "Functional"
+TEST_CLASS = 'Network'
+TEST_TYPE = "Server"
+EXPERIMENTAL = True  # This is functional a test of autotest itself.
+SYNC_COUNT = 2
+DOC = """
+A functional test of autotest's Barrier mechanisms for synchronizing
+events between two clients without the help of the server.
+"""
+
+from autotest_lib.client.common_lib import barrier, error
+from autotest_lib.server import autotest, hosts, subcommand
+
+assert len(machines) > 1, "gimme at least two machines!"
+if len(machines) > 2:
+    machines = machines[:2]
+
+host_objs = [hosts.create_host(machine) for machine in machines]
+host_at_objs = [autotest.Autotest(host) for host in host_objs]
+
+client_control_template = """
+import logging, platform, traceback
+try:
+    client_hostnames = %r
+    logging.info('creating barrier')
+    barrier = job.barrier(platform.node(), 'barriertest_2client', 120)
+    logging.info('rendezvous-ing')
+    barrier.rendezvous(client_hostnames[0], *client_hostnames[1:])
+    logging.info('done.')
+except:
+    traceback.print_exc()
+    raise
+"""
+client_controls = [client_control_template % (machines,) for host in host_objs]
+
+subcommand_list = []
+for host, host_at, control in zip(host_objs, host_at_objs, client_controls):
+    subcommand_list.append(subcommand.subcommand(
+            host_at.run, (control, host.hostname)))
+
+subcommand.parallel(subcommand_list)
_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to