summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2011-08-21 22:51:01 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2011-08-21 22:51:01 +0000
commit122de3fd3ac87a9458c3b8d654741de6ad078280 (patch)
treedf80d2119e12b4855b6d8969fc930070f44ab48d
parent15ac8cb898dca98a1874a2d98a344e50e8898a8f (diff)
Add one more regression test for socket splicing with idle timeout.
-rw-r--r--regress/sys/kern/splice/args-idle-timeout.pl (renamed from regress/sys/kern/splice/args-idle.pl)1
-rw-r--r--regress/sys/kern/splice/args-idle-trickle.pl18
-rwxr-xr-xregress/sys/kern/splice/echo.pl4
-rw-r--r--regress/sys/kern/splice/funcs.pl7
-rwxr-xr-xregress/sys/kern/splice/relay.pl4
-rwxr-xr-xregress/sys/kern/splice/remote.pl4
6 files changed, 31 insertions, 7 deletions
diff --git a/regress/sys/kern/splice/args-idle.pl b/regress/sys/kern/splice/args-idle-timeout.pl
index 7045249ce85..17f05a38f7b 100644
--- a/regress/sys/kern/splice/args-idle.pl
+++ b/regress/sys/kern/splice/args-idle-timeout.pl
@@ -9,6 +9,7 @@ our %args = (
},
relay => {
idle => 2,
+ timeout => 1,
},
len => 251,
md5 => "bc3a3f39af35fe5b1687903da2b00c7f",
diff --git a/regress/sys/kern/splice/args-idle-trickle.pl b/regress/sys/kern/splice/args-idle-trickle.pl
new file mode 100644
index 00000000000..d86c9e56175
--- /dev/null
+++ b/regress/sys/kern/splice/args-idle-trickle.pl
@@ -0,0 +1,18 @@
+# test non idle connection does not timeout by sending a byte every second
+
+use strict;
+use warnings;
+
+our %args = (
+ client => {
+ len => 6,
+ sleep => 1,
+ },
+ relay => {
+ idle => 2,
+ },
+ len => 6,
+ md5 => "857f2261690a2305dba03062e778a73b",
+);
+
+1;
diff --git a/regress/sys/kern/splice/echo.pl b/regress/sys/kern/splice/echo.pl
index 45c8cd7da86..f46cad6312c 100755
--- a/regress/sys/kern/splice/echo.pl
+++ b/regress/sys/kern/splice/echo.pl
@@ -1,5 +1,5 @@
#!/usr/bin/perl
-# $OpenBSD: echo.pl,v 1.4 2011/07/23 23:56:08 bluhm Exp $
+# $OpenBSD: echo.pl,v 1.5 2011/08/21 22:50:59 bluhm Exp $
# Copyright (c) 2010 Alexander Bluhm <bluhm@openbsd.org>
#
@@ -83,7 +83,7 @@ $s->{pid} = -1; # XXX hack
exit if $args{nocheck};
$r->loggrep(qr/^Timeout$/) or die "no relay timeout"
- if $args{relay}{idle};
+ if $args{relay}{timeout};
$r->loggrep(qr/^Max$/) or die "no relay max"
if $args{relay}{max} && $args{len};
diff --git a/regress/sys/kern/splice/funcs.pl b/regress/sys/kern/splice/funcs.pl
index d0342fd8f6f..88501e177ae 100644
--- a/regress/sys/kern/splice/funcs.pl
+++ b/regress/sys/kern/splice/funcs.pl
@@ -1,4 +1,4 @@
-# $OpenBSD: funcs.pl,v 1.6 2011/07/04 05:43:02 bluhm Exp $
+# $OpenBSD: funcs.pl,v 1.7 2011/08/21 22:50:59 bluhm Exp $
# Copyright (c) 2010,2011 Alexander Bluhm <bluhm@openbsd.org>
#
@@ -31,6 +31,7 @@ use BSD::Socket::Splice qw(setsplice getsplice geterror);
sub write_char {
my $self = shift;
my $len = shift // $self->{len} // 251;
+ my $sleep = $self->{sleep};
my $ctx = Digest::MD5->new();
my $char = '0';
@@ -45,6 +46,10 @@ sub write_char {
when(/\n/) { print STDERR "."; $char = '0' }
default { $char++ }
}
+ if ($self->{sleep}) {
+ IO::Handle::flush(\*STDOUT);
+ sleep $self->{sleep};
+ }
}
if ($len) {
$char = "\n";
diff --git a/regress/sys/kern/splice/relay.pl b/regress/sys/kern/splice/relay.pl
index cd2fe35f1fb..c7e82e4c067 100755
--- a/regress/sys/kern/splice/relay.pl
+++ b/regress/sys/kern/splice/relay.pl
@@ -1,5 +1,5 @@
#!/usr/bin/perl
-# $OpenBSD: relay.pl,v 1.4 2011/07/23 23:56:08 bluhm Exp $
+# $OpenBSD: relay.pl,v 1.5 2011/08/21 22:51:00 bluhm Exp $
# Copyright (c) 2010 Alexander Bluhm <bluhm@openbsd.org>
#
@@ -77,7 +77,7 @@ $s->down;
exit if $args{nocheck};
$r->loggrep(qr/^Timeout$/) or die "no relay timeout"
- if $args{relay}{idle};
+ if $args{relay}{timeout};
$r->loggrep(qr/^Max$/) or die "no relay max"
if $args{relay}{max} && $args{len};
diff --git a/regress/sys/kern/splice/remote.pl b/regress/sys/kern/splice/remote.pl
index 446774865d5..d3f3cc04d9c 100755
--- a/regress/sys/kern/splice/remote.pl
+++ b/regress/sys/kern/splice/remote.pl
@@ -1,5 +1,5 @@
#!/usr/bin/perl
-# $OpenBSD: remote.pl,v 1.4 2011/07/23 23:56:08 bluhm Exp $
+# $OpenBSD: remote.pl,v 1.5 2011/08/21 22:51:00 bluhm Exp $
# Copyright (c) 2010 Alexander Bluhm <bluhm@openbsd.org>
#
@@ -129,7 +129,7 @@ $s->down;
exit if $args{nocheck};
$r->loggrep(qr/^Timeout$/) or die "no relay timeout"
- if $args{relay}{idle};
+ if $args{relay}{timeout};
$r->loggrep(qr/^Max$/) or die "no relay max"
if $args{relay}{max} && $args{len};