From 8adea5f86c09854543f6508a79201d50cc958cb7 Mon Sep 17 00:00:00 2001 From: Will Thomas <30wthomas@gmail.com> Date: Sun, 15 Feb 2026 13:39:33 -0600 Subject: [PATCH] Updating for rust-am-lib 0.3.0 compatibility --- Cargo.toml | 10 +++--- .../verus_compare/tests/integration.rs | 32 ++++++++++++++----- 2 files changed, 28 insertions(+), 14 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 64f7a8f..ab986aa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,12 +1,10 @@ [workspace] -members = [ - "executables/*" -] +members = ["executables/*"] resolver = "2" [workspace.dependencies] anyhow = "1.0.86" serde = { version = "1.0.214", features = ["derive"] } -serde_json = {version = "1.0.125", features = ["unbounded_depth"]} -rust_am_lib = { git = "https://github.com/ku-sldg/rust-am-lib.git", version = "0.2.0"} -#rust_am_lib = { git = "file:///Users/adampetz/Documents/Summer_2025/rust-am-lib/", version = "0.2.0", branch="env_demo"} \ No newline at end of file +serde_json = { version = "1.0.125", features = ["unbounded_depth"] } +rust_am_lib = { git = "https://github.com/ku-sldg/rust-am-lib.git", version = "0.3.0" } +#rust_am_lib = { git = "file:///Users/adampetz/Documents/Summer_2025/rust-am-lib/", version = "0.2.0", branch="env_demo"} diff --git a/executables/verus_compare/tests/integration.rs b/executables/verus_compare/tests/integration.rs index ceb2540..7cbf61e 100644 --- a/executables/verus_compare/tests/integration.rs +++ b/executables/verus_compare/tests/integration.rs @@ -1,14 +1,30 @@ -fn test_exec_and_output(test_name: &str, exec: &str, args: &str, expected_output: &str) { - // Capture the output of running [exec] with [args] as a single argument - let output = std::process::Command::new(exec) - .arg(args) - .output() - .expect("Failed to execute process"); +use std::io::Write; +use std::process::{Command, Stdio}; + +fn test_exec_and_output(test_name: &str, exec: &str, input_data: &str, expected_output: &str) { + let mut child = Command::new(exec) + .stdin(Stdio::piped()) + .stdout(Stdio::piped()) + .stderr(Stdio::piped()) + .spawn() + .expect("Failed to spawn process"); + + { + let mut stdin = child.stdin.take().expect("Failed to open stdin"); + stdin + .write_all(input_data.as_bytes()) + .expect("Failed to write to stdin"); + } + + let output = child.wait_with_output().expect("Failed to read stdout"); let stdout = String::from_utf8_lossy(&output.stdout); - // If we fail this, print the full output for debugging + assert!( stdout.contains(expected_output), - "Test {}: Output did not contain expected string\nOutput: ```\n{}\n```\nExpected to contain: \n```{}\n```\nFull output for debugging: \n{:?}", + "Test {}: Output did not contain expected string\n\ + --- Captured STDOUT ---\n{}\n\ + --- Expected to contain ---\n{}\n\ + --- Full Metadata ---\n{:?}", test_name, stdout, expected_output,