| # Copyright (c) 2013 The Chromium OS Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| import time |
| import uuid |
| |
| from autotest_lib.client.common_lib import error |
| from autotest_lib.server import hosts |
| |
| AUTHOR = "chromeos-installer@google.com" |
| NAME = "p2p_EndToEndTest" |
| TIME = "MEDIUM" |
| TEST_CATEGORY = "Functional" |
| TEST_CLASS = "platform" |
| TEST_TYPE = "server" |
| ATTRIBUTES = "suite:au-p2p" |
| JOB_RETRIES = 2 |
| PY_VERSION = 3 |
| |
| DOC = """ |
| End-to-end test of the peer-to-peer (p2p) file sharing system. |
| |
| The test runs with a main DUT and a companion DUT. The main DUT generates a |
| random file and shares it via p2p. The companion DUT searches for and |
| downloads the file. |
| |
| To simulate a progressive download of the shared file, the |
| file becomes available in two parts. The first part of the file is available |
| at the beginning of the test, while the second part appears later. |
| """ |
| |
| def run(machine): |
| host = hosts.create_host(machine) |
| companions = hosts.create_companion_hosts(companion_hosts) |
| |
| # The file ID shared among all test machines. |
| file_id = "%s-%s" % (time.strftime("%Y%m%d-%H%M"), uuid.uuid4()) |
| |
| job.run_test('p2p_EndToEndTest', |
| dut=host, |
| file_id=file_id, |
| companions=companions) |
| |
| job.parallel_simple(run, machines) |