Skip to content

Commit 38be7e7

Browse files
peterthejohnstonCQ Bot
authored and
CQ Bot
committed
[network/test] Add logs and timeout to iPerf test
Add some logs indicating when an iPerf client or server starts or stops, as well as a 60-second timeout to the logic waiting for a component stopped event. Test flakes have looked like the component stopped event may never be arriving for one or more components. Bug: 404377171 Change-Id: Ibc9158b12ad07bc69da78143ed7ffede7ca0f7c1 Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/1231426 Fuchsia-Auto-Submit: Peter Johnston <[email protected]> Reviewed-by: Evan Wildenhain <[email protected]> Commit-Queue: Auto-Submit <[email protected]>
1 parent bbf4424 commit 38be7e7

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

src/connectivity/network/tests/benchmarks/iperf-hermetic/BUILD.gn

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,16 @@ rustc_binary("bin") {
2626
"//src/connectivity/network/tests/integration/common:netstack_testing_common",
2727
"//src/lib/fidl/rust/fidl",
2828
"//src/lib/fuchsia",
29+
"//src/lib/fuchsia-async",
2930
"//src/sys/lib/component-events",
3031
"//third_party/rust_crates:anyhow",
3132
"//third_party/rust_crates:argh",
3233
"//third_party/rust_crates:futures",
34+
"//third_party/rust_crates:log",
3335
]
3436
test_deps = [
3537
"//src/connectivity/network/tests/integration/macros:netstack_testing_macros",
3638
"//src/lib/diagnostics/reader/rust",
37-
"//third_party/rust_crates:log",
3839
"//third_party/rust_crates:test-case",
3940
]
4041
configs -= [ "//build/config/rust/lints:allow_unused_results" ]

src/connectivity/network/tests/benchmarks/iperf-hermetic/src/main.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use std::fmt::Display;
66

77
use fidl::endpoints::ProtocolMarker as _;
88
use fidl_fuchsia_netemul as fnetemul;
9+
use fuchsia_async::TimeoutExt as _;
910
use futures::FutureExt as _;
1011
use net_types::ip::Ipv4;
1112
use netstack_testing_common::realms::{
@@ -84,6 +85,9 @@ async fn watch_for_exit(
8485
component_moniker: &str,
8586
) -> component_events::events::ExitStatus {
8687
let event = wait_for_component_stopped(&realm, component_moniker, None)
88+
.on_timeout(std::time::Duration::from_secs(60), || {
89+
panic!("timed out waiting for component stopped event: {component_moniker}");
90+
})
8791
.await
8892
.expect("observe stopped event");
8993
let component_events::events::StoppedPayload { status, .. } =
@@ -247,10 +251,14 @@ async fn bench<N: Netstack, I: TestIpExt>(
247251
let mut clients = futures::future::join_all((0..flows).map(|i| async move {
248252
loop {
249253
realm_ref.start_child_component(&client_moniker(i)).await.expect("start client");
250-
if watch_for_exit(realm_ref, &client_moniker(i)).await
251-
== component_events::events::ExitStatus::Clean
252-
{
254+
log::info!("started client {i}");
255+
256+
let status = watch_for_exit(realm_ref, &client_moniker(i)).await;
257+
if status == component_events::events::ExitStatus::Clean {
258+
log::info!("client {i} exited cleanly");
253259
return;
260+
} else {
261+
log::info!("client {i} crashed: {status:?}; retrying");
254262
}
255263
}
256264
}))

0 commit comments

Comments
 (0)