mirror of
https://github.com/openai/codex.git
synced 2026-10-20 17:38:45 +00:00
test: tighten Wine remote execution coverage
This commit is contained in:
@@ -1035,6 +1035,12 @@ async fn command_exec_tty_supports_initial_size_and_resize() -> Result<()> {
|
||||
#[tokio::test]
|
||||
async fn command_exec_process_ids_are_connection_scoped_and_disconnect_terminates_process()
|
||||
-> Result<()> {
|
||||
// TODO(anp): Support raw WebSocket command/exec lifecycle tests in cross-OS configurations.
|
||||
skip_if_wine_exec!(
|
||||
Ok(()),
|
||||
"raw WebSocket setup runs command/exec in the local environment"
|
||||
);
|
||||
|
||||
let server = create_mock_responses_server_sequence_unchecked(Vec::new()).await;
|
||||
let codex_home = TempDir::new()?;
|
||||
create_config_toml(codex_home.path(), &server.uri(), "never")?;
|
||||
|
||||
@@ -24,18 +24,18 @@ async fn selected_execution_environment_runs_target_native_command() -> Result<(
|
||||
"cmd.exe".to_string(),
|
||||
"/d".to_string(),
|
||||
"/c".to_string(),
|
||||
format!("echo {EXPECTED_EXEC_OUTPUT}"),
|
||||
format!("echo {EXPECTED_EXEC_OUTPUT}& cd"),
|
||||
],
|
||||
TestEnvironment::Local if cfg!(windows) => vec![
|
||||
"cmd.exe".to_string(),
|
||||
"/d".to_string(),
|
||||
"/c".to_string(),
|
||||
format!("echo {EXPECTED_EXEC_OUTPUT}"),
|
||||
format!("echo {EXPECTED_EXEC_OUTPUT}& cd"),
|
||||
],
|
||||
TestEnvironment::Local | TestEnvironment::Docker { .. } => vec![
|
||||
shell.path,
|
||||
"-lc".to_string(),
|
||||
format!("printf '{EXPECTED_EXEC_OUTPUT}'"),
|
||||
format!("printf '{EXPECTED_EXEC_OUTPUT}\\n'; pwd"),
|
||||
],
|
||||
};
|
||||
let cwd = execution
|
||||
@@ -81,7 +81,9 @@ async fn selected_execution_environment_runs_target_native_command() -> Result<(
|
||||
}
|
||||
|
||||
let output = String::from_utf8(output)?;
|
||||
assert_eq!(output.trim_end_matches(['\r', '\n']), EXPECTED_EXEC_OUTPUT);
|
||||
let output = output.replace("\r\n", "\n");
|
||||
let expected_output = format!("{EXPECTED_EXEC_OUTPUT}\n{}", execution.environment_cwd());
|
||||
assert_eq!(output.trim_end(), expected_output);
|
||||
assert_eq!(exit_code, Some(0));
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -249,11 +249,11 @@ async fn explicit_remote_shell_runs_in_remote_cwd() -> Result<()> {
|
||||
let (shell, command) = match core_test_support::test_environment() {
|
||||
TestEnvironment::Docker { .. } => (
|
||||
"bash",
|
||||
r#"case "$PWD" in /tmp/codex-core-test-cwd-*) ;; *) echo "unexpected cwd: $PWD" >&2; exit 1 ;; esac"#,
|
||||
r#"case "$PWD" in /tmp/codex-test-cwd-*) ;; *) echo "unexpected cwd: $PWD" >&2; exit 1 ;; esac"#,
|
||||
),
|
||||
TestEnvironment::WineExec => (
|
||||
"powershell",
|
||||
r#"$cwd = (Get-Location).Path; if ($cwd -notlike 'C:\codex-core-test-cwd-*') { Write-Error "unexpected cwd: $cwd"; exit 1 }"#,
|
||||
r#"$cwd = (Get-Location).Path; if ($cwd -notlike 'C:\codex-test-cwd-*') { Write-Error "unexpected cwd: $cwd"; exit 1 }"#,
|
||||
),
|
||||
TestEnvironment::Local => return Ok(()),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user