-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: Add a function to exec snphost for tests
Signed-off-by: Tyler Fanelli <[email protected]>
- Loading branch information
1 parent
4998c05
commit fa1f675
Showing
1 changed file
with
21 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |