Bug #28438 mysqlslap in the test suite depends on the $HOME/.my.cnf
Submitted: 15 May 2007 8:25 Modified: 7 Jul 2008 15:57
Reporter: Alexander Nozdrin Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: Tests Severity:S3 (Non-critical)
Version:5.1 OS:Any
Assigned to: CPU Architecture:Any

[15 May 2007 8:25] Alexander Nozdrin
Description:
Like almost any MySQL command-line tool, mysqlslap reads $HOME/.my.cnf on start by default. In order to prevent this --no-defaults option can be used. The test suite however starts mysqlslap with default configuration, so it reads $HOME/.my.cnf.

That can lead to strange failures. In my case, mysqlslap just didn't start because it does not understand --charactser-set-dir option.

The following test cases affected:
  - mysqlslap.test
  - rpl_insert.test
  - rpl_stm_insert_delayed.test

The problem however seems to be more general/serious -- there is no uniform set
of options for all command-line clients (no interface of command-line tools).
So, it's impossible to have one config file and be able to run any tool.

How to repeat:
1. Create $HOME/.my.cnf with the following code:

--------------------------------------------------------------
[client]
# The following options will be passed to all MySQL clients
character-sets-dir  = /tmp/dir
--------------------------------------------------------------

2. Run test cases:

Logging: ./mysql-test-run.pl --tmpdir=/dev/shm/t1/tmp --vardir=/dev/shm/t1/var --force mysqlslap rpl_insert rpl_stm_insert_delayed
...
TEST                           RESULT         TIME (ms)
-------------------------------------------------------

mysqlslap                      [ fail ]

Errors are (from /dev/shm/t1/var/log/mysqltest-time) :
/home/alik/Documents/MySQL/devel/5.1-rt-cs-2-base/client/.libs/lt-mysqlslap: unknown variable 'character-sets-dir=/home/alik/Documents/MySQL/devel/5.1-rt-cs-2-base/sql/share/charsets'
mysqltest: At line 5: command "$MYSQL_SLAP --silent --concurrency=5 --iterations=20 --number-int-cols=2 --number-char-cols=3 --auto-generate-sql" failed
(the last lines may be the most important ones)
Result from queries before failure can be found in /dev/shm/t1/var/log/mysqlslap.log
...
mysql-test-run in default mode: *** Failing the test(s): mysqlslap rpl_insert rpl_stm_insert_delayed

Suggested fix:
1. Run mysqlslap with --no-defaults or --defaults options under mysql-test-run.pl

2. Establish well-known fixed set of options (interface) that every
command-line tool must support.
[15 May 2007 8:37] Sveta Smirnova
Thank you for the report.

Verified as described.
[7 Jul 2008 15:57] Sven Sandberg
This seems to have been fixed. I made a test case containing this:

--echo MYSQL_SLAP=$MYSQL_SLAP

and it produced this:

MYSQL_SLAP=/home/sven/bzr/debug-max/5.1-rpl/client/mysqlslap --defaults-file=/home/sven/bzr/debug-max/5.1-rpl/mysql-test/var/2/my.cnf