summaryrefslogtreecommitdiff
path: root/regress
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2015-02-06 00:27:42 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2015-02-06 00:27:42 +0000
commit728a143aa7c5e0c58982ee86af7a922c111c02d1 (patch)
tree5cfc55ab106902e22e94efb548f7ea6714af70d5 /regress
parent66e7abc11266b2021821d939da28a0eefa1d026c (diff)
Add syslogd tests for dropped messages.
Diffstat (limited to 'regress')
-rw-r--r--regress/usr.sbin/syslogd/args-dropped-sighup-tcp.pl79
-rw-r--r--regress/usr.sbin/syslogd/args-dropped-sighup-tls.pl79
-rw-r--r--regress/usr.sbin/syslogd/args-dropped-sigterm-tcp.pl75
-rw-r--r--regress/usr.sbin/syslogd/args-dropped-sigterm-tls.pl75
-rw-r--r--regress/usr.sbin/syslogd/args-dropped-tcp.pl65
-rw-r--r--regress/usr.sbin/syslogd/args-dropped-tls.pl65
-rw-r--r--regress/usr.sbin/syslogd/args-length-tcp.pl6
-rw-r--r--regress/usr.sbin/syslogd/args-length-tls.pl6
-rw-r--r--regress/usr.sbin/syslogd/args-length-udp.pl8
-rw-r--r--regress/usr.sbin/syslogd/args-length-unix.pl6
-rw-r--r--regress/usr.sbin/syslogd/args-length-vis.pl6
-rw-r--r--regress/usr.sbin/syslogd/args-maxunix.pl2
-rw-r--r--regress/usr.sbin/syslogd/args-server-tcp-close.pl2
-rw-r--r--regress/usr.sbin/syslogd/args-server-tcp-error.pl2
-rw-r--r--regress/usr.sbin/syslogd/args-server-tcp-reconnect.pl38
-rw-r--r--regress/usr.sbin/syslogd/args-server-tcp-sendback.pl2
-rw-r--r--regress/usr.sbin/syslogd/args-server-tls-close.pl2
-rw-r--r--regress/usr.sbin/syslogd/args-server-tls-error.pl2
-rw-r--r--regress/usr.sbin/syslogd/args-server-tls-reconnect.pl38
-rw-r--r--regress/usr.sbin/syslogd/args-server-tls-sendback.pl2
-rw-r--r--regress/usr.sbin/syslogd/args-server-tls-tcp.pl2
-rw-r--r--regress/usr.sbin/syslogd/args-sighup-config.pl34
-rw-r--r--regress/usr.sbin/syslogd/args-sighup-privsep.pl28
-rw-r--r--regress/usr.sbin/syslogd/args-sighup-tcp.pl40
-rw-r--r--regress/usr.sbin/syslogd/args-sighup-tls.pl40
-rw-r--r--regress/usr.sbin/syslogd/args-sighup.pl26
-rw-r--r--regress/usr.sbin/syslogd/args-sigpipe.pl22
-rw-r--r--regress/usr.sbin/syslogd/args-sigterm.pl28
-rw-r--r--regress/usr.sbin/syslogd/funcs.pl51
29 files changed, 622 insertions, 209 deletions
diff --git a/regress/usr.sbin/syslogd/args-dropped-sighup-tcp.pl b/regress/usr.sbin/syslogd/args-dropped-sighup-tcp.pl
new file mode 100644
index 00000000000..8a432eed763
--- /dev/null
+++ b/regress/usr.sbin/syslogd/args-dropped-sighup-tcp.pl
@@ -0,0 +1,79 @@
+# The client writes 300 messages to Sys::Syslog native method.
+# The syslogd writes it into a file and through a pipe.
+# The syslogd passes it via TCP to the loghost.
+# The server blocks the message on its TCP socket.
+# The server waits until the client as written all messages.
+# The server sends a SIGHUP to syslogd and reads messages from kernel.
+# The client waits until the server has read the first message.
+# Find the message in client, file, pipe, syslogd, server log.
+# Check that the 300 messages are in syslogd and file log.
+# Check that the dropped message is in server and file log.
+
+use strict;
+use warnings;
+use Socket;
+
+our %args = (
+ client => {
+ func => sub { write_between2logs(shift, sub {
+ my $self = shift;
+ write_message($self, get_secondlog());
+ foreach (1..300) {
+ write_char($self, [1024], $_);
+ # if client sends too fast, syslogd will not see everything
+ sleep .01;
+ }
+ write_message($self, get_thirdlog());
+ ${$self->{server}}->loggrep(get_secondlog(), 8)
+ or die ref($self), " server did not receive second log";
+ })},
+ },
+ syslogd => {
+ loghost => '@tcp://localhost:$connectport',
+ loggrep => {
+ get_between2loggrep(),
+ get_charlog() => 300,
+ },
+ },
+ server => {
+ listen => { domain => AF_UNSPEC, proto => "tcp", addr => "localhost" },
+ redo => 0,
+ func => sub { read_between2logs(shift, sub {
+ my $self = shift;
+ if ($self->{redo}) {
+ $self->{redo}--;
+ return;
+ }
+ ${$self->{client}}->loggrep(get_thirdlog(), 5)
+ or die ref($self), " client did not send third log";
+ ${$self->{syslogd}}->kill_syslogd('HUP');
+ ${$self->{syslogd}}->loggrep("syslogd: restarted", 5)
+ or die ref($self), " no 'syslogd: restarted' between logs";
+ # syslogd has shut down, read from kernel socket buffer
+ read_log($self);
+ $self->{redo}++;
+ })},
+ loggrep => {
+ get_between2loggrep(),
+ get_secondlog() => 1,
+ get_thirdlog() => 0,
+ qr/syslogd: start/ => 1,
+ qr/syslogd: restart/ => 1,
+ get_charlog() => 43,
+ qr/syslogd: dropped 259 messages to remote loghost/ => 1,
+ },
+ },
+ file => {
+ loggrep => {
+ get_between2loggrep(),
+ get_secondlog() => 1,
+ get_thirdlog() => 1,
+ qr/syslogd: start/ => 1,
+ qr/syslogd: restart/ => 1,
+ get_charlog() => 300,
+ qr/syslogd: dropped 259 messages to remote loghost/ => 1,
+ },
+ },
+);
+
+1;
diff --git a/regress/usr.sbin/syslogd/args-dropped-sighup-tls.pl b/regress/usr.sbin/syslogd/args-dropped-sighup-tls.pl
new file mode 100644
index 00000000000..cc0af507754
--- /dev/null
+++ b/regress/usr.sbin/syslogd/args-dropped-sighup-tls.pl
@@ -0,0 +1,79 @@
+# The client writes 300 messages to Sys::Syslog native method.
+# The syslogd writes it into a file and through a pipe.
+# The syslogd passes it via TLS to the loghost.
+# The server blocks the message on its TLS socket.
+# The server waits until the client as written all messages.
+# The server sends a SIGHUP to syslogd and reads messages from kernel.
+# The client waits until the server has read the first message.
+# Find the message in client, file, pipe, syslogd, server log.
+# Check that the 300 messages are in syslogd and file log.
+# Check that the dropped message is in server and file log.
+
+use strict;
+use warnings;
+use Socket;
+
+our %args = (
+ client => {
+ func => sub { write_between2logs(shift, sub {
+ my $self = shift;
+ write_message($self, get_secondlog());
+ foreach (1..300) {
+ write_char($self, [1024], $_);
+ # if client sends too fast, syslogd will not see everything
+ sleep .01;
+ }
+ write_message($self, get_thirdlog());
+ ${$self->{server}}->loggrep(get_secondlog(), 8)
+ or die ref($self), " server did not receive second log";
+ })},
+ },
+ syslogd => {
+ loghost => '@tls://localhost:$connectport',
+ loggrep => {
+ get_between2loggrep(),
+ get_charlog() => 300,
+ },
+ },
+ server => {
+ listen => { domain => AF_UNSPEC, proto => "tls", addr => "localhost" },
+ redo => 0,
+ func => sub { read_between2logs(shift, sub {
+ my $self = shift;
+ if ($self->{redo}) {
+ $self->{redo}--;
+ return;
+ }
+ ${$self->{client}}->loggrep(get_thirdlog(), 5)
+ or die ref($self), " client did not send third log";
+ ${$self->{syslogd}}->kill_syslogd('HUP');
+ ${$self->{syslogd}}->loggrep("syslogd: restarted", 5)
+ or die ref($self), " no 'syslogd: restarted' between logs";
+ # syslogd has shut down, read from kernel socket buffer
+ read_log($self);
+ $self->{redo}++;
+ })},
+ loggrep => {
+ get_between2loggrep(),
+ get_secondlog() => 1,
+ get_thirdlog() => 0,
+ qr/syslogd: start/ => 1,
+ qr/syslogd: restart/ => 1,
+ get_charlog() => 42,
+ qr/syslogd: dropped 260 messages to remote loghost/ => 1,
+ },
+ },
+ file => {
+ loggrep => {
+ get_between2loggrep(),
+ get_secondlog() => 1,
+ get_thirdlog() => 1,
+ qr/syslogd: start/ => 1,
+ qr/syslogd: restart/ => 1,
+ get_charlog() => 300,
+ qr/syslogd: dropped 260 messages to remote loghost/ => 1,
+ },
+ },
+);
+
+1;
diff --git a/regress/usr.sbin/syslogd/args-dropped-sigterm-tcp.pl b/regress/usr.sbin/syslogd/args-dropped-sigterm-tcp.pl
new file mode 100644
index 00000000000..82a1201ef71
--- /dev/null
+++ b/regress/usr.sbin/syslogd/args-dropped-sigterm-tcp.pl
@@ -0,0 +1,75 @@
+# The client writes 300 messages to Sys::Syslog native method.
+# The syslogd writes it into a file and through a pipe.
+# The syslogd passes it via TCP to the loghost.
+# The server blocks the message on its TCP socket.
+# The server waits until the client as written all messages.
+# The server sends a SIGTERM to syslogd and reads messages from kernel.
+# The client waits until the server has read the first message.
+# Find the message in client, file, pipe, syslogd log.
+# Check that the 300 messages are in syslogd and file log.
+# Check that the dropped message is in file log.
+
+use strict;
+use warnings;
+use Socket;
+
+our %args = (
+ client => {
+ func => sub { write_between2logs(shift, sub {
+ my $self = shift;
+ write_message($self, get_secondlog());
+ foreach (1..300) {
+ write_char($self, [1024], $_);
+ # if client sends too fast, syslogd will not see everything
+ sleep .01;
+ }
+ write_message($self, get_thirdlog());
+ ${$self->{server}}->loggrep(get_secondlog(), 8)
+ or die ref($self), " server did not receive second log";
+ })},
+ },
+ syslogd => {
+ loghost => '@tcp://localhost:$connectport',
+ loggrep => {
+ get_charlog() => 300,
+ },
+ },
+ server => {
+ listen => { domain => AF_UNSPEC, proto => "tcp", addr => "localhost" },
+ redo => 0,
+ func => sub {
+ my $self = shift;
+ ${$self->{client}}->loggrep(get_thirdlog(), 5)
+ or die ref($self), " client did not send third log";
+ ${$self->{syslogd}}->kill_syslogd('TERM');
+ ${$self->{syslogd}}->loggrep("syslogd: exiting", 5)
+ or die ref($self), " no 'syslogd: exiting' between logs";
+ # syslogd has shut down, read from kernel socket buffer
+ read_log($self);
+ },
+ loggrep => {
+ get_firstlog() => 1,
+ get_secondlog() => 1,
+ get_thirdlog() => 0,
+ get_testlog() => 0,
+ qr/syslogd: start/ => 1,
+ get_charlog() => 43,
+ },
+ },
+ pipe => {
+ loggrep => {},
+ },
+ file => {
+ loggrep => {
+ get_firstlog() => 1,
+ get_secondlog() => 1,
+ get_thirdlog() => 1,
+ get_testlog() => 0,
+ qr/syslogd: start/ => 1,
+ get_charlog() => 300,
+ qr/syslogd: dropped 259 messages to remote loghost/ => 1,
+ },
+ },
+);
+
+1;
diff --git a/regress/usr.sbin/syslogd/args-dropped-sigterm-tls.pl b/regress/usr.sbin/syslogd/args-dropped-sigterm-tls.pl
new file mode 100644
index 00000000000..f5b9b9961f4
--- /dev/null
+++ b/regress/usr.sbin/syslogd/args-dropped-sigterm-tls.pl
@@ -0,0 +1,75 @@
+# The client writes 300 messages to Sys::Syslog native method.
+# The syslogd writes it into a file and through a pipe.
+# The syslogd passes it via TLS to the loghost.
+# The server blocks the message on its TLS socket.
+# The server waits until the client as written all messages.
+# The server sends a SIGTERM to syslogd and reads messages from kernel.
+# The client waits until the server has read the first message.
+# Find the message in client, file, pipe, syslogd log.
+# Check that the 300 messages are in syslogd and file log.
+# Check that the dropped message is in file log.
+
+use strict;
+use warnings;
+use Socket;
+
+our %args = (
+ client => {
+ func => sub { write_between2logs(shift, sub {
+ my $self = shift;
+ write_message($self, get_secondlog());
+ foreach (1..300) {
+ write_char($self, [1024], $_);
+ # if client sends too fast, syslogd will not see everything
+ sleep .01;
+ }
+ write_message($self, get_thirdlog());
+ ${$self->{server}}->loggrep(get_secondlog(), 8)
+ or die ref($self), " server did not receive second log";
+ })},
+ },
+ syslogd => {
+ loghost => '@tls://localhost:$connectport',
+ loggrep => {
+ get_charlog() => 300,
+ },
+ },
+ server => {
+ listen => { domain => AF_UNSPEC, proto => "tls", addr => "localhost" },
+ redo => 0,
+ func => sub {
+ my $self = shift;
+ ${$self->{client}}->loggrep(get_thirdlog(), 5)
+ or die ref($self), " client did not send third log";
+ ${$self->{syslogd}}->kill_syslogd('TERM');
+ ${$self->{syslogd}}->loggrep("syslogd: exiting", 5)
+ or die ref($self), " no 'syslogd: exiting' between logs";
+ # syslogd has shut down, read from kernel socket buffer
+ read_log($self);
+ },
+ loggrep => {
+ get_firstlog() => 1,
+ get_secondlog() => 1,
+ get_thirdlog() => 0,
+ get_testlog() => 0,
+ qr/syslogd: start/ => 1,
+ get_charlog() => 42,
+ },
+ },
+ pipe => {
+ loggrep => {},
+ },
+ file => {
+ loggrep => {
+ get_firstlog() => 1,
+ get_secondlog() => 1,
+ get_thirdlog() => 1,
+ get_testlog() => 0,
+ qr/syslogd: start/ => 1,
+ get_charlog() => 300,
+ qr/syslogd: dropped 260 messages to remote loghost/ => 1,
+ },
+ },
+);
+
+1;
diff --git a/regress/usr.sbin/syslogd/args-dropped-tcp.pl b/regress/usr.sbin/syslogd/args-dropped-tcp.pl
new file mode 100644
index 00000000000..dcf69a9797b
--- /dev/null
+++ b/regress/usr.sbin/syslogd/args-dropped-tcp.pl
@@ -0,0 +1,65 @@
+# The client writes 300 messages to Sys::Syslog native method.
+# The syslogd writes it into a file and through a pipe.
+# The syslogd passes it via TCP to the loghost.
+# The server blocks the message on its TCP socket.
+# The server waits until the client has written all messages.
+# The server receives the message on its TCP socket.
+# The client waits until the server as read the first message.
+# Find the message in client, file, pipe, syslogd, server log.
+# Check that the 300 messages are in syslogd and file log.
+# Check that the dropped message is in server and file log.
+
+use strict;
+use warnings;
+use Socket;
+
+our %args = (
+ client => {
+ func => sub { write_between2logs(shift, sub {
+ my $self = shift;
+ write_message($self, get_secondlog());
+ foreach (1..300) {
+ write_char($self, [1024], $_);
+ # if client sends too fast, syslogd will not see everything
+ sleep .01;
+ }
+ write_message($self, get_thirdlog());
+ ${$self->{server}}->loggrep(get_secondlog(), 5)
+ or die ref($self), " server did not receive second log";
+ })},
+ },
+ syslogd => {
+ loghost => '@tcp://localhost:$connectport',
+ loggrep => {
+ get_between2loggrep(),
+ get_charlog() => 300,
+ },
+ },
+ server => {
+ listen => { domain => AF_UNSPEC, proto => "tcp", addr => "localhost" },
+ func => sub {
+ my $self = shift;
+ ${$self->{client}}->loggrep(get_thirdlog(), 5)
+ or die ref($self), " client did not send third log";
+ read_log($self);
+ },
+ loggrep => {
+ get_between2loggrep(),
+ get_secondlog() => 1,
+ get_thirdlog() => 0,
+ get_charlog() => 289,
+ qr/syslogd: dropped 12 messages to loghost "\@tcp:.*"/ => 1,
+ },
+ },
+ file => {
+ loggrep => {
+ get_between2loggrep(),
+ get_secondlog() => 1,
+ get_thirdlog() => 1,
+ get_charlog() => 300,
+ qr/syslogd: dropped 12 messages to loghost "\@tcp:.*"/ => 1,
+ },
+ },
+);
+
+1;
diff --git a/regress/usr.sbin/syslogd/args-dropped-tls.pl b/regress/usr.sbin/syslogd/args-dropped-tls.pl
new file mode 100644
index 00000000000..bc1cf36dd61
--- /dev/null
+++ b/regress/usr.sbin/syslogd/args-dropped-tls.pl
@@ -0,0 +1,65 @@
+# The client writes 300 messages to Sys::Syslog native method.
+# The syslogd writes it into a file and through a pipe.
+# The syslogd passes it via TLS to the loghost.
+# The server blocks the message on its TLS socket.
+# The server waits until the client has written all messages.
+# The server receives the message on its TLS socket.
+# The client waits until the server as read the first message.
+# Find the message in client, file, pipe, syslogd, server log.
+# Check that the 300 messages are in syslogd and file log.
+# Check that the dropped message is in server and file log.
+
+use strict;
+use warnings;
+use Socket;
+
+our %args = (
+ client => {
+ func => sub { write_between2logs(shift, sub {
+ my $self = shift;
+ write_message($self, get_secondlog());
+ foreach (1..300) {
+ write_char($self, [1024], $_);
+ # if client sends too fast, syslogd will not see everything
+ sleep .01;
+ }
+ write_message($self, get_thirdlog());
+ ${$self->{server}}->loggrep(get_secondlog(), 5)
+ or die ref($self), " server did not receive second log";
+ })},
+ },
+ syslogd => {
+ loghost => '@tls://localhost:$connectport',
+ loggrep => {
+ get_between2loggrep(),
+ get_charlog() => 300,
+ },
+ },
+ server => {
+ listen => { domain => AF_UNSPEC, proto => "tls", addr => "localhost" },
+ func => sub {
+ my $self = shift;
+ ${$self->{client}}->loggrep(get_thirdlog(), 5)
+ or die ref($self), " client did not send third log";
+ read_log($self);
+ },
+ loggrep => {
+ get_between2loggrep(),
+ get_secondlog() => 1,
+ get_thirdlog() => 0,
+ get_charlog() => 288,
+ qr/syslogd: dropped 13 messages to loghost "\@tls:.*"/ => 1,
+ },
+ },
+ file => {
+ loggrep => {
+ get_between2loggrep(),
+ get_secondlog() => 1,
+ get_thirdlog() => 1,
+ get_charlog() => 300,
+ qr/syslogd: dropped 13 messages to loghost "\@tls:.*"/ => 1,
+ },
+ },
+);
+
+1;
diff --git a/regress/usr.sbin/syslogd/args-length-tcp.pl b/regress/usr.sbin/syslogd/args-length-tcp.pl
index b935805678d..172aa7ab069 100644
--- a/regress/usr.sbin/syslogd/args-length-tcp.pl
+++ b/regress/usr.sbin/syslogd/args-length-tcp.pl
@@ -9,8 +9,6 @@ use strict;
use warnings;
use Socket;
-my $msg = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
-
our %args = (
client => {
connect => { domain => AF_UNSPEC, addr => "localhost", port => 514 },
@@ -21,14 +19,14 @@ our %args = (
loghost => '@tcp://localhost:$connectport',
options => ["-u"],
loggrep => {
- $msg => 5,
+ get_charlog() => 5,
}
},
server => {
listen => { domain => AF_UNSPEC, proto => "tcp", addr => "localhost" },
# >>> <13>Jan 31 00:10:11 0123456789ABC...567
loggrep => {
- $msg => 5,
+ get_charlog() => 5,
qr/^>>> .{19} .{8190}$/ => 1,
qr/^>>> .{19} .{8191}$/ => 1,
qr/^>>> .{19} .{8192}$/ => 3,
diff --git a/regress/usr.sbin/syslogd/args-length-tls.pl b/regress/usr.sbin/syslogd/args-length-tls.pl
index 04fd3ab19fc..e79d808c429 100644
--- a/regress/usr.sbin/syslogd/args-length-tls.pl
+++ b/regress/usr.sbin/syslogd/args-length-tls.pl
@@ -9,8 +9,6 @@ use strict;
use warnings;
use Socket;
-my $msg = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
-
our %args = (
client => {
connect => { domain => AF_UNSPEC, addr => "localhost", port => 514 },
@@ -21,14 +19,14 @@ our %args = (
loghost => '@tls://localhost:$connectport',
options => ["-u"],
loggrep => {
- $msg => 5,
+ get_charlog() => 5,
}
},
server => {
listen => { domain => AF_UNSPEC, proto => "tls", addr => "localhost" },
# >>> <13>Jan 31 00:10:11 0123456789ABC...567
loggrep => {
- $msg => 5,
+ get_charlog() => 5,
qr/^>>> .{19} .{8190}$/ => 1,
qr/^>>> .{19} .{8191}$/ => 1,
qr/^>>> .{19} .{8192}$/ => 3,
diff --git a/regress/usr.sbin/syslogd/args-length-udp.pl b/regress/usr.sbin/syslogd/args-length-udp.pl
index c50af7df5dc..ee5b8baad16 100644
--- a/regress/usr.sbin/syslogd/args-length-udp.pl
+++ b/regress/usr.sbin/syslogd/args-length-udp.pl
@@ -10,8 +10,6 @@ use strict;
use warnings;
use Socket;
-my $msg = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
-
our %args = (
client => {
connect => { domain => AF_UNSPEC, addr => "localhost", port => 514 },
@@ -21,20 +19,20 @@ our %args = (
syslogd => {
options => ["-u"],
loggrep => {
- $msg => 5,
+ get_charlog() => 5,
}
},
server => {
# >>> <13>Jan 31 00:10:11 0123456789ABC...lmn
loggrep => {
- $msg => 5,
+ get_charlog() => 5,
qr/^>>> .{1180}$/ => 5,
},
},
file => {
# Jan 31 00:12:39 localhost 0123456789ABC...567
loggrep => {
- $msg => 5,
+ get_charlog() => 5,
qr/^.{25} .{8190}$/ => 1,
qr/^.{25} .{8191}$/ => 1,
qr/^.{25} .{8192}$/ => 3,
diff --git a/regress/usr.sbin/syslogd/args-length-unix.pl b/regress/usr.sbin/syslogd/args-length-unix.pl
index 0933d6eff98..787157a30f3 100644
--- a/regress/usr.sbin/syslogd/args-length-unix.pl
+++ b/regress/usr.sbin/syslogd/args-length-unix.pl
@@ -9,8 +9,6 @@ use strict;
use warnings;
use Socket;
-my $msg = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
-
our %args = (
client => {
connect => { domain => AF_UNIX },
@@ -19,13 +17,13 @@ our %args = (
},
syslogd => {
loggrep => {
- $msg => 5,
+ get_charlog() => 5,
}
},
file => {
# Feb 2 00:43:36 hostname 0123456789ABC...567
loggrep => {
- $msg => 5,
+ get_charlog() => 5,
qr/^.{15} \S{1,256} .{8190}$/ => 1,
qr/^.{15} \S{1,256} .{8191}$/ => 1,
qr/^.{15} \S{1,256} .{8192}$/ => 3,
diff --git a/regress/usr.sbin/syslogd/args-length-vis.pl b/regress/usr.sbin/syslogd/args-length-vis.pl
index 158ecbce9e3..c11bb0b2e18 100644
--- a/regress/usr.sbin/syslogd/args-length-vis.pl
+++ b/regress/usr.sbin/syslogd/args-length-vis.pl
@@ -9,8 +9,6 @@ use strict;
use warnings;
use Socket;
-my $msg = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
-
our %args = (
client => {
connect => { domain => AF_UNSPEC, addr => "localhost", port => 514 },
@@ -21,13 +19,13 @@ our %args = (
syslogd => {
options => ["-u"],
loggrep => {
- $msg => 11,
+ get_charlog() => 11,
}
},
file => {
# Jan 31 00:12:39 localhost 0123456789ABC...567
loggrep => {
- $msg => 11,
+ get_charlog() => 11,
qr/^.{25} .{8182}foo\\M\^\@$/ => 1,
qr/^.{25} .{8183}foo\\M\^\@$/ => 1,
qr/^.{25} .{8184}foo\\M\^\@$/ => 1,
diff --git a/regress/usr.sbin/syslogd/args-maxunix.pl b/regress/usr.sbin/syslogd/args-maxunix.pl
index 98357ecc485..753d89b664f 100644
--- a/regress/usr.sbin/syslogd/args-maxunix.pl
+++ b/regress/usr.sbin/syslogd/args-maxunix.pl
@@ -19,7 +19,7 @@ our %args = (
foreach (1..(MAXUNIX-1)) {
write_unix($self, "unix-$_.sock");
}
- write_shutdown($self, @_);
+ write_shutdown($self);
},
},
syslogd => {
diff --git a/regress/usr.sbin/syslogd/args-server-tcp-close.pl b/regress/usr.sbin/syslogd/args-server-tcp-close.pl
index 55b9bd0274d..e02015742a5 100644
--- a/regress/usr.sbin/syslogd/args-server-tcp-close.pl
+++ b/regress/usr.sbin/syslogd/args-server-tcp-close.pl
@@ -16,7 +16,7 @@ our %args = (
my $self = shift;
${$self->{syslogd}}->loggrep("loghost .* connection close", 5)
or die "no connection close in syslogd.log";
- write_log($self, @_);
+ write_log($self);
},
},
syslogd => {
diff --git a/regress/usr.sbin/syslogd/args-server-tcp-error.pl b/regress/usr.sbin/syslogd/args-server-tcp-error.pl
index 955684ab960..ec6a3abf70c 100644
--- a/regress/usr.sbin/syslogd/args-server-tcp-error.pl
+++ b/regress/usr.sbin/syslogd/args-server-tcp-error.pl
@@ -20,7 +20,7 @@ our %args = (
my $self = shift;
${$self->{syslogd}}->loggrep("loghost .* connection error", 5)
or die "no connection error in syslogd.log";
- write_log($self, @_);
+ write_log($self);
},
},
syslogd => {
diff --git a/regress/usr.sbin/syslogd/args-server-tcp-reconnect.pl b/regress/usr.sbin/syslogd/args-server-tcp-reconnect.pl
index 343f10ed26a..7c9cd9a937d 100644
--- a/regress/usr.sbin/syslogd/args-server-tcp-reconnect.pl
+++ b/regress/usr.sbin/syslogd/args-server-tcp-reconnect.pl
@@ -12,13 +12,11 @@ use Socket;
our %args = (
client => {
- func => sub {
+ func => sub { write_between2logs(shift, sub {
my $self = shift;
- write_between2logs($self, sub {
- ${$self->{syslogd}}->loggrep("Connection refused", 5)
- or die "no connection refused in syslogd.log";
- });
- },
+ ${$self->{syslogd}}->loggrep("Connection refused", 5)
+ or die "no connection refused in syslogd.log";
+ })},
},
syslogd => {
loghost => '@tcp://127.0.0.1:$connectport',
@@ -31,22 +29,20 @@ our %args = (
server => {
listen => { domain => AF_INET, proto => "tcp", addr => "127.0.0.1" },
redo => 0,
- func => sub {
+ func => sub { read_between2logs(shift, sub {
my $self = shift;
- read_between2logs($self, sub {
- if ($self->{redo}) {
- $self->{redo}--;
- return;
- }
- $self->close();
- shutdown(\*STDOUT, 1)
- or die "shutdown write failed: $!";
- ${$self->{syslogd}}->loggrep("Connection refused", 5)
- or die "no connection refused in syslogd.log";
- $self->listen();
- $self->{redo}++;
- });
- },
+ if ($self->{redo}) {
+ $self->{redo}--;
+ return;
+ }
+ $self->close();
+ shutdown(\*STDOUT, 1)
+ or die "shutdown write failed: $!";
+ ${$self->{syslogd}}->loggrep("Connection refused", 5)
+ or die "no connection refused in syslogd.log";
+ $self->listen();
+ $self->{redo}++;
+ })},
loggrep => {
qr/Accepted/ => 2,
qr/syslogd: loghost .* connection close/ => 1,
diff --git a/regress/usr.sbin/syslogd/args-server-tcp-sendback.pl b/regress/usr.sbin/syslogd/args-server-tcp-sendback.pl
index d2637fe50fe..81cd09a4cb8 100644
--- a/regress/usr.sbin/syslogd/args-server-tcp-sendback.pl
+++ b/regress/usr.sbin/syslogd/args-server-tcp-sendback.pl
@@ -18,7 +18,7 @@ our %args = (
my $self = shift;
${$self->{syslogd}}->loggrep("loghost .* did send .* back", 5)
or die "no send back in syslogd.log";
- write_log($self, @_);
+ write_log($self);
},
},
syslogd => {
diff --git a/regress/usr.sbin/syslogd/args-server-tls-close.pl b/regress/usr.sbin/syslogd/args-server-tls-close.pl
index 75620034f1e..45330d0b7c2 100644
--- a/regress/usr.sbin/syslogd/args-server-tls-close.pl
+++ b/regress/usr.sbin/syslogd/args-server-tls-close.pl
@@ -16,7 +16,7 @@ our %args = (
my $self = shift;
${$self->{syslogd}}->loggrep("loghost .* connection error", 5)
or die "no connection error in syslogd.log";
- write_log($self, @_);
+ write_log($self);
},
},
syslogd => {
diff --git a/regress/usr.sbin/syslogd/args-server-tls-error.pl b/regress/usr.sbin/syslogd/args-server-tls-error.pl
index eab272a1202..987c53834b1 100644
--- a/regress/usr.sbin/syslogd/args-server-tls-error.pl
+++ b/regress/usr.sbin/syslogd/args-server-tls-error.pl
@@ -16,7 +16,7 @@ our %args = (
my $self = shift;
${$self->{syslogd}}->loggrep("loghost .* connection error", 5)
or die "no connection error in syslogd.log";
- write_log($self, @_);
+ write_log($self);
},
},
syslogd => {
diff --git a/regress/usr.sbin/syslogd/args-server-tls-reconnect.pl b/regress/usr.sbin/syslogd/args-server-tls-reconnect.pl
index 48d60ffdd4d..ec70366883b 100644
--- a/regress/usr.sbin/syslogd/args-server-tls-reconnect.pl
+++ b/regress/usr.sbin/syslogd/args-server-tls-reconnect.pl
@@ -12,13 +12,11 @@ use Socket;
our %args = (
client => {
- func => sub {
+ func => sub { write_between2logs(shift, sub {
my $self = shift;
- write_between2logs($self, sub {
- ${$self->{syslogd}}->loggrep("Connection refused", 5)
- or die "no connection refused in syslogd.log";
- });
- },
+ ${$self->{syslogd}}->loggrep("Connection refused", 5)
+ or die "no connection refused in syslogd.log";
+ })},
},
syslogd => {
loghost => '@tls://127.0.0.1:$connectport',
@@ -31,22 +29,20 @@ our %args = (
server => {
listen => { domain => AF_INET, proto => "tls", addr => "127.0.0.1" },
redo => 0,
- func => sub {
+ func => sub { read_between2logs(shift, sub {
my $self = shift;
- read_between2logs($self, sub {
- if ($self->{redo}) {
- $self->{redo}--;
- return;
- }
- $self->close();
- shutdown(\*STDOUT, 1)
- or die "shutdown write failed: $!";
- ${$self->{syslogd}}->loggrep("Connection refused", 5)
- or die "no connection refused in syslogd.log";
- $self->listen();
- $self->{redo}++;
- });
- },
+ if ($self->{redo}) {
+ $self->{redo}--;
+ return;
+ }
+ $self->close();
+ shutdown(\*STDOUT, 1)
+ or die "shutdown write failed: $!";
+ ${$self->{syslogd}}->loggrep("Connection refused", 5)
+ or die "no connection refused in syslogd.log";
+ $self->listen();
+ $self->{redo}++;
+ })},
loggrep => {
qr/Accepted/ => 2,
qr/syslogd: loghost .* connection error/ => 1,
diff --git a/regress/usr.sbin/syslogd/args-server-tls-sendback.pl b/regress/usr.sbin/syslogd/args-server-tls-sendback.pl
index bd7d33fd72c..58c1ff3d595 100644
--- a/regress/usr.sbin/syslogd/args-server-tls-sendback.pl
+++ b/regress/usr.sbin/syslogd/args-server-tls-sendback.pl
@@ -18,7 +18,7 @@ our %args = (
my $self = shift;
${$self->{syslogd}}->loggrep("loghost .* did send .* back", 5)
or die "no send back in syslogd.log";
- write_log($self, @_);
+ write_log($self);
},
},
syslogd => {
diff --git a/regress/usr.sbin/syslogd/args-server-tls-tcp.pl b/regress/usr.sbin/syslogd/args-server-tls-tcp.pl
index 386e35f1f43..f9cb714c203 100644
--- a/regress/usr.sbin/syslogd/args-server-tls-tcp.pl
+++ b/regress/usr.sbin/syslogd/args-server-tls-tcp.pl
@@ -16,7 +16,7 @@ our %args = (
my $self = shift;
${$self->{syslogd}}->loggrep("loghost .* connection error", 5)
or die "no connection error in syslogd.log";
- write_log($self, @_);
+ write_log($self);
},
},
syslogd => {
diff --git a/regress/usr.sbin/syslogd/args-sighup-config.pl b/regress/usr.sbin/syslogd/args-sighup-config.pl
index 6643878ac68..a6c64e3fb5f 100644
--- a/regress/usr.sbin/syslogd/args-sighup-config.pl
+++ b/regress/usr.sbin/syslogd/args-sighup-config.pl
@@ -10,13 +10,11 @@ use warnings;
our %args = (
client => {
- func => sub {
+ func => sub { write_between2logs(shift, sub {
my $self = shift;
- write_between2logs($self, sub {
- ${$self->{server}}->loggrep("Signal", 8)
- or die ref($self), " no 'Signal' between logs";
- });
- },
+ ${$self->{server}}->loggrep("Signal", 8)
+ or die ref($self), " no 'Signal' between logs";
+ })},
loggrep => { get_between2loggrep() },
},
syslogd => {
@@ -33,20 +31,18 @@ our %args = (
},
},
server => {
- func => sub {
+ func => sub { read_between2logs(shift, sub {
my $self = shift;
- read_between2logs($self, sub {
- my $conffile = ${$self->{syslogd}}->{conffile};
- open(my $fh, '>>', $conffile)
- or die ref($self), " append conf file $conffile failed: $!";
- print $fh "# modified\n";
- close($fh);
- ${$self->{syslogd}}->kill_syslogd('HUP');
- ${$self->{syslogd}}->loggrep("syslogd: started", 5, 2)
- or die ref($self), " no 'syslogd: started' between logs";
- print STDERR "Signal\n";
- });
- },
+ my $conffile = ${$self->{syslogd}}->{conffile};
+ open(my $fh, '>>', $conffile)
+ or die ref($self), " append conf file $conffile failed: $!";
+ print $fh "# modified\n";
+ close($fh);
+ ${$self->{syslogd}}->kill_syslogd('HUP');
+ ${$self->{syslogd}}->loggrep("syslogd: started", 5, 2)
+ or die ref($self), " no 'syslogd: started' between logs";
+ print STDERR "Signal\n";
+ })},
loggrep => { get_between2loggrep() },
},
);
diff --git a/regress/usr.sbin/syslogd/args-sighup-privsep.pl b/regress/usr.sbin/syslogd/args-sighup-privsep.pl
index e28b529ccff..7df36f043de 100644
--- a/regress/usr.sbin/syslogd/args-sighup-privsep.pl
+++ b/regress/usr.sbin/syslogd/args-sighup-privsep.pl
@@ -10,13 +10,11 @@ use warnings;
our %args = (
client => {
- func => sub {
+ func => sub { write_between2logs(shift, sub {
my $self = shift;
- write_between2logs($self, sub {
- ${$self->{server}}->loggrep("Signal", 8)
- or die ref($self), " no 'Signal' between logs";
- });
- },
+ ${$self->{server}}->loggrep("Signal", 8)
+ or die ref($self), " no 'Signal' between logs";
+ })},
loggrep => { get_between2loggrep() },
},
syslogd => {
@@ -31,17 +29,15 @@ our %args = (
},
},
server => {
- func => sub {
+ func => sub { read_between2logs(shift, sub {
my $self = shift;
- read_between2logs($self, sub {
- ${$self->{syslogd}}->rotate();
- ${$self->{syslogd}}->rotate();
- ${$self->{syslogd}}->kill_privsep('HUP');
- ${$self->{syslogd}}->loggrep("syslogd: restarted", 5)
- or die ref($self), " no 'syslogd: restarted' between logs";
- print STDERR "Signal\n";
- });
- },
+ ${$self->{syslogd}}->rotate();
+ ${$self->{syslogd}}->rotate();
+ ${$self->{syslogd}}->kill_privsep('HUP');
+ ${$self->{syslogd}}->loggrep("syslogd: restarted", 5)
+ or die ref($self), " no 'syslogd: restarted' between logs";
+ print STDERR "Signal\n";
+ })},
loggrep => { get_between2loggrep() },
},
check => sub {
diff --git a/regress/usr.sbin/syslogd/args-sighup-tcp.pl b/regress/usr.sbin/syslogd/args-sighup-tcp.pl
index 8e5cff53a13..ba26557b0b3 100644
--- a/regress/usr.sbin/syslogd/args-sighup-tcp.pl
+++ b/regress/usr.sbin/syslogd/args-sighup-tcp.pl
@@ -11,13 +11,11 @@ use Socket;
our %args = (
client => {
- func => sub {
+ func => sub { write_between2logs(shift, sub {
my $self = shift;
- write_between2logs($self, sub {
- ${$self->{server}}->loggrep("Signal", 8)
- or die ref($self), " no 'Signal' between logs";
- });
- },
+ ${$self->{server}}->loggrep("Signal", 8)
+ or die ref($self), " no 'Signal' between logs";
+ })},
loggrep => { get_between2loggrep() },
},
syslogd => {
@@ -38,23 +36,21 @@ our %args = (
server => {
listen => { domain => AF_INET, addr => "127.0.0.1", proto => "tcp" },
redo => 0,
- func => sub {
+ func => sub { read_between2logs(shift, sub {
my $self = shift;
- read_between2logs($self, sub {
- if ($self->{redo}) {
- $self->{redo}--;
- return;
- }
- ${$self->{syslogd}}->rotate();
- ${$self->{syslogd}}->kill_syslogd('HUP');
- ${$self->{syslogd}}->loggrep("syslogd: restarted", 5)
- or die ref($self), " no 'syslogd: restarted' between logs";
- print STDERR "Signal\n";
- # regeneate fstat file
- ${$self->{syslogd}}->fstat();
- $self->{redo}++;
- });
- },
+ if ($self->{redo}) {
+ $self->{redo}--;
+ return;
+ }
+ ${$self->{syslogd}}->rotate();
+ ${$self->{syslogd}}->kill_syslogd('HUP');
+ ${$self->{syslogd}}->loggrep("syslogd: restarted", 5)
+ or die ref($self), " no 'syslogd: restarted' between logs";
+ print STDERR "Signal\n";
+ # regenerate fstat file
+ ${$self->{syslogd}}->fstat();
+ $self->{redo}++;
+ })},
loggrep => {
get_between2loggrep(),
qr/Signal/ => 1,
diff --git a/regress/usr.sbin/syslogd/args-sighup-tls.pl b/regress/usr.sbin/syslogd/args-sighup-tls.pl
index 0093ef28e9c..20b04b17966 100644
--- a/regress/usr.sbin/syslogd/args-sighup-tls.pl
+++ b/regress/usr.sbin/syslogd/args-sighup-tls.pl
@@ -11,13 +11,11 @@ use Socket;
our %args = (
client => {
- func => sub {
+ func => sub { write_between2logs(shift, sub {
my $self = shift;
- write_between2logs($self, sub {
- ${$self->{server}}->loggrep("Signal", 8)
- or die ref($self), " no 'Signal' between logs";
- });
- },
+ ${$self->{server}}->loggrep("Signal", 8)
+ or die ref($self), " no 'Signal' between logs";
+ })},
loggrep => { get_between2loggrep() },
},
syslogd => {
@@ -38,23 +36,21 @@ our %args = (
server => {
listen => { domain => AF_INET, addr => "127.0.0.1", proto => "tls" },
redo => 0,
- func => sub {
+ func => sub { read_between2logs(shift, sub {
my $self = shift;
- read_between2logs($self, sub {
- if ($self->{redo}) {
- $self->{redo}--;
- return;
- }
- ${$self->{syslogd}}->rotate();
- ${$self->{syslogd}}->kill_syslogd('HUP');
- ${$self->{syslogd}}->loggrep("syslogd: restarted", 5)
- or die ref($self), " no 'syslogd: restarted' between logs";
- print STDERR "Signal\n";
- # regeneate fstat file
- ${$self->{syslogd}}->fstat();
- $self->{redo}++;
- });
- },
+ if ($self->{redo}) {
+ $self->{redo}--;
+ return;
+ }
+ ${$self->{syslogd}}->rotate();
+ ${$self->{syslogd}}->kill_syslogd('HUP');
+ ${$self->{syslogd}}->loggrep("syslogd: restarted", 5)
+ or die ref($self), " no 'syslogd: restarted' between logs";
+ print STDERR "Signal\n";
+ # regenerate fstat file
+ ${$self->{syslogd}}->fstat();
+ $self->{redo}++;
+ })},
loggrep => {
get_between2loggrep(),
qr/Signal/ => 1,
diff --git a/regress/usr.sbin/syslogd/args-sighup.pl b/regress/usr.sbin/syslogd/args-sighup.pl
index b375ebbabf8..edbc2e42eda 100644
--- a/regress/usr.sbin/syslogd/args-sighup.pl
+++ b/regress/usr.sbin/syslogd/args-sighup.pl
@@ -10,13 +10,11 @@ use warnings;
our %args = (
client => {
- func => sub {
+ func => sub { write_between2logs(shift, sub {
my $self = shift;
- write_between2logs($self, sub {
- ${$self->{server}}->loggrep("Signal", 8)
- or die ref($self), " no 'Signal' between logs";
- });
- },
+ ${$self->{server}}->loggrep("Signal", 8)
+ or die ref($self), " no 'Signal' between logs";
+ })},
loggrep => { get_between2loggrep() },
},
syslogd => {
@@ -33,16 +31,14 @@ our %args = (
},
},
server => {
- func => sub {
+ func => sub { read_between2logs(shift, sub {
my $self = shift;
- read_between2logs($self, sub {
- ${$self->{syslogd}}->rotate();
- ${$self->{syslogd}}->kill_syslogd('HUP');
- ${$self->{syslogd}}->loggrep("syslogd: restarted", 5)
- or die ref($self), " no 'syslogd: restarted' between logs";
- print STDERR "Signal\n";
- });
- },
+ ${$self->{syslogd}}->rotate();
+ ${$self->{syslogd}}->kill_syslogd('HUP');
+ ${$self->{syslogd}}->loggrep("syslogd: restarted", 5)
+ or die ref($self), " no 'syslogd: restarted' between logs";
+ print STDERR "Signal\n";
+ })},
loggrep => {
get_between2loggrep(),
qr/Signal/ => 1,
diff --git a/regress/usr.sbin/syslogd/args-sigpipe.pl b/regress/usr.sbin/syslogd/args-sigpipe.pl
index e5142066191..7bf9259b3aa 100644
--- a/regress/usr.sbin/syslogd/args-sigpipe.pl
+++ b/regress/usr.sbin/syslogd/args-sigpipe.pl
@@ -10,13 +10,11 @@ use warnings;
our %args = (
client => {
- func => sub {
+ func => sub { write_between2logs(shift, sub {
my $self = shift;
- write_between2logs($self, sub {
- ${$self->{server}}->loggrep("Signal", 8)
- or die ref($self), " no 'Signal' between logs";
- });
- },
+ ${$self->{server}}->loggrep("Signal", 8)
+ or die ref($self), " no 'Signal' between logs";
+ })},
loggrep => { get_between2loggrep() },
},
syslogd => {
@@ -28,14 +26,12 @@ our %args = (
loggrep => { get_between2loggrep() },
},
server => {
- func => sub {
+ func => sub { read_between2logs(shift, sub {
my $self = shift;
- read_between2logs($self, sub {
- ${$self->{syslogd}}->kill_syslogd('PIPE');
- sleep 1; # schedule syslogd
- print STDERR "Signal\n";
- });
- },
+ ${$self->{syslogd}}->kill_syslogd('PIPE');
+ sleep 1; # schedule syslogd
+ print STDERR "Signal\n";
+ })},
loggrep => { get_between2loggrep() },
},
file => { loggrep => { get_between2loggrep() } },
diff --git a/regress/usr.sbin/syslogd/args-sigterm.pl b/regress/usr.sbin/syslogd/args-sigterm.pl
index f060afc245c..93032fe3410 100644
--- a/regress/usr.sbin/syslogd/args-sigterm.pl
+++ b/regress/usr.sbin/syslogd/args-sigterm.pl
@@ -10,13 +10,11 @@ use warnings;
our %args = (
client => {
- func => sub {
+ func => sub { write_between2logs(shift, sub {
my $self = shift;
- write_between2logs($self, sub {
- ${$self->{server}}->loggrep("Signal", 8)
- or die ref($self), " no 'Signal' between logs";
- });
- },
+ ${$self->{server}}->loggrep("Signal", 8)
+ or die ref($self), " no 'Signal' between logs";
+ })},
loggrep => { get_between2loggrep() },
},
syslogd => {
@@ -28,17 +26,15 @@ our %args = (
loggrep => qr/\[unpriv\] syslogd child about to exit/,
},
server => {
- func => sub {
+ func => sub { read_between2logs(shift, sub {
my $self = shift;
- read_between2logs($self, sub {
- ${$self->{syslogd}}->kill_syslogd('TERM');
- my $pattern = "syslogd: exiting on signal 15";
- ${$self->{syslogd}}->loggrep("syslogd: exiting on signal 15", 5)
- or die ref($self),
- " no 'syslogd: exiting on signal 15' between logs";
- print STDERR "Signal\n";
- });
- },
+ ${$self->{syslogd}}->kill_syslogd('TERM');
+ my $pattern = "syslogd: exiting on signal 15";
+ ${$self->{syslogd}}->loggrep("syslogd: exiting on signal 15", 5)
+ or die ref($self),
+ " no 'syslogd: exiting on signal 15' between logs";
+ print STDERR "Signal\n";
+ })},
down => qr/syslogd: exiting on signal 15/,
loggrep => {
(get_between2loggrep())[0] => 1,
diff --git a/regress/usr.sbin/syslogd/funcs.pl b/regress/usr.sbin/syslogd/funcs.pl
index ff7144a246b..9bbaea9299e 100644
--- a/regress/usr.sbin/syslogd/funcs.pl
+++ b/regress/usr.sbin/syslogd/funcs.pl
@@ -1,4 +1,4 @@
-# $OpenBSD: funcs.pl,v 1.13 2015/02/02 17:40:24 bluhm Exp $
+# $OpenBSD: funcs.pl,v 1.14 2015/02/06 00:27:41 bluhm Exp $
# Copyright (c) 2010-2015 Alexander Bluhm <bluhm@openbsd.org>
#
@@ -27,8 +27,11 @@ use IO::Socket;
use IO::Socket::INET6;
my $firstlog = "syslogd regress test first message";
+my $secondlog = "syslogd regress test second message";
+my $thirdlog = "syslogd regress test third message";
my $testlog = "syslogd regress test log message";
my $downlog = "syslogd regress client shutdown";
+my $charlog = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
sub find_ports {
my %args = @_;
@@ -59,7 +62,7 @@ sub write_log {
my $self = shift;
write_message($self, $testlog);
- write_shutdown($self, @_);
+ write_shutdown($self);
}
sub write_between2logs {
@@ -69,7 +72,7 @@ sub write_between2logs {
write_message($self, $firstlog);
$func->($self, @_);
write_message($self, $testlog);
- write_shutdown($self, @_);
+ write_shutdown($self);
}
sub write_message {
@@ -103,15 +106,16 @@ sub write_shutdown {
sub write_char {
my $self = shift;
- my @lenghts = @_ || @{$self->{lengths}};
+ my @lenghts = @{shift || $self->{lengths}};
+ my $tail = shift // $self->{tail};
foreach my $len (@lenghts) {
- my $tail = $self->{tail} // "";
- substr($tail, 0, length($tail) - $len, "")
- if length($tail) && length($tail) > $len;
+ my $t = $tail // "";
+ substr($t, 0, length($t) - $len, "")
+ if length($t) && length($t) > $len;
my $msg = "";
my $char = '0';
- for (my $i = 0; $i < $len - length($tail); $i++) {
+ for (my $i = 0; $i < $len - length($t); $i++) {
$msg .= $char;
given ($char) {
when(/9/) { $char = 'A' }
@@ -120,14 +124,15 @@ sub write_char {
default { $char++ }
}
}
- $msg .= $tail if length($tail);
+ $msg .= $t if length($t);
write_message($self, $msg);
}
}
sub write_length {
- write_char(@_);
- write_log(@_);
+ my $self = shift;
+ write_char($self, @_);
+ write_log($self);
}
sub write_unix {
@@ -150,7 +155,7 @@ sub write_unix {
sub read_log {
my $self = shift;
- read_message($self, $downlog, @_);
+ read_message($self, $downlog);
}
sub read_between2logs {
@@ -158,12 +163,12 @@ sub read_between2logs {
my $func = shift;
unless ($self->{redo}) {
- read_message($self, $firstlog, @_);
+ read_message($self, $firstlog);
}
$func->($self, @_);
unless ($self->{redo}) {
- read_message($self, $testlog, @_);
- read_message($self, $downlog, @_);
+ read_message($self, $testlog);
+ read_message($self, $downlog);
}
}
@@ -196,6 +201,22 @@ sub get_testlog {
return $testlog;
}
+sub get_firstlog {
+ return $firstlog;
+}
+
+sub get_secondlog {
+ return $secondlog;
+}
+
+sub get_thirdlog {
+ return $thirdlog;
+}
+
+sub get_charlog {
+ return $charlog;
+}
+
sub get_between2loggrep {
return (
qr/$firstlog/ => 1,