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)?


In reply to Is AF_UNIX available? by powerman

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.