Skip to content

Commit c7082b8

Browse files
committed
uefi-test-runner: snp test: use smoltcp
Properly deconstruct the response. This improves maintaining this test and to better understand what is going on.
1 parent 310a7d9 commit c7082b8

File tree

3 files changed

+52
-1
lines changed

3 files changed

+52
-1
lines changed

Cargo.lock

Lines changed: 45 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

uefi-test-runner/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ edition = "2024"
88
[dependencies]
99
uefi-raw = { path = "../uefi-raw" }
1010
uefi = { path = "../uefi", features = ["alloc", "global_allocator", "panic_handler", "logger", "qemu", "log-debugcon"] }
11+
smoltcp = { version = "0.12.0", default-features = false, features = ["medium-ethernet", "proto-ipv4", "socket-udp"] }
1112

1213
log.workspace = true
1314

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,12 @@ pub fn test() {
180180
debug!("Reply has {n} bytes");
181181

182182
// Check payload in UDP packet that was reversed by our EchoService.
183-
assert_eq!(buffer[42..47], [4, 4, 3, 2, 1]);
183+
{
184+
let recv_frame = smoltcp::wire::EthernetFrame::new_checked(&buffer).unwrap();
185+
let recv_ipv4 = smoltcp::wire::Ipv4Packet::new_checked(recv_frame.payload()).unwrap();
186+
let udp_packet = smoltcp::wire::UdpPacket::new_checked(recv_ipv4.payload()).unwrap();
187+
assert_eq!(udp_packet.payload(), &[4, 4, 3, 2, 1]);
188+
}
184189

185190
// Get stats
186191
let res = simple_network.collect_statistics();

0 commit comments

Comments
 (0)