summaryrefslogtreecommitdiff
path: root/regress/sys/kern/splice/args-relay-write-forked.pl
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2011-03-12 18:58:55 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2011-03-12 18:58:55 +0000
commit30c1ecbeb90c0d739a2f8dd74d15e05b79aba36e (patch)
tree659e6830f5f0fffaf78f2fca9ae82d20ca92fceb /regress/sys/kern/splice/args-relay-write-forked.pl
parentaecea21552924c16781358d7983dc098272afbf9 (diff)
Add more regression tests for socket splicing. These find the
kernel bugs that have slipped through.
Diffstat (limited to 'regress/sys/kern/splice/args-relay-write-forked.pl')
-rw-r--r--regress/sys/kern/splice/args-relay-write-forked.pl38
1 files changed, 38 insertions, 0 deletions
diff --git a/regress/sys/kern/splice/args-relay-write-forked.pl b/regress/sys/kern/splice/args-relay-write-forked.pl
new file mode 100644
index 00000000000..3717e112d8b
--- /dev/null
+++ b/regress/sys/kern/splice/args-relay-write-forked.pl
@@ -0,0 +1,38 @@
+# test concurrent write and splice
+
+use strict;
+use warnings;
+use Time::HiRes 'sleep';
+
+our %args = (
+ client => {
+ len => 2**20,
+ },
+ relay => {
+ func => sub {
+ defined(my $pid = fork())
+ or die "relay func: fork failed: $!";
+ if ($pid) {
+ relay(@_);
+ kill 15, $pid;
+ return;
+ }
+ my $n;
+ do {
+ $n = syswrite(STDOUT, "\n foo bar\n");
+ sleep .1;
+ } while (defined($n));
+ POSIX::_exit(0);
+ },
+ },
+ server => {
+ func => sub { sleep 2; read_char(@_); },
+ },
+ # As syswrite() adds data to the socket, the content length is not
+ # correct. Disable the checks.
+ nocheck => 1,
+ len => 1048576,
+ md5 => '6649bbec13f3d7efaedf01c0cfa54f88',
+);
+
+1;