Bug #59700 executable in odd place for Windows builds - cannot use --basedir to find mysqld
Submitted: 24 Jan 2011 16:37 Modified: 15 Mar 2011 11:30
Reporter: Chuck Bell Email Updates:
Status: Closed Impact on me:
None 
Category:Tools: MTR / mysql-test-run Severity:S3 (Non-critical)
Version: OS:Microsoft Windows
Assigned to: Bjørn Munch CPU Architecture:Any

[24 Jan 2011 16:37] Chuck Bell
Description:
I am developing a new tool named mysql_plugin (see WL#5710 - I will attach a bundle of a pre-release of the tool for diagnostic purposes). This tool uses --basedir to search for and execute mysqld (for running a bootstrap). 

However, running this tool on Windows via MTR fails to locate the mysqld.exe because it is placed in ./sql/Debug (or ./sql/Release). 

How to repeat:
Use bundle applied to mysql-5.5 tree and attempt to execute test mysql_plugin on Windows (once you remove 'not_windows'). Note that the test fails - this is because the tool cannot find mysqld.exe. 

Suggested fix:
Make it so that the environment when testing on Windows is the same as testing on other platforms. Specifically, --basedir returns a path where mysqld.exe is in ./sql/ rather than ./sql/Debug or ./sql/Release. This will allow testing of tools like mysql_plugin.
[24 Jan 2011 19:05] Peter Laursen
"Unfortunately, either a task with that ID does not exist, or it is not a publicly available Worklog entry."
[25 Jan 2011 9:19] Bjørn Munch
It's not clear to me what the problem is. Where IS your mysqld.exe? If the problem is that mysqld.exe is not in ./sql but in a subdirectory, that's a build issue. If the problem is that mtr can't find it, you may try using
--vs-config=<subdir>. If the problem is that the *tool* can't find mysqld.exe you probably have to fix the tool to look in alternative directories.
[25 Jan 2011 9:59] Bjørn Munch
Ah, I think I get it. You need to be able to pass the correct --basedir to the tool from within an mtr test? This code snippet might help, after running this in a test, the variable $BASEDIR should be set to the value you need:

------
perl;
  use File::Basename;
  my ($mysqld)= split " ", $ENV{MYSQLD_BOOTSTRAP_CMD};
  my $dirn= dirname($mysqld);
  open(FILE, ">", "$ENV{MYSQL_TMP_DIR}/dirn.inc") or die;
  print FILE "let \$BASEDIR= $dirn;\n";
  close FILE;
EOF

source $MYSQL_TMP_DIR/dirn.inc;
remove_file $MYSQL_TMP_DIR/dirn.inc;
-----

This is a modified version of code used in another test that needed the executable name, I added a call to dirname().
[25 Jan 2011 13:27] Chuck Bell
Bundle with mysql_plugin code.

Attachment: 5710_ready.bundle (application/octet-stream, text), 31.00 KiB.

[25 Jan 2011 14:07] Bjørn Munch
OK, that's what I thought, you'd need to add the --basedir option, please see my previous comment for a solution. I think this should work.

Also, I would strongly suggest you use the new mechanism for adding plugins done in Bug #58841, see include/plugin.defs. This avoids having to hard code the settings in mtr.pl.
[26 Jan 2011 10:11] Bjørn Munch
MTR cannot "fix" the different path to the executable on Windows, the test needs to do something along the lines of my suggestion to get the information it needs.

Setting to "!Bg", could as an alternative define this as a test bug (as it currently can't run on Windows)