blob: 5f721e6f71f816062d5dca0a0e8b6540b66fb6df [file] [log] [blame]
# Copyright (c) 2011 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.
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, cros_ui_test
class hardware_ExternalDrives(cros_ui_test.UITest):
version = 1
def _find_root_dev():
rootdev = utils.system_output('rootdev -s -d')
return os.path.basename(rootdev)
def _find_all_storage_dev():
lssys ='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
def run_once(self):
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 = self._find_all_storage_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):
self.job.run_test('hardware_StorageFio', dev=devpath,
result = dialog.get_result()
num_retry -= 1;
raise error.TestError('Unable to find a USB flash drive and '
'a SD-card')