From 72cf2f488e64481a8c5a026e02b16a39bef74401 Mon Sep 17 00:00:00 2001 From: l0ng-ai Date: Tue, 17 Nov 2026 06:23:51 +0800 Subject: [PATCH] test: fix the Windows ui_points and debugger stop tests, and a tight plugin budget (#3842) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - ui_points: a Windows checkout has CRLF line ends, so removing "width = 110\n" from the fixture did nothing and the missing-width case passed. The fixture text is normalized to LF first. - ide-dap: the fake adapter stops at a breakpoint after launch, and since Stop kills a suspended program's tree at once (#3658), the Windows stop test no longer saw the wait it checks. The adapter now continues right after that stop, so Stop meets a running program. - plugin_data_tools: database_calls_enforce_grants… ran its plugin commands under a 250 ms budget it does not test; a slow runner's first call timed out. It gets 10 s. --- crates/ide-dap/src/tests.rs | 15 +++++++++++++-- crates/ide-host/src/plugins/ui_points.rs | 3 ++- crates/ide-host/tests/plugin_data_tools.rs | 3 ++- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/crates/ide-dap/src/tests.rs b/crates/ide-dap/src/tests.rs index 6010b949d..646420a52 100644 --- a/crates/ide-dap/src/tests.rs +++ b/crates/ide-dap/src/tests.rs @@ -72,10 +72,21 @@ async fn windows_stop_releases_the_debuggees_port_before_returning() { .unwrap(); let pid = child.0.id(); child.1 = Some(ide_core::process::ProcessTree::capture(pid)); - let h = harness(Script { debuggee_pid: Some(pid), supports_terminate, ..Default::default() }); + // A running program: one suspended at a breakpoint is killed at once (#3658), without the + // wait for its tree this test is about. + let h = harness(Script { + debuggee_pid: Some(pid), + supports_terminate, + continued_after_stop: true, + ..Default::default() + }); let id = h.start(config()).await.unwrap(); let session = h.manager.session(id).unwrap(); - while session.debuggee_pid.load(Ordering::Acquire) != i64::from(pid) { + // The pid, then the stop at launch and the `continued` that ends it. + while session.debuggee_pid.load(Ordering::Acquire) != i64::from(pid) + || session.suspended.ticket() == 0 + || session.suspended.get() + { tokio::time::sleep(Duration::from_millis(10)).await; } let stop = tokio::spawn({ diff --git a/crates/ide-host/src/plugins/ui_points.rs b/crates/ide-host/src/plugins/ui_points.rs index 91de1d59b..c3b4e24b7 100644 --- a/crates/ide-host/src/plugins/ui_points.rs +++ b/crates/ide-host/src/plugins/ui_points.rs @@ -1243,7 +1243,8 @@ mod tests { #[test] fn editor_panels_validate_api_width_when_capability_and_page() { let root = Path::new(env!("CARGO_MANIFEST_DIR")).join("../ide-plugin/tests/fixtures/editor-panel"); - let source = std::fs::read_to_string(root.join("plugin.toml")).unwrap(); + // A Windows checkout may have CRLF line ends; the edits below match on `\n`. + let source = std::fs::read_to_string(root.join("plugin.toml")).unwrap().replace("\r\n", "\n"); let check = |source: &str| { let manifest = ide_extension::Manifest::parse(source)?; let decl = manifest.declarations(EDITOR_PANELS).into_iter().next().unwrap(); diff --git a/crates/ide-host/tests/plugin_data_tools.rs b/crates/ide-host/tests/plugin_data_tools.rs index 763bea890..a62bdc7e8 100644 --- a/crates/ide-host/tests/plugin_data_tools.rs +++ b/crates/ide-host/tests/plugin_data_tools.rs @@ -80,7 +80,8 @@ impl Harness { } #[tokio::test(flavor = "multi_thread")] async fn database_calls_enforce_grants_trust_ownership_and_uninstall_lifetime() { - let f = Harness::new(); + // Nothing here tests the command budget, and a slow runner's first calls can exceed 250 ms. + let f = Harness::with_timeout(Duration::from_secs(10)); assert!(f.run("sources", None).is_err()); f.host.set_project_trust(&f.root, true, false).await.unwrap(); let source = f.source();