Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: CPAN module failing tests

by Perlbotics (Archbishop)
on Sep 02, 2018 at 08:50 UTC ( [id://1221570]=note: print w/replies, xml ) Need Help??


in reply to CPAN module failing tests

Just a wild guess: NFS (with additional complication: BSD, clang, ARM)

PERL_DL_NONLAZY=1 "/mnt/nas/home/pi2b/njh/perl5/perlbrew/perls/perl-5.24.4/bin/perl"...

Who knows where /var/tmp/ was mounted?

Perhaps, it would be a good addition to CPAN::Reporter to also list the FS-type of the relevant directories mounted?

IFF this is an NFS/BSD issue, there's not much you could or should (if your module doesn't do the flock;2;freebsd()) do. Perhaps, you can add

use warnings FATAL => 'flock';
to your tests as described here: https://metacpan.org/pod/Path::Tiny#File-locking?

Edited: Misleading citation removed / still visible in HTML source.

Replies are listed 'Best First'.
Re^2: CPAN module failing tests
by nysus (Parson) on Sep 02, 2018 at 13:42 UTC

    Will adding that get it to pass the test? Or will it just cause it to fail instead of throwing a warning?

    $PM = "Perl Monk's";
    $MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate Priest";
    $nysus = $PM . ' ' . $MCF;
    Click here if you love Perl Monks

      For some weird reason, Path::Tiny uses flock before reading/writing any file, even though unixish locks are only advisory. But at least this blind checking would prevent multiple programs using Path::Tiny from clobbering each others data.

      The documentation also says that you can disable the flocking by setting $ENV{ PERL_PATH_TINY_NO_FLOCK } to a true value.

      It will fail early because the pre-condition (flock() works) is not met. It will (should = untested) more clearly point out where the problem is - not in your module, but in the environment. You could wrap the exception and turn it into a more descriptive warning, providing advice on how to fix the test-environment or skip this test.

      If the failure is caused by the implementation of the test case, you could fix that, i.e. by circumventing file locking or by skipping the test case (after testing capabilities) with a proper explanation.

      If your module requires proper locking, it would be wise to let the test fail, perhaps with a more meaningful explanation. It might even be useful to make the warning fatal in your Anki module, if you cannot find a workaround.
      The latter leads to a third option: skip test with warning / fail in production (installed module) if pre-condition is not met. Since your module self-tests the pre-condition, the test case could tolerate a not fully compliant test environment. However, this might break applications that (seemed to) worked fine in the past.

      Everything under the assumption that NFS/flock is the real culprit.

Re^2: CPAN module failing tests
by Dallaylaen (Chaplain) on Sep 02, 2018 at 17:57 UTC
    Thank you! I had a module run into the same problem, now I know the (possible) reason...

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1221570]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (2)
As of 2024-04-26 04:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found