From d49f6bb98e910d8a8669a10e59b1b115d4a6f8bb Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Mon, 16 Nov 2026 09:29:57 -0800 Subject: [PATCH 1/2] fix(moq-relay): build the io_uring runtime only where io-uring has bindings moq-relay depended on moq-uring on every Linux target since #8852, so the armv7 release build (and `cargo install` on 32-bit Linux) hit io-uring's compile_error for its prebuilt bindings. A build.rs sets cfg(uring) for Linux on x86_64, aarch64, riscv64, loongarch64, and powerpc64, matching the dependency's target, and runtime.io_uring refuses elsewhere. Co-Authored-By: Claude Opus 5.5 --- doc/bin/relay/config.md | 6 +++--- nix/Cargo.nix | 26 ++++++++++++++++++++-- rs/moq-relay/Cargo.toml | 11 ++++++---- rs/moq-relay/build.rs | 15 +++++++++++++ rs/moq-relay/src/auth.rs | 2 +- rs/moq-relay/src/config.rs | 7 ++++-- rs/moq-relay/src/incoming.rs | 2 +- rs/moq-relay/src/internal.rs | 26 +++++++++++----------- rs/moq-relay/src/lib.rs | 2 +- rs/moq-relay/src/relay.rs | 42 ++++++++++++++++++------------------ rs/moq-relay/src/runtime.rs | 5 +++-- 11 files changed, 94 insertions(+), 50 deletions(-) create mode 100644 rs/moq-relay/build.rs diff --git a/doc/bin/relay/config.md b/doc/bin/relay/config.md index 3cef62e66aa..64156ca0b95 100644 --- a/doc/bin/relay/config.md +++ b/doc/bin/relay/config.md @@ -227,9 +227,9 @@ Pinning is off by default because every relay pins its workers to the same first cores, so two relays on one host, or one limited to fewer CPUs than the host has, would crowd onto them. Turn it on for a host the relay has to itself. -`io_uring` additionally needs Linux 6.12+; it -shares the same reloadable TLS identity and serves every configured version -like the shared runtime. A setting the host cannot deliver refuses to +`io_uring` additionally needs Linux 6.12+ on a 64-bit x86, ARM, RISC-V, +LoongArch, or POWER CPU; it shares the same reloadable TLS identity and serves +every configured version like the shared runtime. A setting the host cannot deliver refuses to start rather than being ignored. Linux 6.14 up to the 7.3 fix (backported to stable kernels) charges io\_uring rings to `RLIMIT_MEMLOCK`: if io\_uring workers fail to start naming it, raise it (`LimitMEMLOCK=` under systemd). diff --git a/nix/Cargo.nix b/nix/Cargo.nix index e851542f990..9df6e913c3a 100644 --- a/nix/Cargo.nix +++ b/nix/Cargo.nix @@ -20887,7 +20887,18 @@ rec { name = "moq-uring"; packageId = "moq-uring"; usesDefaultFeatures = false; - target = { target, features }: ("linux" == target."os" or null); + target = + { target, features }: + ( + ("linux" == target."os" or null) + && ( + ("x86_64" == target."arch" or null) + || ("aarch64" == target."arch" or null) + || ("riscv64" == target."arch" or null) + || ("loongarch64" == target."arch" or null) + || ("powerpc64" == target."arch" or null) + ) + ); features = [ "quic" ]; } { @@ -21003,7 +21014,18 @@ rec { { name = "web-transport-proto"; packageId = "web-transport-proto"; - target = { target, features }: ("linux" == target."os" or null); + target = + { target, features }: + ( + ("linux" == target."os" or null) + && ( + ("x86_64" == target."arch" or null) + || ("aarch64" == target."arch" or null) + || ("riscv64" == target."arch" or null) + || ("loongarch64" == target."arch" or null) + || ("powerpc64" == target."arch" or null) + ) + ); } ]; devDependencies = [ diff --git a/rs/moq-relay/Cargo.toml b/rs/moq-relay/Cargo.toml index cfb42f3c4f9..1553cd2f766 100644 --- a/rs/moq-relay/Cargo.toml +++ b/rs/moq-relay/Cargo.toml @@ -89,15 +89,18 @@ tracing = { workspace = true } url = { workspace = true, features = ["serde"] } usage-rs = { workspace = true, features = ["completions", "config"] } +# Serves QUIC from io_uring workers (`--runtime-io-uring`), on the architectures +# io-uring ships prebuilt kernel bindings for; build.rs sets `cfg(uring)` to match. +[target.'cfg(all(target_os = "linux", any(target_arch = "x86_64", target_arch = "aarch64", target_arch = "riscv64", target_arch = "loongarch64", target_arch = "powerpc64")))'.dependencies] +moq-uring = { workspace = true, features = ["quic"] } +# The WebTransport CONNECT response the io_uring listener answers with. +web-transport-proto = { workspace = true } + [target.'cfg(target_os = "linux")'.dependencies] # `geteuid`, so a handoff only trusts a relay of the same user. libc = { workspace = true } # The reuseport group and descriptor passing a handoff carries the sockets with. moq-sock = { workspace = true } -# Serves QUIC from io_uring workers (`--runtime-io-uring`). -moq-uring = { workspace = true, features = ["quic"] } -# The WebTransport CONNECT response the io_uring listener answers with. -web-transport-proto = { workspace = true } [target.'cfg(unix)'.dependencies] sd-notify = { workspace = true } diff --git a/rs/moq-relay/build.rs b/rs/moq-relay/build.rs new file mode 100644 index 00000000000..1f10dfec778 --- /dev/null +++ b/rs/moq-relay/build.rs @@ -0,0 +1,15 @@ +//! Sets `cfg(uring)` where the io_uring workers build: Linux on the architectures +//! io-uring ships prebuilt kernel bindings for. Keep the list in step with the +//! `moq-uring` dependency's target in Cargo.toml. +fn main() { + println!("cargo::rustc-check-cfg=cfg(uring)"); + let os = std::env::var("CARGO_CFG_TARGET_OS").unwrap_or_default(); + let arch = std::env::var("CARGO_CFG_TARGET_ARCH").unwrap_or_default(); + let bindings = matches!( + arch.as_str(), + "x86_64" | "aarch64" | "riscv64" | "loongarch64" | "powerpc64" + ); + if os == "linux" && bindings { + println!("cargo::rustc-cfg=uring"); + } +} diff --git a/rs/moq-relay/src/auth.rs b/rs/moq-relay/src/auth.rs index 3af10326673..0a81e59e834 100644 --- a/rs/moq-relay/src/auth.rs +++ b/rs/moq-relay/src/auth.rs @@ -1263,7 +1263,7 @@ pub fn request_for(auth: &Auth, request: &moq_tokio::server::Request) -> Request } /// Build an auth request from the path, credential, role, and implementation carried in SETUP. -#[cfg(any(feature = "test-support", target_os = "linux"))] +#[cfg(any(feature = "test-support", uring))] pub(crate) fn request_for_setup( auth: &Auth, setup: &moq_net::server::Handshake, diff --git a/rs/moq-relay/src/config.rs b/rs/moq-relay/src/config.rs index 93c85a79222..5b70b661fde 100644 --- a/rs/moq-relay/src/config.rs +++ b/rs/moq-relay/src/config.rs @@ -361,8 +361,11 @@ impl Config { !io_uring || self.listen.bind.is_some(), "runtime.io_uring requires listen.bind" ); - #[cfg(not(target_os = "linux"))] - anyhow::ensure!(!io_uring, "runtime.io_uring is Linux-only"); + #[cfg(not(uring))] + anyhow::ensure!( + !io_uring, + "runtime.io_uring needs Linux on x86_64, aarch64, riscv64, loongarch64, or powerpc64" + ); // Refused rather than ignored: a group is the whole point of the setting, and // silently serving from the shared runtime instead would look like it worked. Ok(()) diff --git a/rs/moq-relay/src/incoming.rs b/rs/moq-relay/src/incoming.rs index d065b759781..deb2f61649e 100644 --- a/rs/moq-relay/src/incoming.rs +++ b/rs/moq-relay/src/incoming.rs @@ -10,7 +10,7 @@ pub trait Incoming: Sealed {} impl Incoming for moq_tokio::server::Request {} -#[cfg(target_os = "linux")] +#[cfg(uring)] impl Incoming for crate::uring::Request {} #[cfg(feature = "test-support")] diff --git a/rs/moq-relay/src/internal.rs b/rs/moq-relay/src/internal.rs index 9aec67fc184..13fbc719bdc 100644 --- a/rs/moq-relay/src/internal.rs +++ b/rs/moq-relay/src/internal.rs @@ -54,11 +54,11 @@ use prometheus_client::{ /// list is always empty there and the renderer skips itself, rather than /// `cfg`-ing the two fields, the two struct literals that fill them, and the /// renderer's signature separately. -#[cfg(target_os = "linux")] +#[cfg(uring)] type UringWorker = moq_uring::metrics::Metrics; /// One io_uring worker's counters. See the io_uring build's alias. -#[cfg(not(target_os = "linux"))] +#[cfg(not(uring))] type UringWorker = std::convert::Infallible; /// Configuration for the internal (ops) listener. @@ -229,7 +229,7 @@ impl Internal { /// Register them before the threads start, so a worker that never came up /// (or has died) still has a series that has stopped moving rather than no /// series at all. - #[cfg(target_os = "linux")] + #[cfg(uring)] pub(crate) fn with_uring(mut self, workers: impl IntoIterator) -> Self { self.uring.extend(workers); self @@ -883,7 +883,7 @@ fn encode_accepts(encoder: &mut DescriptorEncoder, listeners: &[moq_tokio::accep /// exists for. The pool gauges are the buffer space each worker has allocated, /// which stays at its high-water mark after a burst; only the pages datagrams /// have touched count toward RSS. -#[cfg(target_os = "linux")] +#[cfg(uring)] fn encode_uring(encoder: &mut DescriptorEncoder, workers: &[UringWorker]) -> std::fmt::Result { use moq_uring::metrics::Snapshot; @@ -1046,17 +1046,17 @@ fn encode_uring(encoder: &mut DescriptorEncoder, workers: &[UringWorker]) -> std /// Off the io_uring path there are no workers to describe, and [`UringWorker`] /// is uninhabited, so the list handed here is always empty. -#[cfg(not(target_os = "linux"))] +#[cfg(not(uring))] fn encode_uring(_encoder: &mut DescriptorEncoder, _workers: &[UringWorker]) -> std::fmt::Result { Ok(()) } /// An io_uring worker's histogram, whose cumulative buckets the encoder takes as /// per-bucket counts. -#[cfg(target_os = "linux")] +#[cfg(uring)] struct Distribution(moq_uring::metrics::Histogram); -#[cfg(target_os = "linux")] +#[cfg(uring)] impl EncodeMetric for Distribution { fn encode(&self, mut encoder: prometheus_client::encoding::MetricEncoder) -> std::fmt::Result { let mut below = 0; @@ -1409,7 +1409,7 @@ mod tests { /// yet is empty rather than zero, so an alert on a worker whose receive pool /// has started running dry is unwritable until it has already happened. A /// worker that never started has to publish stuck zeros, not nothing. - #[cfg(target_os = "linux")] + #[cfg(uring)] #[test] fn uring_metrics_list_every_worker_from_zero() { let workers = vec![ @@ -1490,7 +1490,7 @@ mod tests { } /// A worker's cumulative buckets come out cumulative again, not summed twice. - #[cfg(target_os = "linux")] + #[cfg(uring)] #[test] fn uring_histograms_keep_cumulative_buckets() { let histogram = moq_uring::metrics::Histogram { @@ -2012,9 +2012,9 @@ mod tests { refusals: Some(refusals), sessions: crate::session::Registry::new(), listeners: vec![moq_tokio::accept::Health::new("tcp")], - #[cfg(target_os = "linux")] + #[cfg(uring)] uring: vec![moq_uring::metrics::Metrics::default()], - #[cfg(not(target_os = "linux"))] + #[cfg(not(uring))] uring: Vec::new(), demux: Some(moq_tokio::quic::demux::Counters::default()), shutdown: Some(shutdown), @@ -2032,7 +2032,7 @@ mod tests { actual.remove(panics); let mut expected: Vec = EXPECTED_SERIES.trim().lines().map(str::to_string).collect(); - #[cfg(target_os = "linux")] + #[cfg(uring)] expected.extend(EXPECTED_URING_SERIES.trim().lines().map(str::to_string)); expected.extend(EXPECTED_DEMUX_SERIES.trim().lines().map(str::to_string)); expected.sort(); @@ -2125,7 +2125,7 @@ gauge moq_relay_sessions_connected{state="active",tier="edge"} 0 gauge moq_relay_sessions_connected{state="idle",tier="edge"} 1 "#; - #[cfg(target_os = "linux")] + #[cfg(uring)] const EXPECTED_URING_SERIES: &str = r#" # TYPE moq_relay_uring_completions_total counter # TYPE moq_relay_uring_cqes_per_enter histogram diff --git a/rs/moq-relay/src/lib.rs b/rs/moq-relay/src/lib.rs index 17ff6c30fad..45655fe112f 100644 --- a/rs/moq-relay/src/lib.rs +++ b/rs/moq-relay/src/lib.rs @@ -37,7 +37,7 @@ pub mod sim; pub mod stats; #[cfg(feature = "test-support")] mod test_support; -#[cfg(target_os = "linux")] +#[cfg(uring)] pub(crate) mod uring; /// The HTTP/HTTPS server: health, certificate fingerprint, announcements, fetch, and WebSocket sessions. pub mod web; diff --git a/rs/moq-relay/src/relay.rs b/rs/moq-relay/src/relay.rs index 25496ee8b87..0d858761378 100644 --- a/rs/moq-relay/src/relay.rs +++ b/rs/moq-relay/src/relay.rs @@ -114,7 +114,7 @@ pub struct Relay { /// [`serve`](crate::uring::Spawned::serve). `None` unless both /// `runtime.workers` and `runtime.io_uring` are configured, in which case /// they own the QUIC listen address instead of `workers`. - #[cfg(target_os = "linux")] + #[cfg(uring)] uring: Option, /// The tokio QUIC listener's demux, which every worker shares. `None` when /// nothing on tokio serves QUIC: a stream-only relay, or the io_uring workers. @@ -211,7 +211,7 @@ impl Relay { let workers_addr = workers.as_ref().map(moq_tokio::worker::Workers::local_addr); let workers_certificates = workers.as_ref().map(moq_tokio::worker::Workers::certificates); - #[cfg(target_os = "linux")] + #[cfg(uring)] let uring = match config.runtime.workers() { Some(worker) if io_uring => { let mut server = moq_tokio::server::Config::default(); @@ -226,9 +226,9 @@ impl Relay { _ => None, }; - #[cfg(target_os = "linux")] + #[cfg(uring)] let quic_owned_elsewhere = workers_addr.is_some() || uring.is_some(); - #[cfg(not(target_os = "linux"))] + #[cfg(not(uring))] let quic_owned_elsewhere = workers_addr.is_some(); let mut server_config = moq_tokio::server::Config::default(); @@ -250,9 +250,9 @@ impl Relay { }; // `None` for a stream-only server (no QUIC); any other error is real. - #[cfg(target_os = "linux")] + #[cfg(uring)] let uring_addr = uring.as_ref().map(crate::uring::Workers::local_addr); - #[cfg(not(target_os = "linux"))] + #[cfg(not(uring))] let uring_addr: Option = None; let addr = match (workers_addr, uring_addr) { (Some(addr), _) => Some(addr), @@ -266,17 +266,17 @@ impl Relay { // The io_uring workers serve QUIC without the demux, and a stream-only relay // has no UDP port at all. - #[cfg(target_os = "linux")] + #[cfg(uring)] let demux = (addr.is_some() && uring.is_none()).then_some(demux); - #[cfg(not(target_os = "linux"))] + #[cfg(not(uring))] let demux = addr.is_some().then_some(demux); let cache = config.cache.init()?; // Whichever worker group owns QUIC holds the certificates; the shared // server then has none of its own. - #[cfg(target_os = "linux")] + #[cfg(uring)] let uring_certificates = uring.as_ref().map(crate::uring::Workers::certificates); - #[cfg(not(target_os = "linux"))] + #[cfg(not(uring))] let uring_certificates: Option = None; let certificates = match (workers_certificates, uring_certificates) { (Some(certificates), _) => certificates, @@ -355,7 +355,7 @@ impl Relay { // Bound but not yet serving: registering here (rather than after the // threads start) is what gives every worker a series from the first // scrape, including one that is about to fail setup. - #[cfg(target_os = "linux")] + #[cfg(uring)] let internal = match uring.as_ref() { Some(uring) => internal.with_uring(uring.metrics()), None => internal, @@ -389,7 +389,7 @@ impl Relay { internal_routes: None, sessions, workers, - #[cfg(target_os = "linux")] + #[cfg(uring)] uring, demux, handoff, @@ -608,7 +608,7 @@ impl Relay { internal_routes, sessions, workers, - #[cfg(target_os = "linux")] + #[cfg(uring)] uring, handoff, alone, @@ -635,7 +635,7 @@ impl Relay { // before it: an unsupported kernel, a refused ring, or a certificate // identity rustls will not load fails here, and reporting ready first would // release the units depending on a relay that is about to exit. - #[cfg(target_os = "linux")] + #[cfg(uring)] let mut uring = uring .map(|uring| { uring @@ -670,7 +670,7 @@ impl Relay { false => None, }; - #[cfg(target_os = "linux")] + #[cfg(uring)] if let Some(uring) = uring.as_mut() { uring.serve(); } @@ -695,9 +695,9 @@ impl Relay { #[cfg(not(feature = "jemalloc"))] let jemalloc = std::future::pending::>(); - #[cfg(target_os = "linux")] + #[cfg(uring)] let uring_serving = uring.is_some(); - #[cfg(target_os = "linux")] + #[cfg(uring)] let uring_failed = { let uring = uring.as_mut(); async move { @@ -707,7 +707,7 @@ impl Relay { } } }; - #[cfg(not(target_os = "linux"))] + #[cfg(not(uring))] let uring_failed = std::future::pending::(); // Each worker serves from its own thread, so the future built here only @@ -754,9 +754,9 @@ impl Relay { // of those has nothing to accept: its loop would fail with // `NoBackend` immediately and take the healthy relay down. Pend instead; // the workers are what serve. - #[cfg(target_os = "linux")] + #[cfg(uring)] let quic_on_workers = has_workers || uring_serving; - #[cfg(not(target_os = "linux"))] + #[cfg(not(uring))] let quic_on_workers = has_workers; // Set once the relay replacing this one serves: every accept loop stops, since // that relay accepts on the same sockets, and the drain starts. @@ -837,7 +837,7 @@ impl Relay { if let Some(workers) = workers { workers.shutdown().await; } - #[cfg(target_os = "linux")] + #[cfg(uring)] if let Some(uring) = uring { uring.shutdown().await; } diff --git a/rs/moq-relay/src/runtime.rs b/rs/moq-relay/src/runtime.rs index ba589458ef4..0c1a71772ed 100644 --- a/rs/moq-relay/src/runtime.rs +++ b/rs/moq-relay/src/runtime.rs @@ -47,8 +47,9 @@ pub struct Config { /// with `UDP_GRO`, `UDP_SEGMENT` send), userspace timers, and a local task /// set; sessions get every configured version (native raw QUIC and browser /// WebTransport alike), and everything else (HTTP, WebSocket, cluster - /// dials, stats) stays on the shared runtime. Requires `runtime-workers`, - /// Linux 6.12+, and refuses to start anywhere it cannot deliver. + /// dials, stats) stays on the shared runtime. Requires `runtime-workers` and + /// Linux 6.12+ on a 64-bit CPU io-uring has bindings for, and refuses to + /// start anywhere it cannot deliver. #[usage( long = "runtime-io-uring", env = "MOQ_RUNTIME_IO_URING", From 6649422cd0d9131b5a6ca1c6644f24860608a3d7 Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Tue, 17 Nov 2026 05:28:51 -0800 Subject: [PATCH 2/2] fix(moq-relay): gate the io_uring test build on the same architectures The dev-dependency on moq-uring and the io_uring integration tests were still Linux-wide, so `cargo test` on armv7 Linux compiled io-uring and hit its compile_error!. They now follow cfg(uring); handoff and tokio-worker tests stay Linux-wide. Co-Authored-By: Claude Opus 5.5 --- nix/Cargo.nix | 13 ++++++++++++- rs/moq-relay/Cargo.toml | 4 +++- rs/moq-relay/build.rs | 2 +- rs/moq-relay/tests/integration/bitrate_caps.rs | 12 ++++++------ rs/moq-relay/tests/integration/embed.rs | 2 +- rs/moq-relay/tests/integration/handoff.rs | 8 ++++---- rs/moq-relay/tests/integration/main.rs | 2 +- rs/moq-relay/tests/integration/peer_limits.rs | 2 +- rs/moq-relay/tests/integration/refusals.rs | 2 +- rs/moq-relay/tests/integration/runtime_uring.rs | 2 +- rs/moq-relay/tests/integration/tenant_matrix.rs | 2 +- rs/moq-relay/tests/integration/wire_stats.rs | 2 +- 12 files changed, 33 insertions(+), 20 deletions(-) diff --git a/nix/Cargo.nix b/nix/Cargo.nix index 9df6e913c3a..8e1122ae1a4 100644 --- a/nix/Cargo.nix +++ b/nix/Cargo.nix @@ -21077,7 +21077,18 @@ rec { name = "moq-uring"; packageId = "moq-uring"; usesDefaultFeatures = false; - target = { target, features }: ("linux" == target."os" or null); + target = + { target, features }: + ( + ("linux" == target."os" or null) + && ( + ("x86_64" == target."arch" or null) + || ("aarch64" == target."arch" or null) + || ("riscv64" == target."arch" or null) + || ("loongarch64" == target."arch" or null) + || ("powerpc64" == target."arch" or null) + ) + ); features = [ "_manual" ]; } { diff --git a/rs/moq-relay/Cargo.toml b/rs/moq-relay/Cargo.toml index 1553cd2f766..5ff4fa23f46 100644 --- a/rs/moq-relay/Cargo.toml +++ b/rs/moq-relay/Cargo.toml @@ -129,9 +129,11 @@ tracing-subscriber = { workspace = true } web-transport-proto = { workspace = true } workspace-hack = { path = "../workspace-hack" } -[target.'cfg(target_os = "linux")'.dev-dependencies] +[target.'cfg(all(target_os = "linux", any(target_arch = "x86_64", target_arch = "aarch64", target_arch = "riscv64", target_arch = "loongarch64", target_arch = "powerpc64")))'.dev-dependencies] # Workers built inside a runtime with a manual clock installed run on that clock. moq-uring = { workspace = true, features = ["_manual"] } + +[target.'cfg(target_os = "linux")'.dev-dependencies] # Which sockets the process still holds, so the embed tests can prove a stopped # relay closed its own without rebinding a port another test could take. socket2 = { workspace = true, features = ["all"] } diff --git a/rs/moq-relay/build.rs b/rs/moq-relay/build.rs index 1f10dfec778..82f61da9ac7 100644 --- a/rs/moq-relay/build.rs +++ b/rs/moq-relay/build.rs @@ -1,6 +1,6 @@ //! Sets `cfg(uring)` where the io_uring workers build: Linux on the architectures //! io-uring ships prebuilt kernel bindings for. Keep the list in step with the -//! `moq-uring` dependency's target in Cargo.toml. +//! `moq-uring` dependency targets in Cargo.toml. fn main() { println!("cargo::rustc-check-cfg=cfg(uring)"); let os = std::env::var("CARGO_CFG_TARGET_OS").unwrap_or_default(); diff --git a/rs/moq-relay/tests/integration/bitrate_caps.rs b/rs/moq-relay/tests/integration/bitrate_caps.rs index 3e0a5669311..abdfab0f4f2 100644 --- a/rs/moq-relay/tests/integration/bitrate_caps.rs +++ b/rs/moq-relay/tests/integration/bitrate_caps.rs @@ -35,7 +35,7 @@ fn grant(publish: Option, subscribe: Option) -> moq_auth::Grant { /// Where a relay's QUIC listener is, and the clients and sockets that reach it. enum Dial { /// Real sockets on loopback. - #[cfg(target_os = "linux")] + #[cfg(uring)] Real(u16), /// A simulated host serving at `addr`, trusting `fingerprints`. #[cfg(feature = "test-support")] @@ -51,7 +51,7 @@ impl Dial { fn client(&self, host: std::net::IpAddr) -> moq_tokio::Client { let _ = host; match self { - #[cfg(target_os = "linux")] + #[cfg(uring)] Dial::Real(_) => { let mut config = moq_tokio::connect::Config::default(); config.tls.insecure = Some(true); @@ -78,7 +78,7 @@ impl Dial { fn addr(&self) -> SocketAddr { match self { - #[cfg(target_os = "linux")] + #[cfg(uring)] Dial::Real(port) => ([127, 0, 0, 1], *port).into(), #[cfg(feature = "test-support")] Dial::Sim { addr, .. } => *addr, @@ -87,7 +87,7 @@ impl Dial { fn url(&self) -> url::Url { match self { - #[cfg(target_os = "linux")] + #[cfg(uring)] Dial::Real(port) => format!("https://localhost:{port}/room").parse().unwrap(), #[cfg(feature = "test-support")] Dial::Sim { addr, .. } => format!("moqt://{addr}/room").parse().unwrap(), @@ -98,7 +98,7 @@ impl Dial { fn endpoint(&self, host: std::net::IpAddr) -> driver::endpoint::Endpoint { let _ = host; let socket: driver::endpoint::Socket = match self { - #[cfg(target_os = "linux")] + #[cfg(uring)] Dial::Real(_) => std::net::UdpSocket::bind("127.0.0.1:0").unwrap().into(), #[cfg(feature = "test-support")] Dial::Sim { network, .. } => (Box::new(network.bind(SocketAddr::new(host, 4433))) @@ -326,7 +326,7 @@ mod sim { } } -#[cfg(target_os = "linux")] +#[cfg(uring)] mod uring { use std::net::{IpAddr, Ipv4Addr}; diff --git a/rs/moq-relay/tests/integration/embed.rs b/rs/moq-relay/tests/integration/embed.rs index 179f118a32a..7a00aa20805 100644 --- a/rs/moq-relay/tests/integration/embed.rs +++ b/rs/moq-relay/tests/integration/embed.rs @@ -421,7 +421,7 @@ async fn worker_tokio_custom_route_and_quic() { } /// io_uring workers. Skips below the 6.12 floor unless CI_STRICT. -#[cfg(target_os = "linux")] +#[cfg(uring)] #[tokio::test] async fn uring_custom_route_and_quic() { match moq_uring::Worker::new(Default::default()) { diff --git a/rs/moq-relay/tests/integration/handoff.rs b/rs/moq-relay/tests/integration/handoff.rs index f7e94575a97..ef07804ba4b 100644 --- a/rs/moq-relay/tests/integration/handoff.rs +++ b/rs/moq-relay/tests/integration/handoff.rs @@ -36,7 +36,7 @@ fn certificate(dir: &Path) -> (PathBuf, PathBuf) { #[derive(Clone, Copy, Debug)] enum Backend { Tokio, - #[cfg(target_os = "linux")] + #[cfg(uring)] Uring, } @@ -59,7 +59,7 @@ fn config(dir: &Path, cert: &Path, key: &Path, backend: Backend) -> Config { config.handoff.socket = Some(dir.join("handoff.sock")); match backend { Backend::Tokio => {} - #[cfg(target_os = "linux")] + #[cfg(uring)] Backend::Uring => config.runtime.io_uring = true, } config @@ -130,7 +130,7 @@ async fn a_new_relay_takes_over_while_the_old_one_drains() { takes_over(Backend::Tokio, Backend::Tokio).await; } -#[cfg(target_os = "linux")] +#[cfg(uring)] #[tokio::test] async fn an_io_uring_relay_takes_over() { if crate::runtime_uring::supported() { @@ -139,7 +139,7 @@ async fn an_io_uring_relay_takes_over() { } /// Both backends hand on the same group, with connection IDs in the same layout. -#[cfg(target_os = "linux")] +#[cfg(uring)] #[tokio::test] async fn a_relay_takes_over_across_backends() { if crate::runtime_uring::supported() { diff --git a/rs/moq-relay/tests/integration/main.rs b/rs/moq-relay/tests/integration/main.rs index f15f405076d..23ef97582d7 100644 --- a/rs/moq-relay/tests/integration/main.rs +++ b/rs/moq-relay/tests/integration/main.rs @@ -9,7 +9,7 @@ mod auth_lifetime; // Its listeners are the simulator (`test-support`) and the io_uring workers. -#[cfg(any(feature = "test-support", target_os = "linux"))] +#[cfg(any(feature = "test-support", uring))] mod bitrate_caps; mod cluster_close; #[cfg(feature = "test-support")] diff --git a/rs/moq-relay/tests/integration/peer_limits.rs b/rs/moq-relay/tests/integration/peer_limits.rs index efa016eaef5..43dc3168227 100644 --- a/rs/moq-relay/tests/integration/peer_limits.rs +++ b/rs/moq-relay/tests/integration/peer_limits.rs @@ -351,7 +351,7 @@ async fn tokio_worker_peer_session_widens_quic_limits() { peer_widens_and_viewer_does_not(relay, port).await; } -#[cfg(target_os = "linux")] +#[cfg(uring)] #[tokio::test] async fn uring_peer_session_widens_quic_limits() { let _ = rind_rustls::default_provider().unwrap().install_default(); diff --git a/rs/moq-relay/tests/integration/refusals.rs b/rs/moq-relay/tests/integration/refusals.rs index b72014ccc59..45b78aafd57 100644 --- a/rs/moq-relay/tests/integration/refusals.rs +++ b/rs/moq-relay/tests/integration/refusals.rs @@ -543,7 +543,7 @@ async fn tokio_refuses_uri_setup_paths() { uri_setup_paths(false).await; } -#[cfg(target_os = "linux")] +#[cfg(uring)] #[tokio::test] async fn uring_refuses_uri_setup_paths() { match moq_uring::Worker::new(Default::default()) { diff --git a/rs/moq-relay/tests/integration/runtime_uring.rs b/rs/moq-relay/tests/integration/runtime_uring.rs index c84e6aebe5f..260de87af40 100644 --- a/rs/moq-relay/tests/integration/runtime_uring.rs +++ b/rs/moq-relay/tests/integration/runtime_uring.rs @@ -5,7 +5,7 @@ //! //! Linux-only like the mode itself. Unsupported local kernels skip loudly; //! CI_STRICT makes CI refuse them. -#![cfg(target_os = "linux")] +#![cfg(uring)] use std::net::SocketAddr; use std::time::Duration; diff --git a/rs/moq-relay/tests/integration/tenant_matrix.rs b/rs/moq-relay/tests/integration/tenant_matrix.rs index b4595606971..6b5bc3722ea 100644 --- a/rs/moq-relay/tests/integration/tenant_matrix.rs +++ b/rs/moq-relay/tests/integration/tenant_matrix.rs @@ -513,7 +513,7 @@ async fn tokio_keeps_tenants_apart() { matrix(false).await; } -#[cfg(target_os = "linux")] +#[cfg(uring)] #[tokio::test] async fn uring_keeps_tenants_apart() { if !crate::runtime_uring::supported() { diff --git a/rs/moq-relay/tests/integration/wire_stats.rs b/rs/moq-relay/tests/integration/wire_stats.rs index 13beaf6a10d..d9028e230c3 100644 --- a/rs/moq-relay/tests/integration/wire_stats.rs +++ b/rs/moq-relay/tests/integration/wire_stats.rs @@ -138,7 +138,7 @@ async fn native_sessions_supply_direct_wire_counters() { wire_sources(false).await; } -#[cfg(target_os = "linux")] +#[cfg(uring)] #[tokio::test] async fn uring_sessions_supply_direct_wire_counters() { match moq_uring::Worker::new(Default::default()) {