linux/tools/testing/selftests/net/packetdrill/tcp_sendfile_sendfile-simple.pkt
Soham Chakradeo 5d4cadef52 selftests/net: packetdrill: import tcp/user_timeout, tcp/validate, tcp/sendfile, tcp/limited-transmit, tcp/syscall_bad_arg
Use the standard import and testing method, as described in the
import of tcp/ecn and tcp/close , tcp/sack , tcp/tcp_info.

Signed-off-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: Soham Chakradeo <sohamch@google.com>
Link: https://patch.msgid.link/20241217185203.297935-5-sohamch.kernel@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2024-12-18 10:05:48 -08:00

27 lines
872 B
Plaintext

// SPDX-License-Identifier: GPL-2.0
// Simplest possible test of open() and then sendfile().
// We write some zeroes into a file (since packetdrill expects payloads
// to be all zeroes) and then open() the file, then use sendfile()
// and verify that the correct number of zeroes goes out.
`./defaults.sh
/bin/rm -f /tmp/testfile
/bin/dd bs=1 count=5 if=/dev/zero of=/tmp/testfile status=none
`
// Initialize connection
0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
+0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
+0 bind(3, ..., ...) = 0
+0 listen(3, 1) = 0
+0 < S 0:0(0) win 32792 <mss 1000,sackOK,nop,nop,nop,wscale 10>
+0 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK,nop,wscale 8>
+0 < . 1:1(0) ack 1 win 514
+0 accept(3, ..., ...) = 4
+0 open("/tmp/testfile", O_RDONLY) = 5
+0 sendfile(4, 5, [0], 5) = 5
+0 > P. 1:6(5) ack 1