test: tighten Wine remote execution coverage

This commit is contained in:
Adam Perry
2026-06-23 03:16:58 +00:00
parent 32841a4fcf
commit 287084d43e
3 changed files with 14 additions and 6 deletions
@@ -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(())
}
+2 -2
View File
@@ -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(()),
};