I've split IPerf out into a control file and an iperf.py file, to avoid redundancy when writing multiple IPerf tests. I'm also using a couple of new functions recently added to disable IP filters and to check for a specific platform label.
Kelly -- K.D. Lucas [email protected]
Index: server/tests/iperf/control.srv =================================================================== --- server/tests/iperf/control.srv (revision 4290) +++ server/tests/iperf/control.srv (working copy) @@ -1,8 +1,8 @@ -AUTHOR = "Bryce Boe <[email protected]>" +AUTHOR = "Kelly Lucas <[email protected]>" TIME = "SHORT" NAME = "Iperf Multi-machine" TEST_CATEGORY = "Stress" -TEST_CLASS = "Hardware" +TEST_CLASS = "Network" TEST_TYPE = "Server" SYNC_COUNT = 2 DOC = """ @@ -18,7 +18,7 @@ TCP if unspecified. bidirectional - [False/True] specifies if a bidirectional test should be run. Defaults to False -test_time - Specifies how long each iteration of the test should run for. +test_time - Specifies test duration of each iteration in seconds. stream_list - A list containing the number of streams to run the test for. If the list is [1,10,100] then the test will run 3 times. If bidirectional is set then there will be the specified number of @@ -29,29 +29,9 @@ def run(pair): - print "running on %s and %s\n" % (pair[0], pair[1]) - tagname = "%s_%s" % (pair[0], pair[1]) - server = hosts.create_host(pair[0]) - client = hosts.create_host(pair[1]) + job.run_test('iperf', pair=pair, udp=True, bidirectional=True, time=10, + stream_list=range(1,11,2)) - server_at = autotest.Autotest(server) - client_at = autotest.Autotest(client) - - template = ''.join(["job.run_test('iperf', server_ip='%s', client_ip=", - "'%s', role='%s', udp=True, bidirectional=True,", - "stream_list=range(1,11,2))"]) - - server_control_file = template % (server.ip, client.ip, 'server') - client_control_file = template % (server.ip, client.ip, 'client') - - server_command = subcommand(server_at.run, - [server_control_file, server.hostname]) - client_command = subcommand(client_at.run, - [client_control_file, client.hostname]) - - parallel([server_command, client_command]) - - # grab the pairs (and failures) (pairs, failures) = utils.form_ntuples_from_machines(machines, 2) Index: server/tests/iperf/control.stress.srv =================================================================== --- server/tests/iperf/control.stress.srv (revision 0) +++ server/tests/iperf/control.stress.srv (revision 0) @@ -0,0 +1,43 @@ +AUTHOR = "Kelly Lucas <[email protected]>" +TIME = "MEDIUM" +NAME = "Iperf Stress" +TEST_CATEGORY = "Stress" +TEST_CLASS = "Network" +TEST_TYPE = "Server" +SYNC_COUNT = 2 +DOC = """ +Iperf is a 2 machine test (server/client) that measures maximum TCP and UDP +bandwidth performance. The stress test will run for 20 minutes. + +Arguments to run_test: + +server_ip - the ip of the server (automatically filled in) +client_ip - the ip of the client (automatically filled in) +role - specifies either client or server (automatically filled in) +udp - [False/True] specifies if a UDP test should be run. Defaults to + TCP if unspecified. +bidirectional - [False/True] specifies if a bidirectional test should be run. + Defaults to False +test_time - Specifies test duration of each iteration in seconds. +stream_list - A list containing the number of streams to run the test for. If + the list is [1,10,100] then the test will run 3 times. If + bidirectional is set then there will be the specified number of + bidirectional streams. +""" + +from autotest_lib.server import utils + + +def run(pair): + job.run_test('iperf', pair=pair, udp=True, bidirectional=True, time=1200, + stream_list=range(1,11,2)) + +# grab the pairs (and failures) +(pairs, failures) = utils.form_ntuples_from_machines(machines, 2) + +# log the failures +for failure in failures: + job.record("FAIL", failure[0], "iperf", failure[1]) + +# now run through each pair and run +job.parallel_simple(run, pairs, log=False) Index: server/tests/iperf/iperf.py =================================================================== --- server/tests/iperf/iperf.py (revision 0) +++ server/tests/iperf/iperf.py (revision 0) @@ -0,0 +1,52 @@ +from autotest_lib.server import autotest, hosts, subcommand, test +from autotest_lib.server import utils + +class iperf(test.test): + version = 1 + + def run_once(self, pair, udp, bidirectional, time, stream_list): + print "running on %s and %s\n" % (pair[0], pair[1]) + + # Designate a lable for the server side tests. + server_label = 'net_server' + + tagname = "%s_%s" % (pair[0], pair[1]) + server = hosts.create_host(pair[0]) + client = hosts.create_host(pair[1]) + + # Ensure the client doesn't have the server label. + platform_label = client.get_platform_label() + if platform_label == server_label: + (server, client) = (client, server) + + # Disable IPFilters if they are present. + for m in [client, server]: + status = m.run('iptables -L') + if not status.exit_status: + m.disable_ipfilters() + + server_at = autotest.Autotest(server) + client_at = autotest.Autotest(client) + + template = ''.join(["job.run_test('iperf', server_ip='%s', client_ip=", + "'%s', role='%s', udp=%s, bidirectional=%s,", + "test_time=%d, stream_list=%s, tag='%s')"]) + + server_control_file = template % (server.ip, client.ip, 'server', udp, + bidirectional, time, stream_list, + tagname) + client_control_file = template % (server.ip, client.ip, 'client', udp, + bidirectional, time, stream_list, + tagname) + + server_command = subcommand.subcommand(server_at.run, + [server_control_file, server.hostname]) + client_command = subcommand.subcommand(client_at.run, + [client_control_file, client.hostname]) + + subcommand.parallel([server_command, client_command]) + + for m in [client, server]: + status = m.run('iptables -L') + if not status.exit_status: + m.enable_ipfilters() Property changes on: server/tests/iperf/iperf.py ___________________________________________________________________ Added: svn:executable + *
_______________________________________________ Autotest mailing list [email protected] http://test.kernel.org/cgi-bin/mailman/listinfo/autotest
