1 # Copyright (c) 2012 Collabora Ltd. 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 NAME = "hardware_MultiReaderPowerConsumption" 6 AUTHOR = "Vivia Nikolaidou <vivia.nikolaidou (a] collabora.co.uk>" 7 PURPOSE = """Test card reader CPU power consumption to be within acceptable 8 range while performing random r/w""" 9 CRITERIA = """Fails if power consumption readings during heavy-duty random r/w 10 fall outside predefined ranges""" 11 TIME = "SHORT" 12 TEST_CATEGORY = "Functional" 13 TEST_CLASS = "hardware" 14 TEST_TYPE = "client" 15 16 DOC = """ 17 This test runs a heavy-duty random read/write test, which is defined as 18 running a `dd if=/dev/urandom` in parallel with a `tail -f`. The test is 19 run three times: once on a ramdisk with the SD card mounted, once on the 20 SD card with the ramdisk unmounted, and once on the ramdisk with the SD 21 card unmounted. Power consumption is measured after each test and then 22 reported. Preconditions: 23 24 1) User must not be logged on to the GUI 25 2) An empty SD card must be inserted and formatted with a single mountable 26 partition 27 3) No other usb storage devices must be inserted. 28 29 @param ramdisk_size: size of the ramdisk (integer in MiB). 30 @param file_size: test file size (integer in MiB). 31 @param ramdisk_path: path to the ramdisk mount point. 32 @param fs_uuid: the UUID for the attached card. Use this parameter is 33 autodetection does not work as expected. 34 @param drain_limit: maximum ratio between the card reader energy consumption 35 and each of the two ramdisk read/write test energy consumption values. 36 1.00 means the card reader test may not consume more energy than either 37 ramdisk test, 0.9 means it may consume no more than 90% of the ramdisk 38 value, and so forth. default is 1.05. 39 """ 40 41 from autotest_lib.client.cros import storage as storage_mod 42 43 volume_filter, args_dict = storage_mod.args_to_storage_dict(args) 44 ramdisk_size = int(args_dict.get("ramdisk_size", 513)) # MiB 45 file_size = int(args_dict.get("file_size", 512)) # MiB 46 drain_limit = float(args_dict.get("drain_limit", 1.05)) 47 if not volume_filter: 48 volume_filter = {"bus": "usb"} 49 50 job.run_test("hardware_MultiReaderPowerConsumption", 51 ramdisk_size=ramdisk_size, 52 file_size=file_size, 53 drain_limit=drain_limit, 54 volume_filter=volume_filter) 55