1# Copyright (c) 2013 The Chromium OS Authors. All rights reserved. 2# Use of this source code is governed by a BSD-style license that can be 3# found in the LICENSE file. 4 5import time 6import uuid 7 8from autotest_lib.client.common_lib import error 9from autotest_lib.server import hosts 10 11AUTHOR = "[email protected]" 12NAME = "p2p_EndToEndTest" 13TIME = "MEDIUM" 14TEST_CATEGORY = "Functional" 15TEST_CLASS = "platform" 16TEST_TYPE = "server" 17ATTRIBUTES = "suite:au-p2p" 18JOB_RETRIES = 2 19PY_VERSION = 3 20 21DOC = """ 22End-to-end test of the peer-to-peer (p2p) file sharing system. 23 24The test runs with a main DUT and a companion DUT. The main DUT generates a 25random file and shares it via p2p. The companion DUT searches for and 26downloads the file. 27 28To simulate a progressive download of the shared file, the 29file becomes available in two parts. The first part of the file is available 30at the beginning of the test, while the second part appears later. 31""" 32 33def run(machine): 34 host = hosts.create_host(machine) 35 companions = hosts.create_companion_hosts(companion_hosts) 36 37 # The file ID shared among all test machines. 38 file_id = "%s-%s" % (time.strftime("%Y%m%d-%H%M"), uuid.uuid4()) 39 40 job.run_test('p2p_EndToEndTest', 41 dut=host, 42 file_id=file_id, 43 companions=companions) 44 45job.parallel_simple(run, machines) 46