args-client-tls-error.pl revision 1.3
1261287Sdes# The syslogd listens on 127.0.0.1 TLS socket. 2261287Sdes# The client connects and aborts the connection to syslogd. 3261287Sdes# The syslogd writes the error into a file and through a pipe. 4261287Sdes# Find the error message in file, syslogd log. 5261287Sdes# Check that syslogd writes a log message about the client error. 6261287Sdes 7261287Sdesuse strict; 8261287Sdesuse warnings; 9261287Sdesuse Socket; 10261287Sdesuse Errno ':POSIX'; 11261287Sdes 12261287Sdesmy @errors = (ECONNRESET); 13261287Sdesmy $errors = "(". join("|", map { $! = $_ } @errors). ")"; 14261287Sdes 15261287Sdesour %args = ( 16261287Sdes client => { 17261287Sdes connect => { domain => AF_INET, proto => "tls", addr => "127.0.0.1", 18261287Sdes port => 6514 }, 19261287Sdes func => sub { 20261287Sdes my $self = shift; 21261287Sdes setsockopt(STDOUT, SOL_SOCKET, SO_LINGER, pack('ii', 1, 0)) 22261287Sdes or die "set socket linger failed: $!"; 23261287Sdes }, 24261287Sdes loggrep => { 25261287Sdes qr/connect sock: 127.0.0.1 \d+/ => 1, 26261287Sdes }, 27261287Sdes }, 28261287Sdes syslogd => { 29261287Sdes options => ["-S", "127.0.0.1:6514"], 30261287Sdes loggrep => { 31261287Sdes qr/syslogd\[\d+\]: tls logger .* accept/ => 1, 32261287Sdes qr/syslogd\[\d+\]: tls logger .* connection error/ => 1, 33261287Sdes }, 34261287Sdes }, 35261287Sdes server => { 36261287Sdes func => sub { 37261287Sdes my $self = shift; 38261287Sdes ${$self->{syslogd}}->loggrep("tls logger .* connection error", 5) 39261287Sdes or die "no connection error in syslogd.log"; 40261287Sdes }, 41261287Sdes loggrep => {}, 42261287Sdes }, 43261287Sdes file => { 44261287Sdes loggrep => { 45261287Sdes qr/syslogd\[\d+\]: tls logger .* connection error: /. 46261287Sdes qr/read failed: $errors/ => 1, 47261287Sdes }, 48261287Sdes }, 49261287Sdes pipe => { nocheck => 1, }, 50261287Sdes tty => { nocheck => 1, }, 51261287Sdes); 52261287Sdes 53261287Sdes1; 54261287Sdes