Skip to content

Commit 5345989

Browse files
zulinx86roypat
authored andcommitted
test(tap): Check return value of writev()
We are experiencing intermittent failures of test_write_iovec() due to the rx packet not matching the ones written. To ensure the write has been completed successfully, check the return value of writev() matches the number of bytes that were supposed to be written. Signed-off-by: Takahiro Itazuri <[email protected]>
1 parent 68ed647 commit 5345989

File tree

1 file changed

+2
-1
lines changed
  • src/vmm/src/devices/virtio/net

1 file changed

+2
-1
lines changed

src/vmm/src/devices/virtio/net/tap.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,8 @@ pub mod tests {
306306
fragment3.as_slice(),
307307
]);
308308

309-
tap.write_iovec(&scattered).unwrap();
309+
let num_bytes = tap.write_iovec(&scattered).unwrap();
310+
assert_eq!(num_bytes, scattered.len() as usize);
310311

311312
let mut read_buf = vec![0u8; scattered.len() as usize];
312313
assert!(tap_traffic_simulator.pop_rx_packet(&mut read_buf));

0 commit comments

Comments
 (0)