diff options
| author | Ulf Lilleengen <[email protected]> | 2025-08-26 07:05:40 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-08-26 07:05:40 +0000 |
| commit | 551aa5770fccba09ccaaa78745a3e5af2faea964 (patch) | |
| tree | 6ae7de8fec93fbf30d1455727b162ed9097b0c83 /tests/utils/src | |
| parent | 73717f9ae8ea1f13f029c4c2722610a7e54436cb (diff) | |
| parent | c40c20563664a62607f754fc734c7473d28ee955 (diff) | |
Merge pull request #4549 from embassy-rs/releaser-update
feat: add semver checks and releasing to releaser
Diffstat (limited to 'tests/utils/src')
| -rw-r--r-- | tests/utils/src/bin/saturate_serial.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/tests/utils/src/bin/saturate_serial.rs b/tests/utils/src/bin/saturate_serial.rs index 18ca12fb7..85676b106 100644 --- a/tests/utils/src/bin/saturate_serial.rs +++ b/tests/utils/src/bin/saturate_serial.rs | |||
| @@ -2,7 +2,7 @@ use std::path::Path; | |||
| 2 | use std::time::Duration; | 2 | use std::time::Duration; |
| 3 | use std::{env, io, process, thread}; | 3 | use std::{env, io, process, thread}; |
| 4 | 4 | ||
| 5 | use rand::random; | 5 | use rand::{rng, Rng}; |
| 6 | use serial::SerialPort; | 6 | use serial::SerialPort; |
| 7 | 7 | ||
| 8 | pub fn main() { | 8 | pub fn main() { |
| @@ -34,14 +34,15 @@ fn saturate<T: SerialPort>(port: &mut T, idles: bool) -> io::Result<()> { | |||
| 34 | })?; | 34 | })?; |
| 35 | 35 | ||
| 36 | let mut written = 0; | 36 | let mut written = 0; |
| 37 | let mut rng = rng(); | ||
| 37 | loop { | 38 | loop { |
| 38 | let len = random::<usize>() % 0x1000; | 39 | let len = rng.random_range(1..=0x1000); |
| 39 | let buf: Vec<u8> = (written..written + len).map(|x| x as u8).collect(); | 40 | let buf: Vec<u8> = (written..written + len).map(|x| x as u8).collect(); |
| 40 | 41 | ||
| 41 | port.write_all(&buf)?; | 42 | port.write_all(&buf)?; |
| 42 | 43 | ||
| 43 | if idles { | 44 | if idles { |
| 44 | let micros = (random::<usize>() % 1000) as u64; | 45 | let micros = rng.random_range(1..=1000) as u64; |
| 45 | println!("Sleeping {}us", micros); | 46 | println!("Sleeping {}us", micros); |
| 46 | port.flush().unwrap(); | 47 | port.flush().unwrap(); |
| 47 | thread::sleep(Duration::from_micros(micros)); | 48 | thread::sleep(Duration::from_micros(micros)); |
