1# Copyright 2019 The Chromium OS Authors. All rights reserved. 2# Use of this source code is governed by a BSD-style license that can be 3# found in the LICENSE file. 4 5from autotest_lib.client.common_lib import utils 6 7AUTHOR = "Chromium OS" 8NAME = "autoupdate_StatefulCompatibility" 9TIME = "LONG" 10TEST_CATEGORY = "Functional" 11TEST_CLASS = "platform" 12TEST_TYPE = "server" 13 14DOC = """ 15This is an auto update test to check the compatibility of the stateful 16partition between updates. This is mostly intended to be used for the 17kernel-next boards to check rollback compatibility but can be used for any 18pair of images. 19 20To specify args for this test invoke this test with: 21 test_that <DUT-IPADDR> autoupdate_StatefulCompatibility --args="<ARGLIST>" 22 23where ARGLIST is a whitespace separated list of the following key=value pairs. 24Values pertaining to the test case include: 25 26 source_payload_uri (optional) the Google Storage bucket URI for 27 the source payload to be installed. If not 28 specified the test will run on the currently 29 installed image. 30 target_payload_uri (optional) the Google Storage bucket URI for 31 the target payload to be installed. If not 32 specified that target_board and 33 target_version_regex fields are required. 34 target_board (optional) the board name for the target image 35 to be installed. 36 target_version_regex (optional) the version of the target image to 37 install. The test will search through all builds 38 that match this prefix and find the most recent 39 image that passed all tests. 40 Examples: 'LATEST-[0-9]*' or 'R75-*' 41 42To run locally see the instructions in the autoupdate_EndToEndTest. 43""" 44 45TEST_CONF_KEYS = ( 46 'source_payload_uri', 'target_payload_uri', 'target_board', 47 'target_version_regex') 48 49 50args_dict = utils.args_to_dict(args) 51 52test_conf = {} 53for key in TEST_CONF_KEYS: 54 test_conf[key] = args_dict.get(key) or locals().get(key) 55 56def run_test(machine): 57 """Execute a test configuration on a given machine.""" 58 host = hosts.create_host(machine) 59 job.run_test("autoupdate_StatefulCompatibility", host=host, 60 test_conf=test_conf, max_image_checks=20) 61 62# Invoke parallel tests. 63parallel_simple(run_test, machines) 64