Skip to content

Commit

Permalink
Fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewdavidmackenzie committed Feb 26, 2025
1 parent 61f2b94 commit 87b6cd3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
11 changes: 5 additions & 6 deletions hw_test/tests/tcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,12 @@ use std::time::Duration;
const IP: IpAddr = IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1));
const PORT: u16 = 1234;


// Get config and get tcp ip and port and iroh

async fn connect_tcp<F, Fut>(ip: IpAddr, port: u16, test: F)
where
F: FnOnce(HardwareDescription, HardwareConfig, TcpStream) -> Fut,
Fut: Future<Output=()>,
Fut: Future<Output = ()>,
{
match tcp_host::connect(ip, port).await {
Ok((hw_desc, hw_config, tcp_stream)) => {
Expand Down Expand Up @@ -47,7 +46,7 @@ async fn disconnect_tcp() {
.await
.expect("Could not send Disconnect");
})
.await;
.await;
}

#[ignore]
Expand All @@ -59,7 +58,7 @@ async fn get_config_tcp() {
.await
.expect("Could not GetConfig");
})
.await;
.await;
}

#[ignore]
Expand All @@ -71,7 +70,7 @@ async fn reconnect_tcp() {
.await
.expect("Could not send Disconnect");
})
.await;
.await;

tokio::time::sleep(Duration::from_secs(1)).await;

Expand All @@ -84,4 +83,4 @@ async fn reconnect_tcp() {
// piggui tests
// connect using usb from piggui via CLI option
// connect using tcp from piggui via CLI option
// connect using usb from piggui via CLI option
// connect using usb from piggui via CLI option
13 changes: 10 additions & 3 deletions hw_test/tests/usb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ const SERIAL: &str = "e66138528350be2b";
#[tokio::test]
#[serial]
async fn get_known_serial() {
let serials = usb_host::get_serials().await.expect("No usb porky attached");
let serials = usb_host::get_serials()
.await
.expect("No usb porky attached");
if !serials.is_empty() {
assert!(serials.contains(&SERIAL.to_string()));
}
Expand All @@ -17,8 +19,13 @@ async fn get_known_serial() {
#[tokio::test]
#[serial]
async fn connect_usb() {
let serials = usb_host::get_serials().await.expect("No usb porky attached");
let serials = usb_host::get_serials()
.await
.expect("No usb porky attached");
if !serials.is_empty() {
let (_hardware_description, _hardware_config, _usb_connection) = usb_host::connect(serials.first().expect("Could not get first serial number")).await.expect("Could not connect by USB");
let (_hardware_description, _hardware_config, _usb_connection) =
usb_host::connect(serials.first().expect("Could not get first serial number"))
.await
.expect("Could not connect by USB");
}
}

0 comments on commit 87b6cd3

Please sign in to comment.