Skip to content

Commit

Permalink
tests: Add a function to exec snphost for tests
Browse files Browse the repository at this point in the history
Signed-off-by: Tyler Fanelli <[email protected]>
  • Loading branch information
tylerfanelli committed Jul 28, 2023
1 parent 4998c05 commit fa1f675
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/util/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// SPDX-License-Identifier: Apache-2.0

use std::process:Command;

pub const SNPHOST: &'static str = env!("CARGO_BIN_EXE_snphost");

pub fn run(arglist: &[&str]) -> String {
let output = Command::new(SNPHOST).args(arglist).output().unwrap();

let stdout = String::from_utf8(output.stdout).unwrap();
let stderr = String::from_utf8(output.stderr).unwrap();

if !output.status.success() {
panic!(
"\nsnphost command failed.\narglist={:?}\nstdout={}\nstderr={}\n",
arglist, stdout, stderr
);
}

stdout
}

0 comments on commit fa1f675

Please sign in to comment.