diff options
author | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2013-01-17 17:58:29 +0000 |
---|---|---|
committer | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2013-01-17 17:58:29 +0000 |
commit | 7a9b87fd9b226a425a85bf97abd0b3c89485c138 (patch) | |
tree | 664ef764ab84d4d29335547d97dd845c4c8fd2ea | |
parent | 3bf673fa38486e1ccec7328845fb1c3e7f4193ec (diff) |
Improve socket splicing tests:
- One more UDP test.
- Enforce that kernel returns EFBIG where appropriate.
- Better comments in test files.
18 files changed, 83 insertions, 20 deletions
diff --git a/regress/sys/kern/sosplice/funcs.pl b/regress/sys/kern/sosplice/funcs.pl index 35f0be23e41..39cfd35e315 100644 --- a/regress/sys/kern/sosplice/funcs.pl +++ b/regress/sys/kern/sosplice/funcs.pl @@ -1,4 +1,4 @@ -# $OpenBSD: funcs.pl,v 1.4 2013/01/15 10:43:17 bluhm Exp $ +# $OpenBSD: funcs.pl,v 1.5 2013/01/17 17:58:28 bluhm Exp $ # Copyright (c) 2010-2013 Alexander Bluhm <bluhm@openbsd.org> # @@ -238,6 +238,7 @@ sub relay_copy_stream { } if ($max && $len == $max) { print STDERR "\n"; + print STDERR "Big\n"; print STDERR "Max\n"; last; } @@ -295,6 +296,7 @@ sub relay_copy_datagram { if ($max && $len == $max) { print STDERR "\n"; + print STDERR "Big\n"; print STDERR "Max\n"; last; } @@ -633,14 +635,22 @@ sub check_logs { sub check_relay { my ($c, $r, $s, %args) = @_; - $r->loggrep(qr/^Timeout$/) or die "no relay timeout" - if $r && $args{relay}{timeout}; - $r->loggrep(qr/^Big$/) or die "no relay big" - if $r && $args{relay}{big}; + return unless $r; + + if (defined $args{relay}{timeout}) { + my $lg = $r->loggrep(qr/^Timeout$/); + die "no relay timeout" if !$lg && $args{relay}{timeout}; + die "relay has timeout" if $lg && !$args{relay}{timeout}; + } + if (defined $args{relay}{big}) { + my $lg = $r->loggrep(qr/^Big$/); + die "no relay big" if !$lg && $args{relay}{big}; + die "relay has big" if $lg && !$args{relay}{big}; + } $r->loggrep(qr/^Max$/) or die "no relay max" - if $r && $args{relay}{max} && !$args{relay}{nomax}; + if $args{relay}{max} && !$args{relay}{nomax}; $r->loggrep(qr/^End$/) or die "no relay end" - if $r && $args{relay}{end}; + if $args{relay}{end}; } sub check_len { diff --git a/regress/sys/kern/sosplice/tcp/args-max-sleep-client-nonblock.pl b/regress/sys/kern/sosplice/tcp/args-max-sleep-client-nonblock.pl index b47e156d06a..6b189a16956 100644 --- a/regress/sys/kern/sosplice/tcp/args-max-sleep-client-nonblock.pl +++ b/regress/sys/kern/sosplice/tcp/args-max-sleep-client-nonblock.pl @@ -1,4 +1,6 @@ -# test maximum data length with delay before client write with non-blocking relay +# test maximum data length, +# client sleeps before writing, +# relay is non-blocking use strict; use warnings; @@ -10,6 +12,7 @@ our %args = ( }, relay => { max => 113, + big => 1, nonblocking => 1, }, len => 113, diff --git a/regress/sys/kern/sosplice/tcp/args-max-sleep-client-short.pl b/regress/sys/kern/sosplice/tcp/args-max-sleep-client-short.pl index a9dac043f23..cd05f11da48 100644 --- a/regress/sys/kern/sosplice/tcp/args-max-sleep-client-short.pl +++ b/regress/sys/kern/sosplice/tcp/args-max-sleep-client-short.pl @@ -1,4 +1,5 @@ -# test maximum data length with delay before client write +# test maximum data length with short data stream, +# client sleeps before writing use strict; use warnings; @@ -10,6 +11,7 @@ our %args = ( }, relay => { max => 113, + big => 1, }, len => 113, md5 => "dc099ef642faa02bce71298f11e7d44d", diff --git a/regress/sys/kern/sosplice/tcp/args-max-sleep-client.pl b/regress/sys/kern/sosplice/tcp/args-max-sleep-client.pl index bb5644c608a..3da921e6e73 100644 --- a/regress/sys/kern/sosplice/tcp/args-max-sleep-client.pl +++ b/regress/sys/kern/sosplice/tcp/args-max-sleep-client.pl @@ -1,4 +1,5 @@ -# test maximum data length with delay before client write +# test maximum data length, +# client sleeps before writing use strict; use warnings; @@ -11,6 +12,7 @@ our %args = ( }, relay => { max => 32117, + big => 1, }, len => 32117, md5 => "ee338e9693fb2a2ec101bb28935ed123", diff --git a/regress/sys/kern/sosplice/tcp/args-max-sleep-relay-short.pl b/regress/sys/kern/sosplice/tcp/args-max-sleep-relay-short.pl index 353aa12d7cd..5eea8b9d9ab 100644 --- a/regress/sys/kern/sosplice/tcp/args-max-sleep-relay-short.pl +++ b/regress/sys/kern/sosplice/tcp/args-max-sleep-relay-short.pl @@ -1,4 +1,5 @@ -# test maximum data length with delay before relay copy and short len +# test maximum data length with short data stream, +# relay sleeps before processing use strict; use warnings; @@ -10,6 +11,7 @@ our %args = ( relay => { func => sub { sleep 3; relay(@_); }, max => 113, + big => 1, }, len => 113, md5 => "dc099ef642faa02bce71298f11e7d44d", diff --git a/regress/sys/kern/sosplice/tcp/args-max-sleep-relay.pl b/regress/sys/kern/sosplice/tcp/args-max-sleep-relay.pl index 7363ef6fcf8..88d82ac5759 100644 --- a/regress/sys/kern/sosplice/tcp/args-max-sleep-relay.pl +++ b/regress/sys/kern/sosplice/tcp/args-max-sleep-relay.pl @@ -1,4 +1,5 @@ -# test maximum data length with delay before relay copy +# test maximum data length then close stdin, +# relay sleeps before processing use strict; use warnings; @@ -13,6 +14,7 @@ our %args = ( relay => { func => sub { sleep 3; relay(@_); shutin(@_); sleep 1; }, max => 32117, + big => 1, }, len => 32117, md5 => "ee338e9693fb2a2ec101bb28935ed123", diff --git a/regress/sys/kern/sosplice/tcp/args-max-sleep-server.pl b/regress/sys/kern/sosplice/tcp/args-max-sleep-server.pl index 91d2a7af8f7..e8ffe6225be 100644 --- a/regress/sys/kern/sosplice/tcp/args-max-sleep-server.pl +++ b/regress/sys/kern/sosplice/tcp/args-max-sleep-server.pl @@ -1,4 +1,5 @@ -# test maximum data length with delay before server read +# test maximum data length, +# server sleeps before reading use strict; use warnings; @@ -11,6 +12,7 @@ our %args = ( }, relay => { max => 32117, + big => 1, }, server => { func => sub { sleep 3; read_stream(@_); }, diff --git a/regress/sys/kern/sosplice/tcp/args-max-time.pl b/regress/sys/kern/sosplice/tcp/args-max-time.pl index abf22c9e53b..753673639b2 100644 --- a/regress/sys/kern/sosplice/tcp/args-max-time.pl +++ b/regress/sys/kern/sosplice/tcp/args-max-time.pl @@ -11,6 +11,7 @@ our %args = ( relay => { func => sub { relay(@_); sleep(5); }, max => 63, + big => 1, }, server => { func => sub { alarm(4); read_stream(@_); }, diff --git a/regress/sys/kern/sosplice/tcp/args-max.pl b/regress/sys/kern/sosplice/tcp/args-max.pl index 889927b7a88..640cd871e10 100644 --- a/regress/sys/kern/sosplice/tcp/args-max.pl +++ b/regress/sys/kern/sosplice/tcp/args-max.pl @@ -11,6 +11,7 @@ our %args = ( }, relay => { max => 32117, + big => 1, }, len => 32117, md5 => "ee338e9693fb2a2ec101bb28935ed123", diff --git a/regress/sys/kern/sosplice/tcp/args-maxcopy-sleep-client.pl b/regress/sys/kern/sosplice/tcp/args-maxcopy-sleep-client.pl index b39c6cfa04a..780cff70e4c 100644 --- a/regress/sys/kern/sosplice/tcp/args-maxcopy-sleep-client.pl +++ b/regress/sys/kern/sosplice/tcp/args-maxcopy-sleep-client.pl @@ -1,4 +1,5 @@ -# test relay maximum data length then copy with delay before client +# test maximum data length then copy stream, +# client sleeps before writing use strict; use warnings; @@ -10,6 +11,7 @@ our %args = ( relay => { func => sub { relay(@_); relay_copy(@_); }, max => 197, + big => 1, end => 1, nocheck => 1, }, diff --git a/regress/sys/kern/sosplice/tcp/args-maxcopy-sleep-relay.pl b/regress/sys/kern/sosplice/tcp/args-maxcopy-sleep-relay.pl index 7c0a35b3a53..fa371cb9e5f 100644 --- a/regress/sys/kern/sosplice/tcp/args-maxcopy-sleep-relay.pl +++ b/regress/sys/kern/sosplice/tcp/args-maxcopy-sleep-relay.pl @@ -1,4 +1,5 @@ -# test relay maximum data length then copy with delay before relay +# test maximum data length then copy stream, +# relay sleeps before processing use strict; use warnings; @@ -7,6 +8,7 @@ our %args = ( relay => { func => sub { sleep 3; relay(@_); relay_copy(@_); }, max => 197, + big => 1, end => 1, nocheck => 1, }, diff --git a/regress/sys/kern/sosplice/tcp/args-maxcopy-sleep-server.pl b/regress/sys/kern/sosplice/tcp/args-maxcopy-sleep-server.pl index c22659ea0cf..6ae4d5625fe 100644 --- a/regress/sys/kern/sosplice/tcp/args-maxcopy-sleep-server.pl +++ b/regress/sys/kern/sosplice/tcp/args-maxcopy-sleep-server.pl @@ -1,4 +1,5 @@ -# test relay maximum data length then copy with delay before server +# test maximum data length then copy stream, +# server sleeps before reading use strict; use warnings; @@ -7,6 +8,7 @@ our %args = ( relay => { func => sub { relay(@_); relay_copy(@_); }, max => 197, + big => 1, end => 1, nocheck => 1, }, diff --git a/regress/sys/kern/sosplice/tcp/args-null-max-sleep-client-nonblock.pl b/regress/sys/kern/sosplice/tcp/args-null-max-sleep-client-nonblock.pl index ad6436c2c62..05770168181 100644 --- a/regress/sys/kern/sosplice/tcp/args-null-max-sleep-client-nonblock.pl +++ b/regress/sys/kern/sosplice/tcp/args-null-max-sleep-client-nonblock.pl @@ -1,4 +1,6 @@ -# test maximum data length with delay before empty client write with non-blocking relay +# test maximum data length with empty client write, +# client sleeps before writing, +# relay is non-blocking use strict; use warnings; diff --git a/regress/sys/kern/sosplice/udp/args-max-multi.pl b/regress/sys/kern/sosplice/udp/args-max-multi.pl index a1ea7d14a3b..602bceec29a 100644 --- a/regress/sys/kern/sosplice/udp/args-max-multi.pl +++ b/regress/sys/kern/sosplice/udp/args-max-multi.pl @@ -1,4 +1,4 @@ -# test maximum data length with maximum reached with multiple packets in rcvbuf +# test maximum data length with maximum reached and multiple packets in rcvbuf use strict; use warnings; @@ -11,6 +11,7 @@ our %args = ( relay => { funcs => sub { sleep 3; relay(@_); }, max => 4, + big => 0, }, len => 3, lengths => "1 2", diff --git a/regress/sys/kern/sosplice/udp/args-max-nosplit.pl b/regress/sys/kern/sosplice/udp/args-max-nosplit.pl index 904f2a2ef60..7ddbbfb4595 100644 --- a/regress/sys/kern/sosplice/udp/args-max-nosplit.pl +++ b/regress/sys/kern/sosplice/udp/args-max-nosplit.pl @@ -1,4 +1,4 @@ -# test maximum data length +# test maximum data length, packet cannot be split at maximum use strict; use warnings; @@ -11,6 +11,7 @@ our %args = ( }, relay => { max => 2, + big => 0, }, len => 1, lengths => "1", diff --git a/regress/sys/kern/sosplice/udp/args-max.pl b/regress/sys/kern/sosplice/udp/args-max.pl index 641cf9bdbfe..cf4427ed6ce 100644 --- a/regress/sys/kern/sosplice/udp/args-max.pl +++ b/regress/sys/kern/sosplice/udp/args-max.pl @@ -11,6 +11,7 @@ our %args = ( }, relay => { max => 4, + big => 1, }, len => 4, lengths => "1 3", diff --git a/regress/sys/kern/sosplice/udp/args-maxcopy-sleep-client.pl b/regress/sys/kern/sosplice/udp/args-maxcopy-sleep-client.pl index 906019b996d..a46b4ff98ca 100644 --- a/regress/sys/kern/sosplice/udp/args-maxcopy-sleep-client.pl +++ b/regress/sys/kern/sosplice/udp/args-maxcopy-sleep-client.pl @@ -1,4 +1,5 @@ -# test with multiple packets, client sleeps before and during send +# test maximum data length then copy packets, +# client sleeps before and during writing use strict; use warnings; @@ -9,12 +10,14 @@ my @lengths = (5, 4, 3, 2, 1, 0); our %args = ( client => { func => sub { sleep 3; write_datagram(@_); }, + sleep => 1, lengths => \@lengths, }, relay => { idle => 5, func => sub { relay(@_); relay_copy(@_); }, max => 9, + big => 1, timeout => 1, nocheck => 1, }, diff --git a/regress/sys/kern/sosplice/udp/args-maxcopy-sleep-relay.pl b/regress/sys/kern/sosplice/udp/args-maxcopy-sleep-relay.pl new file mode 100644 index 00000000000..df8cce8c43e --- /dev/null +++ b/regress/sys/kern/sosplice/udp/args-maxcopy-sleep-relay.pl @@ -0,0 +1,24 @@ +# test maximum data length then copy packets, +# relay sleeps before processing + +use strict; +use warnings; +use List::Util qw(sum); + +my @lengths = (5, 4, 3, 2, 1, 0); + +our %args = ( + client => { + lengths => \@lengths, + }, + relay => { + func => sub { sleep 3; relay(@_); relay_copy(@_); }, + max => 9, + big => 1, + timeout => 1, + nocheck => 1, + }, + len => sum(@lengths), + lengths => "@lengths", + md5 => "464ddb107046ee0a42f43b202e826b8f", +); |