From 510d16bbd5176fe0b51a4c71c24af84a53535d4f Mon Sep 17 00:00:00 2001 From: Reini Urban Date: Mon, 9 Jun 2014 16:55:09 +1000 Subject: [perl #121732] fix t/op/filetest.t for windows Tony: fix for minitest (cherry picked from commit 683267f66c72ee510f225a18dc9cd0e4c1962532) --- t/op/filetest.t | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 't/op') diff --git a/t/op/filetest.t b/t/op/filetest.t index a67b73f3ce..7316442eb8 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'; -- cgit v1.2.1