diff --git a/Cargo.lock b/Cargo.lock index 3659a264737..aca7f199bb5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2582,6 +2582,7 @@ dependencies = [ "fm", "iai", "iter-extended", + "lazy_static", "light-poseidon", "nargo", "nargo_fmt", diff --git a/Cargo.toml b/Cargo.toml index d819c37daeb..df5cc1f3e4b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -142,6 +142,7 @@ build-data = "0.1.3" bincode = "1.3.3" hex = "0.4.2" const_format = "0.2.30" +lazy_static = "1.4" num-bigint = "0.4" num-traits = "0.2" similar-asserts = "1.5.0" diff --git a/acvm-repo/bn254_blackbox_solver/Cargo.toml b/acvm-repo/bn254_blackbox_solver/Cargo.toml index 97f6b76a9a3..062131bb672 100644 --- a/acvm-repo/bn254_blackbox_solver/Cargo.toml +++ b/acvm-repo/bn254_blackbox_solver/Cargo.toml @@ -19,10 +19,10 @@ workspace = true acir.workspace = true acvm_blackbox_solver.workspace = true hex.workspace = true -lazy_static = "1.4" +lazy_static.workspace = true ark-bn254.workspace = true -grumpkin.workspace = true +grumpkin.workspace = true ark-ec.workspace = true ark-ff.workspace = true num-bigint.workspace = true diff --git a/tooling/nargo_cli/Cargo.toml b/tooling/nargo_cli/Cargo.toml index 4e45749ddaf..317706bb237 100644 --- a/tooling/nargo_cli/Cargo.toml +++ b/tooling/nargo_cli/Cargo.toml @@ -88,6 +88,7 @@ sha3.workspace = true iai = "0.1.1" test-binary = "3.0.2" test-case.workspace = true +lazy_static.workspace = true light-poseidon = "0.2.0" diff --git a/tooling/nargo_cli/build.rs b/tooling/nargo_cli/build.rs index 9c9e8d5b623..678b8aaad60 100644 --- a/tooling/nargo_cli/build.rs +++ b/tooling/nargo_cli/build.rs @@ -95,7 +95,12 @@ struct MatrixConfig { impl Default for MatrixConfig { fn default() -> Self { - Self { vary_brillig: false, vary_inliner: true } + Self { + // Only used with execution, and only on selected tests. + vary_brillig: false, + // Only seems to have an effect on the `execute_success` cases. + vary_inliner: false, + } } } @@ -111,16 +116,25 @@ fn generate_test_cases( test_content: &str, matrix_config: &MatrixConfig, ) { + let mutex_name = format! {"TEST_MUTEX_{}", test_name.to_uppercase()}; let brillig_cases = if matrix_config.vary_brillig { "[false, true]" } else { "[false]" }; let inliner_cases = if matrix_config.vary_inliner { "[i64::MIN, 0, i64::MAX]" } else { "[0]" }; write!( test_file, r#" +lazy_static::lazy_static! {{ + /// Prevent concurrent tests in the matrix from overwriting the compilation artifacts in {test_dir} + static ref {mutex_name}: std::sync::Mutex<()> = std::sync::Mutex::new(()); +}} + #[test_case::test_matrix( {brillig_cases}, {inliner_cases} )] fn test_{test_name}(force_brillig: bool, inliner_aggressiveness: i64) {{ + // Ignore poisoning errors if some of the matrix cases failed. + let _guard = {mutex_name}.lock().unwrap_or_else(|e| e.into_inner()); + let test_program_dir = PathBuf::from("{test_dir}"); let mut nargo = Command::cargo_bin("nargo").unwrap();