Bug #52223 Test "plugin_dir_basic" does not support RPM build (test) directory structure
Submitted: 19 Mar 2010 14:48 Modified: 2 May 2011 14:58
Reporter: Joerg Bruehe Email Updates:
Status: Closed Impact on me:
None 
Category:Tests: Server Severity:S3 (Non-critical)
Version:5.5.3-m3 OS:Linux (RPM builds)
Assigned to: Bjørn Munch CPU Architecture:Any
Tags: experimental, pb2, test failure
Triage: Triaged: D3 (Medium)

[19 Mar 2010 14:48] Joerg Bruehe
Description:
This feature  seems to have never been tested before, so the failure is new in the 5.5.3-m3 builds.
The failure is specific to the building of RPMs.

=====
sys_vars.plugin_dir_basic                [ retry-fail ]
        Test ended at YYYY-MM-DD HH:MM:SS

CURRENT_TEST: sys_vars.plugin_dir_basic
--- /PATH/mysql-test/suite/sys_vars/r/plugin_dir_basic.result
+++ /PATH/mysql-test/suite/sys_vars/r/plugin_dir_basic.reject
@@ -1,20 +1,20 @@
 select @@global.plugin_dir;
 @@global.plugin_dir
-MYSQL_LIBDIR/plugin
+/usr/lib/plugin
 select @@session.plugin_dir;
 ERROR HY000: Variable 'plugin_dir' is a GLOBAL variable
 show global variables like 'plugin_dir';
 Variable_name  Value
-plugin_dir MYSQL_LIBDIR/plugin
+plugin_dir /usr/lib/plugin
 show session variables like 'plugin_dir';
 Variable_name  Value
-plugin_dir MYSQL_LIBDIR/plugin
+plugin_dir /usr/lib/plugin
 select * from information_schema.global_variables where variable_name='plugin_dir';
 VARIABLE_NAME  VARIABLE_VALUE
-PLUGIN_DIR MYSQL_LIBDIR/plugin
+PLUGIN_DIR /usr/lib/plugin
 select * from information_schema.session_variables where variable_name='plugin_dir';
 VARIABLE_NAME  VARIABLE_VALUE
-PLUGIN_DIR MYSQL_LIBDIR/plugin
+PLUGIN_DIR /usr/lib/plugin
 set global plugin_dir=1;
 ERROR HY000: Variable 'plugin_dir' is a read only variable
 set session plugin_dir=1;

mysqltest: Result content mismatch
=====

I assume there is some inconsistency between the path names as seen by "mysqltest" (or rather, "mysql-test-run.pl") and by the server when the tests are run in an RPM build environment, even though I don't have an explanation how that might happen.

How to repeat:
Run an RPM build.

Suggested fix:
If only I knew ...

From the logic of MTR.pl, I cannot spot a point where the variable "MYSQL_LIBDIR" would be set wrong, which is then used for the replacement of varying directory names in the test.

For now, the important thing to note is that the test basically succeeds, what happens here is an inexactness in post-processing.
[2 Sep 2010 9:58] Joerg Bruehe
This is how it looks like in the build of 5.5.6-m3:

=====
sys_vars.plugin_dir_basic                [ retry-fail ]
        Test ended at YYYY-MM-DD HH:MM:SS

CURRENT_TEST: sys_vars.plugin_dir_basic
--- /PATH/mysql-test/suite/sys_vars/r/plugin_dir_basic.result
+++ /PATH/mysql-test/suite/sys_vars/r/plugin_dir_basic.reject
@@ -1,20 +1,20 @@
 select @@global.plugin_dir;
 @@global.plugin_dir
-MYSQL_LIBDIR/plugin
+MYSQL_LIBDIR64/plugin
 select @@session.plugin_dir;
 ERROR HY000: Variable 'plugin_dir' is a GLOBAL variable
 show global variables like 'plugin_dir';
 Variable_name  Value
-plugin_dir     MYSQL_LIBDIR/plugin
+plugin_dir     MYSQL_LIBDIR64/plugin
 show session variables like 'plugin_dir';
 Variable_name  Value
-plugin_dir     MYSQL_LIBDIR/plugin
+plugin_dir     MYSQL_LIBDIR64/plugin
 select * from information_schema.global_variables where variable_name='plugin_dir';
 VARIABLE_NAME  VARIABLE_VALUE
-PLUGIN_DIR     MYSQL_LIBDIR/plugin
+PLUGIN_DIR     MYSQL_LIBDIR64/plugin
 select * from information_schema.session_variables where variable_name='plugin_dir';
 VARIABLE_NAME  VARIABLE_VALUE
-PLUGIN_DIR     MYSQL_LIBDIR/plugin
+PLUGIN_DIR     MYSQL_LIBDIR64/plugin
 set global plugin_dir=1;
 ERROR HY000: Variable 'plugin_dir' is a read only variable
 set session plugin_dir=1;

mysqltest: Result content mismatch
=====

This happens in all RPM builds on x86_64,
these platforms differ between "/usr/lib" and "/usr/lib64".

I suspect it comes from this line in MTR, which assumes just "lib/":
mysql-test/mysql-test-run.pl:  $ENV{'MYSQL_LIBDIR'}=       "$basedir/lib";

This may provide wrong input for the replacement:
mysql-test/suite/sys_vars/t/plugin_dir_basic.test:--replace_result $MYSQL_LIBDIR MYSQL_LIBDIR /mysql/ /

I cannot yet explain why it doesn't happen with tar.gz builds,
there must be some difference in the setup.
[24 Nov 2010 13:28] Alexander Nozdrin
The test case has been marked experimental due to this bug.
Pushed to 5.5-security.
[7 Dec 2010 8:52] 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/126187

3169 Horst.Hunger	2010-12-07
      Fix for bug#52223: Separated test in one for Unix and one for Windows due to diffs in paths. the test idea is now to see a path in mysql(mysqltest) given as option to mysqld. The paths are absolute to avoid automatic compeletion.
[21 Dec 2010 6:00] [ name withheld ]
I'm seeing this type of failure too, on 5.5.8, trying to build with an RPM-style directory layout.  The proposed patch seems bogus to me.  I believe that the actual problem is at line 2186 of mysql-test-run.pl:

$ENV{'MYSQL_LIBDIR'}=       "$basedir/lib";

This of course is wrong for any non-default directory layout.  In the particular case I'm running into, it'd need to end in /lib64 to make the test pass.  Somehow this setting needs to be tweaked on the basis of the INSTALL_LIBDIR configuration variable.
[2 May 2011 14:58] Paul Dubois
Changes to test suite. No changelog entry needed.
[11 Jul 2011 20:02] [ name withheld ]
This test *still fails*, despite the alleged fix, when building on a 64-bit machine where the install lib directory is named "lib64" not "lib".  I see this in 5.5.14:

$ diff suite/sys_vars/r/plugin_dir_basic.result suite/sys_vars/r/plugin_dir_basic.reject
3c3
< MYSQL_LIBDIR/plugin
---
> MYSQL_LIBDIR64/plugin
8c8
< plugin_dir    MYSQL_LIBDIR/plugin
---
> plugin_dir    MYSQL_LIBDIR64/plugin
11c11
< plugin_dir    MYSQL_LIBDIR/plugin
---
> plugin_dir    MYSQL_LIBDIR64/plugin
14c14
< PLUGIN_DIR    MYSQL_LIBDIR/plugin
---
> PLUGIN_DIR    MYSQL_LIBDIR64/plugin
17c17
< PLUGIN_DIR    MYSQL_LIBDIR/plugin
---
> PLUGIN_DIR    MYSQL_LIBDIR64/plugin
[12 Jul 2011 8:18] Bjørn Munch
Please disregard the patch shown here. The bug was later fixed by this patch instead:

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

This is not foolproof however. MTR has to guess since it can't directly determine what the server's default value should be. It was tested on our own RPM builds, but if your build has a lib64 directory *and* a lib directory, this logic will fail. Perhaps it shouldn't care if there's a lib but use lib64 as long as it exists.
[31 Aug 2011 14:46] Paul Dubois
Changes to test suite. No changelog entry needed.