1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Bug#17002 mysql-test-run as root user

- Add test to see if tests are running with root permissions
 - Disables tests that uses chmod if that is the case
This commit is contained in:
msvensson@neptunus.(none)
2006-04-24 10:21:09 +02:00
parent a21b899b39
commit d59a0f4840
5 changed files with 41 additions and 0 deletions

View File

@ -338,6 +338,7 @@ sub environment_setup ();
sub kill_running_server ();
sub kill_and_cleanup ();
sub check_ssl_support ();
sub check_running_as_root();
sub check_ndbcluster_support ();
sub ndbcluster_install ();
sub ndbcluster_start ($);
@ -376,6 +377,7 @@ sub main () {
check_ndbcluster_support();
check_ssl_support();
check_running_as_root();
environment_setup();
signal_setup();
@ -1337,6 +1339,33 @@ sub kill_and_cleanup () {
}
sub check_running_as_root () {
# Check if running as root
# i.e a file can be read regardless what mode we set it to
my $test_file= "test_running_as_root.txt";
mtr_tofile($test_file, "MySQL");
chmod(oct("0000"), $test_file);
my $result="";
if (open(FILE,"<",$test_file))
{
$result= join('', <FILE>);
close FILE;
}
chmod(oct("0755"), $test_file);
unlink($test_file);
$ENV{'MYSQL_TEST_ROOT'}= "NO";
if ($result eq "MySQL")
{
mtr_warning("running this script as _root_ will cause some " .
"tests to be skipped");
$ENV{'MYSQL_TEST_ROOT'}= "YES";
}
}
sub check_ssl_support () {