blob: d6f52204fc525a33530045db4310e45307ff574c [file] [log] [blame]
# Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
TIME='MEDIUM'
AUTHOR = 'The Chromium OS Authors'
DOC = """
External storage test suite.
Tests external storage (USB flash drive / card reader with SD-card inserted)
performance using several benchmark tools.
"""
NAME = 'hardware_ExternalDrives'
PURPOSE = 'Benchmark external storage devices.'
CRITERIA = 'This test is a benchmark.'
TEST_CLASS = 'hardware'
TEST_CATEGORY = 'Performance'
TEST_TYPE = 'client'
VERSION = '1'
import os, re
from autotest_lib.client.bin import utils
from autotest_lib.client.common_lib import error
from autotest_lib.client.cros import cros_ui
def find_root_dev():
rootdev = utils.system_output('rootdev -s -d')
return os.path.basename(rootdev)
def find_all_storage_dev():
lssys = utils.run('ls -d /sys/block/sd*')
devices = lssys.stdout.rsplit('\n')
new_devices = [os.path.basename(d.rstrip()) for d in devices if d]
return new_devices
num_retry = 3
dialog = cros_ui.Dialog(question=("Please insert a USB flash drive and "
"a SD-card. Then press the RETRY button."), choices=['RETRY'])
while num_retry:
# Find all block devices in the system.
devices = find_all_storage_dev()
devices.remove(find_root_dev())
if len(devices) >= 2:
# For each device, run the whole test suite.
for device in devices:
devpath = '/dev/' + device
if os.path.exists(devpath):
job.run_test('hardware_StorageFio', dev=devpath, tag=device)
break
else:
result = dialog.get_result()
num_retry -= 1;
else:
raise error.TestError('Unable to find a USB flash drive and a SD-card')