mirror of
https://github.com/embassy-rs/embassy.git
synced 2024-11-22 23:02:30 +00:00
Merge pull request #1503 from embassy-rs/ci-fixes
ci: add stable build, add tests.
This commit is contained in:
commit
642eb1400b
16
.github/ci/build-stable.sh
vendored
Executable file
16
.github/ci/build-stable.sh
vendored
Executable file
@ -0,0 +1,16 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
## on push branch~=gh-readonly-queue/main/.*
|
||||||
|
## on pull_request
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
export RUSTUP_HOME=/ci/cache/rustup
|
||||||
|
export CARGO_HOME=/ci/cache/cargo
|
||||||
|
export CARGO_TARGET_DIR=/ci/cache/target
|
||||||
|
|
||||||
|
hashtime restore /ci/cache/filetime.json || true
|
||||||
|
hashtime save /ci/cache/filetime.json
|
||||||
|
|
||||||
|
sed -i 's/channel.*/channel = "stable"/g' rust-toolchain.toml
|
||||||
|
|
||||||
|
./ci_stable.sh
|
2
.github/ci/rust.sh → .github/ci/build.sh
vendored
2
.github/ci/rust.sh → .github/ci/build.sh
vendored
@ -4,8 +4,6 @@
|
|||||||
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
echo Hello World!
|
|
||||||
|
|
||||||
export RUSTUP_HOME=/ci/cache/rustup
|
export RUSTUP_HOME=/ci/cache/rustup
|
||||||
export CARGO_HOME=/ci/cache/cargo
|
export CARGO_HOME=/ci/cache/cargo
|
||||||
export CARGO_TARGET_DIR=/ci/cache/target
|
export CARGO_TARGET_DIR=/ci/cache/target
|
28
.github/ci/test.sh
vendored
Executable file
28
.github/ci/test.sh
vendored
Executable file
@ -0,0 +1,28 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
## on push branch~=gh-readonly-queue/main/.*
|
||||||
|
## on pull_request
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
export RUSTUP_HOME=/ci/cache/rustup
|
||||||
|
export CARGO_HOME=/ci/cache/cargo
|
||||||
|
export CARGO_TARGET_DIR=/ci/cache/target
|
||||||
|
|
||||||
|
hashtime restore /ci/cache/filetime.json || true
|
||||||
|
hashtime save /ci/cache/filetime.json
|
||||||
|
|
||||||
|
cargo test --manifest-path ./embassy-sync/Cargo.toml
|
||||||
|
cargo test --manifest-path ./embassy-embedded-hal/Cargo.toml
|
||||||
|
cargo test --manifest-path ./embassy-hal-common/Cargo.toml
|
||||||
|
cargo test --manifest-path ./embassy-time/Cargo.toml --features generic-queue
|
||||||
|
|
||||||
|
cargo test --manifest-path ./embassy-boot/boot/Cargo.toml
|
||||||
|
cargo test --manifest-path ./embassy-boot/boot/Cargo.toml --features nightly
|
||||||
|
cargo test --manifest-path ./embassy-boot/boot/Cargo.toml --features nightly,ed25519-dalek
|
||||||
|
cargo test --manifest-path ./embassy-boot/boot/Cargo.toml --features nightly,ed25519-salty
|
||||||
|
|
||||||
|
#cargo test --manifest-path ./embassy-nrf/Cargo.toml --no-default-features --features nightly,nrf52840,time-driver-rtc1 ## broken doctests
|
||||||
|
|
||||||
|
cargo test --manifest-path ./embassy-stm32/Cargo.toml --no-default-features --features nightly,stm32f429vg,exti,time-driver-any,exti
|
||||||
|
cargo test --manifest-path ./embassy-stm32/Cargo.toml --no-default-features --features nightly,stm32f732ze,exti,time-driver-any,exti
|
||||||
|
cargo test --manifest-path ./embassy-stm32/Cargo.toml --no-default-features --features nightly,stm32f769ni,exti,time-driver-any,exti
|
@ -2,12 +2,9 @@
|
|||||||
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
export CARGO_TARGET_DIR=$PWD/target_ci_stable
|
|
||||||
export RUSTFLAGS=-Dwarnings
|
export RUSTFLAGS=-Dwarnings
|
||||||
export DEFMT_LOG=trace
|
export DEFMT_LOG=trace
|
||||||
|
|
||||||
sed -i 's/channel.*/channel = "stable"/g' rust-toolchain.toml
|
|
||||||
|
|
||||||
cargo batch \
|
cargo batch \
|
||||||
--- build --release --manifest-path embassy-boot/nrf/Cargo.toml --target thumbv7em-none-eabi --features embassy-nrf/nrf52840 \
|
--- build --release --manifest-path embassy-boot/nrf/Cargo.toml --target thumbv7em-none-eabi --features embassy-nrf/nrf52840 \
|
||||||
--- build --release --manifest-path embassy-boot/nrf/Cargo.toml --target thumbv8m.main-none-eabihf --features embassy-nrf/nrf9160-ns \
|
--- build --release --manifest-path embassy-boot/nrf/Cargo.toml --target thumbv8m.main-none-eabihf --features embassy-nrf/nrf9160-ns \
|
||||||
|
@ -2,13 +2,12 @@
|
|||||||
//!
|
//!
|
||||||
//! # Example (nrf52)
|
//! # Example (nrf52)
|
||||||
//!
|
//!
|
||||||
//! ```rust
|
//! ```rust,ignore
|
||||||
//! use embassy_embedded_hal::shared_bus::blocking::i2c::I2cDevice;
|
//! use embassy_embedded_hal::shared_bus::blocking::i2c::I2cDevice;
|
||||||
//! use embassy_sync::blocking_mutex::{NoopMutex, raw::NoopRawMutex};
|
//! use embassy_sync::blocking_mutex::{NoopMutex, raw::NoopRawMutex};
|
||||||
//!
|
//!
|
||||||
//! static I2C_BUS: StaticCell<NoopMutex<RefCell<Twim<TWISPI0>>>> = StaticCell::new();
|
//! static I2C_BUS: StaticCell<NoopMutex<RefCell<Twim<TWISPI0>>>> = StaticCell::new();
|
||||||
//! let irq = interrupt::take!(SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0);
|
//! let i2c = Twim::new(p.TWISPI0, Irqs, p.P0_03, p.P0_04, Config::default());
|
||||||
//! let i2c = Twim::new(p.TWISPI0, irq, p.P0_03, p.P0_04, Config::default());
|
|
||||||
//! let i2c_bus = NoopMutex::new(RefCell::new(i2c));
|
//! let i2c_bus = NoopMutex::new(RefCell::new(i2c));
|
||||||
//! let i2c_bus = I2C_BUS.init(i2c_bus);
|
//! let i2c_bus = I2C_BUS.init(i2c_bus);
|
||||||
//!
|
//!
|
||||||
|
@ -2,13 +2,12 @@
|
|||||||
//!
|
//!
|
||||||
//! # Example (nrf52)
|
//! # Example (nrf52)
|
||||||
//!
|
//!
|
||||||
//! ```rust
|
//! ```rust,ignore
|
||||||
//! use embassy_embedded_hal::shared_bus::blocking::spi::SpiDevice;
|
//! use embassy_embedded_hal::shared_bus::blocking::spi::SpiDevice;
|
||||||
//! use embassy_sync::blocking_mutex::{NoopMutex, raw::NoopRawMutex};
|
//! use embassy_sync::blocking_mutex::{NoopMutex, raw::NoopRawMutex};
|
||||||
//!
|
//!
|
||||||
//! static SPI_BUS: StaticCell<NoopMutex<RefCell<Spim<SPI3>>>> = StaticCell::new();
|
//! static SPI_BUS: StaticCell<NoopMutex<RefCell<Spim<SPI3>>>> = StaticCell::new();
|
||||||
//! let irq = interrupt::take!(SPIM3);
|
//! let spi = Spim::new_txonly(p.SPI3, Irqs, p.P0_15, p.P0_18, Config::default());
|
||||||
//! let spi = Spim::new_txonly(p.SPI3, irq, p.P0_15, p.P0_18, Config::default());
|
|
||||||
//! let spi_bus = NoopMutex::new(RefCell::new(spi));
|
//! let spi_bus = NoopMutex::new(RefCell::new(spi));
|
||||||
//! let spi_bus = SPI_BUS.init(spi_bus);
|
//! let spi_bus = SPI_BUS.init(spi_bus);
|
||||||
//!
|
//!
|
||||||
|
@ -458,8 +458,6 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn push_slices() {
|
fn push_slices() {
|
||||||
init();
|
|
||||||
|
|
||||||
let mut b = [0; 4];
|
let mut b = [0; 4];
|
||||||
let rb = RingBuffer::new();
|
let rb = RingBuffer::new();
|
||||||
unsafe {
|
unsafe {
|
||||||
|
@ -67,7 +67,7 @@ fn compare_n(n: usize) -> u32 {
|
|||||||
1 << (n + 16)
|
1 << (n + 16)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(tests)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
|
@ -163,7 +163,7 @@ pub(super) fn get_sector(address: u32, regions: &[&FlashRegion]) -> FlashSector
|
|||||||
bank_offset = 0;
|
bank_offset = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if address < region.end() {
|
if address >= region.base && address < region.end() {
|
||||||
let index_in_region = (address - region.base) / region.erase_size;
|
let index_in_region = (address - region.base) / region.erase_size;
|
||||||
return FlashSector {
|
return FlashSector {
|
||||||
bank: region.bank,
|
bank: region.bank,
|
||||||
|
@ -209,39 +209,39 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_compute_dead_time_value() {
|
fn test_compute_dead_time_value() {
|
||||||
struct test_run {
|
struct TestRun {
|
||||||
value: u16,
|
value: u16,
|
||||||
ckd: Ckd,
|
ckd: Ckd,
|
||||||
bits: u8,
|
bits: u8,
|
||||||
}
|
}
|
||||||
|
|
||||||
let fn_results = [
|
let fn_results = [
|
||||||
test_run {
|
TestRun {
|
||||||
value: 1,
|
value: 1,
|
||||||
ckd: Ckd::DIV1,
|
ckd: Ckd::DIV1,
|
||||||
bits: 1,
|
bits: 1,
|
||||||
},
|
},
|
||||||
test_run {
|
TestRun {
|
||||||
value: 125,
|
value: 125,
|
||||||
ckd: Ckd::DIV1,
|
ckd: Ckd::DIV1,
|
||||||
bits: 125,
|
bits: 125,
|
||||||
},
|
},
|
||||||
test_run {
|
TestRun {
|
||||||
value: 245,
|
value: 245,
|
||||||
ckd: Ckd::DIV1,
|
ckd: Ckd::DIV1,
|
||||||
bits: 64 + 245 / 2,
|
bits: 64 + 245 / 2,
|
||||||
},
|
},
|
||||||
test_run {
|
TestRun {
|
||||||
value: 255,
|
value: 255,
|
||||||
ckd: Ckd::DIV2,
|
ckd: Ckd::DIV2,
|
||||||
bits: 127,
|
bits: 127,
|
||||||
},
|
},
|
||||||
test_run {
|
TestRun {
|
||||||
value: 400,
|
value: 400,
|
||||||
ckd: Ckd::DIV1,
|
ckd: Ckd::DIV1,
|
||||||
bits: 32 + (400u16 / 8) as u8,
|
bits: 32 + (400u16 / 8) as u8,
|
||||||
},
|
},
|
||||||
test_run {
|
TestRun {
|
||||||
value: 600,
|
value: 600,
|
||||||
ckd: Ckd::DIV4,
|
ckd: Ckd::DIV4,
|
||||||
bits: 64 + (600u16 / 8) as u8,
|
bits: 64 + (600u16 / 8) as u8,
|
||||||
|
@ -169,4 +169,4 @@ wasm-timer = { version = "0.2.5", optional = true }
|
|||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
serial_test = "0.9"
|
serial_test = "0.9"
|
||||||
critical-section = { version = "1.1", features = ["std"] }
|
critical-section = { version = "1.1", features = ["std"] }
|
||||||
|
embassy-executor = { version = "0.2.0", path = "../embassy-executor", features = ["nightly"] }
|
||||||
|
@ -49,7 +49,7 @@
|
|||||||
//! fn set_alarm_callback(&self, alarm: AlarmHandle, callback: fn(*mut ()), ctx: *mut ()) {
|
//! fn set_alarm_callback(&self, alarm: AlarmHandle, callback: fn(*mut ()), ctx: *mut ()) {
|
||||||
//! todo!()
|
//! todo!()
|
||||||
//! }
|
//! }
|
||||||
//! fn set_alarm(&self, alarm: AlarmHandle, timestamp: u64) {
|
//! fn set_alarm(&self, alarm: AlarmHandle, timestamp: u64) -> bool {
|
||||||
//! todo!()
|
//! todo!()
|
||||||
//! }
|
//! }
|
||||||
//! }
|
//! }
|
||||||
|
@ -183,7 +183,6 @@ mod tests {
|
|||||||
|
|
||||||
use serial_test::serial;
|
use serial_test::serial;
|
||||||
|
|
||||||
use super::InnerQueue;
|
|
||||||
use crate::driver::{AlarmHandle, Driver};
|
use crate::driver::{AlarmHandle, Driver};
|
||||||
use crate::queue_generic::QUEUE;
|
use crate::queue_generic::QUEUE;
|
||||||
use crate::Instant;
|
use crate::Instant;
|
||||||
@ -317,14 +316,18 @@ mod tests {
|
|||||||
|
|
||||||
fn setup() {
|
fn setup() {
|
||||||
DRIVER.reset();
|
DRIVER.reset();
|
||||||
|
critical_section::with(|cs| *QUEUE.inner.borrow_ref_mut(cs) = None);
|
||||||
QUEUE.inner.lock(|inner| {
|
|
||||||
*inner.borrow_mut() = InnerQueue::new();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn queue_len() -> usize {
|
fn queue_len() -> usize {
|
||||||
QUEUE.inner.lock(|inner| inner.borrow().queue.iter().count())
|
critical_section::with(|cs| {
|
||||||
|
QUEUE
|
||||||
|
.inner
|
||||||
|
.borrow_ref(cs)
|
||||||
|
.as_ref()
|
||||||
|
.map(|inner| inner.queue.iter().count())
|
||||||
|
.unwrap_or(0)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -109,7 +109,6 @@ impl Future for Timer {
|
|||||||
/// # #![feature(type_alias_impl_trait)]
|
/// # #![feature(type_alias_impl_trait)]
|
||||||
/// #
|
/// #
|
||||||
/// use embassy_time::{Duration, Ticker};
|
/// use embassy_time::{Duration, Ticker};
|
||||||
/// use futures::StreamExt;
|
|
||||||
/// # fn foo(){}
|
/// # fn foo(){}
|
||||||
///
|
///
|
||||||
/// #[embassy_executor::task]
|
/// #[embassy_executor::task]
|
||||||
|
Loading…
Reference in New Issue
Block a user