X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FUser%2Fpwent.t;h=d6bd040df2a85b75f59aef4a83c06a197db6e989;hb=5a35688369fffaf661c919710f783712ba978b59;hp=e274265bd120cfd1a02f7f654f52ba62c77f712c;hpb=b695f709e8a342e35e482b0437eb6cdacdc58b6b;p=p5sagit%2Fp5-mst-13.2.git diff --git a/lib/User/pwent.t b/lib/User/pwent.t index e274265..d6bd040 100644 --- a/lib/User/pwent.t +++ b/lib/User/pwent.t @@ -11,13 +11,18 @@ BEGIN { $haspw = 1 unless $@ && $@ =~ /unimplemented/; unless ($haspw) { print "1..0 # Skip: no getpwuid\n"; exit 0 } use Config; - $haspw = 0 unless $Config{'i_pwd'} eq 'define'; + # VMS's pwd.h struct passwd conflicts with the one in vmsish.h + $haspw = 0 unless ( $Config{'i_pwd'} eq 'define' || $^O eq 'VMS' ); unless ($haspw) { print "1..0 # Skip: no pwd.h\n"; exit 0 } } BEGIN { - our @pwent = getpwuid 0; # This is the function getpwuid. - unless (@pwent) { print "1..0 # Skip: no uid 0\n"; exit 0 } + our $uid = 0; + # On VMS getpwuid(0) may return [$gid,0] UIC info (which may not exist). + # It is better to use the $< uid for testing on VMS instead. + if ( $^O eq 'VMS' ) { $uid = $< ; } + our @pwent = getpwuid $uid; # This is the function getpwuid. + unless (@pwent) { print "1..0 # Skip: no uid $uid\n"; exit 0 } } print "1..9\n"; @@ -26,15 +31,28 @@ use User::pwent; print "ok 1\n"; -my $pwent = getpwuid 0; # This is the OO getpwuid. +my $pwent = getpwuid $uid; # This is the OO getpwuid. -print "not " unless $pwent->uid == 0; +my $uid_expect = $uid; +if ( $^O eq 'cygwin' ) { + print "not " unless ( $pwent->uid == $uid_expect + || $pwent->uid == 500 ); # go figure +} +else { + print "not " unless $pwent->uid == $uid_expect ; +} print "ok 2\n"; -print "not " unless $pwent->name == $pwent[0]; +print "not " unless $pwent->name eq $pwent[0]; print "ok 3\n"; -print "not " unless $pwent->passwd eq $pwent[1]; +if ($^O eq 'os390') { + print "not " + unless not defined $pwent->passwd && + $pwent[1] eq '0'; # go figure +} else { + print "not " unless $pwent->passwd eq $pwent[1]; +} print "ok 4\n"; print "not " unless $pwent->uid == $pwent[2];