Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(ci): use mock backend for all tests #2670

Merged
merged 1 commit into from
Sep 13, 2023
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
8 changes: 1 addition & 7 deletions tooling/acvm_backend_barretenberg/src/cli/info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@
let backend_info: InfoResponse =
serde_json::from_slice(&output.stdout).expect("Backend should return valid json");
let language: Language = match backend_info.language.name.as_str() {
"PLONK-CSAT" => {

Check warning on line 44 in tooling/acvm_backend_barretenberg/src/cli/info.rs

View workflow job for this annotation

GitHub Actions / Spellcheck / Spellcheck

Unknown word (CSAT)
let width = backend_info.language.width.unwrap();
Language::PLONKCSat { width }
}
"R1CS" => Language::R1CS,
_ => panic!("Unknown langauge"),

Check warning on line 49 in tooling/acvm_backend_barretenberg/src/cli/info.rs

View workflow job for this annotation

GitHub Actions / Spellcheck / Spellcheck

Unknown word (langauge)
};

let opcodes_set: HashSet<String> = backend_info.opcodes_supported.into_iter().collect();
Expand All @@ -72,8 +72,7 @@

#[test]
fn info_command() -> Result<(), BackendError> {
use acvm::acir::circuit::black_box_functions::BlackBoxFunc;
use acvm::acir::circuit::opcodes::{BlackBoxFuncCall, Opcode};
use acvm::acir::circuit::opcodes::Opcode;

use acvm::acir::native_types::Expression;

Expand All @@ -85,10 +84,5 @@
assert!(matches!(language, Language::PLONKCSat { width: 3 }));
assert!(is_opcode_supported(&Opcode::Arithmetic(Expression::default())));

assert!(!is_opcode_supported(&Opcode::BlackBoxFuncCall(
#[allow(deprecated)]
BlackBoxFuncCall::dummy(BlackBoxFunc::Keccak256)
)));

Ok(())
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

const INFO_RESPONSE: &str = r#"{
"language": {
"name": "PLONK-CSAT",

Check warning on line 7 in tooling/acvm_backend_barretenberg/test-binaries/mock_backend/src/info_cmd.rs

View workflow job for this annotation

GitHub Actions / Spellcheck / Spellcheck

Unknown word (CSAT)
"width": 3
},
"opcodes_supported": ["arithmetic", "directive", "brillig", "memory_init", "memory_op"],
Expand All @@ -14,6 +14,7 @@
"range",
"sha256",
"blake2s",
"keccak256",
"schnorr_verify",
"pedersen",
"hash_to_field_128_security",
Expand Down
3 changes: 3 additions & 0 deletions tooling/nargo_cli/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ fn execution_success_{test_name}() {{
let test_program_dir = PathBuf::from("{test_dir}");

let mut cmd = Command::cargo_bin("nargo").unwrap();
cmd.env("NARGO_BACKEND_PATH", path_to_mock_backend());
cmd.arg("--program-dir").arg(test_program_dir);
cmd.arg("execute");

Expand Down Expand Up @@ -158,6 +159,7 @@ fn compile_success_contract_{test_name}() {{
let test_program_dir = PathBuf::from("{test_dir}");

let mut cmd = Command::cargo_bin("nargo").unwrap();
cmd.env("NARGO_BACKEND_PATH", path_to_mock_backend());
cmd.arg("--program-dir").arg(test_program_dir);
cmd.arg("compile");

Expand Down Expand Up @@ -195,6 +197,7 @@ fn compile_failure_{test_name}() {{
let test_program_dir = PathBuf::from("{test_dir}");

let mut cmd = Command::cargo_bin("nargo").unwrap();
cmd.env("NARGO_BACKEND_PATH", path_to_mock_backend());
cmd.arg("--program-dir").arg(test_program_dir);
cmd.arg("execute");

Expand Down