blob: 1fa7272a53a358038d047c78a0b60963b5860d4d [file] [log] [blame]
# Copyright (c) 2012 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 logging
from autotest_lib.client.common_lib import error
from autotest_lib.client.common_lib import utils
AUTHOR = "dhaddock@, ahassani@"
NAME = "autoupdate_EndToEndTest"
TEST_CATEGORY = "Functional"
TEST_CLASS = "platform"
TEST_TYPE = "server"
# Disable server-side packaging support for this test.
# This control file is used as the template for paygen_au_canary suite, which
# creates the control files during paygen. Therefore, autotest server package
# does not have these test control files for paygen_au_canary suite.
DOC = """
This is an end-to-end update test of Chrome OS releases. Given a test
configuration, it will perform an end-to-end test of a Chrome OS 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/
Sample from gs://chromeos-releases:
2. Choose the devserver you want to use.
This test uses a devserver to control the autoupdate. You can point to a
devserver on your workstation to aid debugging or you can choose to use a
devserver in the lab.
To start your own devserver, run this (outside the chroot):
src/platform/dev/ --port=8084
For a devserver running on your workstation use as the hostname.
For a devserver running in the lab the port is usually 8082.
Add this line to src/third_party/autotest/files/shadow_config.ini in the [CROS] section:
dev_server = http://<hostname>:<port>
(If shadow_config.ini doesn't exist, you can create it, add [CROS], and add the above.)
The devserver needs to be able to reach the DUT you choose in the next
section. Use this instruction to find the list of lab devservers:
atest server list | grep devserver
3. 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.
4. Setup ssh correctly.
You will need to setup a number of ssh keys and then copy them to
your chroot so that you can ssh into a devserver from there.
Run ssh-keygen to generate your id_rsa and files into ~/.ssh/
Download the testing_rsa ssh keys from here:
Save both to ~/.ssh
chmod 600 ~/.ssh/testing_rsa* (otherwise permissions are too loose and
will be ignored)
Add these lines to your ~/.ssh/config
Host *.cros
User root
IdentityFile /usr/local/google/home/<your ldap here>/.ssh/testing_rsa
You should now be able to ssh into DUTs in the lab without a password.
Follow these instructions to setup the ssh access to lab devservers:
You'll need appropriate group membership to be able to access the
Valentine secret for the devserver file.
Get access to "Access To Chrome Lab or Cautotest" from:
Check that you can now ssh into a lab devserver without a password.
Finally and most importantly, copy the ssh files to your chroot's .ssh
folder so you can ssh from there:
cp -a ~/.ssh/. ~/chromiumos/chroot/home/${USER}/.ssh/
5. 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.)
6. Kick off the test with test_that from a chroot. e.g
test_that <IP OF DUT> autoupdate_EndToEndTest
source_release=10760.0.0 update_type=delta"
7. Unlock any DUTs you locked for debugging when you are done.
'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)
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
raise error.TestError(error_msg)
# Invoke parallel tests.
parallel_simple(run_test, machines)