breadcrumbs: Dynamic Suites > chromium_link: Chromium chromium_os_link: Chromium OS home_link: Home page_name: dynamic-test-suites title: Running Dynamic Test Suites title_hdr: |
This document describes how to write, update, run, disable, and enumerate tests that are in a Test Suite.
A test suite is a collection of tests, client and server side, that are run on across a particular build to validate a larger system.
If you are interested in how dynamic suites works and how it interacts with the CrOS Infrastructure please check out it's generously documented py module.
Test Suites build on the Autotest control file specification.
In order to create a valid suite the following two requirements need to be met:
We have a mechanism that allows suites of tests to be defined dynamically by a control file at runtime. [test_suites/control.bvt](http://git.chromium.org/gitweb/?p=chromiumos/third_party/autotest.git;a=blob;f=test_suites/control.bvt;hb=HEAD)
in the autotest repo is a simple example of such a suite, and login_LoginSuccess is one test that's included in this suite. Looking at the control file for login_LoginSuccess, note the line SUITE='bvt'
. This is used in control.bvt
like this:
suite_tag = 'bvt' bvt = dynamic_suite.Suite.create_from_name(suite_tag, build, pool=pool)
The infrastructure finds login_LoginSuccess by matching the contents of the SUITE field in its control file against the suite tag passed into dynamic_suite.Suite.create_from_name()
If one test should be in multiple suites the SUITE= control file variable can be a comma delimited list of suites.
SUITE='bvt, Kernel_Regression, Nightly'
This section will go over adding, removing, and marking tests as experimental.
Some suites have restrictions when it comes to adding tests to them. To read about the requirements of a particular test suite refer to its suite control under autotest/files/test_suite/control.suite_name.
For example: control.bvt
Add the SUITE=“suite_name” to the control file of the test you want to be run in the suite. If this test is new add it as an experimental test first, see below.
To disable a test remove the Suite Name from the SUITE= Tag, if it is the only suite in the SUITE variable remove the entire variable.
You may consider marking a test as experimental to avoid closing of the tree but continue running tests.
Some times you may want to add tests that are experimental to start gathering some data but you do not want the tree to be closed. To do this use the EXPERIMENTAL control file variable.
AUTHOR = "Autotest Team" NAME = "Sleeptest" TIME = "SHORT" TEST_CATEGORY = "Functional" TEST_CLASS = "General" TEST_TYPE = "client" SUITE = "bvt" EXPERIMENTAL = "True"
An example of a test marked experimental.
These are options that you can use to tweak the behavior in your suite control file.
Boolean, if the hosts required are not currently in good health fail the suite. You may want to let the suite sit around for a while and wait for the hosts to be repaired. Default: True
Whether or not you want the suite to re-image machines before running the tests. Default: False
If you only want the suite to include non-experimental tests. Default: True
Whether or not bugs should be filed when tests fail (See below for a more detailed example)
If you want to apply a dependency across the whole suite (See below for a more detailed example)
How long each job should be allowed to run in a suite. Default is 24 hours. (See below for an example)
In addition to DEPENDENCIES specified on a per-test level, a set of suite dependencies can be specified at the suite level. These dependencies will be appended to the dependency list of all tests when they are run through that suite. To add suite-level dependencies, pass in your desired dependencies to dynamic_suite.reimage_and_run with the suite_dependencies argument. For example:
dynamic_suite.reimage_and_run( build=build, board=board, name='network3g_tmobile', job=job, pool=pool, check_hosts=check_hosts, add_experimental=True, num=num, file_bugs=file_bugs, skip_reimage=dynamic_suite.skip_reimage(globals()), suite_dependencies='carrier:tmobile')
Multiple suite-level dependencies can be given as a comma separated string.
If your suite is already being run via suite_scheduler, you only need to edit the suite control file.
_BUG_TEMPLATE = { 'labels': ['OS-Chrome','Type-Bug', 'your-label'], 'owner': '', 'status': None, 'summary': None, 'title': None, 'ccs': ['a@chromium.org','b@chromium.org', 'c@chromium.org'] }
dynamic_suite.reimage_and_run( build=build, board=board, name='perf_v2', job=job, pool=pool, check_hosts=check_hosts, add_experimental=True, num=num, file_bugs=True, skip_reimage=dynamic_suite.skip_reimage(globals()), bug_template=_BUG_TEMPLATE)
In your suite control file pass the max_runtime_mins option:
An example to allow tests to run for 6 hours.
dynamic_suite.reimage_and_run( build=build, board=board, name='bvt', job=job, pool=pool, check_hosts=check_hosts, add_experimental=True, num=num, file_bugs=file_bugs, skip_reimage=dynamic_suite.skip_reimage(globals()), max_runtime_mins=60*6)
There is a tool under the autotest repo to enumerate tests that will run in a suite.
From within the chroot the following command can be executed:
-a option is to specify what Autotest directory to look in.
The argument bvt is the SUITE you are intersted in.
~/trunk/src/third_party/autotest/files/site_utils/suite_enumerator.py -a ~/trunk/src/third_party/autotest/files -l
./run_remote_tests suite:bvt
Note that if your suite contains multiple control files that are associated with the same autotest, you may get an error that says something like this:
TestError: <AUTOTEST_NAME> already exists; multiple tests cannot run with the same subdirectory
To fix this, add a “tag” parameter to the job.run_test() in the associated control files (e.g., job.run_test(‘foo’, tag=‘some_tag’)) to distinguish them and make the results get written into uniquely-named result directories.
Suite scheduler is the piece of software that is responsible for kicking off suites out of band based on a set of events as opposed to in a waterfall. If you are interested in running suites in a waterfall refer to the HW_Test section below. Below is a run down on how this works and what needs to happen to add new suites to this configuration.
Suites are scheduled based off of build artifacts, the autotest tarball generated at build time is used to enumerate what control files belong to what suites and what version of those particular tests should be run. If updated a test on TOT it will need to be back ported to every branch that needs those updates just like any other change.
If your suite is a part of bvt, kaen_bvt, or smoke it will automatically run and no further action must be taken.
An out of band process runs on the Autotest server to schedule suite runs based on a number of events. The code lives under autotest/files/site_utils/suite_scheduler and is configured via a Python config file located under autotest/files/suite_scheduler.ini
To add your suite send a code review with a new entry as outlined below.
[WeeklyKernelRegressions] run_on: weekly suite: kernel_weekly_regression branch_specs: >=R21 pool: suites
There are 5 parts to a configuration entry.
The top level unique name marker is part of the Python config format and must be unique and it should reflect what suite is being configured.
Pending implementation: new_chrome crbug.com/212678
*If there are other events you would like to have available please file a bug.
The suite line can only be used to describe one individual suite. The name used pertains to the suite added under autotest/files/test_suites/control.suite_name. The above example would invoke the control.kernel_weekly_regression suite file.
There are three different branch specs that can be used to ensure your suite runs on a particular branch:
A pool is a label on a machine like pool:bvt. We are using pools extensively currently as our dependency support is not quite there yet. Unless you are doing something out of the ordinary with extra hardware required to be attached to the DUT you should always use pool: suites which is a general pool for suite runs.
If you are doing things that require extra hardware chances are there is already a precedent for this in the suite_scheduler.ini file and you should reference those. When in doubt ask chromeos-lab-infrastructure@google.com.
Suites can also be run as a step in the buildbot waterfall. This assumes you are running your builds via cbuildbot, if you are not please file a bug with your need and the Lab team can look at how to best direct you.
*Note when running the HW_Test step you are blocking your waterfall on actual hardware tests. If you do not want your builders to block on this consider using Suite Scheduler as described above.
*Note if your build client is not on the master2 vlan you will need to file a bug with the Chrome OS lab team so a proxy connection can be set up.
Adding a HW_Test step to your cbuildbot config is as easy as editing cbuildbot_config.py in the chromite repo and adding a hw_test entry like the following:
Example running the bvt suite for a lumpy build:
You need to specify upload_hw_test_artifacts so that Autotest has access to the image and the build artifacts via Google Storage and specify what suite(s) you want to run via a list called hw_tests.
For suite jobs:
$build-test_suites/control.$suite_name
i.e.
x86-alex-release/R20-2264.0.0-test_suites/control.kernel.per_build.benchmarks
For sub-jobs run from the suite:
$build/$suite_name/$test_name
i.e.
x86-alex-release/R20-2264.0.0/kernel.per_build.benchmarks/Hackbench
If a particular test is set with EXPERIMENTAL = True it is prefaced with experimental_test_name.
i.e.
x86-alex-release/R20-2264.0.0/kernel.per_build.benchmarks/experimental_platform_AesThroughput
*This is not a typical use case for users.
Suite scheduler lives under autotest/files/site_utils/suite_scheduler/suite_scheduler.py
An example of forcing all nightly suites for stumpy to be kicked off.
site_utils/suite_scheduler/suite_scheduler.py -i stumpy-release/R21-2270.0.0 -e nightly
If you need to run an individual suite for a particular build but not all of the suites that would be kicked off by a particular event you can use the same command the buildbots use, run_suite.py.
site_utils/run_suite.py -b parrot -p pool:parrot_2gb -s kernel_weekly_regression -i parrot-release/R23-1913.156.1 -u 1
Other than the BVT suite no other suite results are displayed on the buildbot waterfall. To see your results you need to refer to the Autotest dashboard at http://cautotest.corp.google.com/results/dashboard.
From there:
Refer to: http://cautotest.corp.google.com/results/dashboard/emails.html