1# Copyright (c) 2015 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
5AUTHOR = "chromeos-moblab@google.com"
6NAME = "moblab_StorageQual"
7PURPOSE = "Test that Moblab can run the Storage Qual suite."
8ATTRIBUTES = "suite:moblab_storage_qual"
9TIME = "MEDIUM"
10TEST_CATEGORY = "Functional"
11TEST_CLASS = "moblab"
12TEST_TYPE = "server"
13
14DOC = """
15Kicks off the storage qual suite on a Moblab host against the DUTs on its
16subnet and ensures the suite completes successfully. The suite tests that
17moblab correctly provisions and runs the storage qual suite, but does not
18perform any disk operations.
19
20To invole this test locally:
21  test_that -b stumpy_moblab <remote> moblab_StorageQual
22  --args="<ARGLIST>"
23
24where ARGLIST is a whitespace separated list of the following key=value pairs.
25Values pertaining to the test case include:
26
27  boto_path=<boto_path>                path to the boto file to be installed on
28                                       the Moblab DUT. If not specified, the
29                                       boto file in the current home directory
30                                       will be installed if it exists.
31  image_storage_server=<server_name>   Google Storage Bucket from which to
32                                       fetch test images from. If not
33                                       specified, the value will be fetched
34                                       from global_config.
35  service_init_timeout_m=<int>         Timeout (in minutes) to wait for upstart
36                                       services to start on the moblab host.
37                                       This can take ~5 minutes on a physical
38                                       devices and ~10 minutes on a VM.
39  test_timeout_hint_m=<int>            The overall timeout to expect for the
40                                       test run. For this test, it is very
41                                       important to collect post failure data
42                                       from the moblab device. If the overall
43                                       timeout is provided, the test will try to
44                                       fail early to save some time for log
45                                       collection from the DUT.
46  clear_devserver_cache=<boolean>      If True, image cache of the devserver
47                                       running on moblab is cleared before
48                                       running the test to validate devserver
49                                       imaging staging flow.
50"""
51from autotest_lib.client.bin import sysinfo
52from autotest_lib.client.common_lib import utils
53
54MOBLAB_AUTOTEST_FOLDERS = ['/usr/local/autotest/results',
55                           '/usr/local/autotest/logs']
56
57
58def run(machine):
59    host = hosts.create_host(machine)
60    args_dict = utils.args_to_dict(args)
61
62    logging.info('Logs from moblab\'s instance of autotest will be collected '
63                 'under the sysinfo/ folder in results.')
64    for folder in MOBLAB_AUTOTEST_FOLDERS:
65        logging.info('  Will collect %s', folder)
66        job.sysinfo.add_logdir(sysinfo.logdir(folder, excludes=()))
67
68    job.run_test('moblab_StorageQual', host=host,
69                 moblab_suite_max_retries=1, **args_dict)
70
71parallel_simple(run, machines)
72