This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Revert "cygwin 2.1.0 can test -r just fine, incl. under admin"
[perl5.git] / t / op / stat.t
index e0ce03b..5ad119c 100644 (file)
@@ -195,10 +195,8 @@ SKIP: {
         # Going to try to switch away from root.  Might not work.
         my $olduid = $>;
         eval { $> = 1; };
         # 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
         skip "Can't test -r or -w meaningfully if you're superuser", 2
-          if ($> == 0);
+          if ($Is_Cygwin ? _ingroup(544, 1) : $> == 0);
 
         SKIP: {
             skip "Can't test -r meaningfully?", 1 if $Is_Dos;
 
         SKIP: {
             skip "Can't test -r meaningfully?", 1 if $Is_Dos;
@@ -650,3 +648,17 @@ END {
     chmod 0666, $tmpfile;
     unlink_all $tmpfile;
 }
     chmod 0666, $tmpfile;
     unlink_all $tmpfile;
 }
+
+sub _ingroup {
+    my ($gid, $eff)   = @_;
+
+    $^O eq "VMS"    and return $_[0] == $);
+
+    my ($egid, @supp) = split " ", $);
+    my ($rgid)        = split " ", $(;
+
+    $gid == ($eff ? $egid : $rgid)  and return 1;
+    grep $gid == $_, @supp          and return 1;
+
+    return "";
+}