args-maxunix.pl revision 1.7
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 socket.
7# Check that no error is printed.
8
9use strict;
10use warnings;
11use Sys::Hostname;
12use IO::Socket::UNIX;
13use constant MAXUNIX => 21;
14
15(my $host = hostname()) =~ s/\..*//;
16
17our %args = (
18    client => {
19	func => sub {
20	    my $self = shift;
21	    write_unix($self, "/dev/log");
22	    foreach (1..(MAXUNIX-1)) {
23		write_unix($self, "unix-$_.sock", $_);
24	    }
25	    ${$self->{syslogd}}->loggrep(get_testgrep(), 5, MAXUNIX)
26		or die ref($self), " syslogd did not receive complete line";
27	    write_shutdown($self);
28	},
29    },
30    syslogd => {
31	options => [ map { ("-a" => "unix-$_.sock") } (1..(MAXUNIX-1)) ],
32	loggrep => {
33	    qr/out of descriptors/ => 0,
34	},
35    },
36    file => {
37	loggrep => {
38	    qr/ $host .* unix socket: /.get_testgrep() => MAXUNIX,
39	    "/dev/log unix socket" => 1,
40	    (map { " $_ unix socket: ".get_testgrep() => 1 } 1..MAXUNIX-1),
41	    MAXUNIX." unix socket: ".get_testgrep() => 0,
42	},
43    },
44);
45
461;
47