1# The client writes messages repeatedly to Sys::Syslog native method.
2# Restart 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 restarted.
8
9use strict;
10use warnings;
11
12our %args = (
13    client => {
14	func => sub {
15	    my $self = shift;
16	    write_message($self, "foobar");
17	    write_message($self, "foobar");
18	    write_message($self, "foobar");
19	    ${$self->{syslogd}}->loggrep(qr/ msg .* foobar/, 5, 3)
20		or die ref($self), " syslogd did not receive 3 foobar log";
21	    ${$self->{syslogd}}->kill_syslogd('HUP');
22	    ${$self->{syslogd}}->loggrep(qr/syslogd: restarted/, 8)
23		or die ref($self), " syslogd did not restart";
24	    write_log($self);
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	loggrep => {
40	    get_testgrep() => 1,
41	    qr/foobar/ => 1,
42	    qr/message repeated 2 times/ => 1,
43	},
44    },
45    file => {
46	loggrep => {
47	    get_testgrep() => 1,
48	    qr/foobar/ => 1,
49	    qr/message repeated 2 times/ => 1,
50	},
51    },
52    pipe => { nocheck => 1 },
53    tty => { nocheck => 1 },
54);
55
561;
57