In perl.git, the branch maint-5.20 has been updated <http://perl5.git.perl.org/perl.git/commitdiff/ce54ab865c68e77e8bc1709fd925ef6d51cba933?hp=67c7ec2b8ce1a245a649db768794ba3997700dad>
- Log ----------------------------------------------------------------- commit ce54ab865c68e77e8bc1709fd925ef6d51cba933 Author: Reini Urban <[email protected]> Date: Tue Jun 10 10:15:23 2014 +1000 [perl #121733] fix t/op/stat.t 96 for windows Tony: fixes for minitest (cherry picked from commit 3442c4b3e005f425ea32c16225fbf4bd0cb1fb54) M t/op/stat.t commit 510d16bbd5176fe0b51a4c71c24af84a53535d4f Author: Reini Urban <[email protected]> Date: Mon Jun 9 16:55:09 2014 +1000 [perl #121732] fix t/op/filetest.t for windows Tony: fix for minitest (cherry picked from commit 683267f66c72ee510f225a18dc9cd0e4c1962532) M t/op/filetest.t ----------------------------------------------------------------------- Summary of changes: t/op/filetest.t | 14 +++++++++++++- t/op/stat.t | 12 +++++++++--- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/t/op/filetest.t b/t/op/filetest.t index a67b73f..7316442 100644 --- a/t/op/filetest.t +++ b/t/op/filetest.t @@ -11,6 +11,10 @@ BEGIN { plan(tests => 53 + 27*14); +if ($^O =~ /MSWin32|cygwin|msys/ && !is_miniperl) { + require Win32; # for IsAdminUser() +} + # Tests presume we are in t/op directory and that file 'TEST' is found # therein. is(-d 'op', 1, "-d: directory correctly identified"); @@ -31,7 +35,15 @@ chmod 0555, $ro_empty_file or die "chmod 0555, '$ro_empty_file' failed: $!"; SKIP: { my $restore_root; - if ($> == 0) { + skip "Need Win32::IsAdminUser() on $^O", 1 + if $^O =~ /MSWin32|cygwin|msys/ && is_miniperl(); + my $Is_WinAdminUser = ($^O =~ /MSWin32|cygwin|msys/ and Win32::IsAdminUser()) ? 1 : 0; + # TODO: skip("On an ACL filesystem like $^O we cannot rely on -w via uid/gid"); + # We have no filesystem check for ACL in core + if ($Is_WinAdminUser) { + skip("As Windows Administrator we cannot rely on -w via uid/gid"); + } + elsif ($> == 0) { # root can read and write anything, so switch uid (may not be # implemented) eval '$> = 1'; diff --git a/t/op/stat.t b/t/op/stat.t index 8dc589d..2f34f6e 100644 --- a/t/op/stat.t +++ b/t/op/stat.t @@ -43,7 +43,7 @@ $Is_Dosish = $Is_Dos || $Is_OS2 || $Is_MSWin32 || $Is_NetWare; $Is_UFS = $Is_Darwin && (() = `df -t ufs . 2>/dev/null`) == 2; -if ($Is_Cygwin) { +if ($Is_Cygwin && !is_miniperl) { require Win32; Win32->import; } @@ -186,6 +186,8 @@ SKIP: { # Going to try to switch away from root. Might not work. my $olduid = $>; eval { $> = 1; }; + skip "Can't test if an admin user in miniperl", 2, + if $Is_Cygwin && is_miniperl(); skip "Can't test -r or -w meaningfully if you're superuser", 2 if ($Is_Cygwin ? Win32::IsAdminUser : $> == 0); @@ -530,9 +532,13 @@ SKIP: { my $s2 = -s _; is($s1, $s2, q(-T _ doesn't break the statbuffer)); SKIP: { + my $root_uid = $Is_Cygwin ? 18 : 0; skip "No lstat", 1 unless $Config{d_lstat}; - skip "uid=0", 1 unless $<&&$>; - skip "Readable by group/other means readable by me", 1 if $^O eq 'VMS'; + skip "uid=0", 1 if $< == $root_uid or $> == $root_uid; + skip "Can't check if admin user in miniperl", 1 + if $^O =~ /^(cygwin|MSWin32|msys)$/ && is_miniperl(); + skip "Readable by group/other means readable by me on $^O", 1 if $^O eq 'VMS' + or ($^O =~ /^(cygwin|MSWin32|msys)$/ and Win32::IsAdminUser()); lstat($tmpfile); -T _; ok(eval { lstat _ }, -- Perl5 Master Repository
