Bug #47389 Innodb tests are skipped when running as unix root user
Submitted: 16 Sep 2009 23:40 Modified: 17 Jun 2010 19:42
Reporter: Mark Callaghan Email Updates:
Status: Closed Impact on me:
None 
Category:Tools: MTR / mysql-test-run Severity:S3 (Non-critical)
Version:5.1.38 OS:Any
Assigned to: Bjørn Munch CPU Architecture:Any
Tags: Contribution, innodb, root, skipped, Tests

[16 Sep 2009 23:40] Mark Callaghan
Description:
When mysql-test-run is run by the unix root user, this warning is displayed:
orker[1] mysql-test-run: WARNING: running this script as _root_ will cause some tests to be skipped, and innodb tests are skipped even though the server was built with support for innodb

How to repeat:
as unix root user:
* ./configure --with-plugin-innobase --without-plugin-innodb_plugin
* mysql-test-run.pl innodb

The real problem is that when 'mysqld --no-defaults --help --verbose' is run to determine whether innodb is supported, '--user=root' is not passed on the mysqld command line. mysqld generates some output but does not display the innodb options and mysql-test-run assumes innodb is not supported. 

So maybe the real problem is that mysqld fails quietly in this case. A workaround is to pass '--user=root' on the mysqld command line used in collect_mysqld_features() when mysql-test-run is started as unix root user.

Suggested fix:
Add this to collect_mysqld_features() in mysql-test-run.pl
  if ($ENV{'MYSQL_TEST_ROOT'} == "YES")
  {
    mtr_add_arg($args, "--user=root");
  }
[17 Sep 2009 5:47] MySQL Verification Team
Verified the problem as described, although not the suggested fix.
[17 Sep 2009 7:17] MySQL Verification Team
Verified works with the following patch:

--- mysql-test/mysql-test-run.pl.orig   2009-08-21 22:09:42.000000000 +1000
+++ mysql-test/mysql-test-run.pl        2009-09-17 17:14:10.000000000 +1000
@@ -1409,6 +1409,10 @@
   mtr_add_arg($args, "--skip-grant-tables");
   mtr_add_arg($args, "--verbose");
   mtr_add_arg($args, "--help");
+  if (defined($ENV{'MYSQL_TEST_ROOT'}) && $ENV{'MYSQL_TEST_ROOT'} =~ "YES")
+  {
+    mtr_add_arg($args, "--user=root");
+  }
 
   my $exe_mysqld= find_mysqld($basedir);
   my $cmd= join(" ", $exe_mysqld, @$args);
[10 Feb 2010 12:35] Bjørn Munch
The suggested patches will not work because $MYSQL_TEST_ROOT has not been set at this point.  The first one appears to work because it uses == instead of eq and therefore matches when it actually doesn't.  I don't really know why the seond one would work; it doesn't for me.

Sorry for not seeing this bug before; it somehow escaped getting assigned to me.

Fixing this by doing the initializations in the right order is not trivial, but I'm looking into it.
[10 Feb 2010 15:51] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/99844

2889 Bjorn Munch	2010-02-10
      Bug #47389 Innodb tests are skipped when running as unix root user
      As suggested, add --user=root in collect_mysqld_features()
      But had to do some init in different order to get this right
[11 Feb 2010 10:25] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/99906

2889 Bjorn Munch	2010-02-11
      Bug #47389 Innodb tests are skipped when running as unix root user
      Add --user=root to collect_mysqld_features() if running as root
      Please disregard previous commit; this is much simpler.
[11 Feb 2010 10:38] Magnus Blåudd
Patch OK
[11 Feb 2010 22:17] Bjørn Munch
Pushed to 5.1-mtr, trunk-mtr, next-mr-mtr, 6.0-codebase-mtr.

Expects this to get into 5.1.45.
[20 Feb 2010 9:32] Bugs System
Pushed into 6.0.14-alpha (revid:alik@sun.com-20100220092844-jh07ayojyxn8uh9p) (version source revid:bjorn.munch@sun.com-20100211215815-auwiduho05akqcng) (merge vers: 6.0.14-alpha) (pib:16)
[20 Feb 2010 9:34] Bugs System
Pushed into 5.5.3-m2 (revid:alik@sun.com-20100220092622-wvhh1vfy5tjq4mhu) (version source revid:bjorn.munch@sun.com-20100211133321-yqk2wzpt34ky4b0z) (merge vers: 5.5.2-m2) (pib:16)
[20 Feb 2010 9:37] Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20100220092730-paoo5t9gcajs5dq8) (version source revid:bjorn.munch@sun.com-20100211133554-e7cb7cm06jftk0p2) (pib:16)
[20 Feb 2010 18:46] Paul DuBois
Test suite changes. No changelog entry needed.

Setting report to Need Merge pending push to 5.1.x.
[1 Mar 2010 8:44] Bugs System
Pushed into 5.1.45 (revid:joro@sun.com-20100301083827-xnimmrjg6bh33o1o) (version source revid:azundris@mysql.com-20100222175719-viuh0f3gdsrkgv0r) (merge vers: 5.1.45) (pib:16)
[1 Mar 2010 15:57] Paul DuBois
No changelog entry needed.
[17 Jun 2010 11:56] Bugs System
Pushed into 5.1.47-ndb-7.0.16 (revid:martin.skold@mysql.com-20100617114014-bva0dy24yyd67697) (version source revid:vasil.dimov@oracle.com-20100331130613-8ja7n0vh36a80457) (merge vers: 5.1.46) (pib:16)
[17 Jun 2010 12:34] Bugs System
Pushed into 5.1.47-ndb-6.2.19 (revid:martin.skold@mysql.com-20100617115448-idrbic6gbki37h1c) (version source revid:martin.skold@mysql.com-20100609140708-52rvuyq4q500sxkq) (merge vers: 5.1.45-ndb-6.2.19) (pib:16)
[17 Jun 2010 13:21] Bugs System
Pushed into 5.1.47-ndb-6.3.35 (revid:martin.skold@mysql.com-20100617114611-61aqbb52j752y116) (version source revid:vasil.dimov@oracle.com-20100331130613-8ja7n0vh36a80457) (merge vers: 5.1.46) (pib:16)