-
Notifications
You must be signed in to change notification settings - Fork 3k
Usb msd tests #9444
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Usb msd tests #9444
Conversation
09e236e
to
0e349e2
Compare
Please review astyle travis job |
@maciejbocianski, thank you for your changes. |
0e349e2
to
6087d8a
Compare
astyle fixed |
TESTS/host_tests/pyusb_msd.py
Outdated
@@ -0,0 +1,242 @@ | |||
""" | |||
mbed SDK |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you use updated license header
/*
* Copyright (c) 2019, Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
license headers fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great so far. I left some minor feedback. Once the stability problems you mentioned above are fixed then this will be ready to go.
TESTS/usb_device/msd/mbed_app.json
Outdated
@@ -0,0 +1,39 @@ | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per-tests configs aren't allowed. You may be able to use the test configs at https://github.com/ARMmbed/mbed-os/tree/master/tools/test_configs. @bridadan or @theotherjimmy may have more details around this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately that mechanism isn't really documented. It seems like you can add an entry to the "default_test_configuration" but I haven't used it personally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about --test-config <TEST_CONFIG>
?
It uses configs from https://github.com/ARMmbed/mbed-os/tree/master/tools/test_configs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe so yes. If you don't specify a --test-config
or an --app-config
it seems to go with the default one.
#define MIN_HEAP_SIZE (HEAP_BLOCK_DEVICE_SIZE + 6144) | ||
|
||
|
||
/* TODO: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you want to take action on this TODO?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, as soon as it will be supported in USBMSD class
TESTS/usb_device/msd/mbed_app.json
Outdated
"target.features_add": ["STORAGE"] | ||
}, | ||
"K64F": { | ||
"target.components_remove": ["SD"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does SD need to be removed from the K64F?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My assumption was to test embedded flash BD in the first place. In case of k64f
it has components SD and FLASHAPI
Line 1443 in df9ac85
"components_add": ["SD", "FLASHIAP"], |
Because the
BlockDevice::get_default_instance()
implementation uses SD before FLASHAPI(see code below) we have to remove SD to let
BlockDevice::get_default_instance()
use FLASHAPImbed-os/features/storage/system_storage/SystemStorage.cpp
Lines 81 to 169 in df9ac85
MBED_WEAK BlockDevice *BlockDevice::get_default_instance() | |
{ | |
#if COMPONENT_SPIF | |
static SPIFBlockDevice default_bd( | |
MBED_CONF_SPIF_DRIVER_SPI_MOSI, | |
MBED_CONF_SPIF_DRIVER_SPI_MISO, | |
MBED_CONF_SPIF_DRIVER_SPI_CLK, | |
MBED_CONF_SPIF_DRIVER_SPI_CS, | |
MBED_CONF_SPIF_DRIVER_SPI_FREQ | |
); | |
return &default_bd; | |
#elif COMPONENT_QSPIF | |
static QSPIFBlockDevice default_bd( | |
MBED_CONF_QSPIF_QSPI_IO0, | |
MBED_CONF_QSPIF_QSPI_IO1, | |
MBED_CONF_QSPIF_QSPI_IO2, | |
MBED_CONF_QSPIF_QSPI_IO3, | |
MBED_CONF_QSPIF_QSPI_SCK, | |
MBED_CONF_QSPIF_QSPI_CSN, | |
MBED_CONF_QSPIF_QSPI_POLARITY_MODE, | |
MBED_CONF_QSPIF_QSPI_FREQ | |
); | |
return &default_bd; | |
#elif COMPONENT_DATAFLASH | |
static DataFlashBlockDevice default_bd( | |
MBED_CONF_DATAFLASH_SPI_MOSI, | |
MBED_CONF_DATAFLASH_SPI_MISO, | |
MBED_CONF_DATAFLASH_SPI_CLK, | |
MBED_CONF_DATAFLASH_SPI_CS | |
); | |
return &default_bd; | |
#elif COMPONENT_SD | |
static SDBlockDevice default_bd( | |
MBED_CONF_SD_SPI_MOSI, | |
MBED_CONF_SD_SPI_MISO, | |
MBED_CONF_SD_SPI_CLK, | |
MBED_CONF_SD_SPI_CS | |
); | |
return &default_bd; | |
#elif COMPONENT_FLASHIAP | |
#if (MBED_CONF_FLASHIAP_BLOCK_DEVICE_SIZE == 0) && (MBED_CONF_FLASHIAP_BLOCK_DEVICE_BASE_ADDRESS == 0xFFFFFFFF) | |
size_t flash_size; | |
uint32_t start_address; | |
uint32_t bottom_address; | |
FlashIAP flash; | |
int ret = flash.init(); | |
if (ret != 0) { | |
return 0; | |
} | |
//Find the start of first sector after text area | |
bottom_address = align_up(FLASHIAP_APP_ROM_END_ADDR, flash.get_sector_size(FLASHIAP_APP_ROM_END_ADDR)); | |
start_address = flash.get_flash_start(); | |
flash_size = flash.get_flash_size(); | |
ret = flash.deinit(); | |
static FlashIAPBlockDevice default_bd(bottom_address, start_address + flash_size - bottom_address); | |
#else | |
static FlashIAPBlockDevice default_bd; | |
#endif | |
return &default_bd; | |
#else | |
return NULL; | |
#endif | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps it'd be possible to remove the dependency on the physical device all together? Could you use a HeapBlockDevice instead? https://github.com/ARMmbed/mbed-os/blob/master/features/storage/blockdevice/HeapBlockDevice.h
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really. I'm already using heap block device.
The idea was to test more than one type of block device. The other problem is that many devices has not enough RAM to create 64kB heap block device (it's min size to mount FAT32 fs on it)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea was to test more than one type of block device
I get ya. Though I think the main thing you're trying to test is the USB stack's interaction with the FileSystem API, not the BlockDevice API, correct?
The other problem is that many devices has not enough RAM to create 64kB heap block device (it's min size to mount FAT32 fs on it)
Dang that's a pain. Crazy idea: maybe there's a way to simulate having a large block device? Especially if you don't actually have to store everything and just need to say the data moving. Almost like a streaming block device or something. (I may be going too far off topic now)
SPI_MISO = P0_8, | ||
SPI_SCK = P0_7, | ||
SPI_CS = P0_6, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this change be upstreamed into master directly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I will do
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved to master #9482
TESTS/host_tests/pyusb_msd.py
Outdated
|
||
It will be used to find new disks mounted during test. | ||
""" | ||
self.initial_disk_list = set(MSDUtils.disks()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how test would behave if we run multiple ones in same hosts parallel? test looks a bit problematic in ci where >>2 devices are connected in same host and devices appears and disappeared all the time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In current version it will not work.
There is a plan to enhance host side msd device discovery/unmount mechanism similar as it's done in usb serial tests (https://github.com/ARMmbed/mbed-os/blob/feature-hal-spec-usb-device/TESTS/usb_device/serial distinguished by serial number)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
091b0e7
to
e23e57d
Compare
26628b4
to
90c443a
Compare
Please re-review. Comments appear to be addressed
@NirSonnenschein I left some previous comments but I don't believe I need to approve this PR. Let me know if that's not the case, though. |
CI was started a bit ago. |
Test run: FAILEDSummary: 1 of 12 test jobs failed Failed test jobs:
|
|
301f135
to
7ff689b
Compare
CI restarted |
Test run: SUCCESSSummary: 13 of 13 test jobs passed |
One moment, doing a thing. |
Now we're cooking! 😁 |
Starting CI |
Test run: FAILEDSummary: 2 of 13 test jobs failed Failed test jobs:
|
CI job restarted:
|
CI job restarted:
|
Description
Test for USB MSD calss
Tested on Windows and Linux. On Mac should also work
Supported targets see
TESTS/usb_device/msd/mbed_app.json
Targets with small RAM (less then 70kB) and without flash memory (e.g ARCH_PRO) require ci-sheild + SD card to enable testing
TODO:
Known issues:
greentea_parse_kv
is preempted by usb msd communication task (it doesn't get message from host despite is was send and is visible on serial console)Pull request type
Reviewers
@c1728p9