summaryrefslogtreecommitdiff
path: root/regress/sys/kern/sosplice/udp
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2013-01-05 13:53:43 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2013-01-05 13:53:43 +0000
commit534487b30215d205c590a58e2668db8ca54ca242 (patch)
tree47c54ed2adc9803086a005f46d553c45d43e7609 /regress/sys/kern/sosplice/udp
parent0ebf97f9fb328ee7f28de68373e1e7fa0aa41b66 (diff)
Add more tests for UDP socket splicing and enhance existing tests.
Diffstat (limited to 'regress/sys/kern/sosplice/udp')
-rw-r--r--regress/sys/kern/sosplice/udp/args-idle-timeout.pl14
-rw-r--r--regress/sys/kern/sosplice/udp/args-idle-trickle.pl9
-rw-r--r--regress/sys/kern/sosplice/udp/args-inet6-client.pl2
-rw-r--r--regress/sys/kern/sosplice/udp/args-inet6-server.pl2
-rw-r--r--regress/sys/kern/sosplice/udp/args-inet6.pl2
-rw-r--r--regress/sys/kern/sosplice/udp/args-long.pl4
-rw-r--r--regress/sys/kern/sosplice/udp/args-max-multi.pl18
-rw-r--r--regress/sys/kern/sosplice/udp/args-max-nosplit.pl18
-rw-r--r--regress/sys/kern/sosplice/udp/args-max.pl5
-rw-r--r--regress/sys/kern/sosplice/udp/args-maxcopy-sleep-client.pl24
-rw-r--r--regress/sys/kern/sosplice/udp/args-multi.pl3
-rw-r--r--regress/sys/kern/sosplice/udp/args-nospace.pl10
-rw-r--r--regress/sys/kern/sosplice/udp/args-sleep-client.pl21
-rw-r--r--regress/sys/kern/sosplice/udp/args-sleep-relay.pl19
-rw-r--r--regress/sys/kern/sosplice/udp/args-write.pl26
-rw-r--r--regress/sys/kern/sosplice/udp/args-zero.pl13
-rw-r--r--regress/sys/kern/sosplice/udp/direct.pl3
-rw-r--r--regress/sys/kern/sosplice/udp/relay.pl5
-rw-r--r--regress/sys/kern/sosplice/udp/remote.pl5
19 files changed, 176 insertions, 27 deletions
diff --git a/regress/sys/kern/sosplice/udp/args-idle-timeout.pl b/regress/sys/kern/sosplice/udp/args-idle-timeout.pl
index 5e58a1225e4..cf4c3b74c73 100644
--- a/regress/sys/kern/sosplice/udp/args-idle-timeout.pl
+++ b/regress/sys/kern/sosplice/udp/args-idle-timeout.pl
@@ -1,16 +1,22 @@
-# test idle timeout
+# test idle timeout, must not be too long
use strict;
use warnings;
+my @lengths = (1, 2);
+
our %args = (
client => {
- func => sub { sleep 1; write_datagram(@_); sleep 3; },
+ func => sub { sleep 1; write_datagram(@_); },
+ lengths => \@lengths,
+ sleep => 3,
+ nocheck => 1,
},
relay => {
idle => 2,
timeout => 1,
},
- len => 251,
- md5 => "bc3a3f39af35fe5b1687903da2b00c7f",
+ len => 1,
+ lengths => "1",
+ md5 => "68b329da9893e34099c7d8ad5cb9c940",
);
diff --git a/regress/sys/kern/sosplice/udp/args-idle-trickle.pl b/regress/sys/kern/sosplice/udp/args-idle-trickle.pl
index 738c0278f09..c5aad047a69 100644
--- a/regress/sys/kern/sosplice/udp/args-idle-trickle.pl
+++ b/regress/sys/kern/sosplice/udp/args-idle-trickle.pl
@@ -1,10 +1,10 @@
-# test idle timeout
+# test idle timeout, must not be to short
use strict;
use warnings;
use List::Util qw(sum);
-my @lengths = (0, 1, 2, 3, 4, 5);
+my @lengths = (1, 2, 3);
our %args = (
client => {
@@ -15,10 +15,7 @@ our %args = (
idle => 2,
timeout => 1,
},
- server => {
- num => scalar @lengths,
- },
len => sum(@lengths),
lengths => "@lengths",
- md5 => "a5612eb5137e859bf52c515a890241a5",
+ md5 => "868972544a6c4312aa52568c8dfa2366",
);
diff --git a/regress/sys/kern/sosplice/udp/args-inet6-client.pl b/regress/sys/kern/sosplice/udp/args-inet6-client.pl
index 0a676835700..c3e22c23528 100644
--- a/regress/sys/kern/sosplice/udp/args-inet6-client.pl
+++ b/regress/sys/kern/sosplice/udp/args-inet6-client.pl
@@ -19,4 +19,6 @@ our %args = (
listendomain => AF_INET,
listenaddr => "127.0.0.1",
},
+ len => 251,
+ md5 => "bc3a3f39af35fe5b1687903da2b00c7f",
);
diff --git a/regress/sys/kern/sosplice/udp/args-inet6-server.pl b/regress/sys/kern/sosplice/udp/args-inet6-server.pl
index 66975ce563a..615e126700e 100644
--- a/regress/sys/kern/sosplice/udp/args-inet6-server.pl
+++ b/regress/sys/kern/sosplice/udp/args-inet6-server.pl
@@ -19,4 +19,6 @@ our %args = (
listendomain => AF_INET6,
listenaddr => "::1",
},
+ len => 251,
+ md5 => "bc3a3f39af35fe5b1687903da2b00c7f",
);
diff --git a/regress/sys/kern/sosplice/udp/args-inet6.pl b/regress/sys/kern/sosplice/udp/args-inet6.pl
index c84a85f61a4..4ac32c76e6d 100644
--- a/regress/sys/kern/sosplice/udp/args-inet6.pl
+++ b/regress/sys/kern/sosplice/udp/args-inet6.pl
@@ -19,4 +19,6 @@ our %args = (
listendomain => AF_INET6,
listenaddr => "::1",
},
+ len => 251,
+ md5 => "bc3a3f39af35fe5b1687903da2b00c7f",
);
diff --git a/regress/sys/kern/sosplice/udp/args-long.pl b/regress/sys/kern/sosplice/udp/args-long.pl
index 0323385faf9..529dc2b756b 100644
--- a/regress/sys/kern/sosplice/udp/args-long.pl
+++ b/regress/sys/kern/sosplice/udp/args-long.pl
@@ -9,13 +9,13 @@ our %args = (
sndbuf => 2**16,
},
relay => {
- timeout => 10,
+ idle => 6,
size => 2**16,
sndbuf => 2**16,
rcvbuf => 2**16,
},
server => {
- num => 1,
+ idle => 7,
rcvbuf => 2**16,
},
len => 65507,
diff --git a/regress/sys/kern/sosplice/udp/args-max-multi.pl b/regress/sys/kern/sosplice/udp/args-max-multi.pl
new file mode 100644
index 00000000000..a1ea7d14a3b
--- /dev/null
+++ b/regress/sys/kern/sosplice/udp/args-max-multi.pl
@@ -0,0 +1,18 @@
+# test maximum data length with maximum reached with multiple packets in rcvbuf
+
+use strict;
+use warnings;
+
+our %args = (
+ client => {
+ lengths => [ 1, 2, 3 ],
+ nocheck => 1,
+ },
+ relay => {
+ funcs => sub { sleep 3; relay(@_); },
+ max => 4,
+ },
+ len => 3,
+ lengths => "1 2",
+ md5 => "52f58714e430f1fc84346961c240054b",
+);
diff --git a/regress/sys/kern/sosplice/udp/args-max-nosplit.pl b/regress/sys/kern/sosplice/udp/args-max-nosplit.pl
new file mode 100644
index 00000000000..904f2a2ef60
--- /dev/null
+++ b/regress/sys/kern/sosplice/udp/args-max-nosplit.pl
@@ -0,0 +1,18 @@
+# test maximum data length
+
+use strict;
+use warnings;
+
+our %args = (
+ client => {
+ lengths => [ 1, 3, 1 ],
+ func => sub { errignore(@_); write_datagram(@_); },
+ nocheck => 1,
+ },
+ relay => {
+ max => 2,
+ },
+ len => 1,
+ lengths => "1",
+ md5 => "68b329da9893e34099c7d8ad5cb9c940",
+);
diff --git a/regress/sys/kern/sosplice/udp/args-max.pl b/regress/sys/kern/sosplice/udp/args-max.pl
index 8d8beac72de..641cf9bdbfe 100644
--- a/regress/sys/kern/sosplice/udp/args-max.pl
+++ b/regress/sys/kern/sosplice/udp/args-max.pl
@@ -12,10 +12,7 @@ our %args = (
relay => {
max => 4,
},
- server => {
- num => 2,
- },
len => 4,
lengths => "1 3",
- md5 => "07515c3ca1f21779d63135eb5531eca2",
+ md5 => "5df2ad5a8fa778004d06dc070811754c",
);
diff --git a/regress/sys/kern/sosplice/udp/args-maxcopy-sleep-client.pl b/regress/sys/kern/sosplice/udp/args-maxcopy-sleep-client.pl
new file mode 100644
index 00000000000..906019b996d
--- /dev/null
+++ b/regress/sys/kern/sosplice/udp/args-maxcopy-sleep-client.pl
@@ -0,0 +1,24 @@
+# test with multiple packets, client sleeps before and during send
+
+use strict;
+use warnings;
+use List::Util qw(sum);
+
+my @lengths = (5, 4, 3, 2, 1, 0);
+
+our %args = (
+ client => {
+ func => sub { sleep 3; write_datagram(@_); },
+ lengths => \@lengths,
+ },
+ relay => {
+ idle => 5,
+ func => sub { relay(@_); relay_copy(@_); },
+ max => 9,
+ timeout => 1,
+ nocheck => 1,
+ },
+ len => sum(@lengths),
+ lengths => "@lengths",
+ md5 => "464ddb107046ee0a42f43b202e826b8f",
+);
diff --git a/regress/sys/kern/sosplice/udp/args-multi.pl b/regress/sys/kern/sosplice/udp/args-multi.pl
index b61b812c6aa..df86b81396e 100644
--- a/regress/sys/kern/sosplice/udp/args-multi.pl
+++ b/regress/sys/kern/sosplice/udp/args-multi.pl
@@ -16,10 +16,9 @@ our %args = (
sndbuf => 20000,
},
server => {
- num => scalar @lengths,
rcvbuf => 20000,
},
len => sum(@lengths),
lengths => "@lengths",
- md5 => "f5b58b46c97b566fc8d34080c475d637",
+ md5 => "544464f20384567028998e1a1a4c5b1e",
);
diff --git a/regress/sys/kern/sosplice/udp/args-nospace.pl b/regress/sys/kern/sosplice/udp/args-nospace.pl
index 06d517eb191..d5541affcdd 100644
--- a/regress/sys/kern/sosplice/udp/args-nospace.pl
+++ b/regress/sys/kern/sosplice/udp/args-nospace.pl
@@ -10,14 +10,16 @@ our %args = (
nocheck => 1,
},
relay => {
+ func => sub { sleep 3; errignore(@_); relay(@_); },
+ down => "Message too long",
rcvbuf => 30000,
sndbuf => 10000,
+ nocheck => 1,
},
server => {
- num => 4,
rcvbuf => 30000,
},
- len => 10006,
- lengths => "1 10000 2 3",
- md5 => "90c347b1853f03d6e73aa88c9d12ce55",
+ len => 10003,
+ lengths => "1 10000 2",
+ md5 => "2ec9a4b45a449095245177d2cf51dd24",
);
diff --git a/regress/sys/kern/sosplice/udp/args-sleep-client.pl b/regress/sys/kern/sosplice/udp/args-sleep-client.pl
new file mode 100644
index 00000000000..e9d1cd8b55d
--- /dev/null
+++ b/regress/sys/kern/sosplice/udp/args-sleep-client.pl
@@ -0,0 +1,21 @@
+# test with multiple packets, client sleeps before and during send
+
+use strict;
+use warnings;
+use List::Util qw(sum);
+
+my @lengths = (0, 1, 2, 3, 4, 5);
+
+our %args = (
+ client => {
+ func => sub { sleep 3; write_datagram(@_); },
+ lengths => \@lengths,
+ sleep => 1,
+ },
+ relay => {
+ idle => 5,
+ },
+ len => sum(@lengths),
+ lengths => "@lengths",
+ md5 => "553af7b8fc0e205ead2562ab61a2ad13",
+);
diff --git a/regress/sys/kern/sosplice/udp/args-sleep-relay.pl b/regress/sys/kern/sosplice/udp/args-sleep-relay.pl
new file mode 100644
index 00000000000..da8d12941a2
--- /dev/null
+++ b/regress/sys/kern/sosplice/udp/args-sleep-relay.pl
@@ -0,0 +1,19 @@
+# test with multiple packets, relay sleeps before processing
+
+use strict;
+use warnings;
+use List::Util qw(sum);
+
+my @lengths = (0, 1, 2, 3, 4, 5);
+
+our %args = (
+ client => {
+ lengths => \@lengths,
+ },
+ relay => {
+ func => sub { sleep 3; relay(@_); },
+ },
+ len => sum(@lengths),
+ lengths => "@lengths",
+ md5 => "553af7b8fc0e205ead2562ab61a2ad13",
+);
diff --git a/regress/sys/kern/sosplice/udp/args-write.pl b/regress/sys/kern/sosplice/udp/args-write.pl
new file mode 100644
index 00000000000..bcfe01ae5aa
--- /dev/null
+++ b/regress/sys/kern/sosplice/udp/args-write.pl
@@ -0,0 +1,26 @@
+# test mix write and relay
+
+use strict;
+use warnings;
+use List::Util qw(sum);
+
+my @lengths = (1, 2, 3, 4, 5);
+
+our %args = (
+ client => {
+ lengths => [ 2, 3, 4 ],
+ nocheck => 1,
+ },
+ relay => {
+ func => sub {
+ write_stream(@_, 1);
+ IO::Handle::flush(\*STDOUT);
+ relay(@_);
+ write_stream(@_, 5);
+ },
+ nocheck => 1,
+ },
+ len => sum(@lengths),
+ lengths => "@lengths",
+ md5 => "1830da3b4358ccedeb49877c2cff8c86",
+);
diff --git a/regress/sys/kern/sosplice/udp/args-zero.pl b/regress/sys/kern/sosplice/udp/args-zero.pl
new file mode 100644
index 00000000000..13975f84cc9
--- /dev/null
+++ b/regress/sys/kern/sosplice/udp/args-zero.pl
@@ -0,0 +1,13 @@
+# test sending zero size udp packet
+
+use strict;
+use warnings;
+
+our %args = (
+ client => {
+ len => 0,
+ },
+ len => 0,
+ lengths => "0",
+ md5 => "d41d8cd98f00b204e9800998ecf8427e",
+);
diff --git a/regress/sys/kern/sosplice/udp/direct.pl b/regress/sys/kern/sosplice/udp/direct.pl
index b07bb64b9ad..f8838375638 100644
--- a/regress/sys/kern/sosplice/udp/direct.pl
+++ b/regress/sys/kern/sosplice/udp/direct.pl
@@ -1,5 +1,5 @@
#!/usr/bin/perl
-# $OpenBSD: direct.pl,v 1.1 2013/01/03 17:36:39 bluhm Exp $
+# $OpenBSD: direct.pl,v 1.2 2013/01/05 13:53:42 bluhm Exp $
# Copyright (c) 2010-2013 Alexander Bluhm <bluhm@openbsd.org>
#
@@ -39,6 +39,7 @@ if (@ARGV and -f $ARGV[-1]) {
@ARGV == 0 or usage();
my $s = Server->new(
+ idle => 4,
func => \&read_datagram,
%{$args{server}},
protocol => "udp",
diff --git a/regress/sys/kern/sosplice/udp/relay.pl b/regress/sys/kern/sosplice/udp/relay.pl
index 583cffc3085..0c1a9a1037c 100644
--- a/regress/sys/kern/sosplice/udp/relay.pl
+++ b/regress/sys/kern/sosplice/udp/relay.pl
@@ -1,5 +1,5 @@
#!/usr/bin/perl
-# $OpenBSD: relay.pl,v 1.1 2013/01/03 17:36:39 bluhm Exp $
+# $OpenBSD: relay.pl,v 1.2 2013/01/05 13:53:42 bluhm Exp $
# Copyright (c) 2010-2013 Alexander Bluhm <bluhm@openbsd.org>
#
@@ -39,6 +39,7 @@ if (@ARGV and -f $ARGV[-1]) {
@ARGV == 1 or usage();
my $s = Server->new(
+ idle => 4,
func => \&read_datagram,
listendomain => AF_INET,
listenaddr => "127.0.0.1",
@@ -47,7 +48,7 @@ my $s = Server->new(
);
my $r = Relay->new(
forward => $ARGV[0],
- idle => 5,
+ idle => 3,
func => \&relay,
listendomain => AF_INET,
listenaddr => "127.0.0.1",
diff --git a/regress/sys/kern/sosplice/udp/remote.pl b/regress/sys/kern/sosplice/udp/remote.pl
index cf07bdcbca0..4168797e9d2 100644
--- a/regress/sys/kern/sosplice/udp/remote.pl
+++ b/regress/sys/kern/sosplice/udp/remote.pl
@@ -1,5 +1,5 @@
#!/usr/bin/perl
-# $OpenBSD: remote.pl,v 1.1 2013/01/03 17:36:39 bluhm Exp $
+# $OpenBSD: remote.pl,v 1.2 2013/01/05 13:53:42 bluhm Exp $
# Copyright (c) 2010-2013 Alexander Bluhm <bluhm@openbsd.org>
#
@@ -61,7 +61,7 @@ if ($mode eq "relay") {
$r = Relay->new(
forward => $ARGV[0],
logfile => dirname($0)."/remote.log",
- idle => 5,
+ idle => 3,
func => \&relay,
%{$args{relay}},
protocol => "udp",
@@ -91,6 +91,7 @@ if ($mode eq "relay") {
}
my $s = Server->new(
+ idle => 4,
func => \&read_datagram,
%{$args{server}},
protocol => "udp",