summaryrefslogtreecommitdiff
path: root/t/lib/syslog.t
blob: 7ad4204ee09e63180e866089a92ea6d381321bf8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!./perl

BEGIN {
    chdir 't' if -d 't';
    @INC = '../lib';
    require Config; import Config;
    if ($Config{'extensions'} !~ /\bSyslog\b/) {
	print "1..0 # Skip: Sys::Syslog was not built\n";
	exit 0;
    }
}

use Sys::Syslog qw(:DEFAULT setlogsock);

print "1..6\n";

if (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') }) ? "ok 3\n" : "not ok 3\n";
}
else {
    for (1..3) { print "ok $_ # skipping, _PATH_LOG unavailable\n" }
}

print defined(eval { setlogsock('inet') }) ? "ok 4\n" : "not ok 4\n";
print defined(eval { openlog('perl', 'ndelay', 'local0') }) ? "ok 5\n" : "not ok 5\n";
print defined(eval { syslog('info', 'test') }) ? "ok 6\n" : "not ok 6\n";