Skip to content

Commit

Permalink
Update build.rs
Browse files Browse the repository at this point in the history
Update comment about why both file lock and mutex are needed.
  • Loading branch information
aakoshh authored Nov 13, 2024
1 parent dd8e8a5 commit 731d53b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions tooling/nargo_cli/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,11 @@ fn generate_test_cases(
}
let test_cases = test_cases.join("\n");

// Locking the Nargo.toml file in the test directory so that we can run tests exclusively.
// NB a Mutex is not enough on CI because we use `cargo nextest` which can run test cases
// in the group in different processes.
// For some reason the file lock alone doesn't seem to do the trick locally.
// We need to isolate test cases in the same group, otherwise they overwrite each other's artifacts.
// On CI we use `cargo nextest`, which runs tests in different processes; for this we use a file lock.

Check warning on line 172 in tooling/nargo_cli/build.rs

View workflow job for this annotation

GitHub Actions / Code

Unknown word (nextest)
// Locally we might be using `cargo test`, which run tests in the same process; in this case the file lock
// wouldn't work, becuase the process itself has the lock, and it looks like it can have N instances without

Check warning on line 174 in tooling/nargo_cli/build.rs

View workflow job for this annotation

GitHub Actions / Code

Unknown word (becuase)
// any problems; for this reason we also use a `Mutex`.
let mutex_name = format! {"TEST_MUTEX_{}", test_name.to_uppercase()};
write!(
test_file,
Expand Down

0 comments on commit 731d53b

Please sign in to comment.