blob: 508e90c9b39418c3e51ce54c51aa37019c93f705 [file] [log] [blame]
# Copyright 2012 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import logging
from autotest_lib.client.common_lib import error
from autotest_lib.client.common_lib import utils
AUTHOR = "dhaddock@, ahassani@"
NAME = "autoupdate_EndToEndTest"
METADATA = {
"contacts": [
"chromeos-core-services@google.com",
"chromeos-sw-engprod@google.com"
],
"bug_component": "b:908319",
"criteria": "Tests autoupdate between two given versions."
}
TIME = "MEDIUM"
TEST_TYPE = "server"
DOC = """
This is an end-to-end update test of ChromeOS releases. Given a test
configuration, it will perform an end-to-end test of a ChromeOS update
payload. A test configuration can be given as command-line arguments (see
below) or instantiated inline as local varibles.
To invoke this test locally:
test_that <DUT-IPADDR> autoupdate_EndToEndTest --args="<ARGLIST>"
where ARGLIST is a whitespace separated list of the following key=value pairs.
Values pertaining to the test case include:
name=TAG name tag for the test (e.g. 'nmo', 'npo' or 'fsi')
update_type=full|delta type of update being applied, either 'full' or 'delta'
source_release=REL source image release version (e.g. 2672.0.0)
target_release=REL target image release version (e.g. 2673.0.0)
source_payload_uri=URI URI of the source full payload. None means don't
install a source image (assume it's preinstalled).
source_archive_uri=URI (optional) URI of where the artifacts for the source
image (e.g. stateful update) are located. If not
provided, the test will attempt using the same
location as source_payload_uri. This is required for
any test where the location of the full (source)
payload is separate from that of its build artifacts
(e.g. it is in gs://chromeos-releases/).
target_payload_uri=URI URI of the target payload
target_archive_uri=URI (optional) URI of where the artifacts for the target
image (e.g. stateful update) are located. If not
provided, the test will attempt using the test job's
repo ID (if present), otherwise default to the same
location as target_payload_uri. Normally, this is
only needed for local (non-AFE) runs where the
payload location is separate from that of the build
artifacts (e.g. it is in gs://chromeos-releases).
To run locally:
1. Find the Google Storage URIs of the images you want to use during the test.
You can choose payloads from this bucket: gs://chromeos-releases/
(https://pantheon.corp.google.com/storage/browser/chromeos-releases/)
Sample from gs://chromeos-releases:
gs://chromeos-releases/dev-channel/samus/9433.0.0/payloads/chromeos_9433.0
.0_samus_dev-channel_full_test.bin-1e2db02f3bd9d9ebe74dc81fc7038919
2. Choose the DUT you want to use for the test.
You can use a DUT on your desk connected to corp or you can lock a DUT
in the lab for use in the test.
3. Setup ssh correctly.
Follow go/chromeos-lab-duts-ssh to set up password-less SSH for test image
DUTs and SSH access to the CrOS labs.
4. Make sure you have your gsutil permissions (your .boto file).
Your .boto file must be available inside the chroot.
cp ~/.boto chroot/home/<user>/
Make sure the gsutil command is available outside the chroot (note:
the gsutil package in Ubuntu is not what you're looking for.)
5. Kick off the test with test_that from a chroot. e.g
test_that <IP OF DUT> autoupdate_EndToEndTest
--args="target_release=10906.0.0
source_payload_uri='gs://chromeos-releases/canary-channel/nami/10760.0
.0/payloads/chromeos_10760.0.0_nami_canary-channel_full_test
.bin-cee25d306d164f7514e26efb34f8f57d'
target_payload_uri='gs://chromeos-releases/canary-channel/nami/10906.0
.0/payloads/chromeos_10760.0.0-10906.0.0_nami_canary-channel_delta_test
.bin-98f9af8d919605fc3ee1391eaa79c7e6'
source_release=10760.0.0 update_type=delta"
6. Unlock any DUTs you locked for debugging when you are done.
"""
TEST_CONF_KEYS = (
'name', 'update_type', 'source_release', 'target_release',
'source_payload_uri', 'source_archive_uri', 'target_payload_uri',
'target_archive_uri', 'payload_type')
args_dict = utils.args_to_dict(args)
# Create test configuration based on command-line arguments (higher precedence,
# for test_that invocation) and local variables (lower precedence,
# for Autotest front-end invocation).
test_conf = {}
for key in TEST_CONF_KEYS:
test_conf[key] = args_dict.get(key) or locals().get(key)
def run_test(machine):
"""Execute a test configuration on a given machine."""
host = hosts.create_host(machine)
try:
job.run_test(
"autoupdate_EndToEndTest",
tag='%s_%s' % (test_conf['name'], test_conf['update_type']),
host=host, test_conf=test_conf)
except Exception as e:
if not issubclass(type(e), error.TestBaseException):
error_msg = 'Received test error: %s' % e
logging.error(error_msg)
raise error.TestError(error_msg)
raise
# Invoke parallel tests.
parallel_simple(run_test, machines)