From 429177efa3142c354d94c96a57b1fcc99ff1edc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Ma=C4=87kowski?= Date: Sun, 21 Jun 2026 19:09:34 +0200 Subject: [PATCH] fix: guide code blocks tests under Miri Currently, the guide code blocks tests fail under Miri as they invoke the Rust compiler, which Miri doesn't support. We've missed this because passing the Miri tests are not required for merging PRs. This commit fixes this by ignoring Rust and Askama tests under Miri. --- cot-test/tests/doc_code_blocks.rs | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/cot-test/tests/doc_code_blocks.rs b/cot-test/tests/doc_code_blocks.rs index 7dea66ae..bef843c6 100644 --- a/cot-test/tests/doc_code_blocks.rs +++ b/cot-test/tests/doc_code_blocks.rs @@ -87,12 +87,21 @@ fn test_md(trials: &mut Vec, file_name: &str, file_contents: &str) { let line = node_data.sourcepos.start.line; let runner = *runner; let file_name = file_name.to_string(); - trials.push(Trial::test( - format!( - "{file_name}; line {line}; language {lang:?}; config {test_config:?}" - ), - move || runner(&literal), - )); + + // Rust and Askama tests invoke `cargo check`, which spawns a subprocess via + // `pidfd_spawnp` - an operation Miri doesn't support. + let needs_subprocess = + matches!(lang, TestLanguage::Rust | TestLanguage::AskamaTemplate); + + trials.push( + Trial::test( + format!( + "{file_name}; line {line}; language {lang:?}; config {test_config:?}" + ), + move || runner(&literal), + ) + .with_ignored_flag(cfg!(miri) && needs_subprocess), + ); } } }