From 3927e70476f343a27fba4b69950e8a3049b9bbcd Mon Sep 17 00:00:00 2001 From: Vladislav Kuzmin <67874880+principalwater@users.noreply.github.com> Date: Tue, 24 Nov 2026 23:43:07 +0300 Subject: [PATCH] fix(run): scope JVM thread-dump test helpers to Unix (#5672) The thread-dump tests' helpers in ide-jvm-attach and ide-host use Unix-only APIs, so the Windows test build failed to compile on main. Gate the helpers and the tests that use them to Unix. Closes #5671 Co-authored-by: principalwater <67874880+principalwater@users.noreply.github.com> --- crates/ide-host/src/ops/thread_dump.rs | 1 + crates/ide-jvm-attach/src/listener.rs | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/ide-host/src/ops/thread_dump.rs b/crates/ide-host/src/ops/thread_dump.rs index 82cbbc9fd7..eec90236aa 100644 --- a/crates/ide-host/src/ops/thread_dump.rs +++ b/crates/ide-host/src/ops/thread_dump.rs @@ -68,6 +68,7 @@ mod tests { panic!("not reached") } + #[cfg(unix)] fn proc(pid: u32, ppid: u32, command: &str) -> ProcEntry { ProcEntry { pid, ppid, command: command.into() } } diff --git a/crates/ide-jvm-attach/src/listener.rs b/crates/ide-jvm-attach/src/listener.rs index e4acbe8718..9e6ba26022 100644 --- a/crates/ide-jvm-attach/src/listener.rs +++ b/crates/ide-jvm-attach/src/listener.rs @@ -3,7 +3,7 @@ use std::time::Duration; use crate::socket::AttachError; #[cfg(unix)] use crate::socket::{check_socket, has_listener, has_listener_at, socket_path, temp_dir}; -#[cfg(any(target_os = "linux", target_os = "macos", test))] +#[cfg(any(target_os = "linux", target_os = "macos", all(unix, test)))] use std::time::UNIX_EPOCH; #[cfg(unix)] use std::{ @@ -204,7 +204,7 @@ fn process_start(_pid: u32) -> Option { /// `/proc//stat` field 22 is the start in clock ticks since boot; `btime` in `/proc/stat` /// is the boot time in seconds since the epoch. -#[cfg(any(target_os = "linux", test))] +#[cfg(any(target_os = "linux", all(unix, test)))] fn start_from_proc(stat: &str, system: &str, ticks_per_sec: u64) -> Option { // The command name (field 2) may contain spaces and parentheses; the fields after it start at 3. let ticks: u64 = stat.rsplit_once(')')?.1.split_whitespace().nth(22 - 3)?.parse().ok()?;