Skip to content

Commit c995657

Browse files
committed
type-c-service: Create integration test framework
Create a framework for writing integration tests that initializes the power-policy-service, type-c-service, and provides serveral type-C ports for tests.
1 parent 1e820b1 commit c995657

27 files changed

Lines changed: 805 additions & 32 deletions

File tree

.github/workflows/check.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ concurrency:
3333
name: check
3434
env:
3535
# Crates that require std and won't build on embedded-targets
36-
STD_CRATES: "fw-update-interface-mocks"
36+
STD_EXCLUDED_CRATES: "--exclude fw-update-interface-mocks --exclude type-c-interface-mocks"
3737
jobs:
3838

3939
fmt:
@@ -121,7 +121,7 @@ jobs:
121121
run: cargo hack $COMMON_HACK_ARGS clippy --locked --target ${{ matrix.target }}
122122
- name: cargo hack
123123
if: ${{ matrix.target != 'x86_64-unknown-linux-gnu' }}
124-
run: cargo hack $COMMON_HACK_ARGS clippy --exclude $STD_CRATES --locked --target ${{ matrix.target }}
124+
run: cargo hack $COMMON_HACK_ARGS clippy $STD_EXCLUDED_CRATES --locked --target ${{ matrix.target }}
125125

126126
deny:
127127
# cargo-deny checks licenses, advisories, sources, and bans for
@@ -219,8 +219,8 @@ jobs:
219219
- name: cargo +${{ matrix.msrv }} check
220220
if: ${{ matrix.target != 'x86_64-unknown-linux-gnu' }}
221221
run: |
222-
cargo check -F log --locked --workspace --exclude $STD_CRATES --target ${{ matrix.target }}
223-
cargo check -F defmt --locked --workspace --exclude $STD_CRATES --target ${{ matrix.target }}
222+
cargo check -F log --locked --workspace $STD_EXCLUDED_CRATES --target ${{ matrix.target }}
223+
cargo check -F defmt --locked --workspace $STD_EXCLUDED_CRATES --target ${{ matrix.target }}
224224
225225
check-arm-examples:
226226
runs-on: ubuntu-latest

Cargo.lock

Lines changed: 15 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ members = [
3131
"fw-update-interface",
3232
"fw-update-interface-mocks",
3333
"mctp-rs",
34+
"type-c-interface-mocks",
3435
]
3536
exclude = ["examples/*"]
3637

@@ -114,6 +115,7 @@ thermal-service-relay = { path = "./thermal-service-relay" }
114115
time-alarm-service-interface = { path = "./time-alarm-service-interface" }
115116
time-alarm-service-relay = { path = "./time-alarm-service-relay" }
116117
type-c-interface = { path = "./type-c-interface" }
118+
type-c-interface-mocks = { path = "./type-c-interface-mocks" }
117119
syn = "2.0"
118120
tps6699x = { git = "https://github.com/OpenDevicePartnership/tps6699x", branch = "v0.2.0" }
119121
tokio = { version = "1.42.0" }

examples/rt685s-evk/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/rt685s-evk/src/bin/type_c.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ async fn main(spawner: Spawner) {
238238
)));
239239

240240
static TYPE_C_SERVICE: StaticCell<Mutex<GlobalRawMutex, TypeCServiceType>> = StaticCell::new();
241-
let type_c_service = TYPE_C_SERVICE.init(Mutex::new(Service::create(
241+
let type_c_service = TYPE_C_SERVICE.init(Mutex::new(Service::new(
242242
Default::default(),
243243
TypeCRegistrationType {
244244
ports: [port0, port1],

examples/rt685s-evk/src/bin/type_c_cfu.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ async fn main(spawner: Spawner) {
376376
)));
377377

378378
static TYPE_C_SERVICE: StaticCell<Mutex<GlobalRawMutex, TypeCServiceType>> = StaticCell::new();
379-
let type_c_service = TYPE_C_SERVICE.init(Mutex::new(Service::create(
379+
let type_c_service = TYPE_C_SERVICE.init(Mutex::new(Service::new(
380380
Default::default(),
381381
TypeCRegistrationType {
382382
ports: [port0, port1],

examples/std/Cargo.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/std/src/bin/type_c/service.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ async fn task(spawner: Spawner) {
144144
)));
145145

146146
static TYPE_C_SERVICE: StaticCell<Mutex<GlobalRawMutex, ServiceType>> = StaticCell::new();
147-
let type_c_service = TYPE_C_SERVICE.init(Mutex::new(Service::create(
147+
let type_c_service = TYPE_C_SERVICE.init(Mutex::new(Service::new(
148148
Config::default(),
149149
type_c_service::service::registration::ArrayRegistration {
150150
ports: [port],

examples/std/src/bin/type_c/ucsi.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ async fn task(spawner: Spawner) {
308308

309309
// Create type-c service
310310
static TYPE_C_SERVICE: StaticCell<Mutex<GlobalRawMutex, TypeCServiceType>> = StaticCell::new();
311-
let type_c_service = TYPE_C_SERVICE.init(Mutex::new(Service::create(
311+
let type_c_service = TYPE_C_SERVICE.init(Mutex::new(Service::new(
312312
Config {
313313
ucsi_capabilities: UcsiCapabilities {
314314
num_connectors: 2,

examples/std/src/bin/type_c/unconstrained.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ async fn task(spawner: Spawner) {
164164

165165
// Create type-c service
166166
static TYPE_C_SERVICE: StaticCell<Mutex<GlobalRawMutex, TypeCServiceType>> = StaticCell::new();
167-
let type_c_service = TYPE_C_SERVICE.init(Mutex::new(Service::create(
167+
let type_c_service = TYPE_C_SERVICE.init(Mutex::new(Service::new(
168168
Default::default(),
169169
TypeCRegistrationType {
170170
ports: [port0, port1, port2],

0 commit comments

Comments
 (0)