blob: 57c971fc03e7c5cd141cdffb7ddc9ae57875c26e [file] [log] [blame]
# Copyright (c) 2011 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.
AUTHOR = "Chrome OS Team"
NAME = "Auto Update Smoke Test"
TIME = "SHORT"
TEST_CATEGORY = "Functional"
TEST_CLASS = "suite"
TEST_TYPE = "server"
DOC = """
This is a special control file used by the autoupdate (AU) test scheduler. It
requires a target update URL be provided in order to run.
The test relies on Autotest to image the machine to the proper base image prior
to execution. The target machine is then imaged to the target version and a
basic smoke test is run to verify functionality.
"""
import os, shutil, tempfile
from autotest_lib.server import autoserv_parser
def run_client_test(machine):
host = hosts.create_host(machine)
# Image the machine with the requested build. Run it as a test instead of
# directly in the control file so useful log information is collected.
update_url = "%(update_url)s"
if job.run_test("autoupdate", host=host, update_url=update_url,
disable_sysinfo=True):
# Let the rest of Autotest know about the new update. Necessary to make
# sure test packages are served from the correct version. AU URLs are
# suffixed with ".../au/<build>" which must be stripped since the test
# packages are located at the image root.
autoserv_parser.autoserv_parser.options.image = (
update_url.rstrip('/').rsplit('/', 2)[0])
at = autotest.Autotest(host)
# Fetch smoke suite package for the build we're testing. Since the repo
# list returned by at.get_fetch_location() is ordered from least to
# greatest, take the last entry.
smoke_temp = tempfile.mkdtemp(dir=job.tmpdir)
job.pkgmgr.add_repository(at.get_fetch_location()[-1])
job.pkgmgr.install_pkg('suite_Smoke', 'test', smoke_temp, smoke_temp,
preserve_install_dir=True)
# Execute smoke suite control file 'installed' from package.
at.run(os.path.join(smoke_temp, 'control'))
# Cleanup temp directory.
shutil.rmtree(smoke_temp)
job.parallel_on_machines(run_client_test, machines)