Add basic opensc test

This commit is contained in:
Sosthène Guédon
2022-12-16 11:34:09 +01:00
parent a7d9b21ad1
commit 1704d55e05
4 changed files with 26 additions and 2 deletions
+2
View File
@@ -51,6 +51,8 @@ default = []
strict-pin = []
std = []
virtual = ["std", "vpicc","trussed/virt"]
pivy-tests = []
opensc-tests = []
log-all = []
log-none = []
+1 -1
View File
@@ -11,7 +11,7 @@ build-cortex-m4:
.PHONY: test
test:
cargo test --features virtual
cargo test --features virtual,pivy-tests,opensc-tests
.PHONY: check
check:
+22
View File
@@ -0,0 +1,22 @@
// Copyright (C) 2022 Nitrokey GmbH
// SPDX-License-Identifier: LGPL-3.0-only
#![cfg(all(feature = "virtual", feature = "opensc-tests"))]
mod card;
use card::with_vsc;
use expectrl::{spawn, Eof, Regex, WaitStatus};
#[test]
fn list() {
with_vsc(|| {
let mut p = spawn("piv-tool -n").unwrap();
p.check("Using reader with a card: Virtual PCD 00 00")
.unwrap();
p.check("Personal Identity Verification Card").unwrap();
p.check(Eof).unwrap();
assert_eq!(p.wait().unwrap(), WaitStatus::Exited(p.pid(), 0));
});
}
+1 -1
View File
@@ -1,7 +1,7 @@
// Copyright (C) 2022 Nitrokey GmbH
// SPDX-License-Identifier: LGPL-3.0-only
#![cfg(feature = "virtual")]
#![cfg(all(feature = "virtual", feature = "pivy-tests"))]
mod card;