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