develooper Front page | perl.perl5.porters | Postings from April 2014

ExtUtils-Install/t/Install.t

Thread Next
From:
Dave Mitchell
Date:
April 15, 2014 21:17
Subject:
ExtUtils-Install/t/Install.t
Message ID:
20140415211749.GI18018@iabyn.com
Hi Chris, you pushed this just now:

    commit 84d7dacc0cf1fae82700fa22ee4991accd0a084e

        Skip writable tests in ExtUtils-Install when root

    ...
    -    ok( !-w "$bigdir/DummyHard.pm", 'DummyHard.pm not writeable' );
    +    SKIP: {
    +      skip 'everywhere is writable to root', 1 if $> == 0;
    +      ok( !-w "$bigdir/DummyHard.pm", 'DummyHard.pm not writeable' );
    +    }

At almost the same time that I was about to push my own fix:

    +# do a -w style test, but based on just on file perms rather than UID
    +# (on UNIX, root sees everything as writeable)
    +
    +sub writeable {
    +    my ($file) = @_;
    +    my @stat = stat $file;
    +    return 0 unless defined $stat[2]; # mode
    +    return $stat[2] & 0200;
    +}
    +
    +

    ...

    -    ok( !-w "$bigdir/DummyHard.pm", 'DummyHard.pm not writeable' );
    +    ok( !writeable("$bigdir/DummyHard.pm"), 'DummyHard.pm not writeable' );

I think I prefer my own fix, because it still tests that the file is ok
regardless of who runs the test.


-- 
Lear: Dost thou call me fool, boy?
Fool: All thy other titles thou hast given away; that thou wast born with.

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About