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
14 changes: 14 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Windows MSVC: bump the main-thread stack from the default 1 MiB to 8 MiB.
#
# Rust debug builds produce very large async state machines (no optimisation
# collapses them), and `#[tokio::main]` polls the top-level future on the main
# thread. The compile path nests many async fns whose combined Future state
# easily exceeds 1 MiB, crashing with `thread 'main' has overflowed its stack`
# on a stock `cargo build` + `target\debug\ado-aw.exe compile <fixture>` run.
#
# 8 MiB matches the Linux default and is what the binary already gets on
# Linux/macOS, so applying it on Windows just restores parity rather than
# introducing a platform-specific quirk. Release builds work either way; this
# only matters in practice for debug/test builds.
[target.'cfg(all(windows, target_env = "msvc"))']
rustflags = ["-C", "link-arg=/STACK:8388608"]
19 changes: 17 additions & 2 deletions tests/compiler_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -851,11 +851,17 @@ fn test_1es_compiled_output_no_unreplaced_markers() {
));
fs::create_dir_all(&temp_dir).expect("Failed to create temp directory");

let fixture_path = PathBuf::from(env!("CARGO_MANIFEST_DIR"))
let fixture_src = PathBuf::from(env!("CARGO_MANIFEST_DIR"))
.join("tests")
.join("fixtures")
.join("1es-test-agent.md");

// Copy the fixture into the temp dir before compiling so codemods
// (e.g. pool_object_form) can never rewrite the source tree, and
// parallel test runs cannot race on the same input file.
let fixture_path = temp_dir.join("1es-test-agent.md");
fs::copy(&fixture_src, &fixture_path).expect("Failed to copy 1ES fixture into temp dir");

let output_path = temp_dir.join("1es-test-agent.yml");

// Run the compiler binary
Expand Down Expand Up @@ -3520,11 +3526,20 @@ fn compile_fixture_with_flags(fixture_name: &str, extra_flags: &[&str]) -> Strin
));
fs::create_dir_all(&temp_dir).expect("Failed to create temp directory");

let fixture_path = PathBuf::from(env!("CARGO_MANIFEST_DIR"))
let fixture_src = PathBuf::from(env!("CARGO_MANIFEST_DIR"))
.join("tests")
.join("fixtures")
.join(fixture_name);

// Copy the fixture into the temp dir before compiling. Codemods
// (e.g. pool_object_form) may rewrite the source on disk; copying
// keeps the canonical fixture under tests/fixtures pristine and
// prevents parallel tests that target the same fixture from
// racing on the lost-update guard in compile.
let fixture_path = temp_dir.join(fixture_name);
fs::copy(&fixture_src, &fixture_path)
.unwrap_or_else(|e| panic!("Failed to copy fixture {fixture_name} into temp dir: {e}"));

let output_path = temp_dir.join(fixture_name.replace(".md", ".yml"));

let binary_path = PathBuf::from(env!("CARGO_BIN_EXE_ado-aw"));
Expand Down
Loading