• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
5NAME = "hardware_MultiReaderPowerConsumption"
6AUTHOR = "Vivia Nikolaidou <vivia.nikolaidou@collabora.co.uk>"
7PURPOSE = """Test card reader CPU power consumption to be within acceptable
8range while performing random r/w"""
9CRITERIA = """Fails if power consumption readings during heavy-duty random r/w
10fall outside predefined ranges"""
11TIME = "SHORT"
12TEST_CATEGORY = "Functional"
13TEST_CLASS = "hardware"
14TEST_TYPE = "client"
15
16DOC = """
17This test runs a heavy-duty random read/write test, which is defined as
18running a `dd if=/dev/urandom` in parallel with a `tail -f`. The test is
19run three times: once on a ramdisk with the SD card mounted, once on the
20SD card with the ramdisk unmounted, and once on the ramdisk with the SD
21card unmounted. Power consumption is measured after each test and then
22reported. Preconditions:
23
241) User must not be logged on to the GUI
252) An empty SD card must be inserted and formatted with a single mountable
26   partition
273) 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
41from autotest_lib.client.cros import storage as storage_mod
42
43volume_filter, args_dict = storage_mod.args_to_storage_dict(args)
44ramdisk_size = int(args_dict.get("ramdisk_size", 513)) # MiB
45file_size = int(args_dict.get("file_size", 512)) # MiB
46drain_limit = float(args_dict.get("drain_limit", 1.05))
47if not volume_filter:
48    volume_filter = {"bus": "usb"}
49
50job.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