Mercurial > hg > nginx-tests
diff syslog.t @ 1600:b61e820caa83
Tests: using Sys::Hostname to get hostname in a portable way.
The hostname utility is not defined by POSIX and not available
by default on some modern Linux distro's (Arch, Fedora).
Reported by Geert Hendrickx.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Mon, 12 Oct 2020 18:13:07 +0100 |
parents | 9e142c0e34b2 |
children |
line wrap: on
line diff
--- a/syslog.t +++ b/syslog.t @@ -13,6 +13,7 @@ use strict; use Test::More; use IO::Select; +use Sys::Hostname; BEGIN { use FindBin; chdir($FindBin::Bin); } @@ -321,8 +322,7 @@ sub parse_syslog_message { ok($sec < 60, "$desc valid seconds"); ok(defined($host), "$desc has host"); - chomp(my $hostname = lc `hostname`); - is($host , $hostname, "$desc valid host"); + is($host, lc(hostname()), "$desc valid host"); ok(defined($tag), "$desc has tag"); like($tag, qr'\w+', "$desc valid tag");