|
if ($> == 0) {
diag( "Running tests as root, dropping privileges first" );
my $id = $ENV {TEST_USER_ID} || 1000;
setuid( $id );
}
throws_ok { $> = 0 } qr/seteuid\(0\) failed: Operation not permitted/ , 'Setting $> throws' ;
throws_ok { $< = 0 } qr/setruid\(0\) failed: Operation not permitted/ , 'Setting $< throws' ;
throws_ok { $) = 0 } qr/setegid\(0\) failed: Operation not permitted/ , 'Setting $) throws' ;
throws_ok { $( = 0 } qr/setrgid\(0\) failed: Operation not permitted/ , 'Setting $( throws' ;
done_testing();
|