-# Copyright (c) 2015-2016, NVIDIA CORPORATION. All rights reserved.
-#
# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2015-2016, NVIDIA CORPORATION. All rights reserved.
# Test U-Boot's "ums" command. The test starts UMS in U-Boot, waits for USB
# device enumeration on the host, reads a small block of data from the UMS
import time
import u_boot_utils
-'''
+"""
Note: This test relies on:
a) boardenv_* to contain configuration values to define which USB ports are
env__usb_dev_ports = (
{
+ "fixture_id": "micro_b",
"tgt_usb_ctlr": "0",
"host_ums_dev_node": "/dev/disk/by-path/pci-0000:00:14.0-usb-0:13:1.0-scsi-0:0:0:0",
},
env__block_devs = (
# eMMC; always present
{
+ "fixture_id": "emmc",
"type": "mmc",
"id": "0",
# The following two properties are optional.
},
# SD card; present since I plugged one in
{
+ "fixture_id": "sd",
"type": "mmc",
"id": "1"
},
This entry is only needed if any block_devs above contain a
writable_fs_partition value.
-'''
+"""
@pytest.mark.buildconfigspec('cmd_usb_mass_storage')
def test_ums(u_boot_console, env__usb_dev_port, env__block_devs):
- '''Test the "ums" command; the host system must be able to enumerate a UMS
+ """Test the "ums" command; the host system must be able to enumerate a UMS
device when "ums" is running, block and optionally file I/O are tested,
and this device must disappear when "ums" is aborted.
Returns:
Nothing.
- '''
+ """
have_writable_fs_partition = 'writable_fs_partition' in env__block_devs[0]
if not have_writable_fs_partition:
mounted_test_fn = mount_point + '/' + mount_subdir + test_f.fn
def start_ums():
- '''Start U-Boot's ums shell command.
+ """Start U-Boot's ums shell command.
This also waits for the host-side USB enumeration process to complete.
Returns:
Nothing.
- '''
+ """
u_boot_console.log.action(
'Starting long-running U-Boot ums shell command')
fh.close()
def mount():
- '''Mount the block device that U-Boot exports.
+ """Mount the block device that U-Boot exports.
Args:
None.
Returns:
Nothing.
- '''
+ """
u_boot_console.log.action('Mounting exported UMS device')
cmd = ('/bin/mount', host_ums_part_node)
u_boot_utils.run_and_log(u_boot_console, cmd)
def umount(ignore_errors):
- '''Unmount the block device that U-Boot exports.
+ """Unmount the block device that U-Boot exports.
Args:
ignore_errors: Ignore any errors. This is useful if an error has
Returns:
Nothing.
- '''
+ """
u_boot_console.log.action('Unmounting UMS device')
cmd = ('/bin/umount', host_ums_part_node)
u_boot_utils.run_and_log(u_boot_console, cmd, ignore_errors)
def stop_ums(ignore_errors):
- '''Stop U-Boot's ums shell command from executing.
+ """Stop U-Boot's ums shell command from executing.
This also waits for the host-side USB de-enumeration process to
complete.
Returns:
Nothing.
- '''
+ """
u_boot_console.log.action(
'Stopping long-running U-Boot ums shell command')