1# The client writes messages repeatedly to Sys::Syslog native method.
2# Terminate syslogd with unwritten repeated messages.
3# The syslogd writes it into a file and through a pipe and to tty.
4# The syslogd passes it via UDP to the loghost.
5# The server receives the message on its UDP socket.
6# Find the message in client, file, syslogd, server log.
7# Check that message repeated was written out before syslogd exited.
8
9use strict;
10use warnings;
11
12our %args = (
13    client => {
14	func => sub {
15	    my $self = shift;
16	    write_message($self, get_testlog());
17	    write_message($self, "foobar");
18	    write_message($self, "foobar");
19	    write_message($self, "foobar");
20	    ${$self->{syslogd}}->loggrep(qr/ msg .* foobar/, 5, 3)
21		or die ref($self), " syslogd did not receive 3 foobar log";
22	    ${$self->{syslogd}}->kill_syslogd('TERM');
23	    ${$self->{syslogd}}->loggrep(qr/syslogd: exited/, 8)
24		or die ref($self), " syslogd did not exit";
25	},
26	loggrep => {
27	    get_testgrep() => 1,
28	    qr/foobar/ => 3,
29	},
30    },
31    syslogd => {
32	options => ["-Z"],
33	loggrep => {
34	    get_testgrep() => 1,
35	    qr/logline: .* msg .* foobar/ => 3,
36	},
37    },
38    server => {
39	down => "exiting on signal 15",
40	loggrep => {
41	    get_testgrep() => 1,
42	    qr/foobar/ => 1,
43	    qr/message repeated 2 times/ => 1,
44	},
45    },
46    file => {
47	loggrep => {
48	    get_testgrep() => 1,
49	    qr/foobar/ => 1,
50	    qr/message repeated 2 times/ => 1,
51	},
52    },
53    pipe => { nocheck => 1 },
54    tty => { nocheck => 1 },
55);
56
571;
58