Bug #62907 mysql_plugin.test fails on a RPM-based install.
Submitted: 24 Oct 2011 10:53 Modified: 25 Oct 2011 9:32
Reporter: Davi Arnaut (OCA) Email Updates:
Status: Verified Impact on me:
Category:MySQL Server: Tests Severity:S3 (Non-critical)
Version:5.5.16 OS:Linux
Assigned to: CPU Architecture:Any
Tags: Contribution

[24 Oct 2011 10:53] Davi Arnaut
The test case for mysql_plugin has a couple of problems that make it fail when the test is executed in the context of a RPM-based install.

The first problem is the way it extracts the location of the base directory from the pathname of the mysqld binary. In a RPM-based installation, the base directory is in a completely different location that that of the mysqld binary.

The second problem is that the test does cleanup by itself. It creates a couple of directories/files that are not fully removed at the end of the test:

--mkdir $MYSQLD_BASEDIR/share
--mkdir $MYSQLD_BASEDIR/share/mysql
--copy_file $MYSQL_ERRMSG_BASEDIR/english/errmsg.sys $MYSQLD_BASEDIR/share/errmsg.sys
--copy_file $MYSQL_ERRMSG_BASEDIR/english/errmsg.sys $MYSQLD_BASEDIR/share/mysql/errmsg.sys


# Cleanup the share folder in the binary path.
--remove_file $MYSQLD_BASEDIR/share/errmsg.sys

--rmdir $MYSQLD_BASEDIR/share/mysql
--rmdir $MYSQLD_BASEDIR/share

How to repeat:
RPM-based install:

cd /usr/share/mysql-test
./mtr --vardir=/tmp/mtr-var mysql_plugin

Suggested fix:
Add the missing remove_file and use the value returned by "select @@basedir".
[24 Oct 2011 10:56] Davi Arnaut
The second problem is that the test does NOT cleanup by itself.
[24 Oct 2011 11:26] Davi Arnaut
Also, in a RPM-based installation, the base directory of mysqld is /usr/sbin, which no regular user will have permission to create directories under.
[24 Oct 2011 12:32] Davi Arnaut
Use a temporary base directory, not the mysqld base directory.

Attachment: bug#62907.patch (application/octet-stream, text), 2.24 KiB.

[25 Oct 2011 9:32] Valeriy Kravchuk
Thank you for the problem report and code contributed. Verified by code review.
[27 Feb 2012 2:42] [ name withheld ]
As of 5.5.21, the mysql_plugin test fails for me in an RPM install, even with this patch applied.  The remaining diff looks like

--- /usr/share/mysql-test/r/mysql_plugin.result 2012-01-31 14:28:16.000000000 +0300
+++ /usr/share/mysql-test/r/mysql_plugin.reject 2012-02-27 05:30:06.687853118 +0300
@@ -33,7 +33,7 @@
 SELECT * FROM mysql.plugin WHERE dl like '%libdaemon%' ORDER BY name;
 name   dl
-daemon_example liblibdaemon_example.so
+daemon_example libdaemon_example.so
 # Disable the plugin...
@@ -42,6 +42,7 @@
 SELECT * FROM mysql.plugin WHERE dl like '%libdaemon%' ORDER BY name;
 name   dl
+daemon_example libdaemon_example.so
 # Attempt to load non-existant plugin

mysqltest: Result content mismatch

I believe the reason is that the test thinks it can scribble on $PLUGIN_DIR, which it cannot (unless I choose to run it as root, which I don't care to).  Seems like it should be adjusted to use a temporary directory as $PLUGIN_DIR.
[14 Mar 2012 16:32] Honza Horak
I've extended Davi's patch to move plugin files to $bindir/share/mysql-test/var/ directory, same as errmsg.sys file is moved. That directory is write-able by test utility, so the test will pass also when running under non-root user.

See the patch bellow.
[14 Mar 2012 16:34] Honza Horak
proposed patch - plugin files moved to a write-able directory

Attachment: mysql-plugin-test2.patch (text/x-patch), 3.82 KiB.