diff options
author | Brendan O'Dea <bod@debian.org> | 2002-08-30 08:42:39 +1000 |
---|---|---|
committer | hv <hv@crypt.org> | 2002-09-04 11:10:54 +0000 |
commit | c38ddbc4365cf58ed4e3957d38c67381b8f863be (patch) | |
tree | 4a53917a4ba50becd843e93fc8f92ee76b3bfc80 /ext/Sys | |
parent | fcf3e904e30b5d92c334eda2e043582d131787bc (diff) | |
download | perl-c38ddbc4365cf58ed4e3957d38c67381b8f863be.tar.gz |
allow Sys::Syslog test to fail gracefully
From: "Brendan O'Dea" <bod@debian.org>
Message-ID: <20020829124239.GA31934@londo.odea.dropbear.id.au>
p4raw-id: //depot/perl@17826
Diffstat (limited to 'ext/Sys')
-rwxr-xr-x | ext/Sys/Syslog/syslog.t | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/ext/Sys/Syslog/syslog.t b/ext/Sys/Syslog/syslog.t index 30695e2644..72171f532b 100755 --- a/ext/Sys/Syslog/syslog.t +++ b/ext/Sys/Syslog/syslog.t @@ -47,11 +47,21 @@ print "1..6\n"; if (Sys::Syslog::_PATH_LOG()) { if (-e Sys::Syslog::_PATH_LOG()) { - print defined(eval { setlogsock('unix') }) ? "ok 1\n" : "not ok 1 # $!\n"; - print defined(eval { openlog('perl', 'ndelay', 'local0') }) ? "ok 2\n" : "not ok 2 # $!\n"; - print defined(eval { syslog('info', $test_string ) }) ? "ok 3\n" : "not ok 3 # $!\n"; - } - else { + print defined(eval { setlogsock('unix') }) + ? "ok 1\n" : "not ok 1 # $!\n"; + if (defined(eval { openlog('perl', 'ndelay', 'local0') })) { + print "ok 2\n"; + print defined(eval { syslog('info', $test_string ) }) + ? "ok 3\n" : "not ok 3 # $!\n"; + } else { + if ($@ =~ /no connection to syslog available/) { + print "ok 2 # Skip: syslogd not running\n"; + } else { + print "not ok 2 # $@\n"; + } + print "ok 3 # Skip: openlog failed\n"; + } + } else { for (1..3) { print "ok $_ # Skip: file ", |