• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 use std::process::Command;
2 
3 /// Gets the path of the `hwtrust` binary that works with `atest` and `Cargo`.
hwtrust_bin() -> &'static str4 fn hwtrust_bin() -> &'static str {
5     option_env!("CARGO_BIN_EXE_hwtrust").unwrap_or("./hwtrust")
6 }
7 
8 #[test]
exit_code_for_good_chain()9 fn exit_code_for_good_chain() {
10     let output = Command::new(hwtrust_bin())
11         .args(["verify-dice-chain", "testdata/dice/valid_ed25519.chain"])
12         .output()
13         .unwrap();
14     assert!(output.status.success());
15 }
16 
17 #[test]
exit_code_for_bad_chain()18 fn exit_code_for_bad_chain() {
19     let output = Command::new(hwtrust_bin())
20         .args(["verify-dice-chain", "testdata/dice/bad_p256.chain"])
21         .output()
22         .unwrap();
23     assert!(!output.status.success());
24 }
25