Skip to content

Commit 73c9379

Browse files
committed
test/snp: UNSUPPORTED for statistics is not a test failure
The edk2 virtio-net driver does not support statistics and returns UNSUPPORTED. This is correct behavior. Signed-off-by: Gerd Hoffmann <[email protected]>
1 parent a3bea58 commit 73c9379

File tree

1 file changed

+19
-9
lines changed
  • uefi-test-runner/src/proto/network

1 file changed

+19
-9
lines changed

uefi-test-runner/src/proto/network/snp.rs

+19-9
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ pub fn test() {
3434
.initialize(0, 0)
3535
.expect("Failed to initialize Simple Network");
3636

37-
simple_network.reset_statistics().unwrap();
37+
let res = simple_network.reset_statistics();
38+
assert!(res == Ok(()) || res == Err(Status::UNSUPPORTED.into()));
3839

3940
// Reading the interrupt status clears it
4041
simple_network.get_interrupt_status().unwrap();
@@ -111,13 +112,22 @@ pub fn test() {
111112
assert_eq!(buffer[42..47], [4, 4, 3, 2, 1]);
112113

113114
// Get stats
114-
let stats = simple_network
115-
.collect_statistics()
116-
.expect("Failed to collect statistics");
117-
info!("Stats: {:?}", stats);
118-
119-
// One frame should have been transmitted and one received
120-
assert_eq!(stats.tx_total_frames().unwrap(), 1);
121-
assert_eq!(stats.rx_total_frames().unwrap(), 1);
115+
let res = simple_network.collect_statistics();
116+
match res {
117+
Ok(stats) => {
118+
info!("Stats: {:?}", stats);
119+
120+
// One frame should have been transmitted and one received
121+
assert_eq!(stats.tx_total_frames().unwrap(), 1);
122+
assert_eq!(stats.rx_total_frames().unwrap(), 1);
123+
}
124+
Err(e) => {
125+
if e == Status::UNSUPPORTED.into() {
126+
info!("Stats: unsupported.");
127+
} else {
128+
panic!("{e}");
129+
}
130+
}
131+
}
122132
}
123133
}

0 commit comments

Comments
 (0)