args-maxunix.pl revision 1.3
1# The client writes messages to MAXUNIX unix domain sockets.
2# The syslogd -a writes them into a file and through a pipe.
3# The syslogd -a passes them via UDP to the loghost.
4# The server receives the messages on its UDP socket.
5# Find the message in client, file, pipe, syslogd, server log.
6# Check that the file log contains a message from every sockets.
7# Check that the one socket above the limit prints an error.
8
9use strict;
10use warnings;
11use IO::Socket::UNIX;
12use constant MAXUNIX => 21;
13
14our %args = (
15    client => {
16	func => sub {
17	    my $self = shift;
18	    write_unix($self);
19	    foreach (1..(MAXUNIX-1)) {
20		write_unix($self, "unix-$_.sock");
21	    }
22	    write_shutdown($self, @_);
23	},
24    },
25    syslogd => {
26	options => [ map { ("-a" => "unix-$_.sock") } (1..MAXUNIX) ],
27	loggrep => {
28	    qr/syslogd: out of descriptors, ignoring unix-20.sock/ => 0,
29	    qr/syslogd: out of descriptors, ignoring unix-21.sock/ => 1,
30	    qr/syslogd: out of descriptors, ignoring unix-22.sock/ => 0,
31	},
32    },
33    file => {
34	loggrep => {
35	    get_testlog()." /dev/log unix socket" => 1,
36	    (map { (get_testlog()." unix-$_.sock unix socket" => 1) }
37		(1..(MAXUNIX-1))),
38	    get_testlog()." unix-".MAXUNIX.".sock unix socket" => 0,
39	},
40    },
41);
42
431;
44