Making the barrier test work on the server.

Signed-off-by: Jean-Marc Eurin <[email protected]>

--- autotest/server/tests/barriertest_2client/control.srv       2010-11-12 
13:53:52.000000000 -0800
+++ autotest/server/tests/barriertest_2client/control.srv       2010-11-16 
16:33:33.000000000 -0800
@@ -11,17 +11,14 @@
 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
+from autotest_lib.server import utils
 
-assert len(machines) > 1, "gimme at least two machines!"
-if len(machines) > 2:
-    machines = machines[:2]
+def run(pair):
+    logging.info('Running on %s and %s', pair[0], pair[1])
+    host_objs = [hosts.create_host(machine) for machine in pair]
+    host_at_objs = [autotest.Autotest(host) for host in host_objs]
 
-host_objs = [hosts.create_host(machine) for machine in machines]
-host_at_objs = [autotest.Autotest(host) for host in host_objs]
-
-client_control_template = """
+    client_control_template = """
 import logging, platform, socket, traceback
 try:
     client_hostnames = %r
@@ -60,11 +57,22 @@
     traceback.print_exc()
     raise
 """
-client_controls = [client_control_template % (machines,) for host in host_objs]
+    client_controls = [client_control_template % (pair,) 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(host_at.run,
+                                          (control, host.hostname)))
+
+    parallel(subcommand_list)
+
+
+# grab the pairs (and failures)
+(pairs, failures) = utils.form_ntuples_from_machines(machines, 2)
 
-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)))
+# log the failures
+for failure in failures:
+    job.record("FAIL", failure[0], "barrier_2client", failure[1])
 
-subcommand.parallel(subcommand_list)
+# now run through each pair and run
+job.parallel_simple(run, pairs, log=False)
_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to