blob: 86581f4ebfce77be4e8e2a020ac923c5d806dbba [file] [log] [blame]
Joy Onyerikwu4bd3ee32018-05-03 14:06:57 -05001*** Settings ***
2
3Documentation Verify that connected USB device can be detected by the
4... OS and exercised in HTX or written to.
5
6# TEST PARAMETERS:
7# OPENBMC_HOST The BMC host name or IP address.
8# OPENBMC_USERNAME The BMC user name.
9# OPENBMC_PASSWORD The BMC password.
10# OS_HOST The OS host name or IP address.
11# OS_USERNAME The OS user name.
12# OS_PASSWORD The OS Host password.
13# USB_DEVICE_NAME The USB device to be used in test.
14# TIMEOUT Amount of time to wait for the device
15# being exercised to reach 1 cycle.
16
17Resource ../syslib/utils_os.robot
18
19Test Setup Test Setup Execution
20Test Teardown Test Teardown Execution
21
22*** Variables ***
23
24
25*** Test Cases ***
26
27Verify Write To USB Device
28 [Documentation] Verify that the given device can be written to.
29 [Tags] Verify_Write_To_USB_Device
30
31 OS Execute Command mkdir -p /mount-dev/
32 OS Execute Command mount -rw /dev/${USB_DEVICE_NAME} /mount-dev/
33 ${stdout} ${stderr} ${rc}= OS Execute Command
34 ... echo "Write to file" /mount-dev/file.txt ignore_err=1
35 Should Be Empty ${stderr} msg=Could not write to USB device.
36
37
38Exercise USB Device
39 [Documentation] Verify that the given device can be exercised with
40 ... HTX.
41 [Tags] Exercise_USB_Device
42
43 Run MDT Profile
44 # If the htxcmdline -status does not include this device then it is
45 # not a device that can be exercised with HTX, fail.
46 ${stdout} ${stderr} ${rc} OS Execute Command
47 ... htxcmdline -status | grep ${USB_DEVICE_NAME}
48
49 Wait Until Keyword Succeeds
50 ... ${TIMEOUT} 10s Verify Device Cycle Completion
51
52
53*** Keywords ***
54
55Verify Device Cycle Completion
56 [Documentation] Verify that the USB device has completed at least
57 ... one HTX cycle.
58
59 # Grep htxcmdline -status to get the device's cycle count.
60 ${stdout} ${stderr} ${rc}= OS Execute Command
61 ... htxcmdline -status | grep ${USB_DEVICE_NAME} | awk '{print $5}'
62 Should Not Be Empty ${stdout} msg=Device is not running HTX
63 Run Keyword If ${stdout} < 1
64 ... FAIL msg=Device has not completed at least one cycle.
65
66
67Test Setup Execution
68 [Documentation] Do initial test setup task(s).
69
70 OS Execute Command ls /dev/${USB_DEVICE_NAME}
71
72
73Test Teardown Execution
74 [Documentation] Perform post test case tasks.
75
76 # Even if the tests fails, device should be unmounted and HTX idle.
77 Run Keyword If '${TEST_NAME}' == 'Verify Write To USB Device'
78 ... OS Execute Command umount /mount-dev/
79 ... ELSE
80 ... Shutdown HTX Exerciser
81 FFDC On Test Case Fail