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.server.cros.dynamic_suite import constants 6 7AUTHOR = "Chromium OS" 8ATTRIBUTES = "suite:kernel_per-build_regression" 9NAME = "autoupdate_StatefulCompatibility.kernel_transition" 10TIME = "MEDIUM" 11TEST_CATEGORY = "Functional" 12TEST_CLASS = "platform" 13TEST_TYPE = "server" 14 15DOC = """ 16This is an auto update test to check the compatibility of the stateful 17partition between updates. This control file is specifically meant for 18-kernelnext boards. Any board that declares USE=kernel-transition will attempt 19to run this test. For boards in the form "<board>-kernelnext" this test will 20search for an image matching "<board>". For boards in any other form this test 21will search for an image matching "<board>-kernelnext". 22 23For example the samus board, which declares USE=kernel-transition, will target a 24samus-kernelnext image to run an upgrade test against, and the samus-kernelnext 25board, which also declares USE=kernel-transition, will target a samus image to 26downgrade test against. 27""" 28 29TEST_CONF_KEYS = ( 30 'source_payload_uri', 'target_payload_uri', 'target_board', 31 'target_version_regex') 32 33test_conf = {} 34for key in TEST_CONF_KEYS: 35 test_conf[key] = None 36 37def run_test(machine): 38 """Execute a test configuration on a given machine.""" 39 host = hosts.create_host(machine) 40 board = host.get_board().replace(constants.BOARD_PREFIX, '') 41 42 # <board>-kernelnext downgrade tests to <board> 43 # <board> upgrade tests to <board>-kernelnext 44 if board.endswith('kernelnext'): 45 target_board = board.replace('-kernelnext', '') 46 else: 47 target_board = board + '-kernelnext' 48 49 test_conf['target_board'] = target_board 50 test_conf['target_version_regex'] = 'LATEST-[0-9]*' 51 job.run_test("autoupdate_StatefulCompatibility", host=host, 52 test_conf=test_conf, max_image_checks=20) 53 54# Invoke parallel tests. 55parallel_simple(run_test, machines) 56