powerman has asked for the wisdom of the Perl Monks concerning the following question:
How to check is AF_UNIX available in reliable and cross-platform way?
Or, a little :) more general question: how to write reliable tests for platform-specific features (and is it have sense to do this)?
In Log::Fast test t/raise.t I'm trying to ensure exception will be thrown if user provide wrong custom path for syslog-type logging using UNIX sockets:
SKIP: { skip 'no UNIX sockets on Windows', 2 if $^O =~ /Win/; SKIP: { use Sys::Syslog (); my $path = Sys::Syslog::_PATH_LOG() || '/dev/log'; skip 'unable to detect syslog socket', 1 if !-S $path; lives_ok { $LOG->config({type=>'unix',path=>$path}) }; } throws_ok { $LOG->config({type=>'unix',path=>'nosuch'}) } qr/c +onnect:/; }
I just got this report (failed test is "lives_ok" in above snippet) and looks like target system's kernel built without UNIX socket support ("modprobe unix" probably fix this). I've no idea why anyone may need kernel compiled in this way, but question is how to avoid such FAIL reports?
Removing lives_ok test looks like ignoring/hiding issue instead of fixing it... So, is it better to remove this test, or add "skip if !AF_UNIX" somehow (and how to check this)?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Is AF_UNIX available?
by JavaFan (Canon) on Nov 20, 2010 at 20:30 UTC | |
|
Re: Is AF_UNIX available?
by chrestomanci (Priest) on Nov 20, 2010 at 20:42 UTC | |
by powerman (Friar) on Nov 20, 2010 at 21:38 UTC |