Skip to content
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

Turn repository into workspace and separate the tests #103

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ jobs:

- uses: actions-rs/cargo@v1
with:
command: check
command: build
args: --all-targets

- uses: actions-rs/cargo@v1
with:
command: check
args: --features control-buffer-256
command: build
args: --all-targets --features control-buffer-256

- uses: actions-rs/cargo@v1
with:
command: check
args: --features defmt
command: build
args: --all-targets --features defmt
37 changes: 5 additions & 32 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,33 +1,6 @@
[package]
name = "usb-device"
description = "Experimental device-side USB stack for embedded devices."
version = "0.2.9"
edition = "2018"
readme = "README.md"
keywords = ["no-std", "embedded", "usb"]
license = "MIT"
authors = ["Matti Virkkunen <[email protected]>"]
repository = "https://github.com/mvirkkunen/usb-device"
[workspace]

[dependencies]
defmt = { version = "0.3", optional = true }

[dev-dependencies]
rusb = "0.9.1"
rand = "0.8.5"

[features]
# Use a 256 byte buffer for control transfers instead of 128.
control-buffer-256 = []

# Use larger endpoint buffers for highspeed operation (default fullspeed)
#
# Note: usb-device doesn't truly support high speed enumeration yet, so setting this will make
# TestClass only compliant with high speed mode. It may still manage to be enumerated as a full
# speed device, but the descriptors will be invalid.
test-class-high-speed = []

[[test]]
name = "test_class_host"
path = "tests/test_class_host/main.rs"
harness = false
members = [
"usb-device",
"tests/test_class_host"
]
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ Class crates
* [usbd-hid](https://github.com/twitchyliquid64/usbd-hid) [![Crates.io](https://img.shields.io/crates/v/usbd-hid.svg)](https://crates.io/crates/usbd-hid) - HID class
* [usbd-serial](https://github.com/mvirkkunen/usbd-serial) [![Crates.io](https://img.shields.io/crates/v/usbd-serial.svg)](https://crates.io/crates/usbd-serial) - CDC-ACM serial port class

Development
-----------

### Testing

Testing `usb-device` involves a test suite running on a host computer, connected via USB to a target computer (microcontroller) which provides a test device. See [here](https://github.com/rust-embedded-community/usb-device/tree/master/tests) for further details.

Others
------
Expand Down
10 changes: 10 additions & 0 deletions tests/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
usb-device testing
==================

Testing `usb-device` involves a test suite running on a host computer, connected via USB to a target computer (microcontroller) which provides a test device.
For the host part, see the `test_class_host` folder.
For the device part, external crates are required since `usb-device` only provides an interface but not any hardware drivers.
Here is a list of hardware implementations of the test suite:

* [stm32-usbd-tests](https://github.com/Disasm/stm32-usbd-tests) and [usb-otg-workspace](https://github.com/Disasm/usb-otg-workspace) for STM32 parts.
* [test-usb-device](https://github.com/ianrrees/test-usb-device) for ATSAMD parts.
25 changes: 25 additions & 0 deletions tests/test_class_host/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[package]
name = "usb-device-test-class-host"
description = "Test class host for usb-device."
version = "0.2.9"
edition = "2018"
readme = "../README.md"
keywords = ["no-std", "embedded", "usb"]
license = "MIT"
authors = [
"Matti Virkkunen <[email protected]>",
"Rust Embedded Community Contributors"
]
repository = "https://github.com/rust-embedded-community/usb-device"

[dependencies]
usb-device = { path = "../../usb-device" }

[dev-dependencies]
rusb = "0.9.1"
rand = "0.8.5"

[[test]]
name = "test_class_host"
path = "main.rs"
harness = false
2 changes: 1 addition & 1 deletion LICENSE → tests/test_class_host/LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2018 Matti Virkkunen
Copyright (c) 2018 Matti Virkkunen and contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
File renamed without changes.
27 changes: 27 additions & 0 deletions usb-device/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[package]
name = "usb-device"
description = "Experimental device-side USB stack for embedded devices."
version = "0.2.9"
edition = "2018"
readme = "../README.md"
keywords = ["no-std", "embedded", "usb"]
license = "MIT"
authors = [
"Matti Virkkunen <[email protected]>",
"Rust Embedded Community Contributors"
]
repository = "https://github.com/rust-embedded-community/usb-device"

[dependencies]
defmt = { version = "0.3", optional = true }

[features]
# Use a 256 byte buffer for control transfers instead of 128.
control-buffer-256 = []

# Use larger endpoint buffers for highspeed operation (default fullspeed)
#
# Note: usb-device doesn't truly support high speed enumeration yet, so setting this will make
# TestClass only compliant with high speed mode. It may still manage to be enumerated as a full
# speed device, but the descriptors will be invalid.
test-class-high-speed = []
21 changes: 21 additions & 0 deletions usb-device/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2018 Matti Virkkunen and contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.