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: prevent debugger tests from speaking to a backend #4313

Merged
merged 3 commits into from
Feb 9, 2024
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
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion tooling/debugger/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,4 @@ serde_json.workspace = true
[dev-dependencies]
assert_cmd = "2.0.12"
rexpect = "0.5.0"
test-binary = "3.0.1"
tempfile.workspace = true
12 changes: 5 additions & 7 deletions tooling/debugger/tests/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,29 @@
// Some of these imports are consumed by the injected tests
use assert_cmd::cargo::cargo_bin;

use rexpect::spawn_bash;

Check warning on line 6 in tooling/debugger/tests/debug.rs

View workflow job for this annotation

GitHub Actions / Code

Unknown word (rexpect)

test_binary::build_test_binary_once!(mock_backend, "../backend_interface/test-binaries");

// include tests generated by `build.rs`
include!(concat!(env!("OUT_DIR"), "/debug.rs"));

pub fn debugger_execution_success(test_program_dir: &str) {
let nargo_bin =
cargo_bin("nargo").into_os_string().into_string().expect("Cannot parse nargo path");

let mock_backend_path =
path_to_mock_backend().into_string().expect("Cannot parse mock_backend path");

let mut dbg_session = spawn_bash(Some(10000)).expect("Could not start bash session");

// Set backend to `/dev/null` to force an error if nargo tries to speak to a backend.
dbg_session
.send_line(&format!("export NARGO_BACKEND_PATH={}", mock_backend_path))
.send_line("export NARGO_BACKEND_PATH=/dev/null")
.expect("Could not export NARGO_BACKEND_PATH.");
dbg_session.wait_for_prompt().expect("Could not export NARGO_BACKEND_PATH.");

// Start debugger and test that it loads for the given program.
dbg_session
.execute(
&format!("{} debug --program-dir {} --force-brillig", nargo_bin, test_program_dir),
&format!(
"{nargo_bin} debug --program-dir {test_program_dir} --force-brillig --expression-width 3"
),
".*\\Starting debugger.*",
)
.expect("Could not start debugger");
Expand Down
Loading