args-client-tls-error.pl revision 1.6
1# The syslogd listens on 127.0.0.1 TLS socket. 2# The client connects and aborts the connection to syslogd. 3# The syslogd writes the error into a file and through a pipe. 4# Find the error message in file, syslogd log. 5# Check that syslogd writes a log message about the client error. 6 7use strict; 8use warnings; 9use Socket; 10use Errno ':POSIX'; 11 12my @errors = (ECONNRESET); 13my $errors = "(". join("|", map { $! = $_ } @errors). ")"; 14 15our %args = ( 16 client => { 17 connect => { domain => AF_INET, proto => "tls", addr => "127.0.0.1", 18 port => 6514 }, 19 func => sub { 20 my $self = shift; 21 delete $self->{ts}; 22 setsockopt(STDOUT, SOL_SOCKET, SO_LINGER, pack('ii', 1, 0)) 23 or die ref($self), " set socket linger failed: $!"; 24 }, 25 loggrep => { 26 qr/connect sock: 127.0.0.1 \d+/ => 1, 27 }, 28 }, 29 syslogd => { 30 options => ["-S", "127.0.0.1:6514"], 31 loggrep => { 32 qr/syslogd\[\d+\]: tls logger .* accept/ => 1, 33 qr/syslogd\[\d+\]: tls logger .* connection error/ => 1, 34 }, 35 }, 36 server => { 37 func => sub { 38 my $self = shift; 39 ${$self->{syslogd}}->loggrep( 40 qr/tls logger .* connection (?:close|error)/, 5) 41 or die ref($self), " no connection error in syslogd.log"; 42 }, 43 loggrep => {}, 44 }, 45 file => { 46 loggrep => { 47 qr/syslogd\[\d+\]: tls logger .* connection error: /. 48 qr/read failed: .*$errors/ => 1, 49 }, 50 }, 51 pipe => { nocheck => 1, }, 52 tty => { nocheck => 1, }, 53); 54 551; 56