From: Brendan O'Dea Date: Thu, 29 Aug 2002 22:42:39 +0000 (+1000) Subject: allow Sys::Syslog test to fail gracefully X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c38ddbc4365cf58ed4e3957d38c67381b8f863be;p=p5sagit%2Fp5-mst-13.2.git allow Sys::Syslog test to fail gracefully From: "Brendan O'Dea" Message-ID: <20020829124239.GA31934@londo.odea.dropbear.id.au> p4raw-id: //depot/perl@17826 --- diff --git a/ext/Sys/Syslog/syslog.t b/ext/Sys/Syslog/syslog.t index 30695e2..72171f5 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 ",