From 138448577af23e82a7e83f5e2ae2e7da00eadbe8 Mon Sep 17 00:00:00 2001 From: Ana Hobden Date: Tue, 25 Jun 2024 11:01:34 -0700 Subject: [PATCH] Give remote-test-client a configurable timeout --- src/tools/remote-test-client/src/main.rs | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/tools/remote-test-client/src/main.rs b/src/tools/remote-test-client/src/main.rs index dd2c09c430b61..43980bdfd0913 100644 --- a/src/tools/remote-test-client/src/main.rs +++ b/src/tools/remote-test-client/src/main.rs @@ -18,6 +18,9 @@ use std::time::Duration; const REMOTE_ADDR_ENV: &str = "TEST_DEVICE_ADDR"; const DEFAULT_ADDR: &str = "127.0.0.1:12345"; +const TCP_TIMEOUT_ENV: &str = "TCP_TIMEOUT"; +const DEFAULT_TCP_TIMEOUT: u64 = 100; + macro_rules! t { ($e:expr) => { match $e { @@ -69,16 +72,26 @@ fn spawn_emulator(target: &str, server: &Path, tmpdir: &Path, rootfs: Option break, + Err(e) if e.kind() == io::ErrorKind::WouldBlock => panic!( + "TCP timeout of {timeout}ms exceeded, set `{TCP_TIMEOUT_ENV}` to a larger value" + ), + Err(_) => (), } } }