mirror of
https://github.com/openai/codex.git
synced 2026-09-17 12:23:33 +00:00
Merge 93361c71c7 into sapling-pr-archive-bolinfest
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
#![allow(clippy::unwrap_used, clippy::expect_used)]
|
||||
use std::borrow::Cow;
|
||||
use std::path::PathBuf;
|
||||
use std::sync::Arc;
|
||||
use std::sync::Mutex;
|
||||
|
||||
use anyhow::Context;
|
||||
use anyhow::Result;
|
||||
use anyhow::ensure;
|
||||
use codex_exec_server::ExecResult;
|
||||
use exec_server_test_support::InteractiveClient;
|
||||
use exec_server_test_support::create_transport;
|
||||
@@ -17,6 +20,7 @@ use rmcp::model::CallToolResult;
|
||||
use rmcp::model::CreateElicitationRequestParam;
|
||||
use rmcp::model::object;
|
||||
use serde_json::json;
|
||||
use std::os::unix::fs::PermissionsExt;
|
||||
use std::os::unix::fs::symlink;
|
||||
use tempfile::TempDir;
|
||||
|
||||
@@ -70,11 +74,8 @@ prefix_rule(
|
||||
let linux_sandbox_exe_folder = TempDir::new()?;
|
||||
let codex_linux_sandbox_exe = if cfg!(target_os = "linux") {
|
||||
let codex_linux_sandbox_exe = linux_sandbox_exe_folder.path().join("codex-linux-sandbox");
|
||||
let codex_cli = assert_cmd::Command::cargo_bin("codex")?
|
||||
.get_program()
|
||||
.to_os_string();
|
||||
let codex_cli_path = std::path::PathBuf::from(codex_cli);
|
||||
symlink(&codex_cli_path, &codex_linux_sandbox_exe)?;
|
||||
let codex_cli = ensure_codex_cli()?;
|
||||
symlink(&codex_cli, &codex_linux_sandbox_exe)?;
|
||||
Some(codex_linux_sandbox_exe)
|
||||
} else {
|
||||
None
|
||||
@@ -131,3 +132,32 @@ prefix_rule(
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn ensure_codex_cli() -> Result<PathBuf> {
|
||||
let codex_cli = PathBuf::from(
|
||||
assert_cmd::Command::cargo_bin("codex")?
|
||||
.get_program()
|
||||
.to_os_string(),
|
||||
);
|
||||
|
||||
let metadata = codex_cli.metadata().with_context(|| {
|
||||
format!(
|
||||
"failed to read metadata for codex binary at {}",
|
||||
codex_cli.display()
|
||||
)
|
||||
})?;
|
||||
ensure!(
|
||||
metadata.is_file(),
|
||||
"expected codex binary at {} to be a file; run `cargo build -p codex-cli --bin codex` before this test",
|
||||
codex_cli.display()
|
||||
);
|
||||
|
||||
let mode = metadata.permissions().mode();
|
||||
ensure!(
|
||||
mode & 0o111 != 0,
|
||||
"codex binary at {} is not executable (mode {mode:o}); run `cargo build -p codex-cli --bin codex` before this test",
|
||||
codex_cli.display()
|
||||
);
|
||||
|
||||
Ok(codex_cli)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user