diff --git a/changelog.d/11339-typed-array-rmw-test-env-race.md b/changelog.d/11339-typed-array-rmw-test-env-race.md new file mode 100644 index 0000000000..dfb6f9a782 --- /dev/null +++ b/changelog.d/11339-typed-array-rmw-test-env-race.md @@ -0,0 +1 @@ +**test(codegen): fix the `typed_array_rmw_8692` native-reps race.** `compile_artifact()` pointed the process-global `PERRY_NATIVE_REPS_DIR` at a temp dir it deletes on drop while holding `artifact_env_lock()`, and `compile_ir()` took no lock. A parallel compile could then write its native-reps record into a directory being removed, which flakily failed `e2e-scoped` with "failed to write native reps … No such file or directory". `compile_ir()` now takes the same lock. diff --git a/crates/perry-codegen/tests/typed_array_rmw_8692.rs b/crates/perry-codegen/tests/typed_array_rmw_8692.rs index 5d60bd9361..96cec89a13 100644 --- a/crates/perry-codegen/tests/typed_array_rmw_8692.rs +++ b/crates/perry-codegen/tests/typed_array_rmw_8692.rs @@ -111,6 +111,11 @@ fn rmw_module(name: &str, rhs: Expr) -> Module { } fn compile_ir(module: Module) -> String { + // Hold the same lock as `compile_artifact`: that helper points the + // process-global PERRY_NATIVE_REPS_DIR at a temp dir it deletes on drop, and + // an unlocked compile running meanwhile writes its native-reps record into + // that dir and fails with "failed to write native reps ... No such file". + let _lock = artifact_env_lock(); String::from_utf8( compile_module( &module,