Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"slice_class": "non_ranking",
"targeted_mechanism": "none",
"kind": "harness",
"fixtures": [
"harness-goldens"
],
"slices": [
"fix-ort-exit-test-windows-path"
],
"note": "Test-only: the CLI exit test keeps PATH (and SystemRoot on Windows) in the child's cleared environment so AFT can find git on Windows, and an early exit now prints aft's stderr. No product code changes."
}
14 changes: 12 additions & 2 deletions crates/aft/tests/integration/cli_ort_exit_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,14 @@ use std::time::{Duration, Instant};

use crate::test_helpers::aft_binary;

fn wait_for_file(path: &Path, child: &mut Child, what: &str) {
fn wait_for_file(path: &Path, child: &mut Child, lines: &mpsc::Receiver<String>, what: &str) {
let deadline = Instant::now() + Duration::from_secs(60);
while !path.exists() {
if let Some(status) = child.try_wait().unwrap() {
panic!("aft exited with {status} before {what}");
// Give the reader a moment to pass on the last lines aft wrote.
std::thread::sleep(Duration::from_millis(200));
let stderr: Vec<String> = lines.try_iter().collect();
panic!("aft exited with {status} before {what}; stderr: {stderr:#?}");
}
assert!(Instant::now() < deadline, "timed out waiting for {what}");
std::thread::sleep(Duration::from_millis(10));
Expand Down Expand Up @@ -46,6 +49,12 @@ fn warmup_exit_waits_for_a_fill_inside_model_creation() {
.arg(&root)
.args(["--only", "semantic", "--timeout", "2000"])
.env_clear()
// Keep the search path, and on Windows the system folder: AFT needs
// git to decide whether the root is a repository, and on Windows it
// cannot find git, or run it, without them. The meaning-search fill
// then never starts and the test never reaches the exit it checks.
.env("PATH", std::env::var_os("PATH").unwrap_or_default())
.envs(std::env::var_os("SystemRoot").map(|value| ("SystemRoot", value)))
.env("HOME", &home)
.env("USERPROFILE", &home)
.env("APPDATA", &home)
Expand Down Expand Up @@ -73,6 +82,7 @@ fn warmup_exit_waits_for_a_fill_inside_model_creation() {
wait_for_file(
&hold.join("entered"),
&mut child,
&lines_rx,
"the fill entered model creation",
);

Expand Down
Loading