AUTHOR = "kdlucas@google.com (K.D. Lucas)"
TIME = "SHORT"
NAME = "Netperf Basic"
TEST_CATEGORY = "Benchmark"
TEST_CLASS = 'Network'
TEST_TYPE = "Server"
SYNC_COUNT = 2
DOC = """
netperf2 is a 2 machine test (server/client) that measures the performance
of various network attributes.

Arguments to run_test:

test          - the list of valid netperf tests that can be run
                This currently is:
                  TCP_STREAM, TCP_SENDFILE, TCP_RR, TCP_CRR, UDP_STREAM, UDP_RR
test_time     - Specifies how long each iteration of the test should run for.
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.
cycles        - The number of times to run each test.
"""

from autotest_lib.server import utils


def run(pair):
    job.run_test('netperf2', pair=pair, test='TCP_STREAM', time=10,
                 stream_list=[1], cycles=1)

# 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], "netperf2", failure[1])

# now run through each pair and run
job.parallel_simple(run, pairs, log=False)