1 # Copyright (c) 2014 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 5 import time 6 from autotest_lib.server import autotest 7 from autotest_lib.server import hosts 8 from autotest_lib.server import test 9 10 11 class hardware_StorageQualBase(test.test): 12 """Tests run at the beginning over the disk qual test. 13 14 This code runs simple tests to ensure the device meet basic critera. 15 """ 16 17 version = 1 18 CLIENT_FUNCTIONAL_TESTS = [ 19 ('hardware_DiskSize', {'constraints': ['gb_main_disk_size >= 8']}), 20 ('hardware_SsdDetection', { 21 'constraints': ['mb_ssd_device_size >= 8000']}), 22 ('hardware_StorageFio', {'constraints': [ 23 '_seq_read_read_bw >= 50 * 1024', 24 '_seq_write_write_bw >= 15 * 1024', 25 '_16k_write_write_iops >= 10'], 26 'requirements': [ 27 ('seq_read', []), 28 ('seq_write', []), 29 ('4k_read', []), 30 ('4k_write', []), 31 ('16k_read', []), 32 ('16k_write', [])], 33 }) 34 ] 35 36 CRYPTO_RUNTIME = 5 * 60 # seconds. 37 38 CRYPTO_TESTS = [ 39 'surfing', 40 'boot', 41 'login', 42 'seq_read', 43 'seq_write', 44 '16k_read', 45 '16k_write', 46 '8k_read', 47 '8k_write', 48 '4k_read', 49 '4k_write', 50 ] 51 52 53 def run_once(self, client_ip, client_tag='', crypto_runtime=CRYPTO_RUNTIME, 54 cq=False): 55 56 # in a cq run, do not execute the test, just output 57 # the order that the test would have run in 58 if cq: 59 self.write_test_keyval( 60 {'storage_qual_cq': ('%f hardware_StorageQualBase_%s' 61 % (time.time(), client_tag))}) 62 return 63 64 client = hosts.create_host(client_ip) 65 client_at = autotest.Autotest(client) 66 for test_name, argv in self.CLIENT_FUNCTIONAL_TESTS: 67 client_at.run_test(test_name, disable_sysinfo=True, tag=client_tag, 68 **argv) 69 70 # Test real life performance 71 for script in self.CRYPTO_TESTS: 72 client_at.run_test('platform_CryptohomeFio', 73 disable_sysinfo=True, 74 from_internal_disk_only=True, 75 script=script, 76 tag='_'.join([client_tag, script]), 77 runtime=crypto_runtime, 78 disk_configs=['crypto', 'plain']) 79