1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +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


mysql-test/mysql-test-run.pl:
  Add test to check if mysql-test-run is run with root permission. 
  Set environment variable MYSQL_TEST_ROOT to 'YES' or 'NO'.
mysql-test/t/information_schema.test:
  Disable test if running as root
mysql-test/t/rpl_rotate_logs.test:
  Disable test if running as root.
mysql-test/include/not_as_root.inc:
  New BitKeeper file ``mysql-test/include/not_as_root.inc''
mysql-test/r/not_as_root.require:
  New BitKeeper file ``mysql-test/r/not_as_root.require''
This commit is contained in:
unknown
2006-04-24 10:21:09 +02:00
parent e33031e76a
commit 1d16bc69cf
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 () {