Lightweight coding agent that runs in your terminal
Rust
fix: leverage codex_utils_cargo_bin() in codex-rs/core/tests/suite (#8887)
Michael Bolin1e29774fcedb
diff --git a/codex-rs/Cargo.lock b/codex-rs/Cargo.lockindex d027df83ad..bacb9405ce 100644--- a/codex-rs/Cargo.lock+++ b/codex-rs/Cargo.lock@@ -1302,7 +1302,6 @@ dependencies = ["dunce","encoding_rs","env-flags",- "escargot","eventsource-stream","futures","http 1.3.1",@@ -2810,17 +2809,6 @@ version = "3.3.2"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "dea2df4cf52843e0452895c455a1a2cfbb842a1e7329671acf418fdc53ed4c59"-[[package]]-name = "escargot"-version = "0.5.15"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "11c3aea32bc97b500c9ca6a72b768a26e558264303d101d3409cf6d57a9ed0cf"-dependencies = [- "log",- "serde",- "serde_json",-]-[[package]]name = "event-listener"version = "5.4.0"diff --git a/codex-rs/Cargo.toml b/codex-rs/Cargo.tomlindex feb498cb0b..8a996955e5 100644--- a/codex-rs/Cargo.toml+++ b/codex-rs/Cargo.toml@@ -135,7 +135,6 @@ dunce = "1.0.4"encoding_rs = "0.8.35"env-flags = "0.1.1"env_logger = "0.11.5"-escargot = "0.5"eventsource-stream = "0.2.3"futures = { version = "0.3", default-features = false }http = "1.3.1"diff --git a/codex-rs/core/Cargo.toml b/codex-rs/core/Cargo.tomlindex faa905f3e8..d3ee08c03b 100644--- a/codex-rs/core/Cargo.toml+++ b/codex-rs/core/Cargo.toml@@ -127,7 +127,6 @@ codex-otel = { workspace = true, features = ["disable-default-metrics-exporter"]codex-utils-cargo-bin = { workspace = true }core_test_support = { workspace = true }ctor = { workspace = true }-escargot = { workspace = true }image = { workspace = true, features = ["jpeg", "png"] }maplit = { workspace = true }predicates = { workspace = true }diff --git a/codex-rs/core/tests/common/lib.rs b/codex-rs/core/tests/common/lib.rsindex 7b593f63f0..5b80f80ba3 100644--- a/codex-rs/core/tests/common/lib.rs+++ b/codex-rs/core/tests/common/lib.rs@@ -1,5 +1,6 @@#![expect(clippy::expect_used)]+use codex_utils_cargo_bin::CargoBinError;use codex_utils_cargo_bin::find_resource;use tempfile::TempDir;@@ -245,6 +246,10 @@ pub fn format_with_current_shell_display_non_login(command: &str) -> String {.expect("serialize current shell command without login")}+pub fn stdio_server_bin() -> Result<String, CargoBinError> {+ codex_utils_cargo_bin::cargo_bin("test_stdio_server").map(|p| p.to_string_lossy().to_string())+}+pub mod fs_wait {use anyhow::Result;use anyhow::anyhow;diff --git a/codex-rs/core/tests/suite/rmcp_client.rs b/codex-rs/core/tests/suite/rmcp_client.rsindex 617b3b8a21..9274369967 100644--- a/codex-rs/core/tests/suite/rmcp_client.rs+++ b/codex-rs/core/tests/suite/rmcp_client.rs@@ -19,12 +19,13 @@ use codex_core::protocol::Op;use codex_core::protocol::SandboxPolicy;use codex_protocol::config_types::ReasoningSummary;use codex_protocol::user_input::UserInput;+use codex_utils_cargo_bin::cargo_bin;use core_test_support::responses;use core_test_support::responses::mount_sse_once;use core_test_support::skip_if_no_network;+use core_test_support::stdio_server_bin;use core_test_support::test_codex::test_codex;use core_test_support::wait_for_event;-use escargot::CargoBuild;use mcp_types::ContentBlock;use serde_json::Value;use serde_json::json;@@ -68,13 +69,7 @@ async fn stdio_server_round_trip() -> anyhow::Result<()> {.await;let expected_env_value = "propagated-env";- let rmcp_test_server_bin = CargoBuild::new()- .package("codex-rmcp-client")- .bin("test_stdio_server")- .run()?- .path()- .to_string_lossy()- .into_owned();+ let rmcp_test_server_bin = stdio_server_bin()?;let fixture = test_codex().with_config(move |config| {@@ -82,7 +77,7 @@ async fn stdio_server_round_trip() -> anyhow::Result<()> {server_name.to_string(),McpServerConfig {transport: McpServerTransportConfig::Stdio {- command: rmcp_test_server_bin.clone(),+ command: rmcp_test_server_bin,args: Vec::new(),env: Some(HashMap::from([("MCP_TEST_VALUE".to_string(),@@ -205,13 +200,7 @@ async fn stdio_image_responses_round_trip() -> anyhow::Result<()> {.await;// Build the stdio rmcp server and pass the image as data URL so it can construct ImageContent.- let rmcp_test_server_bin = CargoBuild::new()- .package("codex-rmcp-client")- .bin("test_stdio_server")- .run()?- .path()- .to_string_lossy()- .into_owned();+ let rmcp_test_server_bin = stdio_server_bin()?;let fixture = test_codex().with_config(move |config| {@@ -399,13 +388,7 @@ async fn stdio_image_completions_round_trip() -> anyhow::Result<()> {.mount(&server).await;- let rmcp_test_server_bin = CargoBuild::new()- .package("codex-rmcp-client")- .bin("test_stdio_server")- .run()?- .path()- .to_string_lossy()- .into_owned();+ let rmcp_test_server_bin = stdio_server_bin()?;let fixture = test_codex().with_config(move |config| {@@ -546,13 +529,7 @@ async fn stdio_server_propagates_whitelisted_env_vars() -> anyhow::Result<()> {let expected_env_value = "propagated-env-from-whitelist";let _guard = EnvVarGuard::set("MCP_TEST_VALUE", OsStr::new(expected_env_value));- let rmcp_test_server_bin = CargoBuild::new()- .package("codex-rmcp-client")- .bin("test_stdio_server")- .run()?- .path()- .to_string_lossy()- .into_owned();+ let rmcp_test_server_bin = stdio_server_bin()?;let fixture = test_codex().with_config(move |config| {@@ -680,13 +657,7 @@ async fn streamable_http_tool_call_round_trip() -> anyhow::Result<()> {.await;let expected_env_value = "propagated-env-http";- let rmcp_http_server_bin = CargoBuild::new()- .package("codex-rmcp-client")- .bin("test_streamable_http_server")- .run()?- .path()- .to_string_lossy()- .into_owned();+ let rmcp_http_server_bin = cargo_bin("test_streamable_http_server")?;let listener = TcpListener::bind("127.0.0.1:0")?;let port = listener.local_addr()?.port();@@ -848,13 +819,7 @@ async fn streamable_http_with_oauth_round_trip() -> anyhow::Result<()> {let expected_token = "initial-access-token";let client_id = "test-client-id";let refresh_token = "initial-refresh-token";- let rmcp_http_server_bin = CargoBuild::new()- .package("codex-rmcp-client")- .bin("test_streamable_http_server")- .run()?- .path()- .to_string_lossy()- .into_owned();+ let rmcp_http_server_bin = cargo_bin("test_streamable_http_server")?;let listener = TcpListener::bind("127.0.0.1:0")?;let port = listener.local_addr()?.port();diff --git a/codex-rs/core/tests/suite/truncation.rs b/codex-rs/core/tests/suite/truncation.rsindex 4b916e51b4..0176f8cde3 100644--- a/codex-rs/core/tests/suite/truncation.rs+++ b/codex-rs/core/tests/suite/truncation.rs@@ -22,9 +22,9 @@ use core_test_support::responses::mount_sse_sequence;use core_test_support::responses::sse;use core_test_support::responses::start_mock_server;use core_test_support::skip_if_no_network;+use core_test_support::stdio_server_bin;use core_test_support::test_codex::test_codex;use core_test_support::wait_for_event;-use escargot::CargoBuild;use serde_json::Value;use serde_json::json;use std::collections::HashMap;@@ -411,13 +411,7 @@ async fn mcp_tool_call_output_exceeds_limit_truncated_for_model() -> Result<()>.await;// Compile the rmcp stdio test server and configure it.- let rmcp_test_server_bin = CargoBuild::new()- .package("codex-rmcp-client")- .bin("test_stdio_server")- .run()?- .path()- .to_string_lossy()- .into_owned();+ let rmcp_test_server_bin = stdio_server_bin()?;let mut builder = test_codex().with_config(move |config| {config.mcp_servers.insert(@@ -497,13 +491,7 @@ async fn mcp_image_output_preserves_image_and_no_text_summary() -> Result<()> {.await;// Build the stdio rmcp server and pass a tiny PNG via data URL so it can construct ImageContent.- let rmcp_test_server_bin = CargoBuild::new()- .package("codex-rmcp-client")- .bin("test_stdio_server")- .run()?- .path()- .to_string_lossy()- .into_owned();+ let rmcp_test_server_bin = stdio_server_bin()?;// 1x1 PNG data URLlet openai_png = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMB/ee9bQAAAABJRU5ErkJggg==";@@ -762,13 +750,7 @@ async fn mcp_tool_call_output_not_truncated_with_custom_limit() -> Result<()> {).await;- let rmcp_test_server_bin = CargoBuild::new()- .package("codex-rmcp-client")- .bin("test_stdio_server")- .run()?- .path()- .to_string_lossy()- .into_owned();+ let rmcp_test_server_bin = stdio_server_bin()?;let mut builder = test_codex().with_config(move |config| {config.tool_output_token_limit = Some(50_000);