List:Commits« Previous MessageNext Message »
From:msvensson Date:December 4 2007 12:19pm
Subject:bk commit into 5.0 tree (msvensson:1.2595)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of msvensson. When msvensson does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-12-04 12:19:06+01:00, msvensson@shellback.(none) +137 -0
  Add dynamic configuration support to mysql-test-run.pl
   - Rename servers datadir
   - Rename std_data
   - Move location of different files 

  BitKeeper/deleted/.del-analyze_failure_sync_with_master.test@stripped, 2007-11-30
16:55:06+01:00, msvensson@shellback.(none) +0 -0
    Delete: mysql-test/include/analyze_failure_sync_with_master.test

  BitKeeper/deleted/.del-rpl000015.slave-mi@stripped, 2007-11-23 10:41:19+01:00,
msvensson@shellback.(none) +0 -0
    Delete: mysql-test/t/rpl000015.slave-mi

  BitKeeper/deleted/.del-rpl_rotate_logs-slave.sh@stripped, 2007-11-22 16:05:56+01:00,
msvensson@shellback.(none) +0 -0
    Delete: mysql-test/t/rpl_rotate_logs-slave.sh

  mysql-test/configs/default_mysqld.cnf@stripped, 2007-12-04 12:19:00+01:00,
msvensson@shellback.(none) +19 -0
    New BitKeeper file ``mysql-test/configs/default_mysqld.cnf''

  mysql-test/configs/default_mysqld.cnf@stripped, 2007-12-04 12:19:00+01:00,
msvensson@shellback.(none) +0 -0

  mysql-test/configs/default_ndbd.cnf@stripped, 2007-12-04 12:19:00+01:00,
msvensson@shellback.(none) +22 -0
    New BitKeeper file ``mysql-test/configs/default_ndbd.cnf''

  mysql-test/configs/default_ndbd.cnf@stripped, 2007-12-04 12:19:00+01:00,
msvensson@shellback.(none) +0 -0

  mysql-test/configs/main.cnf@stripped, 2007-12-04 12:19:00+01:00, msvensson@shellback.(none)
+14 -0
    New BitKeeper file ``mysql-test/configs/main.cnf''

  mysql-test/configs/main.cnf@stripped, 2007-12-04 12:19:00+01:00, msvensson@shellback.(none)
+0 -0

  mysql-test/configs/ndb.cnf@stripped, 2007-12-04 12:19:00+01:00, msvensson@shellback.(none)
+17 -0
    New BitKeeper file ``mysql-test/configs/ndb.cnf''

  mysql-test/configs/ndb.cnf@stripped, 2007-12-04 12:19:00+01:00, msvensson@shellback.(none) +0
-0

  mysql-test/configs/rpl_1slave.cnf@stripped, 2007-12-04 12:19:00+01:00,
msvensson@shellback.(none) +11 -0
    New BitKeeper file ``mysql-test/configs/rpl_1slave.cnf''

  mysql-test/configs/rpl_1slave.cnf@stripped, 2007-12-04 12:19:00+01:00,
msvensson@shellback.(none) +0 -0

  mysql-test/configs/rpl_1slave_base.cnf@stripped, 2007-12-04 12:19:00+01:00,
msvensson@shellback.(none) +47 -0
    New BitKeeper file ``mysql-test/configs/rpl_1slave_base.cnf''

  mysql-test/configs/rpl_1slave_base.cnf@stripped, 2007-12-04 12:19:00+01:00,
msvensson@shellback.(none) +0 -0

  mysql-test/include/loaddata_autocom.inc@stripped, 2007-12-04 12:18:54+01:00,
msvensson@shellback.(none) +6 -2
    Read loadfile with absolute path to the file in a variable
    eases replace_result

  mysql-test/include/ndb_backup.inc@stripped, 2007-12-04 12:18:54+01:00,
msvensson@shellback.(none) +2 -2
    Use $NDB_CONNECTSTING instead of "localhost:$NDBCLUSTER_PORT

  mysql-test/lib/My/Config.pm@stripped, 2007-12-04 12:19:00+01:00, msvensson@shellback.(none)
+450 -0
    New BitKeeper file ``mysql-test/lib/My/Config.pm''

  mysql-test/lib/My/Config.pm@stripped, 2007-12-04 12:19:00+01:00, msvensson@shellback.(none)
+0 -0

  mysql-test/lib/My/ConfigFactory.pm@stripped, 2007-12-04 12:19:00+01:00,
msvensson@shellback.(none) +481 -0
    New BitKeeper file ``mysql-test/lib/My/ConfigFactory.pm''

  mysql-test/lib/My/ConfigFactory.pm@stripped, 2007-12-04 12:19:00+01:00,
msvensson@shellback.(none) +0 -0

  mysql-test/lib/My/CpcClient.pm@stripped, 2007-12-04 12:18:54+01:00,
msvensson@shellback.(none) +2 -121
    Update CpcClient to use SocketClient as base

  mysql-test/lib/My/File/Path.pm@stripped, 2007-12-04 12:18:54+01:00,
msvensson@shellback.(none) +30 -1
    Add 'copytree' function

  mysql-test/lib/My/Find.pm@stripped, 2007-12-04 12:18:54+01:00, msvensson@shellback.(none) +70
-17
    Improve My/Find.pm

  mysql-test/lib/My/MgmClient.pm@stripped, 2007-12-04 12:19:00+01:00,
msvensson@shellback.(none) +102 -0
    New BitKeeper file ``mysql-test/lib/My/MgmClient.pm''

  mysql-test/lib/My/MgmClient.pm@stripped, 2007-12-04 12:19:00+01:00,
msvensson@shellback.(none) +0 -0

  mysql-test/lib/My/SafeProcess.pm@stripped, 2007-12-04 12:18:54+01:00,
msvensson@shellback.(none) +27 -3
    Straighten the blocking/use_alarm logic

  mysql-test/lib/My/SafeProcess/Base.pm@stripped, 2007-12-04 12:18:54+01:00,
msvensson@shellback.(none) +16 -16
    Fix warning

  mysql-test/lib/My/SafeProcess/safe_process.pl@stripped, 2007-12-04 12:18:54+01:00,
msvensson@shellback.(none) +1 -0
    Make sure to kill the whole prosessgroup even if the child has exited, it
    could have childs that havent been killed

  mysql-test/lib/My/SafeProcess/safe_process_sshd.pl@stripped, 2007-12-04 12:19:00+01:00,
msvensson@shellback.(none) +261 -0
    New BitKeeper file ``mysql-test/lib/My/SafeProcess/safe_process_sshd.pl''

  mysql-test/lib/My/SafeProcess/safe_process_sshd.pl@stripped, 2007-12-04 12:19:00+01:00,
msvensson@shellback.(none) +0 -0

  mysql-test/lib/My/SocketClient.pm@stripped, 2007-12-04 12:19:00+01:00,
msvensson@shellback.(none) +141 -0
    New BitKeeper file ``mysql-test/lib/My/SocketClient.pm''

  mysql-test/lib/My/SocketClient.pm@stripped, 2007-12-04 12:19:00+01:00,
msvensson@shellback.(none) +0 -0

  mysql-test/lib/mtr_cases.pl@stripped, 2007-12-04 12:18:54+01:00, msvensson@shellback.(none)
+165 -105
    Add dynamic configuration support

  mysql-test/lib/mtr_misc.pl@stripped, 2007-12-04 12:18:54+01:00, msvensson@shellback.(none)
+0 -24
    Remove mtr_copy_dir

  mysql-test/lib/mtr_report.pl@stripped, 2007-12-04 12:18:54+01:00, msvensson@shellback.(none)
+11 -15
    Add dynamic configuration support

  mysql-test/lib/t/CpcClient.t@stripped, 2007-12-04 12:18:54+01:00, msvensson@shellback.(none)
+1 -1
    Update test for CpcClient

  mysql-test/lib/t/Find.t@stripped, 2007-12-04 12:18:54+01:00, msvensson@shellback.(none) +20
-3
    Improve test for My/Find

  mysql-test/lib/t/MgmClient.t@stripped, 2007-12-04 12:19:00+01:00, msvensson@shellback.(none)
+23 -0
    New BitKeeper file ``mysql-test/lib/t/MgmClient.t''

  mysql-test/lib/t/MgmClient.t@stripped, 2007-12-04 12:19:00+01:00, msvensson@shellback.(none)
+0 -0

  mysql-test/lib/t/SocketClient.t@stripped, 2007-12-04 12:19:00+01:00,
msvensson@shellback.(none) +8 -0
    New BitKeeper file ``mysql-test/lib/t/SocketClient.t''

  mysql-test/lib/t/SocketClient.t@stripped, 2007-12-04 12:19:00+01:00,
msvensson@shellback.(none) +0 -0

  mysql-test/lib/t/copytree.t@stripped, 2007-12-04 12:19:00+01:00, msvensson@shellback.(none)
+34 -0
    New BitKeeper file ``mysql-test/lib/t/copytree.t''

  mysql-test/lib/t/copytree.t@stripped, 2007-12-04 12:19:00+01:00, msvensson@shellback.(none)
+0 -0

  mysql-test/lib/t/rmtree.t@stripped, 2007-12-04 12:18:54+01:00, msvensson@shellback.(none) +1
-1
    Fix typo

  mysql-test/lib/t/rmtree.t@stripped, 2007-12-03 11:44:16+01:00, msvensson@shellback.(none) +0
-0
    Rename: mysql-test/lib/t/0.rmtree.t -> mysql-test/lib/t/rmtree.t

  mysql-test/lib/t/testMyConfig.t@stripped, 2007-12-04 12:19:00+01:00,
msvensson@shellback.(none) +131 -0
    New BitKeeper file ``mysql-test/lib/t/testMyConfig.t''

  mysql-test/lib/t/testMyConfig.t@stripped, 2007-12-04 12:19:00+01:00,
msvensson@shellback.(none) +0 -0

  mysql-test/lib/t/testMyConfigFactory.t@stripped, 2007-12-04 12:19:00+01:00,
msvensson@shellback.(none) +98 -0
    New BitKeeper file ``mysql-test/lib/t/testMyConfigFactory.t''

  mysql-test/lib/t/testMyConfigFactory.t@stripped, 2007-12-04 12:19:00+01:00,
msvensson@shellback.(none) +0 -0

  mysql-test/mysql-test-run.pl@stripped, 2007-12-04 12:18:54+01:00,
msvensson@shellback.(none) +691 -1516
    Add dynamic configuration support

  mysql-test/r/backup.result@stripped, 2007-12-04 12:18:54+01:00, msvensson@shellback.(none)
+11 -11
    Update test result ../tmp -> ../../tmp

  mysql-test/r/blackhole.result@stripped, 2007-12-04 12:18:54+01:00,
msvensson@shellback.(none) +2 -2
    ../std_dat_ln -> ../../std_data

  mysql-test/r/ctype_big5.result@stripped, 2007-12-04 12:18:54+01:00,
msvensson@shellback.(none) +2 -2
    Update path to servers datadir

  mysql-test/r/federated.result@stripped, 2007-12-04 12:18:54+01:00,
msvensson@shellback.(none) +1 -1
    Update path to std_data, ../std_data_ln -> ../../std_data

  mysql-test/r/gis.result@stripped, 2007-12-04 12:18:54+01:00, msvensson@shellback.(none) +1
-1
    Update path to std_data, ../std_data_ln -> ../../std_data

  mysql-test/r/loaddata.result@stripped, 2007-12-04 12:18:54+01:00, msvensson@shellback.(none)
+15 -15
    Update path to std_data, ../std_data_ln -> ../../std_data

  mysql-test/r/loaddata_autocom_innodb.result@stripped, 2007-12-04 12:18:54+01:00,
msvensson@shellback.(none) +2 -2
    Update result, use a variable with path to load_file

  mysql-test/r/loaddata_autocom_ndb.result@stripped, 2007-12-04 12:18:54+01:00,
msvensson@shellback.(none) +2 -2
    Update result, use a variable with path to load_file

  mysql-test/r/mysqlbinlog.result@stripped, 2007-12-04 12:18:54+01:00,
msvensson@shellback.(none) +12 -12
    Update path to std_data, ../std_data_ln -> ../../std_data

  mysql-test/r/ndb_load.result@stripped, 2007-12-04 12:18:54+01:00, msvensson@shellback.(none)
+2 -2
    Update result, use a variable with path to load_file

  mysql-test/r/ndb_loaddatalocal.result@stripped, 2007-12-04 12:18:54+01:00,
msvensson@shellback.(none) +8 -8
    Update result, using variable with full path to load_file

  mysql-test/r/ndb_replace.result@stripped, 2007-12-04 12:18:54+01:00,
msvensson@shellback.(none) +2 -2
    Update result, using variable with full path to load_file

  mysql-test/r/ndb_trigger.result@stripped, 2007-12-04 12:18:54+01:00,
msvensson@shellback.(none) +1 -1
    Update path to std_data, ../std_data_ln -> ../../std_data

  mysql-test/r/query_cache.result@stripped, 2007-12-04 12:18:54+01:00,
msvensson@shellback.(none) +1 -1
    Rename std_data_ln -> std_data

  mysql-test/r/rpl000001.result@stripped, 2007-12-04 12:18:54+01:00,
msvensson@shellback.(none) +1 -1
    Update path to std_data, ../std_data_ln -> ../../std_data

  mysql-test/r/rpl000004.result@stripped, 2007-12-04 12:18:54+01:00, msvensson@shellback.(none)
+2 -2
    Update path to std_data, ../std_data_ln -> ../../std_data

  mysql-test/r/rpl_innodb.result@stripped, 2007-12-04 12:18:54+01:00,
msvensson@shellback.(none) +2 -2
    Update path to std_data, ../std_data_ln -> ../../std_data

  mysql-test/r/rpl_loaddata.result@stripped, 2007-12-04 12:18:55+01:00,
msvensson@shellback.(none) +8 -8
    Update path to std_data, ../std_data_ln -> ../../std_data

  mysql-test/r/rpl_loaddata_charset.result@stripped, 2007-12-04 12:18:55+01:00,
msvensson@shellback.(none) +7 -7
    Update path to std_data, ../std_data_ln -> ../../std_data

  mysql-test/r/rpl_loaddata_rule_m.result@stripped, 2007-12-04 12:18:55+01:00,
msvensson@shellback.(none) +2 -2
    Update path to std_data, ../std_data_ln -> ../../std_data

  mysql-test/r/rpl_loaddata_rule_s.result@stripped, 2007-12-04 12:18:55+01:00,
msvensson@shellback.(none) +1 -1
    Update path to std_data, ../std_data_ln -> ../../std_data

  mysql-test/r/rpl_loaddatalocal.result@stripped, 2007-12-04 12:18:55+01:00,
msvensson@shellback.(none) +4 -4
    Update servers datadir path

  mysql-test/r/rpl_log.result@stripped, 2007-12-04 12:18:55+01:00, msvensson@shellback.(none)
+3 -3
    Update path to std_data, ../std_data_ln -> ../../std_data

  mysql-test/r/rpl_misc_functions.result@stripped, 2007-12-04 12:18:55+01:00,
msvensson@shellback.(none) +1 -1
    Update path to servers datadir

  mysql-test/r/rpl_ndb_innodb_trans.result@stripped, 2007-12-04 12:18:55+01:00,
msvensson@shellback.(none) +6 -6
    Update path to std_data, ../std_data_ln -> ../../std_data

  mysql-test/r/rpl_replicate_do.result@stripped, 2007-12-04 12:18:55+01:00,
msvensson@shellback.(none) +1 -1
    Update path to std_data, ../std_data_ln -> ../../std_data

  mysql-test/r/rpl_rewrite_db.result@stripped, 2007-12-04 12:18:55+01:00,
msvensson@shellback.(none) +6 -6
    Update path to std_data, ../std_data_ln -> ../../std_data

  mysql-test/r/rpl_timezone.result@stripped, 2007-12-04 12:18:55+01:00,
msvensson@shellback.(none) +1 -1
    Update path to std_data, ../std_data_ln -> ../../std_data

  mysql-test/r/sp.result@stripped, 2007-12-04 12:18:55+01:00, msvensson@shellback.(none) +2
-2
    Update path to tmp, ../tmp -> ../../tmp

  mysql-test/r/trigger.result@stripped, 2007-12-04 12:18:55+01:00, msvensson@shellback.(none)
+6 -6
    Update path to std_data, ../std_data_ln -> ../../std_data

  mysql-test/r/type_blob.result@stripped, 2007-12-04 12:18:55+01:00,
msvensson@shellback.(none) +10 -10
    Update path to std_data, ../std_data_ln -> ../../std_data

  mysql-test/r/view.result@stripped, 2007-12-04 12:18:55+01:00, msvensson@shellback.(none) +4
-4
    Update path to std_data, ../std_data_ln -> ../../std_data

  mysql-test/r/warnings.result@stripped, 2007-12-04 12:18:55+01:00, msvensson@shellback.(none)
+1 -1
    Update path to std_data, ../std_data_ln -> ../../std_data

  mysql-test/t/archive.test@stripped, 2007-12-04 12:18:55+01:00, msvensson@shellback.(none) +1
-1
    Update path to servers datadir

  mysql-test/t/backup.test@stripped, 2007-12-04 12:18:55+01:00, msvensson@shellback.(none) +12
-12
    Update path to tmp, ../tmp -> ../../tmp

  mysql-test/t/binlog_killed.test@stripped, 2007-12-04 12:18:55+01:00,
msvensson@shellback.(none) +1 -1
    Update path to servers log file

  mysql-test/t/blackhole.test@stripped, 2007-12-04 12:18:55+01:00, msvensson@shellback.(none)
+2 -2
    Update path to std_data, ../std_data_ln -> ../../std_data

  mysql-test/t/csv.test@stripped, 2007-12-04 12:18:55+01:00, msvensson@shellback.(none) +2 -2
    Update path to servers data dir

  mysql-test/t/ctype_big5.test@stripped, 2007-12-04 12:18:55+01:00, msvensson@shellback.(none)
+2 -2
    Update path to servers datadir

  mysql-test/t/ctype_ucs_binlog.test@stripped, 2007-12-04 12:18:55+01:00,
msvensson@shellback.(none) +1 -1
    Update path to servers log file

  mysql-test/t/federated.test@stripped, 2007-12-04 12:18:55+01:00, msvensson@shellback.(none)
+1 -1
    Update path to std_data, ../std_data_ln -> ../../std_data

  mysql-test/t/gis.test@stripped, 2007-12-04 12:18:55+01:00, msvensson@shellback.(none) +1 -1
    Update path to std_data, ../std_data_ln -> ../../std_data

  mysql-test/t/information_schema_chmod.test@stripped, 2007-12-04 12:18:55+01:00,
msvensson@shellback.(none) +2 -2
    Update path to servers datadir

  mysql-test/t/innodb.test@stripped, 2007-12-04 12:18:55+01:00, msvensson@shellback.(none) +6
-6
    Update path to servers datadir

  mysql-test/t/innodb_mysql.test@stripped, 2007-12-04 12:18:55+01:00,
msvensson@shellback.(none) +1 -1
    Update path to servers datadir

  mysql-test/t/loaddata.test@stripped, 2007-12-04 12:18:55+01:00, msvensson@shellback.(none)
+15 -15
    Update path to std_data, ../std_data_ln -> ../../std_data

  mysql-test/t/mix_innodb_myisam_binlog.test@stripped, 2007-12-04 12:18:55+01:00,
msvensson@shellback.(none) +1 -1
    Update path of servers log file

  mysql-test/t/myisam.test@stripped, 2007-12-04 12:18:55+01:00, msvensson@shellback.(none) +3
-3
    Update path of servers data dir

  mysql-test/t/mysql_upgrade.test@stripped, 2007-12-04 12:18:55+01:00,
msvensson@shellback.(none) +3 -3
    Update path of servers data dir

  mysql-test/t/mysqlbinlog-cp932.test@stripped, 2007-12-04 12:18:55+01:00,
msvensson@shellback.(none) +1 -1
    Update path to servers log file

  mysql-test/t/mysqlbinlog.test@stripped, 2007-12-04 12:18:55+01:00,
msvensson@shellback.(none) +23 -23
    Update path to std_data, ../std_data_ln -> ../../std_data
    Update path of servers datadir

  mysql-test/t/mysqlbinlog2.test@stripped, 2007-12-04 12:18:55+01:00,
msvensson@shellback.(none) +13 -13
    Update path of servers datadir

  mysql-test/t/ndb_autodiscover.test@stripped, 2007-12-04 12:18:55+01:00,
msvensson@shellback.(none) +17 -17
    UPdate path of servers datadir

  mysql-test/t/ndb_load.test@stripped, 2007-12-04 12:18:55+01:00, msvensson@shellback.(none) +5
-3
    Use path to load file in variable to simplify replace_result

  mysql-test/t/ndb_loaddatalocal.test@stripped, 2007-12-04 12:18:55+01:00,
msvensson@shellback.(none) +35 -22
    Load more than one record at a time
    Change path to servers datadir
    Use variable to hold the file to load

  mysql-test/t/ndb_replace.test@stripped, 2007-12-04 12:18:55+01:00, msvensson@shellback.(none)
+7 -2
    Use variable to hold the file name of load_file, simplifies replace_result

  mysql-test/t/ndb_single_user.test@stripped, 2007-12-04 12:18:55+01:00,
msvensson@shellback.(none) +6 -6
    Use $NDB_CONNECTSTRING instead of "localhost:$NDBCLUSTER_PORT"

  mysql-test/t/ndb_trigger.test@stripped, 2007-12-04 12:18:55+01:00, msvensson@shellback.(none)
+1 -1
    Update path to std_data, ../std_data_ln -> ../../std_data

  mysql-test/t/ps_1general.test@stripped, 2007-12-04 12:18:55+01:00,
msvensson@shellback.(none) +1 -1
    Update name of servers datadir

  mysql-test/t/query_cache.test@stripped, 2007-12-04 12:18:55+01:00,
msvensson@shellback.(none) +1 -1
    Rename std_data_ln to std_data

  mysql-test/t/repair.test@stripped, 2007-12-04 12:18:56+01:00, msvensson@shellback.(none) +1
-1
    Update path to servers datadir

  mysql-test/t/rpl000001.test@stripped, 2007-12-04 12:18:56+01:00, msvensson@shellback.(none)
+1 -1
    Update path to std_data, ../std_data_ln -> ../../std_data

  mysql-test/t/rpl000004.test@stripped, 2007-12-04 12:18:56+01:00, msvensson@shellback.(none)
+2 -2
    Update path to std_data, ../std_data_ln -> ../../std_data

  mysql-test/t/rpl000009.test@stripped, 2007-12-04 12:18:56+01:00, msvensson@shellback.(none)
+2 -2
    Rename servers datadir

  mysql-test/t/rpl000015-master.opt@stripped, 2007-12-04 12:18:56+01:00,
msvensson@shellback.(none) +1 -1
    Indicate which config template test should use

  mysql-test/t/rpl000015-slave.sh@stripped, 2007-12-04 12:18:56+01:00,
msvensson@shellback.(none) +1 -1
    Update path to servers datadir

  mysql-test/t/rpl000017-master.opt@stripped, 2007-12-04 12:18:56+01:00,
msvensson@shellback.(none) +1 -1
    Indicate which config template the test should use

  mysql-test/t/rpl000017-slave.sh@stripped, 2007-12-04 12:18:56+01:00,
msvensson@shellback.(none) +2 -2
    Update oathe to servers datadir

  mysql-test/t/rpl_EE_error.test@stripped, 2007-12-04 12:18:56+01:00,
msvensson@shellback.(none) +1 -1
    Update oathe to servers datadir

  mysql-test/t/rpl_charset.test@stripped, 2007-12-04 12:18:56+01:00,
msvensson@shellback.(none) +1 -1
    Update oathe to servers logfile

  mysql-test/t/rpl_drop_db.test@stripped, 2007-12-04 12:18:56+01:00,
msvensson@shellback.(none) +1 -1
    Update oathe to servers datadir

  mysql-test/t/rpl_flush_log_loop-master.opt@stripped, 2007-12-04 12:18:56+01:00,
msvensson@shellback.(none) +1 -1
    Update path to the realy log file

  mysql-test/t/rpl_flush_log_loop-master.sh@stripped, 2007-12-04 12:18:56+01:00,
msvensson@shellback.(none) +3 -3
    Update path to servers datadir

  mysql-test/t/rpl_flush_log_loop-slave.opt@stripped, 2007-12-04 12:18:56+01:00,
msvensson@shellback.(none) +1 -1
    Update path to the servers datadir

  mysql-test/t/rpl_flush_log_loop-slave.sh@stripped, 2007-12-04 12:18:56+01:00,
msvensson@shellback.(none) +3 -3
    Update pathe to the servers datadir

  mysql-test/t/rpl_innodb.test@stripped, 2007-12-04 12:18:56+01:00, msvensson@shellback.(none)
+2 -2
    Rename ../std_data_ln to ../../std_data

  mysql-test/t/rpl_loaddata.test@stripped, 2007-12-04 12:18:56+01:00,
msvensson@shellback.(none) +8 -8
    Rename ../std_data_ln to ../../std_data

  mysql-test/t/rpl_loaddata_charset.test@stripped, 2007-12-04 12:18:56+01:00,
msvensson@shellback.(none) +7 -7
    Rename ../std_data_ln to ../../std_data

  mysql-test/t/rpl_loaddata_rule_m.test@stripped, 2007-12-04 12:18:56+01:00,
msvensson@shellback.(none) +1 -1
    Rename ../std_data_ln to ../../std_data

  mysql-test/t/rpl_loaddata_rule_s.test@stripped, 2007-12-04 12:18:56+01:00,
msvensson@shellback.(none) +1 -1
    Rename ../std_data_ln to ../../std_data

  mysql-test/t/rpl_loaddatalocal.test@stripped, 2007-12-04 12:18:56+01:00,
msvensson@shellback.(none) +6 -6
    Rename path to servers datadir

  mysql-test/t/rpl_log.test@stripped, 2007-12-04 12:18:56+01:00, msvensson@shellback.(none) +1
-1
    Rename ../std_data_ln to ../../std_data

  mysql-test/t/rpl_misc_functions-slave.sh@stripped, 2007-12-04 12:18:56+01:00,
msvensson@shellback.(none) +1 -1
    Rename path of servers datadir

  mysql-test/t/rpl_misc_functions.test@stripped, 2007-12-04 12:18:56+01:00,
msvensson@shellback.(none) +1 -1
    Rename path to servers datadir

  mysql-test/t/rpl_ndb_innodb_trans.test@stripped, 2007-12-04 12:18:56+01:00,
msvensson@shellback.(none) +6 -6
    Rename ../std_data_ln to ../../std_data

  mysql-test/t/rpl_replicate_do.test@stripped, 2007-12-04 12:18:56+01:00,
msvensson@shellback.(none) +1 -1
    Rename ../std_data_ln to ../../std_data

  mysql-test/t/rpl_rewrite_db.test@stripped, 2007-12-04 12:18:56+01:00,
msvensson@shellback.(none) +6 -6
    Rename ../std_data_ln to ../../std_data

  mysql-test/t/rpl_rotate_logs.test@stripped, 2007-12-04 12:18:56+01:00,
msvensson@shellback.(none) +3 -3
    Renam path to servers datadir

  mysql-test/t/rpl_timezone.test@stripped, 2007-12-04 12:18:56+01:00,
msvensson@shellback.(none) +2 -2
    Rename path to servers log file

  mysql-test/t/rpl_trigger.test@stripped, 2007-12-04 12:18:56+01:00,
msvensson@shellback.(none) +1 -1
    Update path to servers datadir

  mysql-test/t/show_check.test@stripped, 2007-12-04 12:18:56+01:00, msvensson@shellback.(none)
+1 -1
    Update path to servers datadir

  mysql-test/t/sp-destruct.test@stripped, 2007-12-04 12:18:56+01:00, msvensson@shellback.(none)
+14 -14
    Rename file to servers datadir

  mysql-test/t/sp.test@stripped, 2007-12-04 12:18:56+01:00, msvensson@shellback.(none) +2 -2
    Rename ../tmp -> ../../tmp

  mysql-test/t/symlink.test@stripped, 2007-12-04 12:18:56+01:00, msvensson@shellback.(none) +3
-3
    Rename servers datadir

  mysql-test/t/trigger-compat.test@stripped, 2007-12-04 12:18:56+01:00,
msvensson@shellback.(none) +2 -2
    Update path to servers datadir

  mysql-test/t/trigger-grant.test@stripped, 2007-12-04 12:18:56+01:00,
msvensson@shellback.(none) +1 -1
    Rename servers datadir

  mysql-test/t/trigger.test@stripped, 2007-12-04 12:18:56+01:00, msvensson@shellback.(none)
+11 -11
    Rename servers datadir

  mysql-test/t/type_blob.test@stripped, 2007-12-04 12:18:56+01:00, msvensson@shellback.(none)
+8 -8
    Rename servers datadir

  mysql-test/t/type_varchar.test@stripped, 2007-12-04 12:18:56+01:00,
msvensson@shellback.(none) +3 -3
    Rename servers datadir

  mysql-test/t/user_var-binlog.test@stripped, 2007-12-04 12:18:56+01:00,
msvensson@shellback.(none) +1 -1
    Rename servers log file

  mysql-test/t/varbinary.test@stripped, 2007-12-04 12:18:56+01:00, msvensson@shellback.(none)
+6 -6
    Rename servers datadir

  mysql-test/t/view.test@stripped, 2007-12-04 12:18:56+01:00, msvensson@shellback.(none) +4
-4
    Rename servers datadir

  mysql-test/t/warnings.test@stripped, 2007-12-04 12:18:56+01:00, msvensson@shellback.(none)
+1 -1
    Rename servers datadir

diff -Nrup a/mysql-test/configs/default_mysqld.cnf b/mysql-test/configs/default_mysqld.cnf
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/mysql-test/configs/default_mysqld.cnf	2007-12-04 12:19:00 +01:00
@@ -0,0 +1,19 @@
+# Default values that applies to all MySQL Servers
+[mysqld]
+open-files-limit=           1024
+local-infile
+default-character-set=      latin1
+
+# Increase default connect_timeout to avoid intermittent
+# disconnects when test servers are put under load see BUG#28359
+connect-timeout=            60
+
+log-bin-trust-function-creators=1
+key_buffer_size=            1M
+sort_buffer=                256K
+max_heap_table_size=        1M
+
+innodb_data_file_path=      ibdata1:10M:autoextend
+
+
+
diff -Nrup a/mysql-test/configs/default_ndbd.cnf b/mysql-test/configs/default_ndbd.cnf
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/mysql-test/configs/default_ndbd.cnf	2007-12-04 12:19:00 +01:00
@@ -0,0 +1,22 @@
+
+
+[cluster_config]
+MaxNoOfSavedMessages=          1000
+NoOfReplicas=                  2
+MaxNoOfConcurrentTransactions= 64
+MaxNoOfConcurrentOperations=   10000
+DataMemory=                    40M
+
+IndexMemory=                   12M
+Diskless=                      0
+TimeBetweenWatchDogCheck=      30000
+MaxNoOfOrderedIndexes=         128
+MaxNoOfAttributes=             2048
+TimeBetweenGlobalCheckpoints=  500
+NoOfFragmentLogFiles=          3
+
+# Increase timeouts for slow test-machines
+HeartbeatIntervalDbDb=         30000
+HeartbeatIntervalDbApi=        30000
+
+#TransactionDeadlockDetectionTimeout= 7500
diff -Nrup a/mysql-test/configs/main.cnf b/mysql-test/configs/main.cnf
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/mysql-test/configs/main.cnf	2007-12-04 12:19:00 +01:00
@@ -0,0 +1,14 @@
+# Use default setting for mysqld processes
+!include default_mysqld.cnf
+
+[mysqld.1]
+
+# Run the master.sh script before starting this process
+#!run-master-sh
+
+log-bin=                 master-bin
+
+
+[ENV]
+MASTER_MYPORT=           @mysqld.1.port
+MASTER_MYSOCK=           @mysqld.1.socket
diff -Nrup a/mysql-test/configs/ndb.cnf b/mysql-test/configs/ndb.cnf
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/mysql-test/configs/ndb.cnf	2007-12-04 12:19:00 +01:00
@@ -0,0 +1,17 @@
+!include default_mysqld.cnf
+!include default_ndbd.cnf
+
+[cluster_config.1]
+mysqld=,
+ndbd=,
+
+
+# Make all mysqlds use cluster
+[mysqld]
+ndbcluster
+
+[ENV]
+NDB_CONNECTSTRING=         @mysql_cluster.1.ndb_connectstring
+MASTER_MYPORT=             @mysqld.1.port
+MASTER_MYPORT1=            @mysqld.2.port
+
diff -Nrup a/mysql-test/configs/rpl_1slave.cnf b/mysql-test/configs/rpl_1slave.cnf
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/mysql-test/configs/rpl_1slave.cnf	2007-12-04 12:19:00 +01:00
@@ -0,0 +1,11 @@
+# Use settings from rpl_1slave_raw.cnf
+# add setting to connect the slave to the master by default
+!include rpl_1slave_base.cnf
+
+[mysqld.2]
+master-host=              @mysqld.1.#host
+master-port=              @mysqld.1.port
+master-password=          @mysqld.1.#password
+master-user=              @mysqld.1.#user
+master-connect-retry=     1
+
diff -Nrup a/mysql-test/configs/rpl_1slave_base.cnf
b/mysql-test/configs/rpl_1slave_base.cnf
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/mysql-test/configs/rpl_1slave_base.cnf	2007-12-04 12:19:00 +01:00
@@ -0,0 +1,47 @@
+# Use settings for mysqld.1 from main.cnf
+!include main.cnf
+
+[mysqld.2]
+# Run the slave.sh script before starting this process
+#!run-slave-sh
+
+# Append <testname>-slave.opt file to the list of argument used when
+# starting the mysqld
+#!use-slave-opt
+
+# Force restart between each test case
+#!force-restart
+
+# Always install a fresh datadir before starting process
+#!fresh-datadir
+
+log-bin=                  slave-bin
+relay-log=                slave-relay-bin
+
+init-rpl-role=            slave
+log-slave-updates
+master-retry-count=       10
+
+# Values reported by slave when it connect to master
+# that shows up in SHOW SLAVE STATUS;
+report-host=              127.0.0.1
+report-port=              @mysqld.2.port
+report-user=              root
+
+skip-innodb
+skip-slave-start
+
+# Directory where slaves find the dumps generated by "load data"
+# on the server. The path need to have constant length otherwise
+# test results will vary, thus a relative path is used.
+slave-load-tmpdir=        ../../tmp
+
+set-variable=             slave_net_timeout=120
+
+rpl-recovery-rank=        @mysqld.2.server-id
+
+
+[ENV]
+SLAVE_MYPORT=           @mysqld.2.port
+SLAVE_MYSOCK=           @mysqld.2.socket
+
diff -Nrup a/mysql-test/include/analyze_failure_sync_with_master.test
b/mysql-test/include/analyze_failure_sync_with_master.test
--- a/mysql-test/include/analyze_failure_sync_with_master.test	2006-10-24 17:36:45 +02:00
+++ /dev/null	Wed Dec 31 16:00:00 196900
@@ -1,15 +0,0 @@
-# Connect to both master and slave
-connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,);
-connect (slave,127.0.0.1,root,,test,$SLAVE_MYPORT,);
-
-vertical_results;
-
-echo == MASTER ===========================================================;
-connection master;
-show master status;
-show slave status;
-
-echo == SLAVE ===========================================================;
-connection slave;
-show master status;
-show slave status;
diff -Nrup a/mysql-test/include/loaddata_autocom.inc
b/mysql-test/include/loaddata_autocom.inc
--- a/mysql-test/include/loaddata_autocom.inc	2006-09-05 16:52:03 +02:00
+++ b/mysql-test/include/loaddata_autocom.inc	2007-12-04 12:18:54 +01:00
@@ -7,14 +7,18 @@ eval SET SESSION STORAGE_ENGINE = $engin
 drop table if exists t1;
 --enable_warnings
 
+let $load_file= $MYSQLTEST_VARDIR/std_data/loaddata2.dat;
+
 create table t1 (a text, b text);
 start transaction;
-load data infile '../std_data_ln/loaddata2.dat' into table t1 fields terminated by ','
enclosed by '''';
+replace_result $load_file LOAD_FILE;
+eval load data infile '$load_file' into table t1 fields terminated by ',' enclosed by
'''';
 commit;
 select count(*) from t1;
 truncate table t1;
 start transaction;
-load data infile '../std_data_ln/loaddata2.dat' into table t1 fields terminated by ','
enclosed by '''';
+replace_result $load_file LOAD_FILE;
+eval load data infile '$load_file' into table t1 fields terminated by ',' enclosed by
'''';
 rollback;
 select count(*) from t1;
 
diff -Nrup a/mysql-test/include/ndb_backup.inc b/mysql-test/include/ndb_backup.inc
--- a/mysql-test/include/ndb_backup.inc	2007-03-07 07:19:28 +01:00
+++ b/mysql-test/include/ndb_backup.inc	2007-12-04 12:18:54 +01:00
@@ -2,11 +2,11 @@
 # By JBM 2006-02-16 So that the code is not repeated #
 # in test cases and can be reused.                   #
 ######################################################
---exec $NDB_MGM --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -e "start
backup" >> $NDB_TOOLS_OUTPUT
+--exec $NDB_MGM --no-defaults --ndb-connectstring=$NDB_CONNECTSTRING -e "start backup"
>> $NDB_TOOLS_OUTPUT
 
 # there is no neat way to find the backupid, this is a hack to find it...
 
---exec $NDB_TOOLS_DIR/ndb_select_all --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -d
sys --delimiter=',' SYSTAB_0 | grep 520093696 > $MYSQLTEST_VARDIR/tmp.dat
+--exec $NDB_TOOLS_DIR/ndb_select_all --ndb-connectstring=$NDB_CONNECTSTRING -d sys
--delimiter=',' SYSTAB_0 | grep 520093696 > $MYSQLTEST_VARDIR/tmp.dat
 
 CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE =
HEAP;
 
diff -Nrup a/mysql-test/lib/My/Config.pm b/mysql-test/lib/My/Config.pm
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/mysql-test/lib/My/Config.pm	2007-12-04 12:19:00 +01:00
@@ -0,0 +1,450 @@
+# -*- cperl -*-
+
+package My::Config::Option;
+
+use strict;
+use warnings;
+use Carp;
+
+
+sub new {
+  my ($class, $option_name, $option_value)= @_;
+  my $self= bless { name => $option_name,
+		    value => $option_value
+		  }, $class;
+  return $self;
+}
+
+
+sub name {
+  my ($self)= @_;
+  return $self->{name};
+}
+
+
+sub value {
+  my ($self)= @_;
+  return $self->{value};
+}
+
+
+package My::Config::Group;
+
+use strict;
+use warnings;
+use Carp;
+
+sub new {
+  my ($class, $group_name)= @_;
+  my $self= bless { name => $group_name,
+		    options => [],
+		    options_by_name => {},
+		  }, $class;
+  return $self;
+}
+
+
+sub insert {
+  my ($self, $option_name, $value, $if_not_exist)= @_;
+  my $option= $self->option($option_name);
+  if (defined($option) and !$if_not_exist) {
+    $option->{value}= $value;
+  }
+  else {
+    my $option= My::Config::Option->new($option_name, $value);
+    # Insert option in list
+    push(@{$self->{options}}, $option);
+    # Insert option in hash
+    $self->{options_by_name}->{$option_name}= $option;
+  }
+  return $option;
+}
+
+sub remove {
+  my ($self, $option_name)= @_;
+
+  # Check that option exists
+  my $option= $self->option($option_name);
+
+  return undef unless defined $option;
+
+  # Remove from the hash
+  delete($self->{options_by_name}->{$option_name}) or croak;
+
+  # Remove from the array
+  @{$self->{options}}= grep { $_->name ne $option_name } @{$self->{options}};
+
+  return $option;
+}
+
+
+sub options {
+  my ($self)= @_;
+  return @{$self->{options}};
+}
+
+
+sub name {
+  my ($self)= @_;
+  return $self->{name};
+}
+
+sub suffix {
+  my ($self)= @_;
+  # Everything in name from the last .
+  my @parts= split(/\./, $self->{name});
+  my $suffix= pop(@parts);
+  return ".$suffix";
+}
+
+sub split {
+  my ($self)= @_;
+  # Return an array with name parts
+  return split(/\./, $self->{name});
+}
+
+#
+# Return a specific option in the group
+#
+sub option {
+  my ($self, $option_name)= @_;
+
+  return $self->{options_by_name}->{$option_name};
+}
+
+
+#
+# Return value for an option in the group, fail if it does not exist
+#
+sub value {
+  my ($self, $option_name)= @_;
+  my $option= $self->option($option_name);
+
+  croak "No option named '$option_name' in this group"
+    if ! defined($option);
+
+  return $option->value();
+}
+
+
+#
+# Return value for an option if it exist
+#
+sub if_exist {
+  my ($self, $option_name)= @_;
+  my $option= $self->option($option_name);
+
+  return undef if ! defined($option);
+
+  return $option->value();
+}
+
+
+package My::Config;
+
+use strict;
+use warnings;
+use Carp;
+use IO::File;
+use File::Basename;
+
+#
+# Constructor for My::Config
+# - represents a my.cnf config file
+#
+# Array of arrays
+#
+sub new {
+  my ($class, $path)= @_;
+  my $group_name= undef;
+
+  my $self= bless { groups => [] }, $class;
+  my $F= IO::File->new($path, "<")
+    or croak "Could not open '$path': $!";
+
+  while (  my $line= <$F> ) {
+    chomp($line);
+
+    # [group]
+    if ( $line =~ /^\[(.*)\]/ ) {
+      # New group found
+      $group_name= $1;
+      #print "group: $group_name\n";
+
+      $self->insert($group_name, undef, undef);
+    }
+
+    # Magic #! comments
+    elsif ( $line =~ /^#\!/) {
+      my $magic= $line;
+      croak "Found magic comment '$magic' outside of group"
+	unless $group_name;
+
+      #print "$magic\n";
+      $self->insert($group_name, $magic, undef);
+    }
+
+    # Comments
+    elsif ( $line =~ /^#/ || $line =~ /^;/) {
+      # Skip comment
+      next;
+    }
+
+    # Empty lines
+    elsif ( $line =~ /^$/ ) {
+      # Skip empty lines
+      next;
+    }
+
+    # !include <filename>
+    elsif ( $line =~ /^\!include\s*(.*?)\s*$/ ) {
+      my $include_file_name= dirname($path)."/".$1;
+      # Check that the file exists
+      croak "The include file '$include_file_name' does not exist"
+	unless -f $include_file_name;
+
+      $self->append(My::Config->new($include_file_name));
+    }
+
+    # <option>
+    elsif ( $line =~ /^([\@\w-]+)\s*$/ ) {
+      my $option= $1;
+
+      croak "Found option '$option' outside of group"
+	unless $group_name;
+
+      #print "$option\n";
+      $self->insert($group_name, $option, undef);
+    }
+
+    # <option>=<value>
+    elsif ( $line =~ /^([\@\w-]+)\s*=\s*(.*?)\s*$/ ) {
+      my $option= $1;
+      my $value= $2;
+
+      croak "Found option '$option=$value' outside of group"
+	unless $group_name;
+
+      #print "$option=$value\n";
+      $self->insert($group_name, $option, $value);
+    } else {
+      croak "Unexpected line '$line' found in '$path'";
+    }
+
+  }
+  undef $F;			# Close the file
+
+  return $self;
+}
+
+#
+# Insert a new group if it does not already exist
+# and add option if defined
+#
+sub insert {
+  my ($self, $group_name, $option, $value, $if_not_exist)= @_;
+  my $group;
+
+  # Create empty array for the group if it doesn't exist
+  if ( !$self->group_exists($group_name) ) {
+    $group= $self->_group_insert($group_name);
+  }
+  else {
+    $group= $self->group($group_name);
+  }
+
+  if ( defined $option ) {
+    #print "option: $option, value: $value\n";
+
+    # Add the option to the group
+    $group->insert($option, $value, $if_not_exist);
+  }
+}
+
+#
+# Remove a option, given group and option name
+#
+sub remove {
+  my ($self, $group_name, $option_name)= @_;
+  my $group= $self->group($group_name);
+
+  croak "group '$group_name' does not exist"
+    unless defined($group);
+
+  $group->remove($option_name) or
+    croak "option '$option_name' does not exist";
+}
+
+
+
+#
+# Check if group with given name exists in config
+#
+sub group_exists {
+  my ($self, $group_name)= @_;
+
+  foreach my $group ($self->groups()) {
+    return 1 if $group->{name} eq $group_name;
+  }
+  return 0;
+}
+
+
+#
+# Insert a new group into config
+#
+sub _group_insert {
+  my ($self, $group_name)= @_;
+  caller eq __PACKAGE__ or croak;
+
+  # Check that group does not already exist
+  croak "Group already exists" if $self->group_exists($group_name);
+
+  my $group= My::Config::Group->new($group_name);
+  push(@{$self->{groups}}, $group);
+  return $group;
+}
+
+
+#
+# Append a configuration to current config
+#
+sub append {
+  my ($self, $from)= @_;
+
+  foreach my $group ($from->groups()) {
+    foreach my $option ($group->options()) {
+      $self->insert($group->name(), $option->name(), $option->value());
+    }
+
+  }
+}
+
+
+#
+# Return a list with all the groups in config
+#
+sub groups {
+  my ($self)= @_;
+  return ( @{$self->{groups}} );
+}
+
+
+#
+# Return a list of all the groups in config
+# starting with the given string
+#
+sub like {
+  my ($self, $prefix)= @_;
+  return ( grep ( $_->{name} =~ /^$prefix/, $self->groups()) );
+}
+
+
+#
+# Return the first group in config
+# starting with the given string
+#
+sub first_like {
+  my ($self, $prefix)= @_;
+  return ($self->like($prefix))[0];
+}
+
+
+#
+# Return a specific group in the config
+#
+sub group {
+  my ($self, $group_name)= @_;
+
+  foreach my $group ( $self->groups() ) {
+    return $group if $group->{name} eq $group_name;
+  }
+  return undef;
+}
+
+
+#
+# Return a list of all options in a specific group in the config
+#
+sub options_in_group {
+  my ($self, $group_name)= @_;
+
+  my $group= $self->group($group_name);
+  return () unless defined $group;
+  return $group->options();
+}
+
+
+#
+# Return a value given group and option name
+#
+sub value {
+  my ($self, $group_name, $option_name)= @_;
+  my $group= $self->group($group_name);
+
+  croak "group '$group_name' does not exist"
+    unless defined($group);
+
+  my $option= $group->option($option_name);
+  croak "option '$option_name' does not exist"
+    unless defined($option);
+
+  return $option->value();
+}
+
+
+#
+# Check if an option exists
+#
+sub exists {
+  my ($self, $group_name, $option_name)= @_;
+  my $group= $self->group($group_name);
+
+  croak "group '$group_name' does not exist"
+    unless defined($group);
+
+  my $option= $group->option($option_name);
+  return defined($option);
+}
+
+
+# Overload "to string"-operator with 'stringify'
+use overload
+    '""' => \&stringify;
+
+#
+# Return the config as a string in my.cnf file format
+#
+sub stringify {
+  my ($self)= @_;
+  my $res;
+
+  foreach my $group ($self->groups()) {
+    $res .= "[$group->{name}]\n";
+
+    foreach my $option ($group->options()) {
+      $res .= $option->name();
+      my $value= $option->value();
+      if (defined $value) {
+	$res .= "=$value";
+      }
+      $res .= "\n";
+    }
+    $res .= "\n";
+  }
+  return $res;
+}
+
+
+#
+# Save the config to named file
+#
+sub save {
+  my ($self, $path)= @_;
+  my $F= IO::File->new($path, ">")
+    or croak "Could not open '$path': $!";
+  print $F $self;
+  undef $F; # Close the file
+}
+
+1;
diff -Nrup a/mysql-test/lib/My/ConfigFactory.pm b/mysql-test/lib/My/ConfigFactory.pm
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/mysql-test/lib/My/ConfigFactory.pm	2007-12-04 12:19:00 +01:00
@@ -0,0 +1,481 @@
+# -*- cperl -*-
+package My::ConfigFactory;
+
+use strict;
+use warnings;
+use Carp;
+
+use My::Config;
+use My::Find;
+
+use File::Basename;
+
+
+#
+# Rules to run first of all
+#
+my @pre_rules=
+(
+);
+
+
+my @share_locations= ("share/mysql", "sql/share", "share");
+
+sub fix_charset_dir {
+  my ($self, $config, $group_name, $group)= @_;
+  my $basedir= $group->if_exist('basedir') ||
+    $self->{ARGS}->{basedir};
+  return my_find_dir($basedir, \@share_locations, "charsets");
+}
+
+sub fix_language {
+  my ($self, $config, $group_name, $group)= @_;
+  my $basedir= $group->if_exist('basedir') ||
+    $self->{ARGS}->{basedir};
+  return my_find_dir($basedir, \@share_locations, "english");
+}
+
+sub fix_datadir {
+  my ($self, $config, $group_name)= @_;
+  my $vardir= $self->{ARGS}->{vardir};
+  return "$vardir/$group_name/data";
+}
+
+sub fix_pidfile {
+  my ($self, $config, $group_name, $group)= @_;
+  my $vardir= $self->{ARGS}->{vardir};
+  return "$vardir/run/$group_name.pid";
+}
+
+sub fix_port {
+  my ($self, $config, $group_name, $group)= @_;
+  my $hostname= $group->value('#host');
+  return $self->{HOSTS}->{$hostname}++;
+}
+
+sub fix_host {
+  my ($self)= @_;
+  # Get next host from HOSTS array
+  my @hosts= keys(%{$self->{HOSTS}});;
+  my $host_no= $self->{NEXT_HOST}++ % @hosts;
+  return $hosts[$host_no];
+}
+
+sub fix_socket {
+  my ($self, $config, $group_name, $group)= @_;
+  # Put socket file in tmpdir
+  my $dir= $group->value('tmpdir');
+  return "$dir/$group_name.sock";
+}
+
+sub fix_log_error {
+  my ($self, $config, $group_name, $group)= @_;
+  my $dir= dirname($group->value('datadir'));
+  return "$dir/mysqld.err";
+}
+
+sub fix_log {
+  my ($self, $config, $group_name, $group)= @_;
+  my $dir= dirname($group->value('datadir'));
+  return "$dir/mysqld.log";
+}
+
+sub fix_log_slow_queries {
+  my ($self, $config, $group_name, $group)= @_;
+  my $dir= dirname($group->value('datadir'));
+  return "$dir/mysqld-slow.log";
+}
+
+sub fix_secure_file_priv {
+  my ($self)= @_;
+  my $vardir= $self->{ARGS}->{vardir};
+  # By default, prevent the started mysqld to access files outside of vardir
+  return $vardir;
+}
+
+sub fix_std_data {
+  my ($self)= @_;
+  my $basedir= $self->{ARGS}->{basedir};
+  return "$basedir/mysql-test/std_data";
+}
+
+sub fix_ssl_ca {
+  my $std_data= fix_std_data(@_);
+  return "$std_data/cacert.pem"
+}
+
+sub fix_ssl_server_cert {
+  my $std_data= fix_std_data(@_);
+  return "$std_data/server-cert.pem"
+}
+
+sub fix_ssl_server_key {
+  my $std_data= fix_std_data(@_);
+  return "$std_data/server-key.pem"
+}
+
+
+#
+# Rules to run for each mysqld in the config
+#  - will be run in order listed here
+#
+my @mysqld_rules=
+  (
+ { 'basedir' => sub { return shift->{ARGS}->{basedir}; } },
+ { 'tmpdir' => sub { return shift->{ARGS}->{tmpdir}; } },
+ { 'character-sets-dir' => \&fix_charset_dir },
+ { 'language' => \&fix_language },
+ { 'datadir' => \&fix_datadir },
+ { 'pid-file' => \&fix_pidfile },
+ { '#host' => \&fix_host },
+ { 'port' => \&fix_port },
+ { 'socket' => \&fix_socket },
+ { 'log-error' => \&fix_log_error },
+ { 'log' => \&fix_log },
+ { 'log-slow-queries' => \&fix_log_slow_queries },
+ { '#user' => sub { return shift->{ARGS}->{user} || ""; } },
+ { '#password' => sub { return shift->{ARGS}->{password} || ""; } },
+ { 'server-id' => sub { return shift->{SERVER_ID}++; } },
+ # By default, prevent the started mysqld to access files outside of vardir
+ { 'secure-file-priv' => sub { return shift->{ARGS}->{vardir}; } },
+ { 'loose-ssl-ca' => \&fix_ssl_ca },
+ { 'loose-ssl-cert' => \&fix_ssl_server_cert },
+ { 'loose-ssl-key' => \&fix_ssl_server_key },
+  );
+
+sub fix_ndb_mgmd_port {
+  my ($self, $config, $group_name, $group)= @_;
+  my $hostname= $group->value('HostName');
+  return $self->{HOSTS}->{$hostname}++;
+}
+
+sub fix_cluster_dir {
+  my ($self, $config, $group_name, $group)= @_;
+  my $vardir= $self->{ARGS}->{vardir};
+  my (undef, $process_type, $idx, $suffix)= split(/\./, $group_name);
+  return "$vardir/mysql_cluster.$suffix/$process_type.$idx";
+}
+
+
+#
+# Rules to run for each ndb_mgmd in the config
+#  - will be run in order listed here
+#
+my @ndb_mgmd_rules=
+(
+ { 'PortNumber' => \&fix_ndb_mgmd_port },
+ { 'DataDir' => \&fix_cluster_dir },
+);
+
+
+#
+# Rules to run for each ndbd in the config
+#  - will be run in order listed here
+#
+my @ndbd_rules=
+(
+ { 'HostName' => \&fix_host },
+ { 'DataDir' => \&fix_cluster_dir },
+);
+
+
+#
+# Rules to run for each cluster_config section
+#  - will be run in order listed here
+#
+my @cluster_config_rules=
+(
+ { 'ndbd' => \&fix_host },
+ { 'ndb_mgmd' => \&fix_host },
+ { 'mysqld' => \&fix_host },
+ { 'ndbapi' => \&fix_host },
+);
+
+
+#
+# Generate a [client.<suffix>] group pointing to be
+# used for connecting to [mysqld.<suffix>]
+#
+sub post_check_client_group {
+  my ($self, $config, $client_group_name, $mysqld_group_name)= @_;
+
+  #  Settings needed for client, copied from its "mysqld"
+  my %client_needs=
+    (
+     port       => 'port',
+     socket     => 'socket',
+     host       => '#host',
+     user       => '#user',
+     password   => '#password',
+    );
+
+  my $group_to_copy_from= $config->group($mysqld_group_name);
+  while (my ($name_to, $name_from)= each( %client_needs )) {
+    my $option= $group_to_copy_from->option($name_from);
+
+    if (! defined $option){
+      #print $config;
+      croak "Could not get value for '$name_from'";
+    }
+    $config->insert($client_group_name, $name_to, $option->value())
+  }
+}
+
+
+sub post_check_client_groups {
+ my ($self, $config)= @_;
+
+ my $first_mysqld= $config->first_like('mysqld.');
+
+ return unless $first_mysqld;
+
+ # Always generate [client] pointing to the first
+ # [mysqld.<suffix>]
+ $self->post_check_client_group($config,
+				'client',
+				$first_mysqld->name());
+
+ # Then generate [client.<suffix>] for each [mysqld.<suffix>]
+ foreach my $mysqld ( $config->like('mysqld.') ) {
+   $self->post_check_client_group($config,
+				  'client'.$mysqld->suffix(),
+				  $mysqld->name())
+ }
+
+}
+
+
+# MASV
+# Add setting  to [client] that all clients will use
+#
+#sub post_fix_client {
+#  my ($self, $config)= @_;
+#
+#  my %client=
+#    (
+#     'loose-ssl-ca'       => \&fix_ssl_ca,
+#     'loose-ssl-cert'     => \&fix_ssl_client_cert,
+#     'loose-ssl-key'      => \&fix_ssl_client_key,
+#    );
+#
+#}
+
+
+sub resolve_at_variable {
+  my ($self, $config, $group, $option)= @_;
+
+  # Split the options value on last .
+  my @parts= split(/\./, $option->value());
+  my $option_name= pop(@parts);
+  my $group_name=  join('.', @parts);
+
+  $group_name =~ s/^\@//; # Remove at
+
+  my $from_group= $config->group($group_name)
+    or die "There is no group named '$group_name' that ",
+      "can be used to resolve '$option_name'";
+
+  my $from= $from_group->value($option_name);
+  $config->insert($group->name(), $option->name(), $from)
+}
+
+
+sub post_fix_resolve_at_variables {
+  my ($self, $config)= @_;
+
+  foreach my $group ( $config->groups() ) {
+    foreach my $option ( $group->options()) {
+      next unless defined $option->value();
+
+      $self->resolve_at_variable($config, $group, $option)
+	if ($option->value() =~ /^\@/);
+    }
+  }
+}
+
+sub post_fix_mysql_cluster_section {
+  my ($self, $config)= @_;
+
+  # Add a [mysl_cluster.<suffix>] section for each
+  # defined [cluster_config.<suffix>] section
+  foreach my $group ( $config->like('cluster_config.') )
+  {
+    my @urls;
+    # Generate ndb_connectstring for this cluster
+    foreach my $ndb_mgmd ( $config->like('cluster_config.ndb_mgmd.')) {
+      if ($ndb_mgmd->suffix() eq $group->suffix()) {
+	my $host= $ndb_mgmd->value('HostName');
+	my $port= $ndb_mgmd->value('PortNumber');
+	push(@urls, "$host:$port");
+      }
+    }
+    die "Could not generate valid ndb_connectstring for '$group'"
+      unless @urls > 0;
+    my $ndb_connectstring= join(";", @urls);
+
+    # Add ndb_connectstring to [mysql_cluster.<suffix>]
+    $config->insert('mysql_cluster'.$group->suffix(),
+		    'ndb_connectstring', $ndb_connectstring);
+
+    # Add ndb_connectstring to each mysqld connected to this
+    # cluster
+    foreach my $mysqld ( $config->like('cluster_config.mysqld.')) {
+      if ($mysqld->suffix() eq $group->suffix()) {
+	my (undef, $process_type, $idx, $suffix)= $mysqld->split();
+	$config->insert("$process_type.$idx",
+			'ndb_connectstring', $ndb_connectstring);
+      }
+    }
+  }
+}
+
+#
+# Rules to run last of all
+#
+my @post_rules=
+(
+ \&post_check_client_groups,
+# \&post_fix_client,
+ \&post_fix_mysql_cluster_section,
+ \&post_fix_resolve_at_variables,
+);
+
+
+sub run_section_rules {
+  my ($self, $config, $name, @rules)= @_;
+
+  foreach my $group ( $config->like($name) ) {
+    foreach my $hash ( @rules ) {
+      while (my ($option, $rule)= each( %{$hash} )) {
+	# Only run this rule if the value is not already defined
+	if (!$config->exists($group->name(), $option)) {
+	  my $value;
+	  if (ref $rule eq "CODE") {
+	    # Call the rule function
+	    $value= &$rule($self, $config, $group->name(),
+			   $config->group($group->name()));
+	  } else {
+	    $value= $rule;
+	  }
+	  if (defined $value) {
+	    $config->insert($group->name(), $option, $value, 1);
+	  }
+	}
+      }
+    }
+  }
+}
+
+sub run_generate_sections_from_cluster_config {
+  my ($self, $config)= @_;
+
+  my @options= ('ndb_mgmd', 'ndbd',
+		'mysqld', 'ndbapi');
+
+  # Keep track of current index per process type
+  my %idxes;
+  map { $idxes{$_}= 1; } @options;
+
+  foreach my $group ( $config->like('cluster_config.') ) {
+    foreach my $option_name ( @options ) {
+      my $value= $group->value($option_name);
+      my @hosts= split(/,/, $value, -1); # -1 => retur also empty strings
+
+      # Assign hosts unless already fixed
+      @hosts= map { $self->fix_host() unless $_; } @hosts;
+
+      # Write the hosts value back
+      $group->insert($option_name, join(",", @hosts));
+
+      # Generate sections for each host
+      foreach my $host ( @hosts ){
+	my $idx= $idxes{$option_name}++;
+
+	my $suffix= $group->suffix();
+	# Generate a section for ndb_mgmd to read
+	$config->insert("cluster_config.$option_name.$idx$suffix",
+			"HostName", $host);
+
+	if ($option_name eq 'mysqld'){
+	  my $datadir=
+	    $self->fix_cluster_dir($config,
+				   "cluster_config.mysqld.$idx$suffix",
+				   $group);
+	  $config->insert("$option_name.$idx",
+			  'datadir', "$datadir/data");
+	}
+      }
+    }
+  }
+}
+
+
+sub new_config {
+  my ($class, $args)= @_;
+
+  my @required_args= ('basedir', 'baseport', 'vardir', 'template_path');
+
+  foreach my $required ( @required_args ) {
+    croak "you must pass '$required'" unless defined $args->{$required};
+  }
+
+  # Fill in hosts/port hash
+  my $hosts= {};
+  my $baseport= $args->{baseport};
+  $args->{hosts}= [ 'localhost' ] unless exists($args->{hosts});
+  foreach my $host ( @{$args->{hosts}} ) {
+     $hosts->{$host}= $baseport;
+  }
+
+  # Open the config template
+  my $config= My::Config->new($args->{'template_path'});
+  my $extra_template_path= $args->{'extra_template_path'};
+  if ($extra_template_path){
+    $config->append(My::Config->new($extra_template_path));
+  }
+  my $self= bless {
+		   CONFIG       => $config,
+		   ARGS         => $args,
+		   HOSTS        => $hosts,
+		   NEXT_HOST    => 0,
+		   SERVER_ID    => 1,
+		  }, $class;
+
+
+  {
+    # Run pre rules
+    foreach my $rule ( @pre_rules ) {
+      &$rule($self, $config);
+    }
+  }
+
+
+  $self->run_section_rules($config,
+			   'cluster_config.',
+			   @cluster_config_rules);
+  $self->run_generate_sections_from_cluster_config($config);
+
+  $self->run_section_rules($config,
+			   'cluster_config.ndb_mgmd.',
+			   @ndb_mgmd_rules);
+  $self->run_section_rules($config,
+			   'cluster_config.ndbd',
+			   @ndbd_rules);
+
+  $self->run_section_rules($config,
+			   'mysqld.',
+			   @mysqld_rules);
+
+  {
+    # Run post rules
+    foreach my $rule ( @post_rules ) {
+      &$rule($self, $config);
+    }
+  }
+
+  return $config;
+}
+
+
+1;
+
diff -Nrup a/mysql-test/lib/My/CpcClient.pm b/mysql-test/lib/My/CpcClient.pm
--- a/mysql-test/lib/My/CpcClient.pm	2007-10-16 16:20:19 +02:00
+++ b/mysql-test/lib/My/CpcClient.pm	2007-12-04 12:18:54 +01:00
@@ -1,14 +1,11 @@
 # -*- cperl -*-
-package CpcClient;
+package My::CpcClient;
 
-use base qw(IO::Socket::INET);
+use base qw(My::SocketClient);
 
 use warnings;
 use strict;
 
-# Print commands and replies sent to and received from cpcd
-my $opt_log_io= 1;
-
 
 #
 # Create a new CpcClient that inherits everything
@@ -188,121 +185,5 @@ sub list_processes {
   return $process_list;
 }
 
-#############################################################
-#
-# Private helper functions
-#
-#############################################################
-
-#
-# Send one line to the cpcd, print command if logging is on
-#
-# Returns
-# - Number of characters sent
-#
-sub _send_line {
-  my $self = shift;
-  print ">> ", @_ if $opt_log_io; # Print what is being sent
-  return $self->send(@_);
-}
-
-
-#
-# Send a complete command
-# Returns
-#  - 1 if ok
-#  - -1 if send fails
-#
-sub _send_command {
-  my ($self, $command, $args) = @_;
-
-  # Send the command
-  if ($self->_send_line("$command\n") <= 0 ) {
-    warn("Could not send '$command': $!");
-    return -1;
-  }
-
-  # Send the args
-  foreach my $key (keys %{$args}) {
-    next unless defined $args->{$key};
-    if ($self->_send_line("$key: $args->{$key}\n") <= 0 ) {
-      warn("Could not send '$key' for '$command': $!");
-      return -1;
-    }
-  }
-
-  # Send command terminator(empty new line)
-  if ($self->_send_line("\n") <= 0 ) {
-    warn("Could not send command terminator for '$command': $!");
-    return -1;
-  }
-  return 1;
-}
-
-
-#
-# Read a complete command
-#
-# Returns
-#  - "name of reply" which usually is the same as sent command
-#  - undef if error occured
-#
-sub _read_reply {
-  my ($self, $return_values)= @_;
-
-  # First line of reply is the command echoed back,
-  # return that from funcgtion if all goes well
-  my $reply= <$self>;
-  if (! defined($reply) ) {
-    warn("Could not read reply: $!");
-    return undef;
-  }
-  print "<< ", $reply if $opt_log_io;
-  chomp($reply);
-
-  # Read the : separated key value pairs until a
-  # single newline on it's own line
-  my $line;
-  while (defined($line= <$self>)) {
-    print "<< ", $line if $opt_log_io;
-
-    # List is terminated by newline on it's own
-    if ($line eq "\n") {
-      # Correctly terminated reply
-      return $reply;
-    }
-
-    chomp($line);
-
-    # Split key/value on the first ":"
-    my ($key, $value)= split(": ", $line, 2);
-    $return_values->{$key}= $value;
-  }
-
-  return undef;
-}
-
-
-#
-# Helper for simple commands, send and receive
-# - Returns a hash with result of the command or
-#   undef if anything fails
-#
-sub _simple_command {
-    my ($self, $command, $args)= @_;
-    my $return_values= {};
-
-    if ($self->_send_command($command, $args) <= 0) {
-      return undef;
-    }
-
-    my $reply;
-    if (defined($reply= $self->_read_reply($return_values)) and
-	$reply ne $command ) {
-      return undef;
-    }
-
-    return $return_values;
-}
 
 1;
diff -Nrup a/mysql-test/lib/My/File/Path.pm b/mysql-test/lib/My/File/Path.pm
--- a/mysql-test/lib/My/File/Path.pm	2007-09-17 10:46:10 +02:00
+++ b/mysql-test/lib/My/File/Path.pm	2007-12-04 12:18:54 +01:00
@@ -18,11 +18,13 @@ use strict;
 
 use Exporter;
 use base "Exporter";
-our @EXPORT= qw / rmtree mkpath /;
+our @EXPORT= qw / rmtree mkpath copytree /;
 
 
 use File::Find;
 use File::Path;
+use File::Copy;
+use Carp;
 
 no warnings 'redefine';
 
@@ -42,6 +44,7 @@ sub rmtree {
 	$dir
       );
 
+
   # Call rmtree from File::Path
   goto &File::Path::rmtree;
 };
@@ -50,5 +53,31 @@ sub rmtree {
 sub mkpath {
   goto &File::Path::mkpath;
 };
+
+
+sub copytree {
+  my ($from_dir, $to_dir) = @_;
+
+  die "Usage: copytree(<fromdir>, <todir>" unless @_ == 2;
+
+  mkpath("$to_dir");
+  opendir(DIR, "$from_dir")
+    or croak("Can't find $from_dir$!");
+  for(readdir(DIR)) {
+
+    next if "$_" eq "." or "$_" eq "..";
+
+    # Skip SCCS/ directories
+    next if "$_" eq "SCCS";
+
+    if ( -d "$from_dir/$_" )
+    {
+      copytree("$from_dir/$_", "$to_dir/$_");
+      next;
+    }
+    copy("$from_dir/$_", "$to_dir/$_");
+  }
+  closedir(DIR);
+}
 
 1;
diff -Nrup a/mysql-test/lib/My/Find.pm b/mysql-test/lib/My/Find.pm
--- a/mysql-test/lib/My/Find.pm	2007-11-08 12:15:34 +01:00
+++ b/mysql-test/lib/My/Find.pm	2007-12-04 12:18:54 +01:00
@@ -24,7 +24,9 @@ package My::Find;
 use strict;
 
 use base qw(Exporter);
-our @EXPORT= qw(my_find_bin);
+our @EXPORT= qw(my_find_bin my_find_dir);
+
+our $vs_config_dir;
 
 my $is_win= ($^O eq "MSWin32" or $^O eq "Win32");
 
@@ -33,31 +35,64 @@ my $is_win= ($^O eq "MSWin32" or $^O eq 
 # paths "path_1...path_n" and return the full path
 #
 # Example:
-#    my $mysqld_exe= my_find_bin(["sql", "bin"],
+#    my $mysqld_exe= my_find_bin($basedir.
+#                                ["sql", "bin"],
 #                                ["mysqld", "mysqld-debug"]);
-#    my $mysql_exe= my_find_bin(["client", "bin"],
+#    my $mysql_exe= my_find_bin($basedir,
+#                               ["client", "bin"],
 #                               "mysql");
 #
 # NOTE: The function honours MTR_VS_CONFIG environment variable
 #
 #
 sub my_find_bin {
-  my ($paths, $names)= @_;
-  die "usage: my_find_bin(<paths>, <names>)"
-    unless @_ == 2;
+  my ($base, $paths, $names)= @_;
+  die "usage: my_find_bin(<base>, <paths>, <names>)"
+    unless @_ == 3;
 
   # -------------------------------------------------------
   # Find and return the first executable
   # -------------------------------------------------------
-  foreach my $path (my_find_paths($paths, $names)) {
-    return if ( -x $path or ($is_win and -f $path) );
+  foreach my $path (my_find_paths($base, $paths, $names)) {
+    return $path if ( -x $path or ($is_win and -f $path) );
+  }
+  find_error($base, $paths, $names);
+}
+
+
+#
+# my_find_dir - find the first existing directory in one of
+# the given paths
+#
+# Example:
+#    my $charset_set= my_find_dir($basedir,
+#                                 ["mysql/share","sql/share", "share"],
+#                                 ["charset"]);
+# or
+#    my $charset_set= my_find_dir($basedir,
+#                                 ['client_release', 'client_debug',
+#			           'client', 'bin']);
+#
+# NOTE: The function honours MTR_VS_CONFIG environment variable
+#
+#
+sub my_find_dir {
+  my ($base, $paths, $dirs)= @_;
+  die "usage: my_find_dir(<base>, <paths>[, <dirs>])"
+    unless (@_ == 3 or @_ == 2);
+
+  # -------------------------------------------------------
+  # Find and return the first directory
+  # -------------------------------------------------------
+  foreach my $path (my_find_paths($base, $paths, $dirs)) {
+    return $path if ( -d $path );
   }
-  return undef;
+  find_error($base, $paths, $dirs);
 }
 
 
 sub my_find_paths {
-  my ($paths, $names)= @_;
+  my ($base, $paths, $names)= @_;
 
   # Convert the arguments into two normal arrays to ease
   # further mappings
@@ -65,13 +100,14 @@ sub my_find_paths {
   push(@names, ref $names eq "ARRAY" ? @$names : $names);
   push(@paths, ref $paths eq "ARRAY" ? @$paths : $paths);
 
-  print "names: @names\n";
-  print "paths: @paths\n";
+  #print "base: $base\n";
+  #print "names: @names\n";
+  #print "paths: @paths\n";
 
   # User can select to look in a special build dir
   # which is a subdirectory of any of the paths
   my @extra_dirs;
-  my $build_dir= $ENV{MTR_VS_CONFIG} || $ENV{MTR_BUILD_DIR};
+  my $build_dir= $vs_config_dir || $ENV{MTR_VS_CONFIG} || $ENV{MTR_BUILD_DIR};
   push(@extra_dirs, $build_dir) if defined $build_dir;
 
   # -------------------------------------------------------
@@ -89,7 +125,7 @@ sub my_find_paths {
 	  "debug")) if @extra_dirs == 0;
   }
 
-  print "extra_build_dir: @extra_dirs\n";
+  #print "extra_build_dir: @extra_dirs\n";
 
   # -------------------------------------------------------
   # Build cross product of "paths * extra_build_dirs"
@@ -97,7 +133,7 @@ sub my_find_paths {
   push(@paths, map { my $path= $_;
 		     map  { "$path/$_" } @extra_dirs
 		   } @paths);
-  print "paths: @paths\n";
+  #print "paths: @paths\n";
 
   # -------------------------------------------------------
   # Build cross product of "paths * names"
@@ -105,14 +141,31 @@ sub my_find_paths {
   @paths= map { my $path= $_;
 		map  { "$path/$_" } @names
 	      } @paths;
-  print "paths: @paths\n";
+  #print "paths: @paths\n";
+
+  # -------------------------------------------------------
+  # Prepend base to all paths
+  # -------------------------------------------------------
+  @paths= map { "$base/$_" } @paths;
+  #print "paths: @paths\n";
 
   # -------------------------------------------------------
-  # Find and return the first existing path in paths
+  # Return the list of paths
   # -------------------------------------------------------
   return @paths;
 }
 
 
+sub find_error {
+  my ($base, $paths, $names)= @_;
+
+  my (@names, @paths);
+  push(@names, ref $names eq "ARRAY" ? @$names : $names);
+  push(@paths, ref $paths eq "ARRAY" ? @$paths : $paths);
+
+  die "Could not find ",
+    join(", ", @names), " in ",
+      join(", ", my_find_paths($base, $paths, $names));
+}
 
 1;
diff -Nrup a/mysql-test/lib/My/MgmClient.pm b/mysql-test/lib/My/MgmClient.pm
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/mysql-test/lib/My/MgmClient.pm	2007-12-04 12:19:00 +01:00
@@ -0,0 +1,102 @@
+# -*- cperl -*-
+package My::MgmClient;
+
+#use My::SocketClient;
+use base qw(My::SocketClient);
+
+use warnings;
+use strict;
+
+#
+# Create a new MgmClient that inherits everything
+# from SocketClient
+#
+sub new {
+  my ($class, $args_ref) = @_;
+  return $class->SUPER::new($args_ref);
+}
+
+
+#
+# Show "version"
+# Returns
+# - 'version string' of mgmd
+# - undef in case of error
+#
+sub version {
+    my ($self)= @_;
+    my $command= "get version";
+
+    my $result;
+    if (defined($result= $self->_simple_command($command, {}, "version" )) ) {
+      return $result->{string};
+    }
+    return undef;
+}
+
+
+#
+# List status of Cluster nodes
+# Returns
+# - an array of hashes(one hash for each node)
+# - undef in case of failure
+#
+sub status {
+  my ($self)= @_;
+
+  if ($self->_send_command("get status") <= 0){
+    return -1;
+  }
+
+  my $reply;
+  if (!defined($reply= $self->_simple_command("get status", {},
+					      "node status"))) {
+    return undef;
+  }
+
+  # Get number of nodes
+  my $nodes= $reply->{nodes};
+  return undef unless defined $nodes;
+  my $nodes_list= (); # Array of hash
+  for my $node_no (1..$nodes) {
+    my $node= { id => $node_no };
+    map { $node->{$_}= $reply->{"node.$node_no.$_"}; }
+      ('type', 'status', 'version', 'startphase',
+       'dynamic_id', 'node_group', 'connect_count',
+       'address',
+       );
+    # Push the hash onto the list
+    push(@$nodes_list, $node);
+  }
+  return $nodes_list;
+}
+
+
+#
+# Stop node(s) by id
+# Returns
+#  - 0 => OK
+#
+sub stop_nodes {
+  my ($self)= shift;
+
+  my $args=
+    {
+     nodes   => "",
+     abort  => 1,
+     @_
+    };
+
+  my $result;
+  if (defined($result=
+	      $self->_simple_command("stop", $args
+				    )) and
+      $result->{'result'} eq 'Ok') {
+    return 0;
+  }
+
+  warn("error: '$result->{result}'");
+  return 1;
+}
+
+1;
diff -Nrup a/mysql-test/lib/My/SafeProcess/Base.pm b/mysql-test/lib/My/SafeProcess/Base.pm
--- a/mysql-test/lib/My/SafeProcess/Base.pm	2007-10-29 10:38:07 +01:00
+++ b/mysql-test/lib/My/SafeProcess/Base.pm	2007-12-04 12:18:54 +01:00
@@ -71,7 +71,7 @@ sub _safe_fork {
     $pid= fork;
     if ( not defined($pid)) {
 
-      confess("fork failed after: $!") if (!$retries--);
+      croak("fork failed after: $!") if (!$retries--);
 
       warn("fork failed sleep 1 second and redo: $!");
       sleep(1);
@@ -90,7 +90,7 @@ sub exit_status {
   my $self= shift;
   my $raw= $self->{EXIT_STATUS};
 
-  confess("Can't call exit_status before process has died")
+  croak("Can't call exit_status before process has died")
     unless defined $raw;
 
   if ($raw & 127)
@@ -139,24 +139,24 @@ sub create_process {
 
     if ( $input ) {
       if ( ! open(STDIN, "<", $input) ) {
-	confess("can't redirect STDIN to '$input': $!");
+	croak("can't redirect STDIN to '$input': $!");
       }
     }
 
     if ( $output ) {
       if ( ! open(STDOUT, $open_mode, $output) ) {
-	confess("can't redirect STDOUT to '$output': $!");
+	croak("can't redirect STDOUT to '$output': $!");
       }
     }
 
     if ( $error ) {
       if ( $output eq $error ) {
 	if ( ! open(STDERR, ">&STDOUT") ) {
-	  confess("can't dup STDOUT: $!");
+	  croak("can't dup STDOUT: $!");
 	}
       }
       elsif ( ! open(STDERR, $open_mode, $error) ) {
-	confess("can't redirect STDERR to '$error': $!");
+	croak("can't redirect STDERR to '$error': $!");
       }
     }
 
@@ -172,11 +172,11 @@ sub create_process {
 
     # Retore IO redirects
     open STDERR, '>&', $olderr
-      or confess("unable to reestablish STDERR");
+      or croak("unable to reestablish STDERR");
     open STDOUT, '>&', $oldout
-      or confess("unable to reestablish STDOUT");
+      or croak("unable to reestablish STDOUT");
     open STDIN, '<&', $oldin
-      or confess("unable to reestablish STDIN");
+      or croak("unable to reestablish STDIN");
     #printf STDERR "stdin %d, stdout %d, stderr %d\n",
     #    fileno STDIN, fileno STDOUT, fileno STDERR;
     return wantarray ? ($pid, $pid) : $pid;
@@ -200,23 +200,23 @@ sub create_process {
   setpgrp(0,0) if $opts{setpgrp};
 
   if ( $output and !open(STDOUT, $open_mode, $output) ) {
-    confess("can't redirect STDOUT to '$output': $!");
+    croak("can't redirect STDOUT to '$output': $!");
   }
 
   if ( $error ) {
-    if ( $output eq $error ) {
+    if ( defined $output and $output eq $error ) {
       if ( ! open(STDERR, ">&STDOUT") ) {
-	confess("can't dup STDOUT: $!");
+	croak("can't dup STDOUT: $!");
       }
     }
     elsif ( ! open(STDERR, $open_mode, $error) ) {
-      confess("can't redirect STDERR to '$error': $!");
+      croak("can't redirect STDERR to '$error': $!");
     }
   }
 
   if ( $input ) {
     if ( ! open(STDIN, "<", $input) ) {
-      confess("can't redirect STDIN to '$input': $!");
+      croak("can't redirect STDIN to '$input': $!");
     }
   }
 
@@ -225,10 +225,10 @@ sub create_process {
   print $pipe "ready\n";
 
   if ( !exec($path, @$args) ){
-    confess("Failed to exec '$path': $!");
+    croak("Failed to exec '$path': $!");
   }
 
-  confess("Should never come here");
+  croak("Should never come here");
 
 }
 
diff -Nrup a/mysql-test/lib/My/SafeProcess/safe_process.pl
b/mysql-test/lib/My/SafeProcess/safe_process.pl
--- a/mysql-test/lib/My/SafeProcess/safe_process.pl	2007-11-05 15:09:41 +01:00
+++ b/mysql-test/lib/My/SafeProcess/safe_process.pl	2007-12-04 12:18:54 +01:00
@@ -78,6 +78,7 @@ eval {
   local $SIG{INT}=  \&handle_signal;
   local $SIG{CHLD}= sub {
     message("Got signal @_");
+    kill(9, -$child_pid);
     my $ret= waitpid($child_pid, 0);
     exit($? >> 8);
   };
diff -Nrup a/mysql-test/lib/My/SafeProcess/safe_process_sshd.pl
b/mysql-test/lib/My/SafeProcess/safe_process_sshd.pl
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/mysql-test/lib/My/SafeProcess/safe_process_sshd.pl	2007-12-04 12:19:00 +01:00
@@ -0,0 +1,261 @@
+#!/usr/bin/perl
+# -*- cperl -*-
+
+use strict;
+use warnings;
+
+use Time::localtime;
+use lib 'lib';
+
+BEGIN {
+  #Check availability of Win32::Process
+  if ($^O eq "MSWin32") {
+    require Win32::Process;
+    Win32::Process->import();
+    eval 'sub IS_WIN32PERL () { 1 }';
+  }
+  else {
+    eval 'sub IS_WIN32PERL () { 0 }';
+  }
+}
+
+###########################################################################
+# Util functions
+###########################################################################
+
+#
+# Check if a process with given pid is alive
+# Return >0 if the process is alive
+#
+sub is_alive {
+  my ($pid)= @_;
+  die "Usage: check_alive(pid)" unless defined $pid;
+
+  return kill(0, $pid) unless (IS_WIN32PERL());
+
+  my $proc;
+  Win32::Process::Open($proc, $pid, 0);
+# MASV  proc == INVALID_HANDLE
+  return ($proc->Wait(0) == 0);
+}
+
+#
+#Print message to stderr
+#
+my $verbose= 0;
+sub pe {
+  if ($verbose > 0){
+    my $tm= localtime();
+    my $timestamp= sprintf("%02d%02d%02d %2d:%02d:%02d",
+			   $tm->year % 100, $tm->mon+1, $tm->mday,
+			   $tm->hour, $tm->min, $tm->sec);
+    print STDERR $timestamp, " monitor[$$]: ", @_, "\n";
+  }
+}
+
+
+
+###########################################################################
+# Main program
+###########################################################################
+
+my ($input, $output, $error, $append);
+my $shutdown_timeout= 20;
+my $monitor_interval= 1;
+
+use Getopt::Long;
+GetOptions(
+	   'input=s'            => \$input,
+	   'output=s'           => \$output,
+	   'error=s'            => \$error,
+	   'append'             => \$append,
+	   'shutdown-timeout=i' => \$shutdown_timeout,
+	   'monitor-interval=i' => \$monitor_interval,
+	   'verbose=i'          => \$verbose,
+	  ) or die "GetOptions failed";
+shift(@ARGV) if defined($ARGV[0]) and $ARGV[0] eq "--";
+my $parent_pid= shift(@ARGV); # Pid of parent
+my $path=       shift(@ARGV); # Executable
+
+die "usage:\n" .
+    " safe_process.pl [opts] -- <parent_pid> <path> [<args>
[...<args_n>]]"
+  unless defined $parent_pid and defined $path;
+
+
+pe("started");
+pe("parent_pid: $parent_pid");
+pe("path: $path");
+pe("input: $input") if defined $input;
+pe("output: $output") if defined $output;
+pe("error: $error") if defined $error;
+pe("append: yes") if defined $append;
+
+use IO::Handle();
+
+my $f = new POE::Filter::PBServer;
+open F, '<', 'do-remote.pl' or die "open() failed: $!.\n";
+my $perl;
+{local $/ = undef; $perl = <F>;}
+close F;
+my ($bootstrap) = @{$f->put([ [$perl] ])};
+
+#open PIPE, <<'CMD' or die "Pipe open failed: $!";
+my $cmd_txt = <<'CMD';
+ssh localhost exec /usr/bin/perl -e "'\$_ = <STDIN>;
s/\\\\([0-9a-fA-F]{2})/chr(hex(\$1))/ge; eval(\"\$_; 1\") or die'"
+CMD
+PIPE->autoflush(1);
+print PIPE $bootstrap;
+
+sleep(3);
+
+#			     path => $path,
+#			     args => join(" ", @ARGV),
+#			     stdin => $input,
+#			     stdout => $output,
+#			     stderr => $error,
+
+my $cmd= [ "SPAWN" , $path, @ARGV ];
+
+print PIPE @{$f->put( [ $cmd ])};
+print @{$f->put( [ $cmd ] )};
+
+pe("started child");
+
+sleep(5);
+
+pe("...");
+
+$SIG{TERM}=   'IGNORE';
+$SIG{INT}=    'IGNORE';
+$SIG{BREAK}=  'IGNORE' if exists($SIG{BREAK});
+
+sub hardkill_signaled {
+    pe("Got $_[0] signal => hardkill");
+    die "hardkill\n";
+}
+
+sub shutdown_signaled {
+    pe("Got $_[0] signal => shutdown");
+    die "shutdown\n";
+}
+
+my $terminated= 0;
+my $shutdown= 0;
+eval {
+  # SIGTERM cause hard kill of child
+  local $SIG{TERM}= \&hardkill_signaled;
+
+  # SIGINT causes "nice" kill of child
+  local $SIG{INT}= \&shutdown_signaled;
+
+  if ( exists($SIG{BREAK}) ) {
+    # Win32 perl uses SIGBREAK
+    local $SIG{BREAK}= \&shutdown_signaled;
+  }
+
+  sleep(1);
+  # Monitoring loop
+  while(<PIPE>) {
+    print;
+    sleep(1)
+  };
+
+};
+
+if ( $@ ) {
+  if ( $@ =~ /hardkill/ ) {
+    $terminated= 1;
+  } elsif ( $@ =~ /shutdown/ ) {
+    $terminated= 1;
+    $shutdown=   1;
+  } else {
+    die "Unexpected: $@";
+  }
+}
+
+if ($shutdown){
+  pe("shutting down...");
+
+  # Try the nice shutown method first
+  # and wait for shutdown timeout
+  # MASV how?
+  #proc_shutdown($child_pid) and
+  #  proc_wait($child_pid, $shutdown_timeout);
+}
+
+
+pe("terminating...");
+close PIPE;
+
+
+
+pe("DONE!");
+
+# Exit from monitor with exit status of the child
+exit(0);
+
+
+
+# This stuff is copied from pbserver.pl; saves having to worry about
+# Perl include paths inside the Apache server.
+package POE::Filter::PBServer;
+
+sub new {
+  my ($pack) = @_;
+  my $class = ref $pack || $pack;
+  my $me = bless { BUF => '' }, $class;
+  return $me;
+}
+
+sub get {
+  my ($me, $chunks) = @_;
+  $me->get_one_start($chunks);
+  my @result = ();
+  for(;;) {
+    my ($list) = $me->get_one();
+    if(@$list) {
+      push @result, @$list;
+    } else {
+      last;
+    }
+  }
+  return \@result;
+}
+
+sub get_one_start {
+  my ($me, $chunks) = @_;
+  $me->{BUF} .= join('', @$chunks);
+}
+
+sub get_one {
+  my ($me) = @_;
+  my $eol = index($me->{BUF}, "\n");
+  if($eol >= 0) {
+    my $line = substr($me->{BUF}, 0, $eol + 1, '');
+    chop $line;
+    # Allow CR-NL style line termination (telnet ...).
+    chop $line if $line ne '' && substr($line, -1, 1) eq "\x{0d}";
+    my @elems = split(/\|/, $line, -1);
+    s/\\([0-9a-fA-F]{2})/chr(hex($1))/ge for(@elems);
+    return [ \@elems ];
+  } else {
+    return [ ];
+  }
+}
+
+sub put {
+  my ($me, $records) = @_;
+  my $chunks = [ ];
+  for my $rec (@$records) {
+    # Don't modify the caller's values!
+    my @rec_copy = @$rec;
+    s/([|\\\x{0a}\x{0d}])/sprintf('\%02X', ord($1))/eg for @rec_copy;
+    push @$chunks, join('|', @rec_copy) . "\n";
+  }
+  return $chunks;
+}
+
+sub get_pending {
+  my ($me) = @_;
+  return ($me->{BUF} eq '' ? undef : $me->{BUF});
+}
diff -Nrup a/mysql-test/lib/My/SafeProcess.pm b/mysql-test/lib/My/SafeProcess.pm
--- a/mysql-test/lib/My/SafeProcess.pm	2007-11-08 12:15:34 +01:00
+++ b/mysql-test/lib/My/SafeProcess.pm	2007-12-04 12:18:54 +01:00
@@ -360,18 +360,42 @@ sub wait_one {
   }
 
   my $pid= $self->{SAFE_PID};
-  my $blocking= (defined $timeout and $timeout == 0) ? 0 : 1;
+
+  my $use_alarm;
+  my $blocking;
+  if (defined $timeout)
+  {
+    if ($timeout == 0)
+    {
+      # 0 -> just poll with WNOHANG
+      $blocking= 0;
+      $use_alarm= 0;
+    }
+    else
+    {
+      # >0 -> wait blocking for max timeout seconds
+      $blocking= 1;
+      $use_alarm= 1;
+    }
+  }
+  else
+  {
+    # undef -> wait blocking infinitely
+    $blocking= 1;
+    $use_alarm= 0;
+  }
+
   my $retpid;
   eval
   {
     # alarm should break the wait
     local $SIG{ALRM}= sub { die "waitpid timeout"; };
 
-    alarm($timeout) if $blocking;
+    alarm($timeout) if $use_alarm;
 
     $retpid= waitpid($pid, $blocking ? 0 : &WNOHANG);
 
-    alarm(0) if defined $blocking;
+    alarm(0) if $use_alarm;
   };
 
   if ($@)
diff -Nrup a/mysql-test/lib/My/SocketClient.pm b/mysql-test/lib/My/SocketClient.pm
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/mysql-test/lib/My/SocketClient.pm	2007-12-04 12:19:00 +01:00
@@ -0,0 +1,141 @@
+# -*- cperl -*-
+package My::SocketClient;
+
+use base qw(IO::Socket::INET);
+
+use warnings;
+use strict;
+
+
+# Print commands and replies sent to and received from server
+my $opt_log_io= 1;
+
+
+#
+# Create a new SocketClient that inherits everything
+# from IO::Socket::INET
+#
+sub new {
+  my ($class, $args_ref) = @_;
+  return $class->SUPER::new($args_ref);
+}
+
+
+#
+# Send one line to the server, print command if logging is on
+#
+# Returns
+# - Number of characters sent
+#
+sub _send_line {
+  my $self = shift;
+  print ">> ", @_ if $opt_log_io; # Print what is being sent
+  return $self->send(@_);
+}
+
+
+#
+# Send a complete command
+# Returns
+#  - 1 if ok
+#  - -1 if send fails
+#
+sub _send_command {
+  my ($self, $command, $args) = @_;
+
+  # Send the command
+  if ($self->_send_line("$command\n") <= 0 ) {
+    warn("Could not send '$command': $!");
+    return -1;
+  }
+
+  # Send the args
+  foreach my $key (keys %{$args}) {
+    next unless defined $args->{$key};
+    if ($self->_send_line("$key: $args->{$key}\n") <= 0 ) {
+      warn("Could not send '$key' for '$command': $!");
+      return -1;
+    }
+  }
+
+  # Send command terminator(empty new line)
+  if ($self->_send_line("\n") <= 0 ) {
+    warn("Could not send command terminator for '$command': $!");
+    return -1;
+  }
+  return 1;
+}
+
+
+#
+# Read a complete command
+#
+# Returns
+#  - "name of reply" which usually is the same as sent command
+#  - undef if error occured
+#
+sub _read_reply {
+  my ($self, $return_values)= @_;
+
+  # First line of reply is the command echoed back,
+  # return that from funcgtion if all goes well
+  my $reply= <$self>;
+  if (! defined($reply) ) {
+    warn("Could not read reply: $!");
+    return undef;
+  }
+  print "<< ", $reply if $opt_log_io;
+  chomp($reply);
+
+  # Read the : separated key value pairs until a
+  # single newline on it's own line
+  my $line;
+  while (defined($line= <$self>)) {
+    print "<< ", $line if $opt_log_io;
+
+    # List is terminated by newline on it's own
+    if ($line eq "\n") {
+      # Correctly terminated reply
+      return $reply;
+    }
+
+    chomp($line);
+
+    # Split key/value on the first ":"
+    my ($key, $value)= split(": ", $line, 2);
+    $return_values->{$key}= $value;
+  }
+
+  return undef;
+}
+
+
+#
+# Helper for simple commands, send and receive
+# - Returns a hash with result of the command or
+#   undef if anything fails
+#
+sub _simple_command {
+    my ($self, $command, $args, $reply_command)= @_;
+    my $return_values= {};
+
+    if ($self->_send_command($command, $args) <= 0) {
+      return undef;
+    }
+
+    # Most servers reply to a command with the first line
+    # the same as the command but of course there are exceptions
+    # and it thus possible to pass a different string in the
+    # optional third argument to this function
+    $reply_command = $reply_command || $command;
+
+    my $reply;
+    if (defined($reply= $self->_read_reply($return_values)) and
+	$reply ne $reply_command ) {
+      return undef;
+    }
+
+    return $return_values;
+}
+
+1;
diff -Nrup a/mysql-test/lib/mtr_cases.pl b/mysql-test/lib/mtr_cases.pl
--- a/mysql-test/lib/mtr_cases.pl	2007-11-16 13:14:30 +01:00
+++ b/mysql-test/lib/mtr_cases.pl	2007-12-04 12:18:54 +01:00
@@ -48,8 +48,14 @@ sub init_pattern {
 #
 ##############################################################################
 
-sub collect_test_cases ($) {
+sub collect_test_cases ($$) {
   my $suites= shift; # Semicolon separated list of test suites
+
+  my %opts=
+    (
+     @_
+    );
+
   my $cases = [];    # Array of hash(one hash for each testcase)
 
   $do_test= init_pattern($::opt_do_test, "--do-test");
@@ -57,7 +63,7 @@ sub collect_test_cases ($) {
 
   foreach my $suite (split(",", $suites))
   {
-    collect_one_suite($suite, $cases);
+    collect_one_suite($suite, $cases, %opts);
   }
 
   if ( @::opt_cases )
@@ -198,6 +204,11 @@ sub collect_one_suite($$)
   my $suite= shift;  # Test suite name
   my $cases= shift;  # List of test cases
 
+  my %opts=
+    (
+     @_
+    );
+
   mtr_verbose("Collecting: $suite");
 
   my $suitedir= "$::glob_mysql_test_dir"; # Default
@@ -282,7 +293,8 @@ sub collect_one_suite($$)
 				 $tname,
 				 "$tname.$extension",
 				 \%disabled,
-				 $suite_opts));
+				 $suite_opts,
+				 %opts));
     }
   }
   else
@@ -305,15 +317,94 @@ sub collect_one_suite($$)
 				 $tname,
 				 $elem,
 				 \%disabled,
-				 $suite_opts));
+				 $suite_opts,
+				 %opts));
     }
     closedir TESTDIR;
   }
 
+  # print_testcases($cases);
+
   return $cases;
 }
 
 
+#
+# Read options from the given opt file and append them as an array
+# to $tinfo->{$opt_name}
+#
+sub process_opts_file {
+  my ($tinfo, $opt_file, $opt_name)= @_;
+
+  $tinfo->{$opt_name}= [];
+  if ( -f $opt_file )
+  {
+    my $opts= opts_from_file($opt_file);
+
+    foreach my $opt ( @$opts )
+    {
+      my $value;
+
+      # The opt file is used both to send special options to the mysqld
+      # as well as pass special test case specific options to this
+      # script
+
+      $value= mtr_match_prefix($opt, "--timezone=");
+      if ( defined $value )
+      {
+	$tinfo->{'timezone'}= $value;
+	next;
+      }
+
+      $value= mtr_match_prefix($opt, "--slave-num=");
+      if ( defined $value )
+      {
+	$tinfo->{'slave_num'}= $value;
+	next;
+      }
+
+      $value= mtr_match_prefix($opt, "--result-file=");
+      if ( defined $value )
+      {
+	# Specifies the file mysqltest should compare
+	# output against
+	$tinfo->{'result_file'}= "r/$value.result";
+	next;
+      }
+
+      $value= mtr_match_prefix($opt, "--config-file-template=");
+      if ( defined $value)
+      {
+	# Specifies the configuration file to use for this test
+	$tinfo->{'config_file_template'}= "configs/$value";
+	next;
+      }
+
+      # If we set default time zone, remove the one we have
+      $value= mtr_match_prefix($opt, "--default-time-zone=");
+      if ( defined $value )
+      {
+	# Set timezone for this test case to something different
+	$tinfo->{'timezone'}= "GMT-8";
+	# Fallthrough, add the --default-time-zone option
+      }
+
+      # The --restart option forces a restart even if no special
+      # option is set. If the options are the same as next testcase
+      # there is no need to restart after the testcase
+      # has completed
+      if ( $opt eq "--force-restart" )
+      {
+	$tinfo->{'force_restart'}= 1;
+	next;
+      }
+
+      # Ok, this was a real option, add it
+      push(@{$tinfo->{$opt_name}}, $opt);
+    }
+  }
+}
+
 ##############################################################################
 #
 #  Collect information about a single test case
@@ -329,16 +420,22 @@ sub collect_one_test_case {
   my $disabled=shift;
   my $suite_opts= shift;
 
+  my %opts=
+    (
+     @_
+    );
+
   # ----------------------------------------------------------------------
   # Skip some tests silently
   # ----------------------------------------------------------------------
-  if ( $::opt_start_from and $tname lt $::opt_start_from )
+  my $start_from= $opts{'start-from'};
+  if ( $start_from and $tname lt $start_from )
   {
     return;
   }
 
   # ----------------------------------------------------------------------
-  # Add test to list
+  # Set defaults
   # ----------------------------------------------------------------------
   my $tinfo= {};
   $tinfo->{'name'}= basename($suite) . ".$tname";
@@ -375,7 +472,8 @@ sub collect_one_test_case {
 
   if ( $marked_as_disabled )
   {
-    if ( $::opt_enable_disabled )
+    my $enable_disabled= $opts{'enable-disabled'};
+    if ( $enable_disabled )
     {
       # User has selected to run all disabled tests
       mtr_report(" - $tinfo->{name} wil be run although it's been disabled\n",
@@ -392,114 +490,26 @@ sub collect_one_test_case {
   # ----------------------------------------------------------------------
   # Append suite extra options to both master and slave
   # ----------------------------------------------------------------------
-  foreach my $opt ( @$suite_opts )
-  {
-    mtr_verbose($opt);
-    push(@{$tinfo->{'master_opt'}}, $opt);
-    push(@{$tinfo->{'slave_opt'}}, $opt);
-  }
+  push(@{$tinfo->{'master_opt'}}, @$suite_opts);
+  push(@{$tinfo->{'slave_opt'}}, @$suite_opts);
 
   # ----------------------------------------------------------------------
   # Add master opts, extra options only for master
   # ----------------------------------------------------------------------
-  my $master_opt_file= "$testdir/$tname-master.opt";
-  $tinfo->{'master_opt'}= [];
-  if ( -f $master_opt_file )
-  {
-    my $master_opt= opts_from_file($master_opt_file);
-
-    foreach my $opt ( @$master_opt )
-    {
-      my $value;
-
-      # The opt file is used both to send special options to the mysqld
-      # as well as pass special test case specific options to this
-      # script
-
-      $value= mtr_match_prefix($opt, "--timezone=");
-      if ( defined $value )
-      {
-	$tinfo->{'timezone'}= $value;
-	next;
-      }
-
-      $value= mtr_match_prefix($opt, "--slave-num=");
-      if ( defined $value )
-      {
-	$tinfo->{'slave_num'}= $value;
-	next;
-      }
-
-      $value= mtr_match_prefix($opt, "--result-file=");
-      if ( defined $value )
-      {
-	# Specifies the file mysqltest should compare
-	# output against
-	$tinfo->{'result_file'}= "r/$value.result";
-	next;
-      }
-
-      # If we set default time zone, remove the one we have
-      $value= mtr_match_prefix($opt, "--default-time-zone=");
-      if ( defined $value )
-      {
-	# Set timezone for this test case to something different
-	$tinfo->{'timezone'}= "GMT-8";
-	# Fallthrough, add the --default-time-zone option
-      }
-
-      # The --restart option forces a restart even if no special
-      # option is set. If the options are the same as next testcase
-      # there is no need to restart after the testcase
-      # has completed
-      if ( $opt eq "--force-restart" )
-      {
-	$tinfo->{'force_restart'}= 1;
-	next;
-      }
-
-      # Ok, this was a real option, add it
-      push(@{$tinfo->{'master_opt'}}, $opt);
-    }
-  }
+  process_opts_file($tinfo, "$testdir/$tname-master.opt", 'master_opt');
 
   # ----------------------------------------------------------------------
   # Add slave opts, list of extra option only for slave
   # ----------------------------------------------------------------------
-  my $slave_opt_file=  "$testdir/$tname-slave.opt";
-  $tinfo->{'slave_opt'}=  [];
-  if ( -f $slave_opt_file )
-  {
-    my $slave_opt= opts_from_file($slave_opt_file);
-
-    foreach my $opt ( @$slave_opt )
-    {
-      # If we set default time zone, remove the one we have
-      my $value= mtr_match_prefix($opt, "--default-time-zone=");
-      $tinfo->{'slave_opt'}= [] if defined $value;
-    }
-    push(@{$tinfo->{'slave_opt'}}, @$slave_opt);
-  }
+  process_opts_file($tinfo, "$testdir/$tname-slave.opt", 'slave_opt');
 
   # ----------------------------------------------------------------------
-  # Add slave master info options, list of extra options
-  # for slave that replaces the replication options that
-  # would be added otherwise
-  # ----------------------------------------------------------------------
-  my $slave_mi_file=   "$testdir/$tname.slave-mi";
-  $tinfo->{'slave_mi'}=   [];
-  if ( -f $slave_mi_file )
-  {
-    $tinfo->{'slave_mi'}= opts_from_file($slave_mi_file);
-  }
-
-  # ----------------------------------------------------------------------
-  # MASV FIXME master sh
+  # master sh
   # ----------------------------------------------------------------------
   my $master_sh= "$testdir/$tname-master.sh";
   if ( -f $master_sh )
   {
-    if ( $::glob_win32_perl )
+    if ( $main::is_win32_perl )
     {
       $tinfo->{'skip'}= 1;
       $tinfo->{'comment'}= "No tests with sh scripts on Windows";
@@ -512,12 +522,12 @@ sub collect_one_test_case {
   }
 
   # ----------------------------------------------------------------------
-  # MASV FIXME slave sh
+  # slave sh
   # ----------------------------------------------------------------------
   my $slave_sh= "$testdir/$tname-slave.sh";
   if ( -f $slave_sh )
   {
-    if ( $::glob_win32_perl )
+    if ( $main::is_win32_perl )
     {
       $tinfo->{'skip'}= 1;
       $tinfo->{'comment'}= "No tests with sh scripts on Windows";
@@ -636,7 +646,8 @@ sub collect_one_test_case {
 
   if ( $tinfo->{'rpl_test'} )
   {
-    if ( $::opt_skip_rpl )
+    my $skip_rpl= $opts{'skip-rpl'};
+    if ( $skip_rpl )
     {
       $tinfo->{'skip'}= 1;
       $tinfo->{'comment'}= "No replication tests(--skip-rpl)";
@@ -651,13 +662,42 @@ sub collect_one_test_case {
     # Default, federated uses the first slave as it's federated database
     $tinfo->{'slave_num'}= 1;
   }
+
+  # ----------------------------------------------------------------------
+  # Find config file to use if not already selected in <testname>.opt file
+  # ----------------------------------------------------------------------
+  my $config_file= $opts{'defaults-file'};
+  if (defined $config_file) {
+    # Using same config file for all tests
+    $tinfo->{template_path}= $config_file;
+  }
+  elsif (! $tinfo->{template_path} )
+  {
+    my $config= "$testdir/my.cnf";
+    if (! -f $config )
+    {
+      $config= "configs/main.cnf";
+      if ($tinfo->{ndb_test}) {
+	$config= "configs/ndb.cnf";
+      } elsif ($tinfo->{rpl_test}) {
+	$config= "configs/rpl_1slave.cnf";
+	if ($tinfo->{slave_num} == 2) {
+	  $config= "configs/rpl_2slave.cnf";
+	} elsif ($tinfo->{slave_num} == 3) {
+	  $config= "configs/rpl_3slave.cnf";
+	}
+      }
+    }
+    $tinfo->{template_path}= $config;
+  }
+
   return $tinfo;
 }
 
 
 # List of tags in the .test files that if found should set
 # the specified value in "tinfo"
-our @tags=
+my @tags=
 (
  ["include/have_innodb.inc", "innodb_test", 1],
  ["include/have_binlog_format_row.inc", "binlog_format", "row"],
@@ -787,6 +827,26 @@ sub opts_from_file ($) {
   }
   close FILE;
   return \@args;
+}
+
+sub print_testcases {
+  my $cases= shift;
+
+  print "=" x 60, "\n";
+  foreach my $test (@$cases){
+    print "[", $test->{name}, "]", "\n";
+    while ((my ($key, $value)) = each(%$test)) {
+      print " ", $key, "=";
+      if (ref $value eq "ARRAY") {
+	print join(", ", @$value);
+      } else {
+	print $value;
+      }
+      print "\n";
+    }
+    print "\n";
+  }
+  print "=" x 60, "\n";
 }
 
 
diff -Nrup a/mysql-test/lib/mtr_misc.pl b/mysql-test/lib/mtr_misc.pl
--- a/mysql-test/lib/mtr_misc.pl	2007-11-08 12:50:18 +01:00
+++ b/mysql-test/lib/mtr_misc.pl	2007-12-04 12:18:54 +01:00
@@ -19,7 +19,6 @@
 # same name.
 
 use strict;
-use File::Find;
 
 sub mtr_native_path($);
 sub mtr_init_args ($);
@@ -30,7 +29,6 @@ sub mtr_script_exists(@);
 sub mtr_file_exists(@);
 sub mtr_exe_exists(@);
 sub mtr_exe_maybe_exists(@);
-sub mtr_copy_dir($$);
 sub mtr_same_opts($$);
 sub mtr_cmp_opts($$);
 
@@ -186,28 +184,6 @@ sub mtr_exe_exists (@) {
   }
 }
 
-
-sub mtr_copy_dir($$) {
-  my $from_dir= shift;
-  my $to_dir= shift;
-
-  # mtr_verbose("Copying from $from_dir to $to_dir");
-
-  mkpath("$to_dir");
-  opendir(DIR, "$from_dir")
-    or mtr_error("Can't find $from_dir$!");
-  for(readdir(DIR)) {
-    next if "$_" eq "." or "$_" eq "..";
-    if ( -d "$from_dir/$_" )
-    {
-      mtr_copy_dir("$from_dir/$_", "$to_dir/$_");
-      next;
-    }
-    copy("$from_dir/$_", "$to_dir/$_");
-  }
-  closedir(DIR);
-
-}
 
 
 sub mtr_same_opts ($$) {
diff -Nrup a/mysql-test/lib/mtr_report.pl b/mysql-test/lib/mtr_report.pl
--- a/mysql-test/lib/mtr_report.pl	2007-11-08 13:32:02 +01:00
+++ b/mysql-test/lib/mtr_report.pl	2007-12-04 12:18:54 +01:00
@@ -21,8 +21,8 @@
 use strict;
 use warnings;
 
-sub mtr_report_test_passed($);
-sub mtr_report_test_failed($);
+sub mtr_report_test_passed($$);
+sub mtr_report_test_failed($$);
 sub mtr_report_test_skipped($);
 sub mtr_report_stats ($);
 
@@ -68,12 +68,12 @@ sub mtr_report_test_skipped ($) {
   }
 }
 
-sub mtr_report_test_passed ($) {
-  my $tinfo= shift;
+sub mtr_report_test_passed ($$) {
+  my ($tinfo, $use_timer)= @_;
   mtr_report_test_name($tinfo);
 
   my $timer=  "";
-  if ( $::opt_timer and -f "$::opt_vardir/log/timer" )
+  if ( $use_timer and -f "$::opt_vardir/log/timer" )
   {
     $timer= mtr_fromfile("$::opt_vardir/log/timer");
     $tot_real_time += ($timer/1000);
@@ -84,8 +84,8 @@ sub mtr_report_test_passed ($) {
 }
 
 
-sub mtr_report_test_failed ($) {
-  my $tinfo= shift;
+sub mtr_report_test_failed ($$) {
+  my ($tinfo, $logfile)= @_;
   mtr_report_test_name($tinfo);
 
   $tinfo->{'result'}= 'MTR_RES_FAILED';
@@ -106,12 +106,12 @@ sub mtr_report_test_failed ($) {
     # failing the test is saved in "comment"
     mtr_report("\nERROR: $tinfo->{'comment'}");
   }
-  elsif ( -f $::path_timefile )
+  elsif ( defined $logfile and -f $logfile )
   {
     # Test failure was detected by test tool and its report
     # about what failed has been saved to file. Display the report.
     print "\n";
-    mtr_printfile($::path_timefile);
+    mtr_printfile($logfile);
     print "\n";
   }
   else
@@ -162,11 +162,7 @@ sub mtr_report_stats ($) {
   # ----------------------------------------------------------------------
   # Print out a summary report to screen
   # ----------------------------------------------------------------------
-
-  if (!$::opt_extern)
-  {
-    print "The servers were restarted $tot_restarts times\n";
-  }
+  print "The servers were restarted $tot_restarts times\n";
 
   if ( $::opt_timer )
   {
@@ -181,7 +177,7 @@ sub mtr_report_stats ($) {
   # the "var/log/*.err" files. We save this info in "var/log/warnings"
   # ----------------------------------------------------------------------
 
-  if ( $::opt_warnings and ! $::glob_use_running_server )
+  if ( $::opt_warnings )
   {
     # Save and report if there was any fatal warnings/errors in err logs
 
diff -Nrup a/mysql-test/lib/t/0.rmtree.t b/mysql-test/lib/t/0.rmtree.t
--- a/mysql-test/lib/t/0.rmtree.t	2007-09-04 15:36:23 +02:00
+++ /dev/null	Wed Dec 31 16:00:00 196900
@@ -1,52 +0,0 @@
-#!/usr/bin/perl
-# -*- cperl -*-
-
-use strict;
-
-use My::File::Path;
-
-use Test::Simple tests => 8;
-use File::Temp qw / tempdir /;
-my $dir = tempdir( CLEANUP => 1 );
-my $testdir="$dir/test";
-
-my $subdir= "$testdir/test1/test2/test3";
-
-#
-# 1. Create and remove a directory structure
-#
-mkpath($subdir);
-ok( -d $subdir, "Check '$subdir' is created");
-
-rmtree($testdir);
-ok( ! -d $testdir, "Check '$testdir' is gone");
-
-#
-# 2. Create and remove a directory structure
-# where one directory is chmod to 0000
-#
-mkpath($subdir);
-ok( -d $subdir, "Check '$subdir' is created");
-
-ok( chmod(0000, $subdir) == 1 , "Check one dir was chmoded");
-
-rmtree($testdir);
-ok( ! -d $testdir, "Check '$testdir' is gone");
-
-#
-# 2. Create and remove a directory structure
-# where one file is chmod to 0000
-#
-mkpath($subdir);
-ok( -d $subdir, "Check '$subdir' is created");
-
-my $testfile= "$subdir/test.file";
-open(F, ">", $testfile) or die;
-print F "hello\n";
-close(F);
-
-ok( chmod(0000, $testfile) == 1 , "Check one file was chmoded");
-
-rmtree($testdir);
-ok( ! -d $testdir, "Check '$testdir' is gone");
-
diff -Nrup a/mysql-test/lib/t/CpcClient.t b/mysql-test/lib/t/CpcClient.t
--- a/mysql-test/lib/t/CpcClient.t	2007-10-18 18:59:26 +02:00
+++ b/mysql-test/lib/t/CpcClient.t	2007-12-04 12:18:54 +01:00
@@ -8,7 +8,7 @@ use_ok ("My::CpcClient");
 
 SKIP: {
   my $remote= "localhost:1234";
-  my $cpc= CpcClient->new($remote) or skip("Could not connect to cpcd", 2);
+  my $cpc= My::CpcClient->new($remote) or skip("Could not connect to cpcd", 2);
 
   print $cpc->show_version(), "\n";
 
diff -Nrup a/mysql-test/lib/t/Find.t b/mysql-test/lib/t/Find.t
--- a/mysql-test/lib/t/Find.t	2007-11-08 12:15:34 +01:00
+++ b/mysql-test/lib/t/Find.t	2007-12-04 12:18:54 +01:00
@@ -3,14 +3,31 @@ use Test::More qw(no_plan);
 use strict;
 
 use_ok ("My::Find");
-
+my $basedir= "../..";
 
 print "=" x 40, "\n";
-my $mysqld_exe= my_find_bin(["sql", "bin"],
+my $mysqld_exe= my_find_bin($basedir,
+			    ["sql", "bin"],
                             ["mysqld", "mysqld-debug"]);
 print "mysqld_exe: $mysqld_exe\n";
 print "=" x 40, "\n";
-my $mysql_exe= my_find_bin(["client", "bin"],
+my $mysql_exe= my_find_bin($basedir,
+			   ["client", "bin"],
                            "mysql");
 print "mysql_exe: $mysql_exe\n";
+print "=" x 40, "\n";
+
+my $mtr_build_dir= $ENV{MTR_BUILD_DIR};
+$ENV{MTR_BUILD_DIR}= "debug";
+my $mysql_exe= my_find_bin($basedir,
+			   ["client", "bin"],
+                           "mysql");
+print "mysql_exe: $mysql_exe\n";
+$ENV{MTR_BUILD_DIR}= $mtr_build_dir;
+print "=" x 40, "\n";
+
+my $charset_dir= my_find_dir($basedir,
+			     ["share/mysql", "sql/share", "share"],
+			     "charsets");
+print "charset_dir: $charset_dir\n";
 print "=" x 40, "\n";
diff -Nrup a/mysql-test/lib/t/MgmClient.t b/mysql-test/lib/t/MgmClient.t
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/mysql-test/lib/t/MgmClient.t	2007-12-04 12:19:00 +01:00
@@ -0,0 +1,23 @@
+# -*- cperl -*-
+use strict;
+use warnings;
+use Test::More qw(no_plan);
+
+use_ok ("My::MgmClient");
+
+
+SKIP: {
+  my $remote= "localhost:9310";
+  my $mgm= My::MgmClient->new($remote) or skip("Could not connect to mgmd", 2);
+
+  print $mgm->version(), "\n";
+
+#  my $slist= $mgm->status();
+#  foreach my $node (@$slist) {
+#    print "$node->{id}: $node->{'type'} - $node->{status} \n";
+#  }
+
+  ok($mgm->stop_nodes(nodes => "1 2") == 0, "stop nodes");
+
+}
+
diff -Nrup a/mysql-test/lib/t/SocketClient.t b/mysql-test/lib/t/SocketClient.t
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/mysql-test/lib/t/SocketClient.t	2007-12-04 12:19:00 +01:00
@@ -0,0 +1,8 @@
+# -*- cperl -*-
+use strict;
+use warnings;
+use Test::More qw(no_plan);
+
+use_ok ("My::SocketClient");
+
+my $server= SocketClient->new();
diff -Nrup a/mysql-test/lib/t/copytree.t b/mysql-test/lib/t/copytree.t
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/mysql-test/lib/t/copytree.t	2007-12-04 12:19:00 +01:00
@@ -0,0 +1,34 @@
+#!/usr/bin/perl
+# -*- cperl -*-
+
+use strict;
+
+use My::File::Path;
+
+use Test::Simple tests => 7;
+use File::Temp qw / tempdir /;
+my $dir = tempdir( CLEANUP => 1 );
+my $testdir="$dir/test";
+my $test_todir="$dir/to";
+
+my $subdir= "$testdir/test1/test2/test3";
+
+#
+# 1. Create, copy and remove a directory structure
+#
+mkpath($subdir);
+ok( -d $subdir, "Check '$subdir' is created");
+
+copytree($testdir, $test_todir);
+ok( -d $test_todir, "Check '$test_todir' is created");
+ok( -d "$test_todir/test1", "Check 'test1' is created");
+ok( -d "$test_todir/test1/test2", "Check 'test2' is created");
+ok( -d "$test_todir/test1/test2/test3", "Check 'test3' is created");
+
+
+rmtree($testdir);
+ok( ! -d $testdir, "Check '$testdir' is gone");
+
+rmtree($test_todir);
+ok( ! -d $test_todir, "Check '$test_todir' is gone");
+
diff -Nrup a/mysql-test/lib/t/rmtree.t b/mysql-test/lib/t/rmtree.t
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/mysql-test/lib/t/rmtree.t	2007-12-04 12:18:54 +01:00
@@ -0,0 +1,52 @@
+#!/usr/bin/perl
+# -*- cperl -*-
+
+use strict;
+
+use My::File::Path;
+
+use Test::Simple tests => 8;
+use File::Temp qw / tempdir /;
+my $dir = tempdir( CLEANUP => 1 );
+my $testdir="$dir/test";
+
+my $subdir= "$testdir/test1/test2/test3";
+
+#
+# 1. Create and remove a directory structure
+#
+mkpath($subdir);
+ok( -d $subdir, "Check '$subdir' is created");
+
+rmtree($testdir);
+ok( ! -d $testdir, "Check '$testdir' is gone");
+
+#
+# 2. Create and remove a directory structure
+# where one directory is chmod to 0000
+#
+mkpath($subdir);
+ok( -d $subdir, "Check '$subdir' is created");
+
+ok( chmod(0000, $subdir) == 1 , "Check one dir was chmoded");
+
+rmtree($testdir);
+ok( ! -d $testdir, "Check '$testdir' is gone");
+
+#
+# 3. Create and remove a directory structure
+# where one file is chmod to 0000
+#
+mkpath($subdir);
+ok( -d $subdir, "Check '$subdir' is created");
+
+my $testfile= "$subdir/test.file";
+open(F, ">", $testfile) or die;
+print F "hello\n";
+close(F);
+
+ok( chmod(0000, $testfile) == 1 , "Check one file was chmoded");
+
+rmtree($testdir);
+ok( ! -d $testdir, "Check '$testdir' is gone");
+
diff -Nrup a/mysql-test/lib/t/testMyConfig.t b/mysql-test/lib/t/testMyConfig.t
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/mysql-test/lib/t/testMyConfig.t	2007-12-04 12:19:00 +01:00
@@ -0,0 +1,131 @@
+#!/usr/bin/perl
+# -*- cperl -*-
+
+use strict;
+use warnings;
+use File::Temp qw / tempdir /;
+my $dir = tempdir( CLEANUP => 1 );
+
+use Test::More qw(no_plan);
+
+BEGIN { use_ok ( "My::Config" ) };
+
+my $test_cnf= "$dir/test.cnf";
+
+# Write test config file
+open(OUT, ">", $test_cnf) or die;
+print $test_cnf, "\n";
+
+print OUT <<EOF
+[mysqld]
+# Comment
+option1=values2
+option2= value4
+option4
+basedir=thebasedir
+[mysqld_1]
+[mysqld_2]
+[mysqld.9]
+[client]
+socket  =\tasocketpath
+EOF
+;
+close OUT;
+
+my $config= My::Config->new($test_cnf);
+isa_ok( $config, "My::Config" );
+
+print $config;
+
+ok ( $config->group("mysqld_2"), "group mysqld_2 exists");
+ok ( $config->group("mysqld_1"), "group mysqld_1 exists");
+ok ( $config->group("mysqld.9"), "group mysqld.9 exists");
+ok ( $config->group("mysqld.9")->suffix() eq ".9", "group mysqld.9 has suffix .9");
+
+ok ( $config->group("mysqld"), "group mysqld exists");
+ok ( $config->group("client"), "group client exists");
+ok ( !$config->group("mysqld_3"), "group mysqld_3 does not exist");
+
+ok ( $config->options_in_group("mysqld") == 4, "options in [mysqld] is 4");
+ok ( $config->options_in_group("nonexist") == 0, "options in [nonexist] is 0");
+
+{
+  my @groups= $config->groups();
+  ok(@groups == 5, "5 groups");
+  my $idx= 0;
+  foreach my $name ('mysqld', 'mysqld_1', 'mysqld_2', 'mysqld.9', 'client') {
+    is($groups[$idx++]->name(), $name, "checking groups $idx");
+  }
+}
+
+{
+  my @groups= $config->like("mysqld");
+  ok(@groups == 4, "4 groups like mysqld");
+  my $idx= 0;
+  foreach my $name ('mysqld', 'mysqld_1', 'mysqld_2', 'mysqld.9') {
+    is($groups[$idx++]->name(), $name, "checking like(\"mysqld\") $idx");
+  }
+}
+
+{
+  my @groups= $config->like("not");
+  ok(@groups == 0, "checking like(\"not\")");
+}
+
+is($config->first_like("mysqld_")->name(), "mysqld_1", "first_like");
+
+is( $config->value('mysqld', 'option4'), undef,
+    "mysqld_option4 exists, does not have a value");
+
+ok( $config->exists('mysqld', 'option4'),
+    "mysqld_option4 exists");
+ok( $config->exists('mysqld', 'option2'),
+    "mysqld_option2 exists");
+ok( !$config->exists('mysqld', 'option5'),
+    "mysqld_option5 does not exists");
+
+# Save the config to file
+my $test2_cnf= "$dir/test2.cnf";
+$config->save($test2_cnf);
+
+# read it back and check it's the same
+my $config2= My::Config->new($test2_cnf);
+isa_ok( $config2, "My::Config" );
+is_deeply( \$config, \$config2, "test.cnf is equal to test2.cnf");
+
+
+my $test_include_cnf= "$dir/test_include.cnf";
+# Write test config file that includes test.cnf
+open(OUT, ">", $test_include_cnf) or die;
+
+print OUT <<EOF
+[mysqld]
+!include test.cnf
+# Comment
+option1=values3
+basedir=anotherbasedir
+EOF
+;
+close OUT;
+
+# Read the config file
+my $config3= My::Config->new($test_include_cnf);
+isa_ok( $config3, "My::Config" );
+print $config3;
+is( $config3->value('mysqld', 'basedir'), 'anotherbasedir',
+    "mysqld_basedir has been overriden by value in test_include.cnf");
+
+is( $config3->value('mysqld', 'option1'), 'values3',
+    "mysqld_option1 has been overriden by value in test_include.cnf");
+
+is( $config3->value('mysqld', 'option2'), 'value4',
+    "mysqld_option2 is from included file");
+
+is( $config3->value('client', 'socket'), 'asocketpath',
+    "client.socket is from included file");
+
+is( $config3->value('mysqld', 'option4'), undef,
+    "mysqld_option4 exists, does not have a value");
+
+print "$config3\n";
+
diff -Nrup a/mysql-test/lib/t/testMyConfigFactory.t
b/mysql-test/lib/t/testMyConfigFactory.t
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/mysql-test/lib/t/testMyConfigFactory.t	2007-12-04 12:19:00 +01:00
@@ -0,0 +1,98 @@
+#!/usr/bin/perl
+# -*- cperl -*-
+
+use strict;
+use warnings;
+
+use File::Temp qw / tempdir /;
+my $dir = tempdir( CLEANUP => 1 );
+
+use Test::More qw(no_plan);
+
+BEGIN { use_ok ( "My::ConfigFactory" ) };
+
+my $gen1_cnf= "$dir/gen1.cnf";
+open(OUT, ">", $gen1_cnf) or die;
+
+print OUT <<EOF
+[mysqld.master]
+# Comment
+option1=value1
+basedir=abasedir
+
+[mysqld.1]
+# Comment
+option1=value1
+option2=value2
+
+[ENV]
+MASTER_MY_PORT=\@mysqld.master.port
+
+EOF
+;
+close OUT;
+
+my $basedir= "../..";
+
+my $config= My::ConfigFactory->new_config
+(
+ {
+  basedir => $basedir,
+  template_path => $gen1_cnf,
+  vardir => "/path/to/var",
+  baseport => 10987,
+  #hosts => [ 'host1', 'host2' ],
+ }
+);
+
+print $config;
+
+ok ( $config->group("mysqld.master"), "group mysqld.master exists");
+ok ( $config->group("mysqld.1"), "group mysqld.1 exists");
+ok ( $config->group("client"), "group client exists");
+ok ( !$config->group("mysqld.3"), "group mysqld.3 does not exist");
+
+ok ( $config->first_like("mysqld"), "group like 'mysqld' exists");
+
+is( $config->value('mysqld.1', '#host'), 'localhost',
+    "mysqld.1.#host has been generated");
+
+is( $config->value('client', 'host'), 'localhost',
+    "client.host has been generated");
+
+is( $config->value('client', 'host'),
+    $config->value('mysqld.master', '#host'),
+    "client.host is same as mysqld.master.host");
+
+ok ( $config->value("mysqld.1", 'character-sets-dir') =~ /$basedir.*charsets$/,
+     "'character-sets-dir' generated");
+
+ok ( $config->value("mysqld.1", 'language') =~ /$basedir.*english$/,
+     "'language' generated");
+
+ok ( $config->value("ENV", 'MASTER_MY_PORT') =~ /\d/,
+     "'language' generated");
+
+my $gen2_cnf= "$dir/gen2.cnf";
+open(OUT, ">", $gen2_cnf) or die;
+
+print OUT <<EOF
+[mysqld.master]
+EOF
+;
+close OUT;
+
+my $config2= My::ConfigFactory->new_config
+(
+ {
+  basedir => $basedir,
+  template_path => $gen2_cnf,
+  vardir => "/path/to/var",
+  baseport => 10987,
+  #hosts => [ 'host1', 'host2' ],
+ }
+);
+
+print $config2;
+
+ok ( $config2->first_like("mysqld"), "group like 'mysqld' exists");
diff -Nrup a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
--- a/mysql-test/mysql-test-run.pl	2007-11-16 13:14:30 +01:00
+++ b/mysql-test/mysql-test-run.pl	2007-12-04 12:18:54 +01:00
@@ -6,7 +6,7 @@
 #
 #  mysql-test-run.pl
 #
-#  Tool used for executing a suite of .test file
+#  Tool used for executing a suite of .test files
 #
 #  See the "MySQL Test framework manual" for more information
 #  http://dev.mysql.com/doc/mysqltest/en/index.html
@@ -16,8 +16,9 @@
 ##############################################################################
 
 use strict;
-use lib "lib/";
+use warnings;    # MASV
 
+use lib "lib/";
 use My::File::Path; # Patched version of File::Path
 use File::Basename;
 use File::Copy;
@@ -25,13 +26,14 @@ use File::Temp qw / tempdir /;
 use Cwd;
 use Getopt::Long;
 use My::SafeProcess;
+use My::ConfigFactory;
 
 select(STDOUT);
 $| = 1; # Automatically flush STDOUT
 
-our $glob_win32_perl=  ($^O eq "MSWin32"); # ActiveState Win32 Perl
-our $glob_cygwin_perl= ($^O eq "cygwin");  # Cygwin Perl
-our $glob_win32=       ($glob_win32_perl or $glob_cygwin_perl);
+our $is_win32_perl=  ($^O eq "MSWin32"); # ActiveState Win32 Perl
+our $is_cygwin=      ($^O eq "cygwin");  # Cygwin Perl
+our $is_win32=       ($is_win32_perl or $is_cygwin);
 
 require "lib/mtr_cases.pl";
 require "lib/mtr_process.pl";
@@ -40,35 +42,25 @@ require "lib/mtr_gcov.pl";
 require "lib/mtr_report.pl";
 require "lib/mtr_match.pl";
 require "lib/mtr_misc.pl";
-require "lib/mtr_stress.pl";
 require "lib/mtr_unique.pl";
 
 $SIG{INT}= sub { mtr_error("Got ^C signal"); };
 
-##############################################################################
-#
-#  Default settings
-#
-##############################################################################
-
-# Misc global variables
 our $mysql_version_id;
 our $glob_mysql_test_dir=         undef;
-our $glob_mysql_bench_dir=        undef;
-our $glob_use_embedded_server=    0;
-our $glob_basedir;
+our $basedir;
 
 our $path_charsetsdir;
 our $path_client_bindir;
 our $path_language;
 our $path_timefile;
 our $path_current_test_log;
-our $path_my_basedir;
 
-our $opt_vardir;                 # A path but set directly on cmd line
-our $path_vardir_trace;          # unix formatted opt_vardir for trace files
-our $opt_tmpdir;                 # A path but set directly on cmd line
-my $path_config_file;            # var/my.cnf
+our $default_vardir;
+our $opt_vardir;                # A path but set directly on cmd line
+my $path_vardir_trace;          # unix formatted opt_vardir for trace files
+my $opt_tmpdir;                 # A path but set directly on cmd line
+my $path_config_file;           # var/my.cnf
 
 # Visual Studio produces executables in different sub-directories based on the
 # configuration used to build them.  To make life easier, an environment
@@ -76,26 +68,18 @@ my $path_config_file;            # var/m
 # executables will be used by the test suite.
 our $opt_vs_config = $ENV{'MTR_VS_CONFIG'};
 
-our $default_vardir;
-
-our $opt_usage;
 our $opt_suites= "main";
 
 our $opt_verbose= 0;  # Verbose output, enable with --verbose
 
-my $exe_master_mysqld;
-my $exe_slave_mysqld;
 my $exe_mysqld;
-
 our $exe_mysql;
 our $exe_mysqladmin;
 our $exe_mysqltest;
 our $exe_ndbd;
-our $exe_ndb_mgmd;
+our $exe_ndb_mgmd= "";
 our $exe_libtool;
 
-our $opt_bench= 0;
-our $opt_small_bench= 0;
 our $opt_big_test= 0;
 
 our @opt_extra_mysqld_opt;
@@ -112,15 +96,22 @@ our $opt_view_protocol;
 our $opt_debug;
 our $opt_do_test;
 our @opt_cases;                  # The test cases names in argv
-our $opt_embedded_server;
+my $opt_embedded_server;
 
-our $opt_extern= 0;
-our $opt_socket;
+# Options used when connecting to an already running server
+my %opts_extern;
+sub using_extern { return (keys %opts_extern > 0);};
+
+# Options used for the collect phase
+my %opts_collect;
+sub collect_option {
+  my ($opt, $value)= @_;
+  $opts_collect{$opt}= $value;
+}
 
 our $opt_fast= 0;
 our $opt_force;
 our $opt_reorder= 0;
-our $opt_enable_disabled;
 our $opt_mem= $ENV{'MTR_MEM'};
 
 our $opt_gcov;
@@ -135,30 +126,20 @@ our $opt_client_ddd;
 our $opt_manual_gdb;
 our $opt_manual_ddd;
 our $opt_manual_debug;
-our $opt_mtr_build_thread= $ENV{'MTR_BUILD_THREAD'} || "auto";
 our $opt_debugger;
 our $opt_client_debugger;
 
-our $master;
-our $slave;
-our $clusters;
-
-my $opt_master_myport        = 9306;
-my $opt_slave_myport         = 9308;
-my $opt_ndbcluster_port      = 9310;
-my $opt_ndbcluster_port_slave= 9311;
+my $config; # The currently running config
+my $current_config_name; # The currently running config file template
 
-our $opt_ndbconnectstring;
-our $opt_ndbconnectstring_slave;
+my $opt_baseport;
+my $opt_mtr_build_thread= $ENV{'MTR_BUILD_THREAD'} || "auto";
 
 my $opt_record;
 my $opt_report_features;
 my $opt_check_testcases;
 my $opt_mark_progress;
 
-our $opt_skip_rpl;
-my $max_slave_num= 0;
-my $max_master_num= 1;
 my $use_innodb;
 my $opt_skip_test;
 
@@ -167,10 +148,10 @@ my $opt_sleep;
 my $opt_testcase_timeout=  15; # 15 minutes
 my $opt_suite_timeout   = 180; # 3 hours
 my $opt_shutdown_timeout=  10; # 10 seconds
+my $opt_start_timeout=  30; # 30 seconds
 
-my $opt_start_and_exit;
+my $opt_start;
 my $opt_start_dirty;
-our $opt_start_from;
 
 my $opt_strace_client;
 
@@ -186,16 +167,6 @@ my @valgrind_args;
 my $opt_valgrind_path;
 my $opt_callgrind;
 
-our $opt_stress=               "";
-our $opt_stress_suite=     "main";
-our $opt_stress_mode=    "random";
-our $opt_stress_threads=        5;
-our $opt_stress_test_count=     0;
-our $opt_stress_loop_count=     0;
-our $opt_stress_test_duration=  0;
-our $opt_stress_init_file=     "";
-our $opt_stress_test_file=     "";
-
 our $opt_warnings= 1;
 
 our $opt_skip_ndbcluster= 0;
@@ -207,11 +178,11 @@ our $opt_ndb_extra_test= 0;
 our $opt_skip_master_binlog= 0;
 our $opt_skip_slave_binlog= 0;
 
-our $exe_ndb_mgm;
+our $exe_ndb_mgm="";
 our $exe_ndb_waiter;
-our $path_ndb_tools_dir;
-our $path_ndb_examples_dir;
-our $exe_ndb_example;
+our $path_ndb_tools_dir= "";
+our $path_ndb_examples_dir= "";
+our $exe_ndb_example= "";
 our $path_ndb_testrun_log;
 
 our $path_sql_dir;
@@ -227,17 +198,14 @@ my $source_dist= 0;
 our $opt_max_save_core= 5;
 my $num_saved_cores= 0;  # Number of core files saved in vardir/log/ so far.
 
-my $opt_cpcd= 0;
-my $exe_cpcd;
-
-
-
 main();
 
 sub main {
 
   command_line_setup();
 
+  mtr_report("Checking supported features...");
+
   check_ndbcluster_support(\%mysqld_variables);
   check_ssl_support(\%mysqld_variables);
   check_debug_support(\%mysqld_variables);
@@ -251,104 +219,44 @@ sub main {
     gcov_prepare();
   }
 
-  if ( $opt_bench )
-  {
-    initialize_servers();
-    run_benchmarks(shift);      # Shift what? Extra arguments?!
-  }
-  elsif ( $opt_stress )
-  {
-    initialize_servers();
-    run_stress_test()
-  }
-  else
-  {
-    # Figure out which tests we are going to run
-    mtr_report("Collecting tests...");
-    my $tests= collect_test_cases($opt_suites);
-
-    # Turn off NDB and other similar options if no tests use it
-    my ($need_ndbcluster);
-    foreach my $test (@$tests)
-    {
-      next if $test->{skip};
-
-      $need_ndbcluster||= $test->{ndb_test};
-
-      # Count max number of slaves used by a test case
-      my $slave_num= $test->{slave_num} || 0;
-      if ( $slave_num > $max_slave_num)
-      {
-	$max_slave_num= $slave_num;
-	mtr_error("Too many slaves") if $max_slave_num > 3;
-      }
+  # Figure out which tests we are going to run
+  mtr_report("Collecting tests...");
+  my $tests= collect_test_cases($opt_suites, %opts_collect);
 
-      # Count max number of masters used by a test case
-      if ( $test->{master_num} > $max_master_num)
-      {
-	$max_master_num= $test->{master_num};
-	mtr_error("Too many masters") if $max_master_num > 2;
-	mtr_error("Too few masters") if $max_master_num < 1;
-      }
-
-      $use_innodb||= $test->{'innodb_test'};
-    }
-
-    # Check if cluster can be skipped
-    if ( !$need_ndbcluster )
-    {
-      $opt_skip_ndbcluster= 1;
-      $opt_skip_ndbcluster_slave= 1;
-    }
-
-    # Check if slave cluster can be skipped
-    if ($max_slave_num == 0)
-    {
-      $opt_skip_ndbcluster_slave= 1;
-    }
-
-    initialize_servers();
+  foreach my $test (@$tests)
+  {
+    next if $test->{skip};
 
-    if ($opt_cpcd) {
-      my $args;
-      mtr_init_args(\$args);
-      mtr_add_arg($args, "--work-dir=%s", "$opt_vardir/run/");
-      # mtr_add_arg($args, "--port=%d", ...);
-      mtr_add_arg($args, "--logfile=%s", "$opt_vardir/log/cpcd.log");
-      mtr_add_arg($args, "--debug");
-      my $cpcd= My::SafeProcess->new
-	(
-	 name          => "cpcd",
-	 path          => $exe_cpcd,
-	 args          => \$args,
-	 output        => "$opt_vardir/log/cpcd.out",
-	 error         => "$opt_vardir/log/cpcd.err",
-	 verbose       => $opt_verbose,
-	) or die "Failed to start cpcd";
-    }
+    $use_innodb||= $test->{'innodb_test'};
+  }
 
+  initialize_servers();
 
-    if ( $opt_report_features ) {
-      # Put "report features" as the first test to run
-      my $tinfo = {};
-      $tinfo->{'name'} = 'report_features';
-      $tinfo->{'result_file'} = undef; # Prints result
-      $tinfo->{'path'} = 'include/report-features.test';
-      $tinfo->{'master_opt'} = [];
-      $tinfo->{'slave_opt'} = [];
-      $tinfo->{'slave_mi'} = [];
-      unshift(@$tests, $tinfo);
-    }
+  if ( $opt_report_features ) {
+    # Put "report features" as the first test to run
+    my $tinfo = {};
+    $tinfo->{'name'} = 'report_features';
+    $tinfo->{'result_file'} = undef; # Prints result
+    $tinfo->{'path'} = 'include/report-features.test';
+    $tinfo->{'master_opt'} = [];
+    $tinfo->{'slave_opt'} = [];
+    $tinfo->{'slave_mi'} = [];
+    unshift(@$tests, $tinfo);
+  }
 
-    run_tests($tests);
+  if ( using_extern() ) {
+    create_config_file_for_extern(%opts_extern);
   }
 
+  run_tests($tests);
+
   exit(0);
 }
 
 
 sub command_line_setup {
   my $opt_comment;
+  my $opt_usage;
 
   # This is needed for test log evaluation in "gen-build-status-page"
   # in all cases where the calling tool does not log the commands
@@ -368,11 +276,14 @@ sub command_line_setup {
              'ssl|with-openssl'         => \$opt_ssl,
              'skip-ssl'                 => \$opt_skip_ssl,
              'compress'                 => \$opt_compress,
-             'bench'                    => \$opt_bench,
-             'small-bench'              => \$opt_small_bench,
              'with-ndbcluster|ndb'      => \$opt_with_ndbcluster,
              'vs-config'                => \$opt_vs_config,
 
+             # Config file to use as template for all tests
+	     'defaults-file|config=s'   => \&collect_option,
+	     # Extra config file to append to all generated configs
+	     'defaults-extra-file=s'    => \&collect_option,
+
              # Control what test suites or cases to run
              'force'                    => \$opt_force,
              'with-ndbcluster-only'     => \$opt_with_ndbcluster_only,
@@ -383,17 +294,13 @@ sub command_line_setup {
              'skip-master-binlog'       => \$opt_skip_master_binlog,
              'skip-slave-binlog'        => \$opt_skip_slave_binlog,
              'do-test=s'                => \$opt_do_test,
-             'start-from=s'             => \$opt_start_from,
+             'start-from=s'             => \&collect_option,
              'suite|suites=s'           => \$opt_suites,
-             'skip-rpl'                 => \$opt_skip_rpl,
+             'skip-rpl'                 => \&collect_option,
              'skip-test=s'              => \$opt_skip_test,
              'big-test'                 => \$opt_big_test,
 
              # Specify ports
-             'master_port=i'            => \$opt_master_myport,
-             'slave_port=i'             => \$opt_slave_myport,
-             'ndbcluster-port|ndbcluster_port=i' => \$opt_ndbcluster_port,
-             'ndbcluster-port-slave=i'  => \$opt_ndbcluster_port_slave,
 	     'mtr-build-thread=i'       => \$opt_mtr_build_thread,
 
              # Test case authoring
@@ -405,11 +312,10 @@ sub command_line_setup {
              'mysqld=s'                 => \@opt_extra_mysqld_opt,
 
              # Run test on running server
-             'extern'                    => \$opt_extern,
-             'ndb-connectstring=s'       => \$opt_ndbconnectstring,
-             'ndb-connectstring-slave=s' => \$opt_ndbconnectstring_slave,
+             'extern=s'                  => \%opts_extern, # Append to hash
 
              # Debugging
+             'debug'                    => \$opt_debug,
              'gdb'                      => \$opt_gdb,
              'client-gdb'               => \$opt_client_gdb,
              'manual-gdb'               => \$opt_manual_gdb,
@@ -419,9 +325,7 @@ sub command_line_setup {
              'manual-ddd'               => \$opt_manual_ddd,
 	     'debugger=s'               => \$opt_debugger,
 	     'client-debugger=s'        => \$opt_client_debugger,
-             'strace-client'            => \$opt_strace_client,
-             'master-binary=s'          => \$exe_master_mysqld,
-             'slave-binary=s'           => \$exe_slave_mysqld,
+             'strace-client:s'          => \$opt_strace_client,
              'max-save-core=i'          => \$opt_max_save_core,
 
              # Coverage, profiling etc
@@ -444,51 +348,35 @@ sub command_line_setup {
              'valgrind-path=s'          => \$opt_valgrind_path,
 	     'callgrind'                => \$opt_callgrind,
 
-             # Stress testing
-             'stress'                   => \$opt_stress,
-             'stress-suite=s'           => \$opt_stress_suite,
-             'stress-threads=i'         => \$opt_stress_threads,
-             'stress-test-file=s'       => \$opt_stress_test_file,
-             'stress-init-file=s'       => \$opt_stress_init_file,
-             'stress-mode=s'            => \$opt_stress_mode,
-             'stress-loop-count=i'      => \$opt_stress_loop_count,
-             'stress-test-count=i'      => \$opt_stress_test_count,
-             'stress-test-duration=i'   => \$opt_stress_test_duration,
-
 	     # Directories
              'tmpdir=s'                 => \$opt_tmpdir,
              'vardir=s'                 => \$opt_vardir,
-             'benchdir=s'               => \$glob_mysql_bench_dir,
              'mem'                      => \$opt_mem,
 
              # Misc
              'report-features'          => \$opt_report_features,
              'comment=s'                => \$opt_comment,
-             'debug'                    => \$opt_debug,
              'fast'                     => \$opt_fast,
              'reorder'                  => \$opt_reorder,
-             'enable-disabled'          => \$opt_enable_disabled,
+             'enable-disabled'          => \&collect_option,
              'verbose+'                 => \$opt_verbose,
              'sleep=i'                  => \$opt_sleep,
-             'socket=s'                 => \$opt_socket,
              'start-dirty'              => \$opt_start_dirty,
-             'start-and-exit'           => \$opt_start_and_exit,
+             'start'                    => \$opt_start,
+# MASV 'repeat'
+# MASV 'retry'
              'timer!'                   => \$opt_timer,
              'user=s'                   => \$opt_user,
              'testcase-timeout=i'       => \$opt_testcase_timeout,
              'suite-timeout=i'          => \$opt_suite_timeout,
              'shutdown-timeout=i'       => \$opt_shutdown_timeout,
              'warnings!'                => \$opt_warnings,
-	     'cpcd!'                    => \$opt_cpcd,
 
              'help|h'                   => \$opt_usage,
             ) or usage("Can't read options");
 
   usage("") if $opt_usage;
 
-  set_mtr_build_thread_ports($opt_mtr_build_thread);
-
-
   # We require that we are in the "mysql-test" directory
   # to run mysql-test-run
   my $scriptname=  basename($0);
@@ -506,7 +394,7 @@ sub command_line_setup {
 
   # Find the absolute path to the test directory
   $glob_mysql_test_dir=  cwd();
-  if ( $glob_cygwin_perl )
+  if ( $is_cygwin )
   {
     # Windows programs like 'mysqld' needs Windows paths
     $glob_mysql_test_dir= `cygpath -m "$glob_mysql_test_dir"`;
@@ -516,43 +404,34 @@ sub command_line_setup {
   # In most cases, the base directory we find everything relative to,
   # is the parent directory of the "mysql-test" directory. For source
   # distributions, TAR binary distributions and some other packages.
-  $glob_basedir= dirname($glob_mysql_test_dir);
+  $basedir= dirname($glob_mysql_test_dir);
 
   # In the RPM case, binaries and libraries are installed in the
   # default system locations, instead of having our own private base
   # directory. And we install "/usr/share/mysql-test". Moving up one
   # more directory relative to "mysql-test" gives us a usable base
   # directory for RPM installs.
-  if ( ! $source_dist and ! -d "$glob_basedir/bin" )
+  if ( ! $source_dist and ! -d "$basedir/bin" )
   {
-    $glob_basedir= dirname($glob_basedir);
+    $basedir= dirname($basedir);
   }
 
-  # Expect mysql-bench to be located adjacent to the source tree, by default
-  $glob_mysql_bench_dir= "$glob_basedir/../mysql-bench"
-    unless defined $glob_mysql_bench_dir;
-  $glob_mysql_bench_dir= undef
-    unless -d $glob_mysql_bench_dir;
-
-  $path_my_basedir=
-    $source_dist ? $glob_mysql_test_dir : $glob_basedir;
-
   #
   # Find the mysqld executable to be able to find the mysqld version
   # number as early as possible
   #
 
   # Look for the client binaries directory
-  $path_client_bindir= mtr_path_exists("$glob_basedir/client_release",
-				       "$glob_basedir/client_debug",
+  $path_client_bindir= mtr_path_exists("$basedir/client_release",
+				       "$basedir/client_debug",
 				       vs_config_dirs('client', ''),
-				       "$glob_basedir/client",
-				       "$glob_basedir/bin");
+				       "$basedir/client",
+				       "$basedir/bin");
 
   # Look for language files and charsetsdir, use same share
-  my $path_share=      mtr_path_exists("$glob_basedir/share/mysql",
-				       "$glob_basedir/sql/share",
-				       "$glob_basedir/share");
+  my $path_share=      mtr_path_exists("$basedir/share/mysql",
+				       "$basedir/sql/share",
+				       "$basedir/share");
 
   $path_language=      mtr_path_exists("$path_share/english");
   $path_charsetsdir=   mtr_path_exists("$path_share/charsets");
@@ -565,33 +444,25 @@ sub command_line_setup {
   }
   else
   {
-    $path_sql_dir= mtr_path_exists("$glob_basedir/share",
-				   "$glob_basedir/scripts");
+    $path_sql_dir= mtr_path_exists("$basedir/share",
+				   "$basedir/scripts");
   }
 
-  if (!$opt_extern)
-  {
-    $exe_mysqld=       mtr_exe_exists (vs_config_dirs('sql', 'mysqld'),
-                                       vs_config_dirs('sql', 'mysqld-debug'),
-				       "$glob_basedir/sql/mysqld",
-				       "$path_client_bindir/mysqld-max-nt",
-				       "$path_client_bindir/mysqld-max",
-				       "$path_client_bindir/mysqld-nt",
-				       "$path_client_bindir/mysqld",
-				       "$path_client_bindir/mysqld-debug",
-				       "$path_client_bindir/mysqld-max",
-				       "$glob_basedir/libexec/mysqld",
-				       "$glob_basedir/bin/mysqld",
-				       "$glob_basedir/sbin/mysqld");
+  $exe_mysqld=       mtr_exe_exists (vs_config_dirs('sql', 'mysqld'),
+				     vs_config_dirs('sql', 'mysqld-debug'),
+				     "$basedir/sql/mysqld",
+				     "$path_client_bindir/mysqld-max-nt",
+				     "$path_client_bindir/mysqld-max",
+				     "$path_client_bindir/mysqld-nt",
+				     "$path_client_bindir/mysqld",
+				     "$path_client_bindir/mysqld-debug",
+				     "$path_client_bindir/mysqld-max",
+				     "$basedir/libexec/mysqld",
+				     "$basedir/bin/mysqld",
+				     "$basedir/sbin/mysqld");
 
-    # Use the mysqld found above to find out what features are available
-    collect_mysqld_features();
-  }
-  else
-  {
-    $mysqld_variables{'port'}= 3306;
-    $mysqld_variables{'master-port'}= 3306;
-  }
+  # Use the mysqld found above to find out what features are available
+  collect_mysqld_features();
 
   if ( $opt_comment )
   {
@@ -628,7 +499,7 @@ sub command_line_setup {
   # --------------------------------------------------------------------------
   # NOTE if the default binlog format is changed, this has to be changed
   $used_binlog_format= "statement";
-  if (!$opt_extern && $mysql_version_id >= 50100 )
+  if ( $mysql_version_id >= 50100 )
   {
     $used_binlog_format= "mixed"; # Default value for binlog format
 
@@ -702,7 +573,7 @@ sub command_line_setup {
     # Version 4.1 and --vardir was specified
     # Only supported as a symlink from var/
     # by setting up $opt_mem that symlink will be created
-    if ( ! $glob_win32 )
+    if ( ! $is_win32 )
     {
       # Only platforms that have native symlinks can use the vardir trick
       $opt_mem= $opt_vardir;
@@ -718,7 +589,7 @@ sub command_line_setup {
 
   # We make the path absolute, as the server will do a chdir() before usage
   unless ( $opt_vardir =~ m,^/, or
-           ($glob_win32 and $opt_vardir =~ m,^[a-z]:/,i) )
+           ($is_win32 and $opt_vardir =~ m,^[a-z]:/,i) )
   {
     # Make absolute path, relative test dir
     $opt_vardir= "$glob_mysql_test_dir/$opt_vardir";
@@ -753,67 +624,33 @@ sub command_line_setup {
   # --------------------------------------------------------------------------
   if ( $opt_embedded_server )
   {
-    $glob_use_embedded_server= 1;
-    # Add the location for libmysqld.dll to the path.
-    if ( $glob_win32 )
+    $opt_embedded_server= 1;
+    if ( $is_win32 )
     {
+      # Add the location for libmysqld.dll to the path.
+      my $separator= ";";
       my $lib_mysqld=
         mtr_path_exists(vs_config_dirs('libmysqld',''));
-      $lib_mysqld= $glob_cygwin_perl ? ":".`cygpath "$lib_mysqld"` 
-	: ";".$lib_mysqld;
-      chomp($lib_mysqld);
-      $ENV{'PATH'}= "$ENV{'PATH'}".$lib_mysqld;
+      if ( $is_cygwin )
+      {
+	$lib_mysqld= `cygpath "$lib_mysqld"`;
+	chomp($lib_mysqld);
+	$separator= ":";
+      }
+      $ENV{'PATH'}= "$ENV{'PATH'}".$separator.$lib_mysqld;
     }
-    $opt_skip_rpl= 1;              # We never run replication with embedded
     $opt_skip_ndbcluster= 1;       # Turn off use of NDB cluster
     $opt_skip_ssl= 1;              # Turn off use of SSL
 
     # Turn off use of bin log
     push(@opt_extra_mysqld_opt, "--skip-log-bin");
 
-    if ( $opt_extern )
+    if ( using_extern() )
     {
       mtr_error("Can't use --extern with --embedded-server");
     }
   }
 
-
-  # --------------------------------------------------------------------------
-  # ndbconnectstring and ndbconnectstring_slave
-  # --------------------------------------------------------------------------
-  if ( $opt_ndbconnectstring )
-  {
-    # ndbconnectstring was supplied by user, the tests shoudl be run
-    # against an already started cluster, change settings
-    my $cluster= $clusters->[0]; # Master cluster
-    $cluster->{'connect_string'}= $opt_ndbconnectstring;
-    $cluster->{'use_running'}= 1;
-
-    mtr_error("Can't specify --ndb-connectstring and --skip-ndbcluster")
-      if $opt_skip_ndbcluster;
-  }
-
-  if ( $opt_ndbconnectstring_slave )
-  {
-    # ndbconnectstring-slave was supplied by user, the tests should be run
-    # agains an already started slave cluster, change settings
-    my $cluster= $clusters->[1]; # Slave cluster
-    $cluster->{'connect_string'}= $opt_ndbconnectstring_slave;
-    $cluster->{'use_running'}= 1;
-
-    mtr_error("Can't specify ndb-connectstring_slave and " .
-	      "--skip-ndbcluster-slave")
-      if $opt_skip_ndbcluster_slave;
-  }
-
-  # --------------------------------------------------------------------------
-  # Bench flags
-  # --------------------------------------------------------------------------
-  if ( $opt_small_bench )
-  {
-    $opt_bench=  1;
-  }
-
   # --------------------------------------------------------------------------
   # Big test flags
   # --------------------------------------------------------------------------
@@ -839,7 +676,7 @@ sub command_line_setup {
   {
     # Indicate that we are using debugger
     $glob_debugger= 1;
-    if ( $opt_extern )
+    if ( using_extern() )
     {
       mtr_error("Can't use --extern when using debugger");
     }
@@ -858,6 +695,7 @@ sub command_line_setup {
     # Increase the timeouts when running with valgrind
     $opt_testcase_timeout*= 10;
     $opt_suite_timeout*= 6;
+    $opt_start_timeout*= 10;
 
   }
   elsif ( $opt_valgrind_mysqld )
@@ -894,14 +732,7 @@ sub command_line_setup {
 
   if ( ! $opt_user )
   {
-    if ( $opt_extern )
-    {
-      $opt_user= "test";
-    }
-    else
-    {
-      $opt_user= "root"; # We want to do FLUSH xxx commands
-    }
+    $opt_user= "root"; # We want to do FLUSH xxx commands
   }
 
   # On QNX, /tmp/dir/master.sock and /tmp/dir//master.sock seem to be
@@ -915,148 +746,15 @@ sub command_line_setup {
   # socket path names.
   $sockdir = tempdir(CLEANUP => 0) if ( length($sockdir) >= 70 );
 
-  $master->[0]=
-  {
-   type          => "master",
-   idx           => 0,
-   path_myddir   => "$opt_vardir/master-data",
-   path_myerr    => "$opt_vardir/log/master.err",
-   path_pid    => "$opt_vardir/run/master.pid",
-   path_sock   => "$sockdir/master.sock",
-   port   =>  $opt_master_myport,
-   start_timeout =>  400, # enough time create innodb tables
-   cluster       =>  0, # index in clusters list
-   start_opts    => [],
-  };
-
-  $master->[1]=
-  {
-   type          => "master",
-   idx           => 1,
-   path_myddir   => "$opt_vardir/master1-data",
-   path_myerr    => "$opt_vardir/log/master1.err",
-   path_pid    => "$opt_vardir/run/master1.pid",
-   path_sock   => "$sockdir/master1.sock",
-   port   => $opt_master_myport + 1,
-   start_timeout => 400, # enough time create innodb tables
-   cluster       =>  0, # index in clusters list
-   start_opts    => [],
-  };
-
-  $slave->[0]=
-  {
-   type          => "slave",
-   idx           => 0,
-   path_myddir   => "$opt_vardir/slave-data",
-   path_myerr    => "$opt_vardir/log/slave.err",
-   path_pid    => "$opt_vardir/run/slave.pid",
-   path_sock   => "$sockdir/slave.sock",
-   port   => $opt_slave_myport,
-   start_timeout => 400,
-
-   cluster       =>  1, # index in clusters list
-   start_opts    => [],
-  };
-
-  $slave->[1]=
-  {
-   type          => "slave",
-   idx           => 1,
-   path_myddir   => "$opt_vardir/slave1-data",
-   path_myerr    => "$opt_vardir/log/slave1.err",
-   path_pid    => "$opt_vardir/run/slave1.pid",
-   path_sock   => "$sockdir/slave1.sock",
-   port   => $opt_slave_myport + 1,
-   start_timeout => 300,
-   cluster       =>  -1, # index in clusters list
-   start_opts    => [],
-  };
-
-  $slave->[2]=
-  {
-   type          => "slave",
-   idx           => 2,
-   path_myddir   => "$opt_vardir/slave2-data",
-   path_myerr    => "$opt_vardir/log/slave2.err",
-   path_pid    => "$opt_vardir/run/slave2.pid",
-   path_sock   => "$sockdir/slave2.sock",
-   port   => $opt_slave_myport + 2,
-   start_timeout => 300,
-   cluster       =>  -1, # index in clusters list
-   start_opts    => [],
-  };
-
-  my $data_dir= "$opt_vardir/ndbcluster-$opt_ndbcluster_port";
-  $clusters->[0]=
-  {
-   name            => "master",
-   nodes           => 2,
-   port            => "$opt_ndbcluster_port",
-   data_dir        => "$data_dir",
-   connect_string  => "host=localhost:$opt_ndbcluster_port",
-   path_pid        => "$data_dir/ndb_3.pid", # Nodes + 1
-   failed_start    => 0,
-  };
-
-  $data_dir= "$opt_vardir/ndbcluster-$opt_ndbcluster_port_slave";
-  $clusters->[1]=
-  {
-   name            => "slave",
-   nodes           => 1,
-   port            => "$opt_ndbcluster_port_slave",
-   data_dir        => "$data_dir",
-   connect_string  => "host=localhost:$opt_ndbcluster_port_slave",
-   path_pid        => "$data_dir/ndb_2.pid", # Nodes + 1
-   failed_start    => 0,
-  };
-
-  # Init pids of ndbd's
-  foreach my $cluster ( @{$clusters} )
-  {
-    for ( my $idx= 0; $idx < $cluster->{'nodes'}; $idx++ )
-    {
-      my $nodeid= $idx+1;
-      $cluster->{'ndbds'}->[$idx]=
-	{
-	 nodeid => $nodeid,
-	 path_pid => "$cluster->{'data_dir'}/ndb_${nodeid}.pid",
-	 path_fs => "$cluster->{'data_dir'}/ndb_${nodeid}_fs",
-	};
-    }
-  }
-
-  if ( $opt_extern )
-  {
-    # Turn off features not supported when running with extern server
-    $opt_skip_rpl= 1;
-    $opt_skip_ndbcluster= 1;
-
-    # Setup master->[0] with the settings for the extern server
-    $master->[0]->{'path_sock'}=  $opt_socket ? $opt_socket : "/tmp/mysql.sock";
-    mtr_report("Using extern server at '$master->[0]->{path_sock}'");
-  }
-  else
-  {
-    mtr_error("--socket can only be used in combination with --extern")
-      if $opt_socket;
-  }
-
   $path_timefile=  "$opt_vardir/log/mysqltest-time";
   $path_current_test_log= "$opt_vardir/log/current_test";
   $path_ndb_testrun_log= "$opt_vardir/log/ndb_testrun.log";
 
-  if ( $opt_valgrind and $opt_debug )
-  {
-    # When both --valgrind and --debug is selected, send
-    # all output to the trace file, making it possible to
-    # see the exact location where valgrind complains
-    foreach my $mysqld (@{$master}, @{$slave})
-    {
-      my $sidx= $mysqld->{idx} ? "$mysqld->{idx}" : "";
-      $mysqld->{path_myerr}=
-	"$opt_vardir/log/" . $mysqld->{type} . "$sidx.trace";
-    }
-  }
+  # --------------------------------------------------------------------------
+  # Check mtr_build_thread and calculate baseport
+  # --------------------------------------------------------------------------
+  set_mtr_build_thread_ports($opt_mtr_build_thread);
+
 }
 
 
@@ -1086,20 +784,18 @@ sub set_mtr_build_thread_ports($) {
   }
   $opt_mtr_build_thread= $mtr_build_thread;
 
-  return if $mtr_build_thread == 0;
-
-  # Up to two masters, up to three slaves
-  $opt_master_myport=         $mtr_build_thread * 10 + 10000; # and 1
-  $opt_slave_myport=          $opt_master_myport + 2;  # and 3 4
-  $opt_ndbcluster_port=       $opt_master_myport + 5;
-  $opt_ndbcluster_port_slave= $opt_master_myport + 6;
-
-  if ( $opt_master_myport < 5001 or $opt_master_myport + 10 >= 32767 )
+  # Calculate baseport
+  $opt_baseport= $mtr_build_thread * 10 + 10000;
+  if ( $opt_baseport < 5001 or $opt_baseport + 9 >= 32767 )
   {
     mtr_error("MTR_BUILD_THREAD number results in a port",
               "outside 5001 - 32767",
-              "($opt_master_myport - $opt_master_myport + 10)");
+              "($opt_baseport - $opt_baseport + 9)");
   }
+
+  mtr_report("Using MR_BUILD_THREAD $opt_mtr_build_thread,",
+	     "with reserved ports $opt_baseport..".($opt_baseport+9));
+
 }
 
 
@@ -1181,9 +877,9 @@ sub collect_mysqld_features {
 sub executable_setup_ndb () {
 
   # Look for ndb tols and binaries
-  my $ndb_path= mtr_file_exists("$glob_basedir/ndb",
-				"$glob_basedir/storage/ndb",
-				"$glob_basedir/bin");
+  my $ndb_path= mtr_file_exists("$basedir/ndb",
+				"$basedir/storage/ndb",
+				"$basedir/bin");
 
   $exe_ndbd=
     mtr_exe_maybe_exists("$ndb_path/src/kernel/ndbd",
@@ -1238,28 +934,22 @@ sub executable_setup () {
   $exe_mysqladmin=     mtr_exe_exists("$path_client_bindir/mysqladmin");
   $exe_mysql=          mtr_exe_exists("$path_client_bindir/mysql");
 
-  if ($opt_cpcd) {
-    $exe_cpcd=
-      mtr_exe_exists("$glob_basedir/ndb/src/cw/cpcd/ndb_cpcd",
-		     "$glob_basedir/ndb_cpcd");
-  }
-
   if ( ! $opt_skip_ndbcluster and executable_setup_ndb()) {
     mtr_warning("Could not find all required ndb binaries, " .
 		"all ndb tests will fail, use --skip-ndbcluster to " .
 		"skip testing it.");
 
-    foreach my $cluster (@{$clusters}) {
+    foreach my $cluster ( clusters()) {
       $cluster->{"executable_setup_failed"}= 1;
     }
   }
 
   # Look for mysqltest executable
-  if ( $glob_use_embedded_server )
+  if ( $opt_embedded_server )
   {
     $exe_mysqltest=
       mtr_exe_exists(vs_config_dirs('libmysqld/examples','mysqltest_embedded'),
-                     "$glob_basedir/libmysqld/examples/mysqltest_embedded",
+                     "$basedir/libmysqld/examples/mysqltest_embedded",
                      "$path_client_bindir/mysqltest_embedded");
   }
   else
@@ -1284,16 +974,16 @@ sub client_debug_arg($$) {
 
 sub mysql_fix_arguments () {
 
-  return "" if ( $opt_extern || $glob_win32 );
+  return "" if ( $is_win32 );
 
   my $exe=
-    mtr_script_exists("$glob_basedir/scripts/mysql_fix_privilege_tables",
+    mtr_script_exists("$basedir/scripts/mysql_fix_privilege_tables",
 		      "$path_client_bindir/mysql_fix_privilege_tables");
   my $args;
   mtr_init_args(\$args);
   mtr_add_arg($args, "--defaults-file=%s", $path_config_file);
 
-  mtr_add_arg($args, "--basedir=", $glob_basedir);
+  mtr_add_arg($args, "--basedir=", $basedir);
   mtr_add_arg($args, "--bindir=", $path_client_bindir);
   mtr_add_arg($args, "--verbose");
   return mtr_args2str($exe, @$args);
@@ -1333,14 +1023,14 @@ sub mysqlslap_arguments () {
 
 
 sub mysqldump_arguments ($) {
-  my($mysqld) = @_;
+  my($group_suffix) = @_;
   my $exe= mtr_exe_exists("$path_client_bindir/mysqldump");
 
   my $args;
   mtr_init_args(\$args);
   mtr_add_arg($args, "--defaults-file=%s", $path_config_file);
-  mtr_add_arg($args, "--defaults-group-suffix=_%s", $mysqld->{'type'});
-  client_debug_arg($args, "mysqldump-$mysqld->{'type'}");
+  mtr_add_arg($args, "--defaults-group-suffix=_%s", $group_suffix);
+  client_debug_arg($args, "mysqldump-$group_suffix");
   return mtr_args2str($exe, @$args);
 }
 
@@ -1348,14 +1038,14 @@ sub mysqldump_arguments ($) {
 sub mysql_client_test_arguments(){
   my $exe;
   # mysql_client_test executable may _not_ exist
-  if ( $glob_use_embedded_server ) {
+  if ( $opt_embedded_server ) {
     $exe= mtr_exe_maybe_exists(
 	    vs_config_dirs('libmysqld/examples','mysql_client_test_embedded'),
-	    "$glob_basedir/libmysqld/examples/mysql_client_test_embedded");
+	    "$basedir/libmysqld/examples/mysql_client_test_embedded");
   } else {
     $exe= mtr_exe_maybe_exists(vs_config_dirs('tests', 'mysql_client_test'),
-			       "$glob_basedir/tests/mysql_client_test",
-			       "$glob_basedir/bin/mysql_client_test");
+			       "$basedir/tests/mysql_client_test",
+			       "$basedir/bin/mysql_client_test");
   }
 
   my $args;
@@ -1368,15 +1058,6 @@ sub mysql_client_test_arguments(){
   mtr_add_arg($args, "--vardir=$opt_vardir");
   client_debug_arg($args,"mysql_client_test");
 
-  if ( $glob_use_embedded_server ) {
-    mtr_add_arg($args,
-      " -A --language=$path_language");
-    mtr_add_arg($args,
-      " -A --datadir=$master->[0]->{'path_myddir'}");
-    mtr_add_arg($args,
-      " -A --character-sets-dir=$path_charsetsdir");
-  }
-
   return mtr_args2str($exe, @$args);
 }
 
@@ -1397,13 +1078,13 @@ sub environment_setup {
   # --------------------------------------------------------------------------
   if ( $source_dist )
   {
-    push(@ld_library_paths, "$glob_basedir/libmysql/.libs/",
-                            "$glob_basedir/libmysql_r/.libs/",
-                            "$glob_basedir/zlib.libs/");
+    push(@ld_library_paths, "$basedir/libmysql/.libs/",
+                            "$basedir/libmysql_r/.libs/",
+                            "$basedir/zlib.libs/");
   }
   else
   {
-    push(@ld_library_paths, "$glob_basedir/lib");
+    push(@ld_library_paths, "$basedir/lib");
   }
 
   # --------------------------------------------------------------------------
@@ -1411,7 +1092,7 @@ sub environment_setup {
   # --------------------------------------------------------------------------
   if ( $glob_ndbcluster_supported )
   {
-    push(@ld_library_paths,  "$glob_basedir/storage/ndb/src/.libs");
+    push(@ld_library_paths,  "$basedir/storage/ndb/src/.libs");
   }
 
   # --------------------------------------------------------------------------
@@ -1419,7 +1100,7 @@ sub environment_setup {
   # --------------------------------------------------------------------------
   my $lib_udf_example=
     mtr_file_exists(vs_config_dirs('sql', 'udf_example.dll'),
-		    "$glob_basedir/sql/.libs/udf_example.so",);
+		    "$basedir/sql/.libs/udf_example.so",);
 
   if ( $lib_udf_example )
   {
@@ -1437,7 +1118,7 @@ sub environment_setup {
   if ($mysql_version_id >= 50100) {
     my $lib_example_plugin=
       mtr_file_exists(vs_config_dirs('storage/example', 'ha_example.dll'),
-		      "$glob_basedir/storage/example/.libs/ha_example.so",);
+		      "$basedir/storage/example/.libs/ha_example.so",);
     $ENV{'EXAMPLE_PLUGIN'}=
       ($lib_example_plugin ? basename($lib_example_plugin) : "");
     $ENV{'EXAMPLE_PLUGIN_OPT'}=
@@ -1504,66 +1185,38 @@ sub environment_setup {
   $ENV{'LC_CTYPE'}=           "C";
 
   $ENV{'LC_COLLATE'}=         "C";
-  $ENV{'USE_RUNNING_SERVER'}= $opt_extern;
+  $ENV{'USE_RUNNING_SERVER'}= using_extern();
   $ENV{'MYSQL_TEST_DIR'}=     $glob_mysql_test_dir;
   $ENV{'MYSQLTEST_VARDIR'}=   $opt_vardir;
-  $ENV{'MYSQL_TMP_DIR'}=      $opt_tmpdir;
-  $ENV{'MASTER_MYSOCK'}=      $master->[0]->{'path_sock'};
-  $ENV{'MASTER_MYSOCK1'}=     $master->[1]->{'path_sock'};
-  $ENV{'MASTER_MYPORT'}=      $master->[0]->{'port'};
-  $ENV{'MASTER_MYPORT1'}=     $master->[1]->{'port'};
-  $ENV{'SLAVE_MYSOCK'}=       $slave->[0]->{'path_sock'};
-  $ENV{'SLAVE_MYPORT'}=       $slave->[0]->{'port'};
-  $ENV{'SLAVE_MYPORT1'}=      $slave->[1]->{'port'};
-  $ENV{'SLAVE_MYPORT2'}=      $slave->[2]->{'port'};
-  $ENV{'MYSQL_TCP_PORT'}=     $mysqld_variables{'port'};
-  $ENV{'DEFAULT_MASTER_PORT'}= $mysqld_variables{'master-port'};
+  $ENV{'DEFAULT_MASTER_PORT'}= $mysqld_variables{'master-port'} || 3306; # MASV
 
   # ----------------------------------------------------
   # Setup env for NDB
   # ----------------------------------------------------
-  if ( ! $opt_skip_ndbcluster )
-  {
-    $ENV{'NDB_MGM'}=                  $exe_ndb_mgm;
-
-    $ENV{'NDBCLUSTER_PORT'}=          $opt_ndbcluster_port;
-    $ENV{'NDBCLUSTER_PORT_SLAVE'}=    $opt_ndbcluster_port_slave;
-
-    $ENV{'NDB_EXTRA_TEST'}=           $opt_ndb_extra_test;
-
-    $ENV{'NDB_BACKUP_DIR'}=           $clusters->[0]->{'data_dir'};
-    $ENV{'NDB_DATA_DIR'}=             $clusters->[0]->{'data_dir'};
-    $ENV{'NDB_TOOLS_DIR'}=            $path_ndb_tools_dir;
-    $ENV{'NDB_TOOLS_OUTPUT'}=         $path_ndb_testrun_log;
-
-    if ( $mysql_version_id >= 50000 )
-    {
-      $ENV{'NDB_EXAMPLES_DIR'}=         $path_ndb_examples_dir;
-      $ENV{'MY_NDB_EXAMPLES_BINARY'}=   $exe_ndb_example;
-    }
-    $ENV{'NDB_EXAMPLES_OUTPUT'}=      $path_ndb_testrun_log;
-
-    $ENV{'NDB_CONNECTSTRING'}= $clusters->[0]->{'connect_string'};
-
-  }
+  $ENV{'NDB_MGM'}=                  $exe_ndb_mgm;
+  $ENV{'NDB_EXTRA_TEST'}=           $opt_ndb_extra_test;
+  $ENV{'NDB_TOOLS_DIR'}=            $path_ndb_tools_dir;
+  $ENV{'NDB_TOOLS_OUTPUT'}=         $path_ndb_testrun_log;
+  $ENV{'NDB_EXAMPLES_DIR'}=         $path_ndb_examples_dir;
+  $ENV{'MY_NDB_EXAMPLES_BINARY'}=   $exe_ndb_example; # MASV MY?
+  $ENV{'NDB_EXAMPLES_OUTPUT'}=      $path_ndb_testrun_log;
 
   # ----------------------------------------------------
   # mysql clients
   # ----------------------------------------------------
-  $ENV{'MYSQL_CHECK'}=      client_arguments("mysqlcheck");
-  $ENV{'MYSQL_DUMP'}=       mysqldump_arguments($master->[0]);
-  $ENV{'MYSQL_DUMP_SLAVE'}= mysqldump_arguments($slave->[0]);
-  $ENV{'MYSQL_SLAP'}=       mysqlslap_arguments();
-  $ENV{'MYSQL_IMPORT'}=     client_arguments("mysqlimport");
-  $ENV{'MYSQL_SHOW'}=       client_arguments("mysqlshow");
-  $ENV{'MYSQL_BINLOG'}=     client_arguments("mysqlbinlog");
-  $ENV{'MYSQL'}=            client_arguments("mysql");
-  $ENV{'MYSQL_UPGRADE'}=    client_arguments("mysql_upgrade");
-  $ENV{'MYSQLADMIN'}=       mtr_native_path($exe_mysqladmin);
-  $ENV{'MYSQL_CLIENT_TEST'}=  mysql_client_test_arguments();
+  $ENV{'MYSQL_CHECK'}=              client_arguments("mysqlcheck");
+  $ENV{'MYSQL_DUMP'}=               mysqldump_arguments(".1");
+  $ENV{'MYSQL_DUMP_SLAVE'}=         mysqldump_arguments(".2");
+  $ENV{'MYSQL_SLAP'}=               mysqlslap_arguments();
+  $ENV{'MYSQL_IMPORT'}=             client_arguments("mysqlimport");
+  $ENV{'MYSQL_SHOW'}=               client_arguments("mysqlshow");
+  $ENV{'MYSQL_BINLOG'}=             client_arguments("mysqlbinlog");
+  $ENV{'MYSQL'}=                    client_arguments("mysql");
+  $ENV{'MYSQL_UPGRADE'}=            client_arguments("mysql_upgrade");
+  $ENV{'MYSQLADMIN'}=               mtr_native_path($exe_mysqladmin);
+  $ENV{'MYSQL_CLIENT_TEST'}=        mysql_client_test_arguments();
   $ENV{'MYSQL_FIX_SYSTEM_TABLES'}=  mysql_fix_arguments();
-
-  $ENV{'EXE_MYSQL'}=          $exe_mysql;
+  $ENV{'EXE_MYSQL'}=                $exe_mysql;
 
   # ----------------------------------------------------
   # bug25714 executable may _not_ exist in
@@ -1571,15 +1224,15 @@ sub environment_setup {
   # ----------------------------------------------------
   my $exe_bug25714=
       mtr_exe_maybe_exists(vs_config_dirs('tests', 'bug25714'),
-                           "$glob_basedir/tests/bug25714");
+                           "$basedir/tests/bug25714");
   $ENV{'MYSQL_BUG25714'}=  mtr_native_path($exe_bug25714);
 
   # ----------------------------------------------------
   # mysql_fix_privilege_tables.sql
   # ----------------------------------------------------
   my $file_mysql_fix_privilege_tables=
-    mtr_file_exists("$glob_basedir/scripts/mysql_fix_privilege_tables.sql",
-		    "$glob_basedir/share/mysql_fix_privilege_tables.sql");
+    mtr_file_exists("$basedir/scripts/mysql_fix_privilege_tables.sql",
+		    "$basedir/share/mysql_fix_privilege_tables.sql");
   $ENV{'MYSQL_FIX_PRIVILEGE_TABLES'}=  $file_mysql_fix_privilege_tables;
 
   # ----------------------------------------------------
@@ -1588,38 +1241,17 @@ sub environment_setup {
   my $exe_my_print_defaults=
     mtr_exe_exists(vs_config_dirs('extra', 'my_print_defaults'),
 		   "$path_client_bindir/my_print_defaults",
-		   "$glob_basedir/extra/my_print_defaults");
+		   "$basedir/extra/my_print_defaults");
   $ENV{'MYSQL_MY_PRINT_DEFAULTS'}= mtr_native_path($exe_my_print_defaults);
 
   # ----------------------------------------------------
   # perror
   # ----------------------------------------------------
   my $exe_perror= mtr_exe_exists(vs_config_dirs('extra', 'perror'),
-				 "$glob_basedir/extra/perror",
+				 "$basedir/extra/perror",
 				 "$path_client_bindir/perror");
   $ENV{'MY_PERROR'}= mtr_native_path($exe_perror);
 
-  # ----------------------------------------------------
-  # We are nice and report a bit about our settings
-  # ----------------------------------------------------
-  if (!$opt_extern)
-  {
-    print "Using MTR_BUILD_THREAD      = $opt_mtr_build_thread\n";
-    print "Using MASTER_MYPORT         = $ENV{MASTER_MYPORT}\n";
-    print "Using MASTER_MYPORT1        = $ENV{MASTER_MYPORT1}\n";
-    print "Using SLAVE_MYPORT          = $ENV{SLAVE_MYPORT}\n";
-    print "Using SLAVE_MYPORT1         = $ENV{SLAVE_MYPORT1}\n";
-    print "Using SLAVE_MYPORT2         = $ENV{SLAVE_MYPORT2}\n";
-    if ( ! $opt_skip_ndbcluster )
-    {
-      print "Using NDBCLUSTER_PORT       = $ENV{NDBCLUSTER_PORT}\n";
-      if ( ! $opt_skip_ndbcluster_slave )
-      {
-	print "Using NDBCLUSTER_PORT_SLAVE = $ENV{NDBCLUSTER_PORT_SLAVE}\n";
-      }
-    }
-  }
-
   # Create an environment variable to make it possible
   # to detect that valgrind is being used from test cases
   $ENV{'VALGRIND_TEST'}= $opt_valgrind;
@@ -1638,7 +1270,7 @@ sub remove_stale_vardir () {
 
   # Safety!
   mtr_error("No, don't remove the vardir when running with --extern")
-    if $opt_extern;
+    if using_extern();
 
   mtr_verbose("opt_vardir: $opt_vardir");
   if ( $opt_vardir eq $default_vardir )
@@ -1770,16 +1402,9 @@ sub setup_vardir() {
   mkpath("$opt_vardir/tmp");
   mkpath($opt_tmpdir) if $opt_tmpdir ne "$opt_vardir/tmp";
 
-  # Make a link std_data_ln in var/ that points to std_data
-  if ( ! $glob_win32 )
-  {
-    symlink("$glob_mysql_test_dir/std_data", "$opt_vardir/std_data_ln");
-  }
-  else
-  {
-    # on windows, copy all files from std_data into var/std_data_ln
-    mtr_copy_dir("$glob_mysql_test_dir/std_data", "$opt_vardir/std_data_ln");
-  }
+  # copy all files from std_data into var/std_data
+  # and make them writable
+  copytree("$glob_mysql_test_dir/std_data", "$opt_vardir/std_data");
 
   # Remove old log files
   foreach my $name (glob("r/*.progress r/*.log r/*.warnings"))
@@ -1827,12 +1452,9 @@ sub  check_running_as_root () {
 sub check_ssl_support ($) {
   my $mysqld_variables= shift;
 
-  if ($opt_skip_ssl || $opt_extern)
+  if ($opt_skip_ssl)
   {
-    if (!$opt_extern)
-    {
-      mtr_report("Skipping SSL");
-    }
+    mtr_report(" - skipping SSL");
     $opt_ssl_supported= 0;
     $opt_ssl= 0;
     return;
@@ -1845,12 +1467,12 @@ sub check_ssl_support ($) {
       mtr_error("Couldn't find support for SSL");
       return;
     }
-    mtr_report("Skipping SSL, mysqld not compiled with SSL");
+    mtr_report(" - skipping SSL, mysqld not compiled with SSL");
     $opt_ssl_supported= 0;
     $opt_ssl= 0;
     return;
   }
-  mtr_report("Setting mysqld to support SSL connections");
+  mtr_report(" - SSL connections supported");
   $opt_ssl_supported= 1;
 }
 
@@ -1860,7 +1482,7 @@ sub check_debug_support ($) {
 
   if ( ! $mysqld_variables->{'debug'} )
   {
-    #mtr_report("Binaries are not debug compiled");
+    #mtr_report(" - binaries are not debug compiled");
     $debug_compiled_binaries= 0;
 
     if ( $opt_debug )
@@ -1869,7 +1491,7 @@ sub check_debug_support ($) {
     }
     return;
   }
-  mtr_report("Binaries are debug compiled");
+  mtr_report(" - binaries are debug compiled");
   $debug_compiled_binaries= 1;
 }
 
@@ -1888,41 +1510,39 @@ sub vs_config_dirs ($$) {
   $exe = "" if not defined $exe;
 
   # Don't look in these dirs when not on windows
-  return () unless $glob_win32;
+  return () unless $is_win32;
 
   if ($opt_vs_config)
   {
-    return ("$glob_basedir/$path_part/$opt_vs_config/$exe");
+    return ("$basedir/$path_part/$opt_vs_config/$exe");
   }
 
-  return ("$glob_basedir/$path_part/release/$exe",
-          "$glob_basedir/$path_part/relwithdebinfo/$exe",
-          "$glob_basedir/$path_part/debug/$exe");
+  return ("$basedir/$path_part/release/$exe",
+          "$basedir/$path_part/relwithdebinfo/$exe",
+          "$basedir/$path_part/debug/$exe");
 }
 
 
 sub check_ndbcluster_support ($) {
   my $mysqld_variables= shift;
 
-  if ($opt_skip_ndbcluster || $opt_extern)
+  if ($opt_skip_ndbcluster)
   {
-    if (!$opt_extern)
-    {
-      mtr_report("Skipping ndbcluster");
-    }
+    mtr_report(" - skipping ndbcluster");
     $opt_skip_ndbcluster_slave= 1;
     return;
   }
 
-  if ( ! $mysqld_variables->{'ndb-connectstring'} )
+  if ( ! $mysqld_variables{'ndb-connectstring'} )
   {
-    mtr_report("Skipping ndbcluster, mysqld not compiled with ndbcluster");
+    mtr_report(" - skipping ndbcluster, mysqld not compiled with ndbcluster");
     $opt_skip_ndbcluster= 1;
     $opt_skip_ndbcluster_slave= 1;
     return;
   }
+
   $glob_ndbcluster_supported= 1;
-  mtr_report("Using ndbcluster when necessary, mysqld supports it");
+  mtr_report(" - using ndbcluster when necessary, mysqld supports it");
 
   if ( $mysql_version_id < 50100 )
   {
@@ -1935,92 +1555,15 @@ sub check_ndbcluster_support ($) {
 }
 
 
-sub ndbcluster_install ($) {
-  my $cluster= shift;
-
-  mtr_report("Installing $cluster->{'name'} cluster...");
-
-  mkdir($cluster->{'data_dir'});
-
-  # Create a config file from template
-  my $ndb_no_ord=512;
-  my $ndb_no_attr=2048;
-  my $ndb_con_op=105000;
-  my $ndb_dmem="80M";
-  my $ndb_imem="24M";
-  my $ndb_pbmem="32M";
-  my $nodes= $cluster->{'nodes'};
-  my $ndb_host= "localhost";
-  my $ndb_diskless= 0;
-
-  if (!$opt_bench)
-  {
-    # Use a smaller configuration
-    if (  $mysql_version_id < 50100 )
-    {
-      # 4.1 and 5.0 is using a "larger" --small configuration
-      $ndb_no_ord=128;
-      $ndb_con_op=10000;
-      $ndb_dmem="40M";
-      $ndb_imem="12M";
-    }
-    else
-    {
-      $ndb_no_ord=32;
-      $ndb_con_op=10000;
-      $ndb_dmem="20M";
-      $ndb_imem="1M";
-      $ndb_pbmem="4M";
-    }
-  }
-
-  my $config_file_template=     "ndb/ndb_config_${nodes}_node.ini";
-  my $config_file= "$cluster->{'data_dir'}/config.ini";
-
-  open(IN, $config_file_template)
-    or mtr_error("Can't open $config_file_template: $!");
-  open(OUT, ">", $config_file)
-    or mtr_error("Can't write to $config_file: $!");
-  while (<IN>)
-  {
-    chomp;
-
-    s/CHOOSE_MaxNoOfAttributes/$ndb_no_attr/;
-    s/CHOOSE_MaxNoOfOrderedIndexes/$ndb_no_ord/;
-    s/CHOOSE_MaxNoOfConcurrentOperations/$ndb_con_op/;
-    s/CHOOSE_DataMemory/$ndb_dmem/;
-    s/CHOOSE_IndexMemory/$ndb_imem/;
-    s/CHOOSE_Diskless/$ndb_diskless/;
-    s/CHOOSE_HOSTNAME_.*/$ndb_host/;
-    s/CHOOSE_FILESYSTEM/$cluster->{'data_dir'}/;
-    s/CHOOSE_PORT_MGM/$cluster->{'port'}/;
-    if ( $mysql_version_id < 50000 )
-    {
-      my $base_port= $cluster->{'port'} + 1;
-      s/CHOOSE_PORT_TRANSPORTER/$base_port/;
-    }
-    s/CHOOSE_DiskPageBufferMemory/$ndb_pbmem/;
-
-    print OUT "$_ \n";
-  }
-  close OUT;
-  close IN;
-
-  return 0;
-}
-
-
 sub ndbcluster_wait_started($$){
   my $cluster= shift;
   my $ndb_waiter_extra_opt= shift;
-  my $path_waiter_log= "$cluster->{'data_dir'}/ndb_waiter.log";
-  my $args;
+  my $path_waitlog= join('/', $opt_vardir, $cluster->name(), "ndb_waiter.log");
 
+  my $args;
   mtr_init_args(\$args);
-
-  mtr_add_arg($args, "--no-defaults");
-  mtr_add_arg($args, "--core");
-  mtr_add_arg($args, "--ndb-connectstring=%s", $cluster->{'connect_string'});
+  mtr_add_arg($args, "--defaults-file=%s", $path_config_file);
+  mtr_add_arg($args, "--defaults-group-suffix=%s", $cluster->suffix());
   mtr_add_arg($args, "--timeout=60");
 
   if ($ndb_waiter_extra_opt)
@@ -2034,14 +1577,43 @@ sub ndbcluster_wait_started($$){
 
   my $res= My::SafeProcess->run
     (
-     name          => "ndb_waiter $cluster->{'name'}",
+     name          => "ndb_waiter ".$cluster->name(),
      path          => $exe_ndb_waiter,
      args          => \$args,
-     output        => $path_waiter_log,
-     error         => $path_waiter_log,
+     output        => $path_waitlog,
+     error         => $path_waitlog,
+     append        => 1,
     );
-  mtr_verbose("ndbcluster_wait_started, returns: $res") if $res;
-  return $res;
+
+  # Check that ndb_mgmd(s) are still alive
+  foreach my $ndb_mgmd ( in_cluster($cluster, ndb_mgmds()) )
+  {
+    my $proc= $ndb_mgmd->{proc};
+    if ( ! $proc->wait_one(0) )
+    {
+      mtr_warning("$proc died");
+      return 2;
+    }
+  }
+
+  # Check that all started ndbd(s) are still alive
+  foreach my $ndbd ( in_cluster($cluster, ndbds()) )
+  {
+    my $proc= $ndbd->{proc};
+    next unless defined $proc;
+    if ( ! $proc->wait_one(0) )
+    {
+      mtr_warning("$proc died");
+      return 3;
+    }
+  }
+
+  if ($res)
+  {
+    mtr_verbose("ndbcluster_wait_started failed");
+    return 1;
+  }
+  return 0;
 }
 
 
@@ -2049,38 +1621,51 @@ sub ndb_mgmd_wait_started($) {
   my ($cluster)= @_;
 
   my $retries= 100;
-  while (ndbcluster_wait_started($cluster, "--no-contact") and
-	 $retries)
+  while ($retries)
   {
+    my $result= ndbcluster_wait_started($cluster, "--no-contact");
+    if ($result == 0)
+    {
+      # ndb_mgmd is started
+      mtr_verbose("ndb_mgmd is started");
+      return 0;
+    }
+    elsif ($result > 1)
+    {
+      mtr_warning("Cluster process failed while waiting for start");
+      return $result;
+    }
+
     # Millisceond sleep emulated with select
     select(undef, undef, undef, (0.1));
 
     $retries--;
   }
 
-  return $retries == 0;
-
+  return 1;
 }
 
 
-sub ndb_mgmd_start ($) {
-  my $cluster= shift or die;
+sub ndb_mgmd_start ($$) {
+  my ($cluster, $ndb_mgmd)= @_;
 
   mtr_verbose("ndb_mgmd_start");
 
+  my $dir= $ndb_mgmd->value("DataDir");
+  mkdir($dir) unless -d $dir;
+
   my $args;
   mtr_init_args(\$args);
-  mtr_add_arg($args, "--no-defaults");
-  mtr_add_arg($args, "--core");
+  mtr_add_arg($args, "--defaults-file=%s", $path_config_file);
+  mtr_add_arg($args, "--defaults-group-suffix=%s", $cluster->suffix());
+  mtr_add_arg($args, "--mycnf");
   mtr_add_arg($args, "--nodaemon");
-  mtr_add_arg($args, "--config-file=%s", "$cluster->{'data_dir'}/config.ini");
 
-  my $path_ndb_mgmd_log=
-    "$cluster->{'data_dir'}/$cluster->{'name'}_ndb_mgmd.log";
+  my $path_ndb_mgmd_log= "$dir/ndb_mgmd.log";
 
-  $cluster->{'proc'}= My::SafeProcess->new
+  $ndb_mgmd->{'proc'}= My::SafeProcess->new
     (
-     name          => "ndb_mgmd_$cluster->{'name'}",
+     name          => $ndb_mgmd->name(),
      path          => $exe_ndb_mgmd,
      args          => \$args,
      output        => $path_ndb_mgmd_log,
@@ -2088,41 +1673,42 @@ sub ndb_mgmd_start ($) {
      append        => 1,
      verbose       => $opt_verbose,
     );
-  mtr_verbose("Started $cluster->{proc}");
+  mtr_verbose("Started $ndb_mgmd->{proc}");
 
   # FIXME Should not be needed
   # Unfortunately the cluster nodes will fail to start
   # if ndb_mgmd has not started properly
   if (ndb_mgmd_wait_started($cluster))
   {
-    mtr_error("Failed to wait for start of ndb_mgmd");
+    mtr_warning("Failed to wait for start of ndb_mgmd");
+    return 1;
   }
-  return;
+
+  return 0;
 }
 
 
-sub ndbd_start ($$$) {
-  my $cluster= shift;
-  my $idx= shift;
-  my $extra_args= shift;
+sub ndbd_start {
+  my ($cluster, $ndbd)= @_;
 
   mtr_verbose("ndbd_start");
 
+  my $dir= $ndbd->value("DataDir");
+  mkdir($dir) unless -d $dir;
+
   my $args;
   mtr_init_args(\$args);
-  mtr_add_arg($args, "--no-defaults");
-  mtr_add_arg($args, "--core");
-  mtr_add_arg($args, "--ndb-connectstring=%s", "$cluster->{'connect_string'}");
-  mtr_add_arg($args, "--character-sets-dir=%s", "$path_charsetsdir");
+  mtr_add_arg($args, "--defaults-file=%s", $path_config_file);
+  mtr_add_arg($args, "--defaults-group-suffix=%s", $cluster->suffix());
   mtr_add_arg($args, "--nodaemon");
-  mtr_add_arg($args, "$extra_args");
 
-  my $nodeid= $cluster->{'ndbds'}->[$idx]->{'nodeid'};
-  my $path_ndbd_log= "$cluster->{'data_dir'}/ndb_${nodeid}.log";
+# > 5.0 { 'character-sets-dir' => \&fix_charset_dir },
 
+
+  my $path_ndbd_log= "$dir/ndbd.log";
   my $proc= My::SafeProcess->new
     (
-     name          => "ndbd_$cluster->{'name'}",
+     name          => $ndbd->name(),
      path          => $exe_ndbd,
      args          => \$args,
      output        => $path_ndbd_log,
@@ -2132,124 +1718,33 @@ sub ndbd_start ($$$) {
     );
   mtr_verbose("Started $proc");
 
-  $cluster->{'ndbds'}->[$idx]->{'proc'}= $proc;
-
-  # Rememeber options used when starting
-  $cluster->{'ndbds'}->[$idx]->{'start_extra_args'}= $extra_args;
-  $cluster->{'ndbds'}->[$idx]->{'idx'}= $idx;
+  $ndbd->{proc}= $proc;
 
   return;
 }
 
 
-sub ndbcluster_start ($$) {
+sub ndbcluster_start ($) {
   my $cluster= shift;
-  my $extra_args= shift;
 
-  mtr_verbose("ndbcluster_start '$cluster->{'name'}'");
+  mtr_verbose("ndbcluster_start '".$cluster->name()."'");
 
-  if ( $cluster->{use_running} )
+  foreach my $ndb_mgmd ( in_cluster($cluster, ndb_mgmds()) )
   {
-    return 0;
+    next if started($ndb_mgmd);
+    ndb_mgmd_start($cluster, $ndb_mgmd);
   }
 
-  if ( defined $cluster->{'proc'} )
+  foreach my $ndbd ( in_cluster($cluster, ndbds()) )
   {
-    mtr_error("Cluster '$cluster->{'name'}' already started");
-  }
-
-  ndb_mgmd_start($cluster);
-
-  for ( my $idx= 0; $idx < $cluster->{'nodes'}; $idx++ )
-  {
-    ndbd_start($cluster, $idx, $extra_args);
+    next if started($ndbd);
+    ndbd_start($cluster, $ndbd);
   }
 
   return 0;
 }
 
 
-sub rm_ndbcluster_tables ($) {
-  my $dir=       shift;
-  foreach my $bin ( glob("$dir/mysql/ndb_apply_status*"),
-                    glob("$dir/mysql/ndb_schema*"))
-  {
-    unlink($bin);
-  }
-}
-
-
-#
-#  Run the benchmark suite
-#
-sub run_benchmarks ($) {
-  my $benchmark=  shift;
-
-  my $args;
-
-  if ( ! $glob_use_embedded_server )
-  {
-    mysqld_start($master->[0],[],[]);
-    if ( ! $master->[0]->{'proc'} )
-    {
-      mtr_error("Can't start the mysqld server");
-    }
-  }
-
-  mtr_init_args(\$args);
-
-  mtr_add_arg($args, "--socket=%s", $master->[0]->{'path_sock'});
-  mtr_add_arg($args, "--user=%s", $opt_user);
-
-  if ( $opt_small_bench )
-  {
-    mtr_add_arg($args, "--small-test");
-    mtr_add_arg($args, "--small-tables");
-  }
-
-  if ( $opt_with_ndbcluster )
-  {
-    mtr_add_arg($args, "--create-options=TYPE=ndb");
-  }
-
-  chdir($glob_mysql_bench_dir)
-    or mtr_error("Couldn't chdir to '$glob_mysql_bench_dir': $!");
-
-  if ( ! $benchmark )
-  {
-    mtr_add_arg($args, "--log");
-    my $res= My::SafeProcess->run
-      (
-       name          => "run-all-tests",
-       path          => "$glob_mysql_bench_dir/run-all-tests",
-       args          => \$args,
-    );
-    # FIXME check result code?!
-  }
-  elsif ( -x $benchmark )
-  {
-    my $res= My::SafeProcess->run
-      (
-       name          => "$benchmark",
-       path          => "$glob_mysql_bench_dir/$benchmark",
-       args          => \$args,
-    );
-    # FIXME check result code?!
-  }
-  else
-  {
-    mtr_error("Benchmark $benchmark not found");
-  }
-
-  chdir($glob_mysql_test_dir);          # Go back
-
-  if ( ! $glob_use_embedded_server )
-  {
-    stop_masters();
-  }
-}
-
-
 #
 # Run the collected tests
 #
@@ -2276,12 +1771,7 @@ sub run_tests {
 
   mtr_print_line();
 
-  if ( ! $glob_debugger and
-       ! $opt_extern and
-       ! $glob_use_embedded_server )
-  {
-    stop_all_servers();
-  }
+  stop_all_servers();
 
   if ( $opt_gcov )
   {
@@ -2293,22 +1783,27 @@ sub run_tests {
 }
 
 
-sub create_config_file() {
+sub create_config_file_for_extern {
+  my %opts=
+    (
+     socket     => '/tmp/mysqld.sock',
+     port       => 3306,
+     user       => 'test',
+     password   => '',
+     @_
+    );
 
-  mtr_report("Creating my.cnf file...");
+  mtr_report("Creating my.cnf file for extern server...");
   my $F= IO::File->new($path_config_file, "w")
     or mtr_error("Can't write to $path_config_file: $!");
 
+  print $F "[client]\n";
+  while (my ($option, $value)= each( %opts )) {
+    print $F "$option= $value\n";
+    mtr_report(" $option= $value");
+  }
+
   print $F <<EOF
-[client]
-socket            = $master->[0]->{'path_sock'}
-port              = $master->[0]->{'port'}
-user              = $opt_user
-password          =
-
-[client_slave]
-socket            = $slave->[0]->{'path_sock'}
-port              = $slave->[0]->{'port'}
 
 # binlog reads from [client] and [mysqlbinlog]
 [mysqlbinlog]
@@ -2316,10 +1811,10 @@ character-sets-dir= $path_charsetsdir
 
 # mysql_fix_privilege_tables.sh don't read from [client]
 [mysql_fix_privilege_tables]
-socket            = $master->[0]->{'path_sock'}
-port              = $master->[0]->{'port'}
-user              = $opt_user
-password          =
+socket            = $opts{'socket'}
+port              = $opts{'port'}
+user              = $opts{'user'}
+password          = $opts{'password'}
 
 
 EOF
@@ -2387,20 +1882,19 @@ sub kill_leftovers ($) {
 #
 sub check_ports_free
 {
-  my @ports_to_check=
-    grep { defined } map { $_->{port} } all_servers();
-
+  my @ports_to_check;
+  for ($opt_baseport..$opt_baseport+9){
+    push(@ports_to_check, $_);
+  }
   mtr_report("Checking ports...");
-
   # print "@ports_to_check\n";
-
   foreach my $port (@ports_to_check){
     if (mtr_ping_port($port)){
       mtr_report(" - 'localhost:$port' was not free");
       return 1; # One port was not free
     }
   }
-
+# MASV TODO
 #  return parallel(&check_port_free,
 #		  @ports_to_check);
 
@@ -2410,7 +1904,7 @@ sub check_ports_free
 
 sub initialize_servers {
 
-  if ( $opt_extern )
+  if ( using_extern() )
   {
     # Running against an already started server, if the specified
     # vardir does not already exist it should be created
@@ -2430,7 +1924,7 @@ sub initialize_servers {
     kill_leftovers("$opt_vardir/run");
 
     if (check_ports_free()){
-      # Some port was not free
+      # Some port was not free(which one has already been printed)
       mtr_error("Some port(s) was not free")
     }
 
@@ -2445,59 +1939,6 @@ sub initialize_servers {
   check_running_as_root();
 
   mtr_log_init("$opt_vardir/log/mysql-test-run.log");
-
-  if ( ! -f $path_config_file ) {
-    # Create a new config file if one does not already exist
-    create_config_file();
-  }
-}
-
-
-sub mysql_install_db {
-
-  install_db();
-
-  my $cluster_started_ok= 1; # Assume it can be started
-  my $cluster= $clusters->[0]; # Master cluster
-  if ($opt_skip_ndbcluster ||
-      $cluster->{use_running} ||
-      $clusters->[0]->{executable_setup_failed})
-  {
-    # Don't install master cluster
-  }
-  elsif (ndbcluster_install($clusters->[0]))
-  {
-    mtr_warning("Failed to install $clusters->[0]->{name} cluster");
-    $cluster_started_ok= 0;
-  }
-
-  my $cluster= $clusters->[1]; # Slave cluster
-  if ($max_slave_num == 0 ||
-      $opt_skip_ndbcluster_slave ||
-      $cluster->{use_running} ||
-      $clusters->[1]->{executable_setup_failed})
-  {
-    # Don't install slave cluster
-  }
-  elsif (ndbcluster_install($clusters->[1]))
-  {
-    mtr_warning("Failed to install $clusters->[1]->{name} cluster");
-    $cluster_started_ok= 0;
-  }
-
-  if ( ! $cluster_started_ok )
-  {
-    if ( $opt_force)
-    {
-      # Continue without cluster
-    }
-    else
-    {
-      mtr_error("To continue, re-run with '--force'.");
-    }
-  }
-
-  return 0;
 }
 
 
@@ -2512,11 +1953,11 @@ sub copy_install_db ($) {
     if -d $path_data_dir;
 
   # copy the installed db into place
-  mtr_copy_dir("$opt_vardir/install.db", $path_data_dir);
+  copytree("$opt_vardir/install.db", $path_data_dir);
 }
 
 
-sub install_db {
+sub mysql_install_db {
   my $data_dir= "$opt_vardir/install.db";
 
   mtr_report("Installing system database...");
@@ -2525,10 +1966,10 @@ sub install_db {
   mtr_init_args(\$args);
   mtr_add_arg($args, "--no-defaults");
   mtr_add_arg($args, "--bootstrap");
-  mtr_add_arg($args, "--basedir=%s", $path_my_basedir);
+  mtr_add_arg($args, "--basedir=%s", $basedir);
   mtr_add_arg($args, "--datadir=%s", $data_dir);
-  mtr_add_arg($args, "--loose-skip-innodb");
-  mtr_add_arg($args, "--loose-skip-ndbcluster");
+  mtr_add_arg($args, "--skip-innodb");
+  mtr_add_arg($args, "--skip-ndbcluster");
   mtr_add_arg($args, "--tmpdir=.");
   mtr_add_arg($args, "--core-file");
 
@@ -2604,6 +2045,7 @@ sub install_db {
 	input         => $bootstrap_sql_file,
 	output        => $path_bootstrap_log,
 	error         => $path_bootstrap_log,
+	append        => 1,
        ) != 0)
   {
     mtr_error("Error executing mysqld --bootstrap\n" .
@@ -2632,16 +2074,8 @@ sub run_testcase_check_skip_test($)
 
   if ($tinfo->{'ndb_test'})
   {
-    foreach my $cluster (@{$clusters})
+    foreach my $cluster ( clusters() )
     {
-      last if ($opt_skip_ndbcluster_slave and
-	       $cluster->{'name'} eq 'Slave');
-
-      # Using running cluster - no need
-      # to check if test should be skipped
-      # will be done by test itself
-      last if ($cluster->{'use_running'});
-
       # If test needs this cluster, check binaries was found ok
       if ( $cluster->{'executable_setup_failed'} )
       {
@@ -2650,16 +2084,6 @@ sub run_testcase_check_skip_test($)
 	mtr_report_test_failed($tinfo);
 	return 1;
       }
-
-      # If test needs this cluster, check it was installed ok
-      if ( $cluster->{'failed_start'} >= 3 )
-      {
-	$tinfo->{comment}=
-	  "Cluster $cluster->{'name'} failed to start too many times";
-	mtr_report_test_failed($tinfo);
-	return 1;
-      }
-
     }
   }
 
@@ -2679,17 +2103,14 @@ sub do_before_run_mysqltest($)
   unlink("$base_file.log");
   unlink("$base_file.warnings");
 
-  if (!$opt_extern)
-  {
-    if ( $mysql_version_id < 50000 ) {
-      # Set environment variable NDB_STATUS_OK to 1
-      # if script decided to run mysqltest cluster _is_ installed ok
-      $ENV{'NDB_STATUS_OK'} = "1";
-    } elsif ( $mysql_version_id < 50100 ) {
-      # Set environment variable NDB_STATUS_OK to YES
-      # if script decided to run mysqltest cluster _is_ installed ok
-      $ENV{'NDB_STATUS_OK'} = "YES";
-    }
+  if ( $mysql_version_id < 50000 ) {
+    # Set environment variable NDB_STATUS_OK to 1
+    # if script decided to run mysqltest cluster _is_ installed ok
+    $ENV{'NDB_STATUS_OK'} = "1";
+  } elsif ( $mysql_version_id < 50100 ) {
+    # Set environment variable NDB_STATUS_OK to YES
+    # if script decided to run mysqltest cluster _is_ installed ok
+    $ENV{'NDB_STATUS_OK'} = "YES";
   }
 }
 
@@ -2700,7 +2121,7 @@ sub run_check_testcase_all($$)
 
   return if ( !$opt_check_testcases );
 
-  foreach my $mysqld (@{$master}, @{$slave})
+  foreach my $mysqld ( mysqlds() )
   {
     if ( defined $mysqld->{'proc'} )
     {
@@ -2714,24 +2135,10 @@ sub run_check_testcase_all($$)
 }
 
 
-sub run_testcase_mark_logs($)
-{
-  my ($log_msg)= @_;
-
-  # Write a marker to all log files
-
-  # The file indicating current test name
-  mtr_tonewfile($path_current_test_log, $log_msg);
-
-  # each mysqld's .err file
-  foreach my $mysqld (@{$master}, @{$slave})
-  {
-    mtr_tofile($mysqld->{path_myerr}, $log_msg);
-  }
-
-  # ndbcluster log file
-  mtr_tofile($path_ndb_testrun_log, $log_msg);
-
+sub mark_log {
+  my ($log, $tinfo)= @_;
+  my $log_msg= "CURRENT_TEST: $tinfo->{name}\n";
+  mtr_tofile($log, $log_msg);
 }
 
 
@@ -2765,52 +2172,104 @@ sub find_testcase_skipped_reason($)
 }
 
 
+# Return timezone value of tinfo or default value
+sub timezone {
+  my ($tinfo)= @_;
+  return $tinfo->{timezone} || "GMT-3";
+}
+
+
+# Storage for changed environment variables
+my %old_env;
+
 #
 # Run a single test case
 #
 sub run_testcase ($) {
   my $tinfo=  shift;
 
+  mtr_verbose("Running test:", $tinfo->{name});
+
   # -------------------------------------------------------
   # Init variables that can change between each test case
   # -------------------------------------------------------
-  my $timezone= $tinfo->{'timezone'} || "GMT-3";
+  my $timezone= timezone($tinfo);
   $ENV{'TZ'}= $timezone;
   mtr_verbose("Setting timezone: $timezone");
 
-  my $master_restart= run_testcase_need_master_restart($tinfo);
-  my $slave_restart= run_testcase_need_slave_restart($tinfo);
-
-  if ($master_restart or $slave_restart)
+  if ( ! using_extern() )
   {
-    # Can't restart a running server that may be in use
-    if ( $opt_extern )
-    {
-      $tinfo->{comment}= "Can't restart a running server";
-      mtr_report_test_skipped($tinfo);
-      return;
-    }
+    my @restart= servers_need_restart($tinfo);
+    if ( @restart != 0) {
+      stop_servers($tinfo, @restart );
+    }
+
+    if ( started(all_servers()) == 0 )
+    {
+      # Restore old ENV
+      while (my ($option, $value)= each( %old_env )) {
+	if (defined $value){
+	  mtr_verbose("Restoring $option to $value");
+	  $ENV{$option}= $value;
+	} else {
+	  mtr_verbose("Removing $option");
+	  delete($ENV{$option});
+	}
+      }
+      %old_env= ();
 
-    run_testcase_stop_servers($tinfo, $master_restart, $slave_restart);
-  }
+      mtr_verbose("Generating my.cnf from '$tinfo->{template_path}'");
 
-  # Write to all log files to indicate start of testcase
-  run_testcase_mark_logs("CURRENT_TEST: $tinfo->{name}\n");
+      # Generate new config file from template
+      $config= My::ConfigFactory->new_config
+	( {
+	   basedir         => $basedir,
+	   template_path   => $tinfo->{template_path},
+	   extra_template_path => $tinfo->{extra_template_path},
+	   vardir          => $opt_vardir,
+	   tmpdir          => $opt_tmpdir,
+	   baseport        => $opt_baseport,
+	   #hosts          => [ 'host1', 'host2' ],
+	   user            => $opt_user,
+	   password        => '',
+	  }
+	);
 
-  if ($master_restart or $slave_restart)
-  {
-    if (run_testcase_start_servers($tinfo))
+      # Write the new my.cnf
+      $config->save($path_config_file);
+
+      # Remember current config so a restart can occur when a test need
+      # to use a different one
+      $current_config_name= $tinfo->{template_path};
+
+      #
+      # Set variables in the ENV section
+      #
+      foreach my $option ($config->options_in_group("ENV"))
+      {
+	# Save old value to restore it before next time
+	$old_env{$option->name()}= $ENV{$option->name()};
+
+	mtr_verbose($option->name(), "=",$option->value());
+	$ENV{$option->name()}= $option->value();
+      }
+    }
+
+    # Write start of testcase to log
+    mark_log($path_current_test_log, $tinfo);
+
+    if (start_servers($tinfo))
     {
       report_failure_and_restart($tinfo);
       return 1;
     }
   }
 
-  # ----------------------------------------------------------------------
-  # If --start-and-exit or --start-dirty given, stop here to let user manually
+  # --------------------------------------------------------------------
+  # If --start or --start-dirty given, stop here to let user manually
   # run tests
   # ----------------------------------------------------------------------
-  if ( $opt_start_and_exit or $opt_start_dirty )
+  if ( $opt_start or $opt_start_dirty )
   {
     mtr_report("\nServers started, sleeping");
     sleep(1) while (1);
@@ -2845,7 +2304,7 @@ sub run_testcase ($) {
 
     if ( $res == 0 )
     {
-      mtr_report_test_passed($tinfo);
+      mtr_report_test_passed($tinfo, $opt_timer);
 
       run_check_testcase_all($tinfo, "after");
     }
@@ -2879,6 +2338,8 @@ sub run_testcase ($) {
 
     # Remove the file that mysqltest writes info to
     unlink($path_timefile);
+    # Remove the file that mysql-test-run writes info to
+    unlink($path_current_test_log);
 
     return;
 
@@ -2954,21 +2415,24 @@ sub after_test_failure ($) {
 
   mtr_report("Cleaning datadirs...");
 
-  foreach my $server (@{$master}, @{$slave} )
+  foreach my $mysqld ( mysqlds() )
   {
-    my $data_dir= $server->{path_myddir};
+    my $data_dir= $mysqld->value('datadir');
     my $name= basename($data_dir);
     save_files_after_test_failure($test_name, $data_dir);
-    rmtree("$data_dir");
+    rmtree($data_dir);
   }
 
   # Remove the ndb_*_fs dirs for all ndbd nodes
   # forcing a clean start of ndb next time
-  foreach my $cluster (@{$clusters})
+  foreach my $cluster ( clusters() )
   {
-    foreach my $ndbd (@{$cluster->{'ndbds'}})
+    foreach my $ndbd ( ndbds($cluster) )
     {
-      rmtree("$ndbd->{'path_fs'}" );
+      my $datadir= $ndbd->value('DataDir');
+      foreach my $fs_dir ( glob("$datadir/ndb_*_fs") ) {
+	rmtree($fs_dir) if -d $fs_dir;
+      }
     }
   }
 }
@@ -2977,7 +2441,7 @@ sub after_test_failure ($) {
 sub report_failure_and_restart ($) {
   my $tinfo= shift;
 
-  mtr_report_test_failed($tinfo);
+  mtr_report_test_failed($tinfo, $path_timefile);
   print "\n";
   if ( $opt_force )
   {
@@ -2998,60 +2462,12 @@ sub run_sh_script {
 
   return 0 unless defined $script;
 
+  mtr_verbose("Running '$script'");
   my $ret= system("/bin/sh $script") >> 8;
   return $ret;
 }
 
 
-sub do_before_start_master ($) {
-  my ($tinfo)= @_;
-
-  my $tname= $tinfo->{'name'};
-
-  # FIXME what about second master.....
-
-  # Don't delete anything if starting dirty
-  return if ($opt_start_dirty);
-
-  foreach my $bin ( glob("$opt_vardir/log/master*-bin*") )
-  {
-    unlink($bin);
-  }
-
-  # FIXME only remove the ones that are tied to this master
-  # Remove old master.info and relay-log.info files
-  unlink("$master->[0]->{'path_myddir'}/master.info");
-  unlink("$master->[0]->{'path_myddir'}/relay-log.info");
-  unlink("$master->[1]->{'path_myddir'}/master.info");
-  unlink("$master->[1]->{'path_myddir'}/relay-log.info");
-
-}
-
-
-sub do_before_start_slave ($) {
-  my ($tinfo)= @_;
-
-  my $tname= $tinfo->{'name'};
-
-  # Don't delete anything if starting dirty
-  return if ($opt_start_dirty);
-
-  foreach my $bin ( glob("$opt_vardir/log/slave*-bin*") )
-  {
-    unlink($bin);
-  }
-
-  unlink("$slave->[0]->{'path_myddir'}/master.info");
-  unlink("$slave->[0]->{'path_myddir'}/relay-log.info");
-
-  foreach my $bin ( glob("$slave->[0]->{'path_myddir'}/log.*") )
-  {
-    unlink($bin);
-  }
-}
-
-
-
 sub mysqld_stop {
   my $mysqld= shift or die "usage: mysqld_stop(<mysqld>)";
 
@@ -3061,8 +2477,8 @@ sub mysqld_stop {
   mtr_add_arg($args, "--no-defaults");
   mtr_add_arg($args, "--user=%s", $opt_user);
   mtr_add_arg($args, "--password=");
-  mtr_add_arg($args, "--port=%d", $mysqld->{port});
-  mtr_add_arg($args, "--host=%s", $mysqld->{host} || "localhost");
+  mtr_add_arg($args, "--port=%d", $mysqld->value('port'));
+  mtr_add_arg($args, "--host=%s", $mysqld->value('#host'));
   mtr_add_arg($args, "--connect_timeout=20");
   mtr_add_arg($args, "--protocol=tcp");
 
@@ -3070,7 +2486,7 @@ sub mysqld_stop {
 
   My::SafeProcess->run
     (
-     name          => "mysqladmin shutdown $mysqld->{'type'} $mysqld->{'idx'}",
+     name          => "mysqladmin shutdown ".$mysqld->name(),
      path          => $exe_mysqladmin,
      args          => \$args,
      error         => "/dev/null",
@@ -3079,68 +2495,28 @@ sub mysqld_stop {
 }
 
 
-sub mysqld_arguments ($$$$) {
+sub mysqld_arguments ($$$) {
   my $args=              shift;
   my $mysqld=            shift;
   my $extra_opt=         shift;
-  my $slave_master_info= shift;
-
-  my $idx= $mysqld->{'idx'};
-  my $sidx= "";                 # Index as string, 0 is empty string
-  if ( $idx> 0 )
-  {
-    $sidx= $idx;
-  }
 
   my $prefix= "";               # If mysqltest server arg
-  if ( $glob_use_embedded_server )
+  if ( $opt_embedded_server )
   {
     $prefix= "--server-arg=";
   }
 
-  mtr_add_arg($args, "%s--no-defaults", $prefix);
-
-  mtr_add_arg($args, "%s--basedir=%s", $prefix, $path_my_basedir);
-  mtr_add_arg($args, "%s--character-sets-dir=%s", $prefix, $path_charsetsdir);
+  mtr_add_arg($args, "%s--defaults-file=%s", $prefix, $path_config_file);
+  mtr_add_arg($args, "--defaults-group-suffix=%s", $mysqld->suffix());
 
   # When mysqld is run by a root user(euid is 0), it will fail
   # to start unless we specify what user to run as, see BUG#30630
   my $euid= $>;
-  if (!$glob_win32 and $euid == 0 and
+  if (!$is_win32 and $euid == 0 and
       (grep(/^--user/, @$extra_opt, @opt_extra_mysqld_opt)) == 0) {
     mtr_add_arg($args, "%s--user=root", $prefix);
   }
 
-  if ( $mysql_version_id >= 50036)
-  {
-    # By default, prevent the started mysqld to access files outside of vardir
-    mtr_add_arg($args, "%s--secure-file-priv=%s", $prefix, $opt_vardir);
-  }
-
-  if ( $mysql_version_id >= 50000 )
-  {
-    mtr_add_arg($args, "%s--log-bin-trust-function-creators", $prefix);
-  }
-
-  mtr_add_arg($args, "%s--default-character-set=latin1", $prefix);
-  mtr_add_arg($args, "%s--language=%s", $prefix, $path_language);
-  mtr_add_arg($args, "%s--tmpdir=$opt_tmpdir", $prefix);
-
-  # Increase default connect_timeout to avoid intermittent
-  # disconnects when test servers are put under load
-  # see BUG#28359
-  mtr_add_arg($args, "%s--connect-timeout=60", $prefix);
-
-
-  # When mysqld is run by a root user(euid is 0), it will fail
-  # to start unless we specify what user to run as. If not running
-  # as root it will be ignored, see BUG#30630
-  my $euid= $>;
-  if (!$glob_win32 and $euid == 0 and
-      grep(/^--user/, @$extra_opt, @opt_extra_mysqld_opt) == 0) {
-    mtr_add_arg($args, "%s--user=root");
-  }
-
   if ( $opt_valgrind_mysqld )
   {
     mtr_add_arg($args, "%s--skip-safemalloc", $prefix);
@@ -3151,165 +2527,29 @@ sub mysqld_arguments ($$$$) {
     }
   }
 
-  mtr_add_arg($args, "%s--pid-file=%s", $prefix,
-	      $mysqld->{'path_pid'});
-
-  mtr_add_arg($args, "%s--port=%d", $prefix,
-                $mysqld->{'port'});
-
-  mtr_add_arg($args, "%s--socket=%s", $prefix,
-	      $mysqld->{'path_sock'});
-
-  mtr_add_arg($args, "%s--datadir=%s", $prefix,
-	      $mysqld->{'path_myddir'});
-
   if ( $mysql_version_id >= 50106 )
   {
-    # Turn on logging to bothe tables and file
+    # Turn on logging to both tables and file
     mtr_add_arg($args, "%s--log-output=table,file", $prefix);
   }
 
-  my $log_base_path= "$opt_vardir/log/$mysqld->{'type'}$sidx";
-  mtr_add_arg($args, "%s--log=%s.log", $prefix, $log_base_path);
-  mtr_add_arg($args,
-	      "%s--log-slow-queries=%s-slow.log", $prefix, $log_base_path);
-
   # Check if "extra_opt" contains --skip-log-bin
   my $skip_binlog= grep(/^--skip-log-bin/, @$extra_opt, @opt_extra_mysqld_opt);
-  if ( $mysqld->{'type'} eq 'master' )
-  {
-    if (! ($opt_skip_master_binlog || $skip_binlog) )
-    {
-      mtr_add_arg($args, "%s--log-bin=%s/log/master-bin%s", $prefix,
-                  $opt_vardir, $sidx);
-    }
-
-    mtr_add_arg($args, "%s--server-id=%d", $prefix,
-	       $idx > 0 ? $idx + 101 : 1);
 
-    mtr_add_arg($args, "%s--innodb_data_file_path=ibdata1:10M:autoextend",
-		$prefix);
-
-    mtr_add_arg($args, "%s--local-infile", $prefix);
-
-    if ( $idx > 0 or !$use_innodb)
-    {
-      mtr_add_arg($args, "%s--loose-skip-innodb", $prefix);
-    }
 
-    my $cluster= $clusters->[$mysqld->{'cluster'}];
-    if ( defined $cluster->{'proc'} ||  # Cluster is started
-	 $cluster->{'use_running'} )    # Using running cluster
-    {
-      mtr_add_arg($args, "%s--ndbcluster", $prefix);
-      mtr_add_arg($args, "%s--ndb-connectstring=%s", $prefix,
-		  $cluster->{'connect_string'});
-      if ( $mysql_version_id >= 50100 )
-      {
-	mtr_add_arg($args, "%s--ndb-extra-logging", $prefix);
-      }
-    }
-    else
-    {
-      mtr_add_arg($args, "%s--loose-skip-ndbcluster", $prefix);
-    }
-  }
-  else
+  if ( !$use_innodb )
   {
-    mtr_error("unknown mysqld type")
-      unless $mysqld->{'type'} eq 'slave';
-
-    mtr_add_arg($args, "%s--init-rpl-role=slave", $prefix);
-    if (! ( $opt_skip_slave_binlog || $skip_binlog ))
-    {
-      mtr_add_arg($args, "%s--log-bin=%s/log/slave%s-bin", $prefix,
-                  $opt_vardir, $sidx); # FIXME use own dir for binlogs
-      mtr_add_arg($args, "%s--log-slave-updates", $prefix);
-    }
-
-    mtr_add_arg($args, "%s--master-retry-count=10", $prefix);
-
-    mtr_add_arg($args, "%s--relay-log=%s/log/slave%s-relay-bin", $prefix,
-                $opt_vardir, $sidx);
-    mtr_add_arg($args, "%s--report-host=127.0.0.1", $prefix);
-    mtr_add_arg($args, "%s--report-port=%d", $prefix,
-                $mysqld->{'port'});
-    mtr_add_arg($args, "%s--report-user=root", $prefix);
-    mtr_add_arg($args, "%s--loose-skip-innodb", $prefix);
-    mtr_add_arg($args, "%s--skip-slave-start", $prefix);
-
-    # Directory where slaves find the dumps generated by "load data"
-    # on the server. The path need to have constant length otherwise
-    # test results will vary, thus a relative path is used.
-    my $slave_load_path= "../tmp";
-    mtr_add_arg($args, "%s--slave-load-tmpdir=%s", $prefix,
-                $slave_load_path);
-    mtr_add_arg($args, "%s--set-variable=slave_net_timeout=10", $prefix);
-
-    if ( @$slave_master_info )
-    {
-      foreach my $arg ( @$slave_master_info )
-      {
-        mtr_add_arg($args, "%s%s", $prefix, $arg);
-      }
-    }
-    else
-    {
-      mtr_add_arg($args, "%s--master-user=root", $prefix);
-      mtr_add_arg($args, "%s--master-connect-retry=1", $prefix);
-      mtr_add_arg($args, "%s--master-host=127.0.0.1", $prefix);
-      mtr_add_arg($args, "%s--master-password=", $prefix);
-      mtr_add_arg($args, "%s--master-port=%d", $prefix,
-                  $master->[0]->{'port'}); # First master
-
-      my $slave_server_id=  2 + $idx;
-      my $slave_rpl_rank= $slave_server_id;
-      mtr_add_arg($args, "%s--server-id=%d", $prefix, $slave_server_id);
-      mtr_add_arg($args, "%s--rpl-recovery-rank=%d", $prefix, $slave_rpl_rank);
-    }
-
-
-    my $cluster= $clusters->[$mysqld->{'cluster'}];
-    if ( defined $cluster->{'proc'} ||  # Cluster is started
-	 $cluster->{'use_running'} )    # Using running cluster
-    {
-      mtr_add_arg($args, "%s--ndbcluster", $prefix);
-      mtr_add_arg($args, "%s--ndb-connectstring=%s", $prefix,
-		  $clusters->[$mysqld->{'cluster'}]->{'connect_string'});
-
-      if ( $mysql_version_id >= 50100 )
-      {
-	mtr_add_arg($args, "%s--ndb-extra-logging", $prefix);
-      }
-    }
-    else
-    {
-      mtr_add_arg($args, "%s--loose-skip-ndbcluster", $prefix);
-    }
-
-  } # end slave
+    mtr_add_arg($args, "%s--skip-innodb", $prefix);
+  }
 
   if ( $opt_debug )
   {
-    mtr_add_arg($args, "%s--debug=d:t:i:A,%s/log/%s%s.trace",
-		$prefix, $path_vardir_trace, $mysqld->{'type'}, $sidx);
+    mtr_add_arg($args, "%s--debug=d:t:i:A,%s/log/%s.trace",
+		$prefix, $path_vardir_trace, $mysqld->name());
   }
 
-  mtr_add_arg($args, "%s--key_buffer_size=1M", $prefix);
-  mtr_add_arg($args, "%s--sort_buffer=256K", $prefix);
-  mtr_add_arg($args, "%s--max_heap_table_size=1M", $prefix);
 
-  if ( $opt_ssl_supported )
-  {
-    mtr_add_arg($args, "%s--ssl-ca=%s/std_data/cacert.pem", $prefix,
-                $glob_mysql_test_dir);
-    mtr_add_arg($args, "%s--ssl-cert=%s/std_data/server-cert.pem", $prefix,
-                $glob_mysql_test_dir);
-    mtr_add_arg($args, "%s--ssl-key=%s/std_data/server-key.pem", $prefix,
-                $glob_mysql_test_dir);
-  }
-
-  # Indicate to "mysqld" it will be debugged in debugger
+  # Indicate to mysqld it will be debugged in debugger
   if ( $glob_debugger )
   {
     mtr_add_arg($args, "%s--gdb", $prefix);
@@ -3337,17 +2577,9 @@ sub mysqld_arguments ($$$$) {
     mtr_add_arg($args, "%s%s", $prefix, "--core-file");
   }
 
-  if ( $opt_bench )
-  {
-    mtr_add_arg($args, "%s--rpl-recovery-rank=1", $prefix);
-    mtr_add_arg($args, "%s--init-rpl-role=master", $prefix);
-  }
-  elsif ( $mysqld->{'type'} eq 'master' )
-  {
-    mtr_add_arg($args, "%s--open-files-limit=1024", $prefix);
-  }
+# MASV  move core-file before extra_opts, core-file=0/skip-core-file?
 
-  if ( $glob_win32 ){
+  if ( $is_win32 ){
     mtr_add_arg($args, "%s--log-error=%s", $prefix, $mysqld->{"path_myerr"});
   }
 
@@ -3355,32 +2587,15 @@ sub mysqld_arguments ($$$$) {
 }
 
 
-sub mysqld_start ($$$) {
+sub mysqld_start ($$) {
   my $mysqld=            shift;
   my $extra_opt=         shift;
-  my $slave_master_info= shift;
 
-  my $exe;
+  my $exe= $exe_mysqld;
   my $wait_for_pid_file= 1;
 
-  my $type= $mysqld->{'type'};
-  my $idx= $mysqld->{'idx'};
-
   mtr_error("Internal error: mysqld should never be started for embedded")
-    if $glob_use_embedded_server;
-
-  if ( $type eq 'master' )
-  {
-    $exe= $exe_master_mysqld || $exe_mysqld;
-  }
-  elsif ( $type eq 'slave' )
-  {
-    $exe= $exe_slave_mysqld || $exe_mysqld;
-  }
-  else
-  {
-    mtr_error("Unknown 'type' \"$type\" passed to mysqld_start");
-  }
+    if $opt_embedded_server;
 
   my $args;
   mtr_init_args(\$args);
@@ -3390,23 +2605,23 @@ sub mysqld_start ($$$) {
     valgrind_arguments($args, \$exe);
   }
 
-  mysqld_arguments($args,$mysqld,$extra_opt,$slave_master_info);
+  mysqld_arguments($args,$mysqld,$extra_opt);
 
-  if ( $opt_gdb || $opt_manual_gdb)
+  if ( $opt_gdb || $opt_manual_gdb )
   {
-    gdb_arguments(\$args, \$exe, "$type"."_$idx");
+    gdb_arguments(\$args, \$exe, $mysqld->name());
   }
   elsif ( $opt_ddd || $opt_manual_ddd )
   {
-    ddd_arguments(\$args, \$exe, "$type"."_$idx");
+    ddd_arguments(\$args, \$exe, $mysqld->name());
   }
   elsif ( $opt_debugger )
   {
-    debugger_arguments(\$args, \$exe, "$type"."_$idx");
+    debugger_arguments(\$args, \$exe, $mysqld->name());
   }
   elsif ( $opt_manual_debug )
   {
-     print "\nStart $type in your debugger\n" .
+     print "\nStart $mysqld->name() in your debugger\n" .
            "dir: $glob_mysql_test_dir\n" .
            "exe: $exe\n" .
 	   "args:  " . join(" ", @$args)  . "\n\n" .
@@ -3422,40 +2637,44 @@ sub mysqld_start ($$$) {
   }
 
   # Remove the pidfile
-  unlink($mysqld->{'path_pid'});
+  unlink($mysqld->value('pid-file'));
 
-  # Copy data dir from installed db if it does not exist
-  copy_install_db($mysqld->{path_myddir})
-    unless -d $mysqld->{path_myddir};
+  my $output= $mysqld->value('log-error');
+  if ( $opt_valgrind and $opt_debug )
+  {
+    # When both --valgrind and --debug is selected, send
+    # all output to the trace file, making it possible to
+    # see the exact location where valgrind complains
+    $output= "$opt_vardir/log/".$mysqld->name().".trace";
+  }
 
   if ( defined $exe )
   {
     $mysqld->{'proc'}= My::SafeProcess->new
       (
-       name          => "mysqld_$type$idx",
+       name          => $mysqld->name(),
        path          => $exe,
        args          => \$args,
-       output        => $mysqld->{'path_myerr'},
-       error         => $mysqld->{'path_myerr'},
+       output        => $output,
+       error         => $output,
        append        => 1,
        verbose       => $opt_verbose,
-       host          => $opt_cpcd ? "localhost" : undef,
+       host          => undef,
        shutdown      => sub { mysqld_stop($mysqld) },
       );
     mtr_verbose("Started $mysqld->{proc}");
   }
 
   if ( $wait_for_pid_file &&
-       !sleep_until_file_created($mysqld->{'path_pid'},
-				 $mysqld->{'start_timeout'},
+       !sleep_until_file_created($mysqld->value('pid-file'),
+				 $opt_start_timeout,
 				 $mysqld->{'proc'}))
   {
-    mtr_error("Failed to start mysqld $mysqld->{'type'}");
+    mtr_error("Failed to start mysqld $mysqld->name()");
   }
 
   # Remember options used when starting
-  $mysqld->{'start_opts'}= $extra_opt;
-  $mysqld->{'start_slave_master_info'}= $slave_master_info;
+  $mysqld->{'started_opts'}= $extra_opt;
 
   return;
 }
@@ -3472,327 +2691,293 @@ sub stop_all_servers () {
   # Mark servers as stopped
   map($_->{proc}= undef, all_servers());
 
-  # Remove ndb cluster tables to start clean next time
-  foreach my $mysqld (@{$master}, @{$slave}) {
-    rm_ndbcluster_tables($mysqld->{'path_myddir'});
-  }
 }
 
 
-sub run_testcase_need_master_restart($) {
-  my ($tinfo)= @_;
 
-  # We try to find out if we are to restart the master(s)
-  my $do_restart= 0;          # Assumes we don't have to
+# Find out if server should be restarted for this test
+sub server_need_restart {
+  my ($tinfo, $server)= @_;
 
-  if ( $glob_use_embedded_server )
+  if ( using_extern() )
   {
-    mtr_verbose("Never start or restart for embedded server");
-    return $do_restart;
-  }
-  elsif ( $tinfo->{'master_sh'} )
-  {
-    $do_restart= 1;           # Always restart if script to run
-    mtr_verbose("Restart master: Always restart if script to run");
-  }
-  if ( $tinfo->{'force_restart'} )
-  {
-    $do_restart= 1; # Always restart if --force-restart in -opt file
-    mtr_verbose("Restart master: Restart forced with --force-restart");
+    mtr_verbose("No restart: using extern");
+    return 0;
   }
-  elsif ( ! $opt_skip_ndbcluster and
-	  !$tinfo->{'ndb_test'} and
-	  defined $clusters->[0]->{'proc'} )
+
+  if ( $opt_embedded_server )
   {
-    $do_restart= 1;           # Restart without cluster
-    mtr_verbose("Restart master: Test does not need cluster");
+    mtr_verbose("No start or restart for embedded server");
+    return 0;
   }
-  elsif ( ! $opt_skip_ndbcluster and
-	  $tinfo->{'ndb_test'} and
-	  not defined $clusters->[0]->{'proc'} )
-  {
-    $do_restart= 1;           # Restart with cluster
-    mtr_verbose("Restart master: Test need cluster");
+
+  if ( $server->{'#!force-restart'} ) {
+    mtr_verbose("Restart: forced in configuration");
+    return 1;
   }
-  elsif ( $master->[0]->{'running_master_options'} and
-	  $master->[0]->{'running_master_options'}->{'timezone'} ne
-	  $tinfo->{'timezone'})
-  {
-    $do_restart= 1;
-    mtr_verbose("Restart master: Different timezone");
+
+  if ( $tinfo->{'force_restart'} ) {
+    mtr_verbose("Restart: forced in .opt file");
+    return 1;
   }
-  # Check that running master was started with same options
-  # as the current test requires
-  elsif (! mtr_same_opts($master->[0]->{'start_opts'},
-                         $tinfo->{'master_opt'}) )
+
+  if ( $tinfo->{template_path} ne $current_config_name)
   {
-    $do_restart= 1;
-    mtr_verbose("Restart master: running with different options '" .
-	       join(" ", @{$tinfo->{'master_opt'}}) . "' != '" .
-		join(" ", @{$master->[0]->{'start_opts'}}) . "'" );
+    mtr_verbose("Restart: using different config file");
+    return 1;
   }
-  elsif( ! defined $master->[0]->{'proc'} )
+
+  if ( $tinfo->{'master_sh'}  || $tinfo->{'slave_sh'} )
   {
-    if ( $opt_extern )
-    {
-      $do_restart= 0;
-      mtr_verbose("No restart: using extern master");
-    }
-    else
-    {
-      $do_restart= 1;
-      mtr_verbose("Restart master: master is not started");
-    }
+    mtr_verbose("Restart: script to run");
+    return 1;
   }
-  return $do_restart;
-}
 
-
-sub run_testcase_need_slave_restart($) {
-  my ($tinfo)= @_;
-
-  # We try to find out if we are to restart the slaves
-  my $do_slave_restart= 0;     # Assumes we don't have to
-
-  if ( $glob_use_embedded_server )
+  if ( $tinfo->{'force_restart'} )
   {
-    mtr_verbose("Never start or restart for embedded server");
-    return $do_slave_restart;
+    mtr_verbose("Restart: forced in .opt file");
+    return 1;
   }
-  elsif ( $max_slave_num == 0)
+
+  if ( ! started($server) )
   {
-    mtr_verbose("Skip slave restart: No testcase use slaves");
+    mtr_verbose("Restart: not started");
+    return 1;
   }
-  else
+
+  my $started_tinfo= $server->{'started_tinfo'};
+  if ( defined $started_tinfo )
   {
 
-    # Check if any slave is currently started
-    my $any_slave_started= 0;
-    foreach my $mysqld (@{$slave})
+    # Check if timezone of  test that server was started
+    # with differs from timezone of next test
+    if ( timezone($started_tinfo) ne timezone($tinfo) )
     {
-      if ( defined $mysqld->{'proc'} )
-      {
-	$any_slave_started= 1;
-	last;
-      }
+      mtr_verbose("Restart: Different timezone");
+      return 1;
     }
+  }
 
-    if ($any_slave_started)
-    {
-      mtr_verbose("Restart slave: Slave is started, always restart");
-      $do_slave_restart= 1;
-    }
-    elsif ( $tinfo->{'slave_num'} )
-    {
-      mtr_verbose("Restart slave: Test need slave");
-      $do_slave_restart= 1;
-    }
+  # Check that running process was started with same options
+  # as the current test requires
+  my $extra_opt= get_extra_opt($server, $tinfo);
+  my $started_opts= $server->{'started_opts'};
+  if (defined $started_opts and $extra_opt and
+      ! mtr_same_opts($started_opts, $extra_opt) )
+  {
+    mtr_verbose("Restart: running with different options '" .
+	       join(" ", @{$extra_opt}) . "' != '" .
+		join(" ", @{$server->{'started_opts'}}) . "'" );
+    return 1;
   }
 
-  return $do_slave_restart;
+  # Default, no restart
+  return 0;
+}
 
+
+sub servers_need_restart($) {
+  my ($tinfo)= @_;
+  return grep { server_need_restart($tinfo, $_); } all_servers();
 }
 
 
+
+#
+# Return list of specific servers
+#  - there is no servers in an empty config
+#
+sub _like   { return $config ? $config->like($_[0]) : (); }
+sub mysqlds { return _like('mysqld.'); }
+sub ndbds   { return _like('cluster_config.ndbd.');}
+sub ndb_mgmds { return _like('cluster_config.ndb_mgmd.'); }
+sub clusters  { return _like('mysql_cluster.'); }
+sub all_servers { return ( mysqlds(), ndb_mgmds(), ndbds() ); }
+
+
 #
-# Return a list of all servers
+# Filter a list of servers and return only those that are part
+# of the specified cluster
 #
-sub all_servers {
-  return (@{$master}, @{$slave}, @{$clusters},
-	  map { @{$_->{'ndbds'}} } @{$clusters});
+sub in_cluster {
+  my ($cluster)= shift;
+  # Return only processes for a specific cluster
+  return grep { $_->suffix() eq $cluster->suffix() } @_;
 }
 
 
+
 #
 # Filter a list of servers and return the SafeProcess
-# for only those that are started
+# for only those that are started or stopped
 #
-sub started {
-  return grep(defined $_, map($_->{proc}, @_));
+sub started { return grep(defined $_, map($_->{proc}, @_));  }
+sub stopped { return grep(!defined $_, map($_->{proc}, @_)); }
+
+
+sub get_extra_opt {
+  my ($mysqld, $tinfo)= @_;
+
+  return
+    $mysqld->option("#!use-slave-opt") ?
+      $tinfo->{slave_opt} : $tinfo->{master_opt};
 }
 
 
-sub run_testcase_stop_servers($$$) {
-  my ($tinfo, $do_restart, $do_slave_restart)= @_;
+sub stop_servers($$) {
+  my ($tinfo, @servers)= @_;
 
   # Remember if we restarted for this test case (count restarts)
-  $tinfo->{'restarted'}= $do_restart;
+  $tinfo->{'restarted'}= 1;
 
-  if ( $do_restart )
+  if ( @servers == all_servers() )
   {
-    delete $master->[0]->{'running_master_options'}; # Forget history
+    # All servers are going down, use some kind of order to
+    # avoid too many warnings in the log files
 
-    # Master mysqld's
-    My::SafeProcess::shutdown( $opt_shutdown_timeout, started(@{$master}) );
+    #  mysqld processes
+    My::SafeProcess::shutdown( $opt_shutdown_timeout, started(mysqlds()) );
 
-    # Master cluster
-    my $cluster= $clusters->[0];
+    # cluster processes
     My::SafeProcess::shutdown( $opt_shutdown_timeout,
-			       started($cluster, @{$cluster->{'ndbds'}}) );
-    # Mark servers as stopped
-    map($_->{proc}= undef, @{$master}, $cluster, @{$cluster->{'ndbds'}});
-
+			       started(ndbds(), ndb_mgmds()) );
   }
-
-  if ( $do_restart || $do_slave_restart )
+  else
   {
-
-    delete $slave->[0]->{'running_slave_options'}; # Forget history
-
-    # Slave mysqld's
+     # Stop only some servers
     My::SafeProcess::shutdown( $opt_shutdown_timeout,
-			       started(@{$slave}) );
-
-    # Slave cluster
-    my $cluster= $clusters->[1];
-    My::SafeProcess::shutdown( $opt_shutdown_timeout,
-			       started($cluster, @{$cluster->{'ndbds'}}) );
-
-    # Mark servers as stopped
-    map($_->{proc}= undef, @{$slave}, $cluster, @{$cluster->{'ndbds'}});
+			       started(@servers) );
+  }
 
-    foreach my $mysqld ( @{$slave} )
+  foreach my $server (@servers)
+  {
+    # Remove datadir
+    if ( $server->{'#!remove-datadir'} )
     {
-      # Remove slaves datadir
-      rmtree($mysqld->{'path_myddir'});
+      rmtree($server->value('datadir'));
     }
-  }
 
-  foreach my $mysqld (@{$master}, @{$slave})
-  {
-    # Remove ndbcluster tables if server is stopped
-    rm_ndbcluster_tables($mysqld->{'path_myddir'})
-      if ( ! defined $mysqld->{'proc'} );
+    # Mark server as stopped
+    $server->{proc}= undef;
+
+    # Forget history
+    delete $server->{'started_tinfo'};
+    delete $server->{'started_opts'};
+    delete $server->{'started_cnf'};
   }
 }
 
 
 #
-# run_testcase_start_servers
+# start_servers
 #
-# Start the servers needed by this test case
+# Start servers not already started
 #
 # RETURN
 #  0 OK
 #  1 Start failed
 #
-sub run_testcase_start_servers($) {
-  my $tinfo= shift;
-  my $tname= $tinfo->{'name'};
+sub start_servers($) {
+  my ($tinfo)= @_;
 
-  if ( ! $opt_skip_ndbcluster and
-       ! defined $clusters->[0]->{'proc'} and
-       $tinfo->{'ndb_test'} )
+  # Start clusters
+  foreach my $cluster ( clusters() )
   {
-    # Test need cluster, cluster is not started, start it
-    ndbcluster_start($clusters->[0], "");
+    ndbcluster_start($cluster);
   }
 
-  if ( ! defined $master->[0]->{'proc'} )
+  # Start mysqlds
+  foreach my $mysqld ( mysqlds() )
   {
-    # Master mysqld is not started
-    do_before_start_master($tinfo);
-
-    if (run_sh_script($tinfo->{master_sh}))
+    if ( $mysqld->{proc} )
     {
-      $tinfo->{'comment'}= "Failed to execute '$tinfo->{master_sh}'";
-      return 1;
-    }
+      # Already started
 
-    mysqld_start($master->[0],$tinfo->{'master_opt'},[]);
+      # Write start of testcase to log file
+      mark_log($mysqld->value('log-error'), $tinfo);
 
-  }
+      next;
+    }
 
-  if ( defined $clusters->[0]->{'proc'} ||
-       $clusters->[0]->{'use_running'} and
-       ! defined $master->[1]->{'proc'} and
-       $tinfo->{'master_num'} > 1 )
-  {
-    # Test needs cluster, start an extra mysqld connected to cluster
-    if ( $mysql_version_id >= 50100 )
+    my $datadir= $mysqld->value('datadir');
+
+    # Don't delete anything if starting dirty
+    if (!$opt_start_dirty)
     {
-      # First wait for first mysql server to have created ndb system
-      # tables ok FIXME This is a workaround so that only one mysqld
-      # create the tables
-      if ( ! sleep_until_file_created(
-	      "$master->[0]->{'path_myddir'}/mysql/ndb_apply_status.ndb",
-				      $master->[0]->{'start_timeout'},
-				      $master->[0]->{'proc'}))
-      {
-	$tinfo->{'comment'}= "Failed to create 'mysql/ndb_apply_status' table";
-	return 1;
+      # Remove old datadir before starting process
+      if ($mysqld->option('#!fresh-datadir') and -d $datadir) {
+	mtr_verbose("Removing old datadir: '$datadir'");
+	rmdir($datadir);
       }
-    }
-    mysqld_start($master->[1],$tinfo->{'master_opt'},[]);
-  }
 
-  # Save this test case information, so next can examine it
-  $master->[0]->{'running_master_options'}= $tinfo;
+      my @options= ('log-bin', 'relay-log');
 
-  # ----------------------------------------------------------------------
-  # Start slaves - if needed
-  # ----------------------------------------------------------------------
-  if ( defined $tinfo->{'slave_num'} )
-  {
-    do_before_start_slave($tinfo);
+      foreach my $option_name ( @options )  {
+	next unless $mysqld->option($option_name);
 
-    # Hack to copy data dir for first slave _before_ running <tname>-slave.sh
-    copy_install_db($slave->[0]->{path_myddir})
-      unless -d $slave->[0]->{path_myddir} and defined $tinfo->{slave_sh};
+	my $value= $mysqld->value($option_name);
 
-    if (run_sh_script($tinfo->{slave_sh}))
-    {
-      $tinfo->{'comment'}= "Failed to execute '$tinfo->{slave_sh}'";
-      return 1;
+	foreach my $file ( glob("$datadir/$value*") )
+	{
+	  #print "removing: $file\n";
+	  unlink($file);
+	}
+      }
+
+      # Remove old master.info and relay-log.info files
+      # from the servers datadir
+      unlink("$datadir/master.info");
+      unlink("$datadir/relay-log.info");
     }
 
-    if ( ! $opt_skip_ndbcluster_slave and
-	 ! defined $clusters->[1]->{'proc'} and
-	 $tinfo->{'ndb_test'} )
+    # Copy datadir from installed system db
+    copy_install_db($datadir) unless -d $datadir;
+
+    # Write start of testcase to log file
+    mark_log($mysqld->value('log-error'), $tinfo);
+
+    # Run <tname>-master.sh
+    if ($mysqld->option('#!run-master-sh') and
+       run_sh_script($tinfo->{master_sh}) )
     {
-      # Test need slave cluster, cluster is not started, start it
-      ndbcluster_start($clusters->[1], "");
+      $tinfo->{'comment'}= "Failed to execute '$tinfo->{master_sh}'";
+      return 1;
     }
 
-    for ( my $idx= 0; $idx <  $tinfo->{'slave_num'}; $idx++ )
+    # Run <tname>-slave.sh
+    if ($mysqld->option('#!run-slave-sh') and
+	run_sh_script($tinfo->{slave_sh}))
     {
-      if ( ! defined $slave->[$idx]->{'proc'} )
-      {
-	mysqld_start($slave->[$idx],$tinfo->{'slave_opt'},
-		     $tinfo->{'slave_mi'});
-
-      }
+      $tinfo->{'comment'}= "Failed to execute '$tinfo->{slave_sh}'";
+      return 1;
     }
 
+    my $extra_opt= get_extra_opt($mysqld, $tinfo);
+    mysqld_start($mysqld,$extra_opt);
+
     # Save this test case information, so next can examine it
-    $slave->[0]->{'running_slave_options'}= $tinfo;
+    $mysqld->{'started_tinfo'}= $tinfo;
   }
 
   # Wait for clusters to start
-  foreach my $cluster (@{$clusters})
+  foreach my $cluster ( clusters() )
   {
-
-    next if ! defined $cluster->{'proc'};
-
     if (ndbcluster_wait_started($cluster, ""))
     {
       # failed to start
-      $tinfo->{'comment'}= "Start of $cluster->{'name'} cluster failed";
-      $cluster->{failed_start}++;
+      $tinfo->{'comment'}= "Start of '".$cluster->name()."' cluster failed";
       return 1;
     }
   }
 
-  # Wait for mysqld's to start
-  foreach my $mysqld (@{$master},@{$slave})
+  # Wait for mysqlds to start
+  foreach my $mysqld ( mysqlds() )
   {
-    next if ! defined $mysqld->{'proc'};
-
-    if (sleep_until_file_created($mysqld->{'path_pid'},
-				 $mysqld->{'start_timeout'},
+    if (sleep_until_file_created($mysqld->value('pid-file'),
+				 $opt_start_timeout,
 				 $mysqld->{'proc'}) == 0) {
       $tinfo->{comment}=
-	"Failed to start $mysqld->{'type'} $mysqld->{'idx'}";
+	"Failed to start ".$mysqld->name();
       return 1;
     }
   }
@@ -3802,7 +2987,7 @@ sub run_testcase_start_servers($) {
 
 #
 # Run include/check-testcase.test
-# Before a testcase, run in record mode, save result file to var
+# Before a testcase, run in record mode and save result file to var/tmp
 # After testcase, run and compare with the recorded file, they should be equal!
 #
 # RETURN VALUE
@@ -3814,7 +2999,7 @@ sub run_check_testcase ($$$) {
   my $mode=     shift;
   my $mysqld=   shift;
 
-  my $name= "check-" . $mysqld->{'type'} . $mysqld->{'idx'};
+  my $name= "check-".$mysqld->name();
   my $tname= $tinfo->{name};
 
   my $args;
@@ -3826,8 +3011,8 @@ sub run_check_testcase ($$$) {
   mtr_add_arg($args, "--tmpdir=%s", $opt_tmpdir);
   mtr_add_arg($args, "--character-sets-dir=%s", $path_charsetsdir);
 
-  mtr_add_arg($args, "--socket=%s", $mysqld->{'path_sock'});
-  mtr_add_arg($args, "--port=%d", $mysqld->{'port'});
+  mtr_add_arg($args, "--socket=%s", $mysqld->value('socket'));
+  mtr_add_arg($args, "--port=%d", $mysqld->value('port'));
   mtr_add_arg($args, "--database=test");
   mtr_add_arg($args, "--user=%s", $opt_user);
   mtr_add_arg($args, "--password=");
@@ -3840,27 +3025,26 @@ sub run_check_testcase ($$$) {
     mtr_add_arg($args, "--record");
   }
   my $errfile= "$opt_vardir/tmp/$name.err";
-  my $proc= My::SafeProcess->new
+  my $res= My::SafeProcess->run
     (
      name          => $name,
      path          => $exe_mysqltest,
      error         => $errfile,
      args          => \$args,
     );
-  $proc->wait();
-  my $res= $proc->exit_status();
+
   if ( $mode eq "after" and $res == 1 )
   {
-    print "\nThe check of testcase '$tname' failed, this is the\n",
-      "diff between before and after:\n\n";
+    mtr_report("\nThe check of testcase '$tname' failed, this is the\n",
+	       "diff between before and after:\n");
     # Test failed, display the report mysqltest has created
     mtr_printfile("$opt_vardir/tmp/$name.err");
   }
   elsif ( $res )
   {
-    print "\nCould not execute 'check-testcase' $mode testcase '$tname':\n";
+    mtr_report("\nCould not execute 'check-testcase' $mode testcase '$tname':");
     mtr_printfile("$opt_vardir/tmp/$name.err");
-    print "\n";
+    mtr_report();
   }
   return $res;
 }
@@ -3914,7 +3098,7 @@ sub start_mysqltest ($) {
 
   if ( $opt_strace_client )
   {
-    $exe=  "strace";            # FIXME there are ktrace, ....
+    $exe=  $opt_strace_client || "strace";
     mtr_add_arg($args, "-o");
     mtr_add_arg($args, "%s/log/mysqltest.strace", $opt_vardir);
     mtr_add_arg($args, "$exe_mysqltest");
@@ -3958,15 +3142,6 @@ sub start_mysqltest ($) {
   }
 
   # ----------------------------------------------------------------------
-  # If embedded server, we create server args to give mysqltest to pass on
-  # ----------------------------------------------------------------------
-
-  if ( $glob_use_embedded_server )
-  {
-    mysqld_arguments($args,$master->[0],$tinfo->{'master_opt'},[]);
-  }
-
-  # ----------------------------------------------------------------------
   # export MYSQL_TEST variable containing <path>/mysqltest <args>
   # ----------------------------------------------------------------------
   $ENV{'MYSQL_TEST'}=
@@ -3975,7 +3150,6 @@ sub start_mysqltest ($) {
   # ----------------------------------------------------------------------
   # Add arguments that should not go into the MYSQL_TEST env var
   # ----------------------------------------------------------------------
-
   if ( $opt_valgrind_mysqltest )
   {
     # Prefix the Valgrind options to the argument list.
@@ -4268,12 +3442,15 @@ Options to control what engine/variation
   compress              Use the compressed protocol between client and server
   ssl                   Use ssl protocol between client and server
   skip-ssl              Dont start server with support for ssl connections
-  bench                 Run the benchmark suite
-  small-bench           Run the benchmarks with --small-tests --small-tables
   ndb|with-ndbcluster   Use cluster as default table type
   vs-config             Visual Studio configuration used to create executables
                         (default: MTR_VS_CONFIG environment variable)
 
+  config|defaults-file=<config template> Use fixed config template for all
+                        tests
+  extra_defaults_file=<config template> Extra config template to add to
+                        all generated configs
+
 Options to control directories to use
   benchdir=DIR          The directory where the benchmark suite is stored
                         (default: ../../mysql-bench)
@@ -4312,13 +3489,10 @@ Options to control what test suites or c
 
 Options that specify ports
 
-  master_port=PORT      Specify the port number used by the first master
-  slave_port=PORT       Specify the port number used by the first slave
-  ndbcluster-port=PORT  Specify the port number used by cluster
-  ndbcluster-port-slave=PORT  Specify the port number used by slave cluster
-  mtr-build-thread=#    Specify unique collection of ports. Can also be set by
-                        setting the environment variable MTR_BUILD_THREAD.
-                        Set MTR_BUILD_THREAD="auto" to automatically aquire
+  baseport=PORT         Specify the first port number used
+  mtr-build-thread=#    Specify unique number to calculate port number(s) from.
+                        Can be set in environment variable MTR_BUILD_THREAD.
+                        Set  MTR_BUILD_THREAD="auto" to automatically aquire
                         a build thread id that is unique to current host
 
 Options for test case authoring
@@ -4333,9 +3507,12 @@ Options that pass on options
 
 Options to run test on running server
 
-  extern                Use running server for tests
-  ndb-connectstring=STR Use running cluster, and connect using STR
-  ndb-connectstring-slave=STR Use running slave cluster, and connect using STR
+  extern option=value   Run only the tests against an already started server
+                        the options to use for connection to the extern server
+                        must be specified using name-value pair notation
+                        For example:
+                         ./$0 --extern socket=/tmp/mysqld.sock
+
   user=USER             User for connection to extern server
   socket=PATH           Socket for connection to extern server
 
@@ -4354,16 +3531,15 @@ Options for debugging the product
                         test(s)
   manual-ddd            Let user manually start mysqld in ddd, before running
                         test(s)
-  master-binary=PATH    Specify the master "mysqld" to use
-  slave-binary=PATH     Specify the slave "mysqld" to use
-  strace-client         Create strace output for mysqltest client
+  strace-client=[path]  Create strace output for mysqltest client, optionally
+                        specifying name and path to the trace program to use.
+                        Example: $0 --strace-client=ktrace
   max-save-core         Limit the number of core files saved (to avoid filling
                         up disks for heavily crashing server). Defaults to
                         $opt_max_save_core, set to 0 for no limit.
 
-Options for coverage, profiling etc
+Options for valgrind
 
-  gcov                  FIXME
   valgrind              Run the "mysqltest" and "mysqld" executables using
                         valgrind with default options
   valgrind-all          Synonym for --valgrind
@@ -4381,11 +3557,14 @@ Misc options
   comment=STR           Write STR to the output
   notimer               Don't show test case execution time
   verbose               More verbose output(use multiple times for even more)
-  start-and-exit        Only initialize and start the servers, using the
-                        startup settings for the specified test case (if any)
+  start                 Only initialize and start the servers, using the
+                        startup settings for the first specified test case
+                        Example:
+                         ./$0 --start alias &
   start-dirty           Only start the servers (without initialization) for
-                        the specified test case (if any)
-  fast                  Don't try to clean up from earlier runs
+                        the first specified test case
+  fast                  Run as fast as possible, dont't wait for servers
+                        to shutdown etc.
   reorder               Reorder tests to get fewer server restarts
   help                  Get this help text
 
@@ -4397,10 +3576,6 @@ Misc options
                         to turn off.
 
   sleep=SECONDS         Passed to mysqltest, will be used as fixed sleep time
-
-Deprecated options
-  with-openssl          Deprecated option for ssl
-
 
 HERE
   exit(1);
diff -Nrup a/mysql-test/r/backup.result b/mysql-test/r/backup.result
--- a/mysql-test/r/backup.result	2007-06-06 01:42:39 +02:00
+++ b/mysql-test/r/backup.result	2007-12-04 12:18:54 +01:00
@@ -1,21 +1,21 @@
 set SQL_LOG_BIN=0;
 drop table if exists t1, t2, t3;
 create table t4(n int);
-backup table t4 to '../bogus';
+backup table t4 to '../../bogus';
 Table	Op	Msg_type	Msg_text
 test.t4	backup	error	Failed copying .frm file (errno: X)
 test.t4	backup	Error	Can't create/write to file 'MYSQLTEST_VARDIR/bogus/t4.frm' (Errcode:
X)
 test.t4	backup	status	Operation failed
-backup table t4 to '../tmp';
+backup table t4 to '../../tmp';
 Table	Op	Msg_type	Msg_text
 test.t4	backup	status	OK
-backup table t4 to '../tmp';
+backup table t4 to '../../tmp';
 Table	Op	Msg_type	Msg_text
 test.t4	backup	error	Failed copying .frm file (errno: X)
 test.t4	backup	Error	Can't create/write to file 'MYSQLTEST_VARDIR/tmp/t4.frm' (Errcode:
X)
 test.t4	backup	status	Operation failed
 drop table t4;
-restore table t4 from '../tmp';
+restore table t4 from '../../tmp';
 Table	Op	Msg_type	Msg_text
 test.t4	restore	status	OK
 select count(*) from t4;
@@ -23,16 +23,16 @@ count(*)
 0
 create table t1(n int);
 insert into t1 values (23),(45),(67);
-backup table t1 to '../tmp';
+backup table t1 to '../../tmp';
 Table	Op	Msg_type	Msg_text
 test.t1	backup	status	OK
 drop table t1;
-restore table t1 from '../bogus';
+restore table t1 from '../../bogus';
 Table	Op	Msg_type	Msg_text
 t1	restore	error	Failed copying .frm file
 Warnings:
 Error	29	File 'MYSQLTEST_VARDIR/bogus/t1.frm' not found (Errcode: X)
-restore table t1 from '../tmp';
+restore table t1 from '../../tmp';
 Table	Op	Msg_type	Msg_text
 test.t1	restore	status	OK
 select n from t1;
@@ -44,12 +44,12 @@ create table t2(m int not null primary k
 create table t3(k int not null primary key);
 insert into t2 values (123),(145),(167);
 insert into t3 values (223),(245),(267);
-backup table t2,t3 to '../tmp';
+backup table t2,t3 to '../../tmp';
 Table	Op	Msg_type	Msg_text
 test.t2	backup	status	OK
 test.t3	backup	status	OK
 drop table t1,t2,t3;
-restore table t1,t2,t3 from '../tmp';
+restore table t1,t2,t3 from '../../tmp';
 Table	Op	Msg_type	Msg_text
 test.t1	restore	status	OK
 test.t2	restore	status	OK
@@ -70,12 +70,12 @@ k
 245
 267
 drop table t1,t2,t3,t4;
-restore table t1 from '../tmp';
+restore table t1 from '../../tmp';
 Table	Op	Msg_type	Msg_text
 test.t1	restore	status	OK
 rename table t1 to t5;
 lock tables t5 write;
-backup table t5 to '../tmp';
+backup table t5 to '../../tmp';
 unlock tables;
 Table	Op	Msg_type	Msg_text
 test.t5	backup	status	OK
diff -Nrup a/mysql-test/r/blackhole.result b/mysql-test/r/blackhole.result
--- a/mysql-test/r/blackhole.result	2007-05-10 15:14:02 +02:00
+++ b/mysql-test/r/blackhole.result	2007-12-04 12:18:54 +01:00
@@ -92,7 +92,7 @@ insert into t1 values(1);
 insert ignore into t1 values(1);
 replace into t1 values(100);
 create table t2 (a varchar(200)) engine=blackhole;
-load data infile '../std_data_ln/words.dat' into table t2;
+load data infile '../../std_data/words.dat' into table t2;
 alter table t1 add b int;
 alter table t1 drop b;
 create table t3 like t1;
@@ -116,7 +116,7 @@ master-bin.000001	#	Query	1	#	use `test`
 master-bin.000001	#	Query	1	#	use `test`; replace into t1 values(100)
 master-bin.000001	#	Query	1	#	use `test`; create table t2 (a varchar(200))
engine=blackhole
 master-bin.000001	#	Begin_load_query	1	#	;file_id=1;block_len=581
-master-bin.000001	#	Execute_load_query	1	#	use `test`; load data infile
'../std_data_ln/words.dat' into table t2 ;file_id=1
+master-bin.000001	#	Execute_load_query	1	#	use `test`; load data infile
'../../std_data/words.dat' into table t2 ;file_id=1
 master-bin.000001	#	Query	1	#	use `test`; alter table t1 add b int
 master-bin.000001	#	Query	1	#	use `test`; alter table t1 drop b
 master-bin.000001	#	Query	1	#	use `test`; create table t3 like t1
diff -Nrup a/mysql-test/r/ctype_big5.result b/mysql-test/r/ctype_big5.result
--- a/mysql-test/r/ctype_big5.result	2007-10-04 09:09:20 +02:00
+++ b/mysql-test/r/ctype_big5.result	2007-12-04 12:18:54 +01:00
@@ -211,8 +211,8 @@ create table t1 (a blob);
 insert into t1 values (0xEE00);
 select * into outfile 'test/t1.txt' from t1;
 delete from t1;
-select hex(load_file('MYSQLTEST_VARDIR/master-data/test/t1.txt'));;
-hex(load_file('MYSQLTEST_VARDIR/master-data/test/t1.txt'))
+select hex(load_file('MYSQLTEST_VARDIR/mysqld.1/data/test/t1.txt'));;
+hex(load_file('MYSQLTEST_VARDIR/mysqld.1/data/test/t1.txt'))
 5CEE5C300A
 load data infile 't1.txt' into table t1;
 select hex(a) from t1;
diff -Nrup a/mysql-test/r/federated.result b/mysql-test/r/federated.result
--- a/mysql-test/r/federated.result	2007-08-08 09:34:30 +02:00
+++ b/mysql-test/r/federated.result	2007-12-04 12:18:54 +01:00
@@ -1753,7 +1753,7 @@ a	b	c
 13	17	221
 19	23	437
 delete from federated.t1;
-load data infile '../std_data_ln/loaddata5.dat' into table federated.t1 fields terminated
by '' enclosed by '' ignore 1 lines (a, b);
+load data infile '../../std_data/loaddata5.dat' into table federated.t1 fields terminated
by '' enclosed by '' ignore 1 lines (a, b);
 select * from federated.t1;
 a	b	c
 3	4	12
diff -Nrup a/mysql-test/r/gis.result b/mysql-test/r/gis.result
--- a/mysql-test/r/gis.result	2007-09-20 10:54:44 +02:00
+++ b/mysql-test/r/gis.result	2007-12-04 12:18:54 +01:00
@@ -685,7 +685,7 @@ asbinary(g)
 drop table t1;
 create table t1 (a TEXT, b GEOMETRY NOT NULL, SPATIAL KEY(b));
 alter table t1 disable keys;
-load data infile '../std_data_ln/bad_gis_data.dat' into table t1;
+load data infile '../../std_data/bad_gis_data.dat' into table t1;
 ERROR 22004: Column was set to data type implicit default; NULL supplied for NOT NULL
column 'b' at row 1
 alter table t1 enable keys;
 drop table t1;
diff -Nrup a/mysql-test/r/loaddata.result b/mysql-test/r/loaddata.result
--- a/mysql-test/r/loaddata.result	2007-07-06 00:43:11 +02:00
+++ b/mysql-test/r/loaddata.result	2007-12-04 12:18:54 +01:00
@@ -1,6 +1,6 @@
 drop table if exists t1, t2;
 create table t1 (a date, b date, c date not null, d date);
-load data infile '../std_data_ln/loaddata1.dat' into table t1 fields terminated by ',';
+load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',';
 Warnings:
 Warning	1265	Data truncated for column 'a' at row 1
 Warning	1265	Data truncated for column 'c' at row 1
@@ -8,7 +8,7 @@ Warning	1265	Data truncated for column '
 Warning	1265	Data truncated for column 'a' at row 2
 Warning	1265	Data truncated for column 'b' at row 2
 Warning	1265	Data truncated for column 'd' at row 2
-load data infile '../std_data_ln/loaddata1.dat' into table t1 fields terminated by ','
IGNORE 2 LINES;
+load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ','
IGNORE 2 LINES;
 SELECT * from t1;
 a	b	c	d
 0000-00-00	NULL	0000-00-00	0000-00-00
@@ -16,7 +16,7 @@ a	b	c	d
 2003-03-03	2003-03-03	2003-03-03	NULL
 2003-03-03	2003-03-03	2003-03-03	NULL
 truncate table t1;
-load data infile '../std_data_ln/loaddata1.dat' into table t1 fields terminated by ','
LINES STARTING BY ',' (b,c,d);
+load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ','
LINES STARTING BY ',' (b,c,d);
 Warnings:
 Warning	1265	Data truncated for column 'c' at row 1
 Warning	1265	Data truncated for column 'd' at row 1
@@ -29,7 +29,7 @@ NULL	0000-00-00	0000-00-00	0000-00-00
 NULL	2003-03-03	2003-03-03	NULL
 drop table t1;
 create table t1 (a text, b text);
-load data infile '../std_data_ln/loaddata2.dat' into table t1 fields terminated by ','
enclosed by '''';
+load data infile '../../std_data/loaddata2.dat' into table t1 fields terminated by ','
enclosed by '''';
 Warnings:
 Warning	1261	Row 3 doesn't contain data for all columns
 select concat('|',a,'|'), concat('|',b,'|') from t1;
@@ -41,7 +41,7 @@ Field 3,'Field 4|
 |Field 6|	| 'Field 7'|
 drop table t1;
 create table t1 (a int, b char(10));
-load data infile '../std_data_ln/loaddata3.dat' into table t1 fields terminated by ''
enclosed by '' ignore 1 lines;
+load data infile '../../std_data/loaddata3.dat' into table t1 fields terminated by ''
enclosed by '' ignore 1 lines;
 Warnings:
 Warning	1366	Incorrect integer value: 'error      ' for column 'a' at row 3
 Warning	1262	Row 3 was truncated; it contained more data than there were input columns
@@ -55,7 +55,7 @@ a	b
 3	row 3
 0	1234567890
 truncate table t1;
-load data infile '../std_data_ln/loaddata4.dat' into table t1 fields terminated by ''
enclosed by '' lines terminated by '' ignore 1 lines;
+load data infile '../../std_data/loaddata4.dat' into table t1 fields terminated by ''
enclosed by '' lines terminated by '' ignore 1 lines;
 Warnings:
 Warning	1366	Incorrect integer value: '
 ' for column 'a' at row 4
@@ -79,7 +79,7 @@ id
 SET @@SQL_MODE=@OLD_SQL_MODE;
 drop table t1;
 create table t1 (a varchar(20), b varchar(20));
-load data infile '../std_data_ln/loaddata_dq.dat' into table t1 fields terminated by ','
enclosed by '"' escaped by '"' (a,b);
+load data infile '../../std_data/loaddata_dq.dat' into table t1 fields terminated by ','
enclosed by '"' escaped by '"' (a,b);
 select * from t1;
 a	b
 field1	field2
@@ -141,25 +141,25 @@ SELECT t1.id, c1, c2 FROM t1 RIGHT JOIN 
 id	c1	c2
 DROP TABLE t1,t2;
 create table t1 (a int default 100, b int, c varchar(60));
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t1 (a, @b) set b=@b+10,
c=concat("b=",@b);
+load data infile '../../std_data/rpl_loaddata.dat' into table t1 (a, @b) set b=@b+10,
c=concat("b=",@b);
 select * from t1;
 a	b	c
 NULL	20	b=10
 NULL	25	b=15
 truncate table t1;
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t1 (a, @b) set c= if(a is
null,"oops",a);
+load data infile '../../std_data/rpl_loaddata.dat' into table t1 (a, @b) set c= if(a is
null,"oops",a);
 select * from t1;
 a	b	c
 NULL	NULL	oops
 NULL	NULL	oops
 truncate table t1;
 set @c:=123;
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t1 (@a, b) set c= if(@a is
null,@c,b);
+load data infile '../../std_data/rpl_loaddata.dat' into table t1 (@a, b) set c= if(@a is
null,@c,b);
 select * from t1;
 a	b	c
 100	10	123
 100	15	123
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t1 (@a, @b);
+load data infile '../../std_data/rpl_loaddata.dat' into table t1 (@a, @b);
 select * from t1;
 a	b	c
 100	10	123
@@ -170,25 +170,25 @@ select @a, @b;
 @a	@b
 NULL	15
 truncate table t1;
-load data infile '../std_data_ln/loaddata5.dat' into table t1 fields terminated by ''
enclosed by '' (a, b) set c="Wow";
+load data infile '../../std_data/loaddata5.dat' into table t1 fields terminated by ''
enclosed by '' (a, b) set c="Wow";
 select * from t1;
 a	b	c
 1	2	Wow
 3	4	Wow
 5	6	Wow
 truncate table t1;
-load data infile '../std_data_ln/loaddata5.dat' into table t1 fields terminated by ''
enclosed by '' (a, b) set c=concat(a,"+",b,"+",@c,"+",b,"+",if(c is null,"NIL",c));
+load data infile '../../std_data/loaddata5.dat' into table t1 fields terminated by ''
enclosed by '' (a, b) set c=concat(a,"+",b,"+",@c,"+",b,"+",if(c is null,"NIL",c));
 select * from t1;
 a	b	c
 1	2	1+2+123+2+NIL
 3	4	3+4+123+4+NIL
 5	6	5+6+123+6+NIL
-load data infile '../std_data_ln/loaddata5.dat' into table t1 fields terminated by ''
enclosed by '' (a, @b);
+load data infile '../../std_data/loaddata5.dat' into table t1 fields terminated by ''
enclosed by '' (a, @b);
 ERROR HY000: Can't load value from file with fixed size rows to variable
 create table t2 (num int primary key, str varchar(10));
 insert into t2 values (10,'Ten'), (15,'Fifteen');
 truncate table t1;
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t1 (@dummy,@n) set a= @n,
c= (select str from t2 where num=@n);
+load data infile '../../std_data/rpl_loaddata.dat' into table t1 (@dummy,@n) set a= @n,
c= (select str from t2 where num=@n);
 select * from t1;
 a	b	c
 10	NULL	Ten
diff -Nrup a/mysql-test/r/loaddata_autocom_innodb.result
b/mysql-test/r/loaddata_autocom_innodb.result
--- a/mysql-test/r/loaddata_autocom_innodb.result	2006-09-05 16:52:03 +02:00
+++ b/mysql-test/r/loaddata_autocom_innodb.result	2007-12-04 12:18:54 +01:00
@@ -2,7 +2,7 @@ SET SESSION STORAGE_ENGINE = InnoDB;
 drop table if exists t1;
 create table t1 (a text, b text);
 start transaction;
-load data infile '../std_data_ln/loaddata2.dat' into table t1 fields terminated by ','
enclosed by '''';
+load data infile 'LOAD_FILE' into table t1 fields terminated by ',' enclosed by '''';
 Warnings:
 Warning	1261	Row 3 doesn't contain data for all columns
 commit;
@@ -11,7 +11,7 @@ count(*)
 4
 truncate table t1;
 start transaction;
-load data infile '../std_data_ln/loaddata2.dat' into table t1 fields terminated by ','
enclosed by '''';
+load data infile 'LOAD_FILE' into table t1 fields terminated by ',' enclosed by '''';
 Warnings:
 Warning	1261	Row 3 doesn't contain data for all columns
 rollback;
diff -Nrup a/mysql-test/r/loaddata_autocom_ndb.result
b/mysql-test/r/loaddata_autocom_ndb.result
--- a/mysql-test/r/loaddata_autocom_ndb.result	2006-09-05 16:52:03 +02:00
+++ b/mysql-test/r/loaddata_autocom_ndb.result	2007-12-04 12:18:54 +01:00
@@ -2,7 +2,7 @@ SET SESSION STORAGE_ENGINE = ndbcluster;
 drop table if exists t1;
 create table t1 (a text, b text);
 start transaction;
-load data infile '../std_data_ln/loaddata2.dat' into table t1 fields terminated by ','
enclosed by '''';
+load data infile 'LOAD_FILE' into table t1 fields terminated by ',' enclosed by '''';
 Warnings:
 Warning	1261	Row 3 doesn't contain data for all columns
 commit;
@@ -11,7 +11,7 @@ count(*)
 4
 truncate table t1;
 start transaction;
-load data infile '../std_data_ln/loaddata2.dat' into table t1 fields terminated by ','
enclosed by '''';
+load data infile 'LOAD_FILE' into table t1 fields terminated by ',' enclosed by '''';
 Warnings:
 Warning	1261	Row 3 doesn't contain data for all columns
 rollback;
diff -Nrup a/mysql-test/r/mysqlbinlog.result b/mysql-test/r/mysqlbinlog.result
--- a/mysql-test/r/mysqlbinlog.result	2007-08-01 12:27:00 +02:00
+++ b/mysql-test/r/mysqlbinlog.result	2007-12-04 12:18:54 +01:00
@@ -4,11 +4,11 @@ create table t1 (word varchar(20));
 create table t2 (id int auto_increment not null primary key);
 insert into t1 values ("abirvalg");
 insert into t2 values ();
-load data infile '../std_data_ln/words.dat' into table t1;
-load data infile '../std_data_ln/words.dat' into table t1;
-load data infile '../std_data_ln/words.dat' into table t1;
-load data infile '../std_data_ln/words.dat' into table t1;
-load data infile '../std_data_ln/words.dat' into table t1;
+load data infile '../../std_data/words.dat' into table t1;
+load data infile '../../std_data/words.dat' into table t1;
+load data infile '../../std_data/words.dat' into table t1;
+load data infile '../../std_data/words.dat' into table t1;
+load data infile '../../std_data/words.dat' into table t1;
 insert into t1 values ("Alas");
 flush logs;
 
@@ -256,17 +256,17 @@ call p1();
 drop procedure p1;
 flush logs;
 create table t1 (a varchar(64) character set utf8);
-load data infile '../std_data_ln/loaddata6.dat' into table t1;
+load data infile '../../std_data/loaddata6.dat' into table t1;
 set character_set_database=koi8r;
-load data infile '../std_data_ln/loaddata6.dat' into table t1;
+load data infile '../../std_data/loaddata6.dat' into table t1;
 set character_set_database=latin1;
-load data infile '../std_data_ln/loaddata6.dat' into table t1;
-load data infile '../std_data_ln/loaddata6.dat' into table t1;
+load data infile '../../std_data/loaddata6.dat' into table t1;
+load data infile '../../std_data/loaddata6.dat' into table t1;
 set character_set_database=koi8r;
-load data infile '../std_data_ln/loaddata6.dat' into table t1;
+load data infile '../../std_data/loaddata6.dat' into table t1;
 set character_set_database=latin1;
-load data infile '../std_data_ln/loaddata6.dat' into table t1;
-load data infile '../std_data_ln/loaddata6.dat' into table t1 character set koi8r;
+load data infile '../../std_data/loaddata6.dat' into table t1;
+load data infile '../../std_data/loaddata6.dat' into table t1 character set koi8r;
 select hex(a) from t1;
 hex(a)
 C3BF
diff -Nrup a/mysql-test/r/ndb_load.result b/mysql-test/r/ndb_load.result
--- a/mysql-test/r/ndb_load.result	2006-02-14 17:15:09 +01:00
+++ b/mysql-test/r/ndb_load.result	2007-12-04 12:18:54 +01:00
@@ -1,10 +1,10 @@
 DROP TABLE IF EXISTS t1;
 CREATE TABLE t1 (word CHAR(20) NOT NULL PRIMARY KEY) ENGINE=NDB;
-LOAD DATA INFILE '../std_data_ln/words.dat' INTO TABLE t1 ;
+LOAD DATA INFILE 'LOAD_FILE' INTO TABLE t1 ;
 ERROR 23000: Can't write; duplicate key in table 't1'
 DROP TABLE t1;
 CREATE TABLE t1 (word CHAR(20) NOT NULL) ENGINE=NDB;
-LOAD DATA INFILE '../std_data_ln/words.dat' INTO TABLE t1 ;
+LOAD DATA INFILE 'LOAD_FILE' INTO TABLE t1 ;
 SELECT * FROM t1 ORDER BY word;
 word
 Aarhus
diff -Nrup a/mysql-test/r/ndb_loaddatalocal.result b/mysql-test/r/ndb_loaddatalocal.result
--- a/mysql-test/r/ndb_loaddatalocal.result	2006-06-14 20:16:27 +02:00
+++ b/mysql-test/r/ndb_loaddatalocal.result	2007-12-04 12:18:54 +01:00
@@ -1,19 +1,19 @@
 DROP TABLE IF EXISTS t1;
 create table t1(a int) engine=myisam;
-select * into outfile 'MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile'
from t1;
+select * into outfile 'LOAD_FILE' from t1;
 drop table t1;
 create table t1(a int) engine=ndb;
-load data local infile 'MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile'
into table t1;
+load data local infile 'LOAD_FILE' into table t1;
 select count(*) from t1;
 count(*)
 10000
 drop table t1;
 create table t1(a int) engine=myisam;
 insert into t1 values (1), (2), (2), (3);
-select * into outfile 'MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile'
from t1;
+select * into outfile 'LOAD_FILE' from t1;
 drop table t1;
 create table t1(a int primary key) engine=ndb;
-load data local infile 'MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile'
into table t1;
+load data local infile 'LOAD_FILE' into table t1;
 select * from t1 order by a;
 a
 1
@@ -22,10 +22,10 @@ a
 drop table t1;
 create table t1(a int) engine=myisam;
 insert into t1 values (1), (1), (2), (3);
-select * into outfile 'MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile'
from t1;
+select * into outfile 'LOAD_FILE' from t1;
 drop table t1;
 create table t1(a int primary key) engine=ndb;
-load data local infile 'MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile'
into table t1;
+load data local infile 'LOAD_FILE' into table t1;
 select * from t1 order by a;
 a
 1
@@ -34,10 +34,10 @@ a
 drop table t1;
 create table t1(a int) engine=myisam;
 insert into t1 values (1), (2), (3), (3);
-select * into outfile 'MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile'
from t1;
+select * into outfile 'LOAD_FILE' from t1;
 drop table t1;
 create table t1(a int primary key) engine=ndb;
-load data local infile 'MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile'
into table t1;
+load data local infile 'LOAD_FILE' into table t1;
 select * from t1 order by a;
 a
 1
diff -Nrup a/mysql-test/r/ndb_replace.result b/mysql-test/r/ndb_replace.result
--- a/mysql-test/r/ndb_replace.result	2006-07-01 23:51:01 +02:00
+++ b/mysql-test/r/ndb_replace.result	2007-12-04 12:18:54 +01:00
@@ -72,7 +72,7 @@ pk	apk	data
 3	3	3
 delete from t1;
 insert into t1 values (1, 1, 1), (4, 4, 4), (6, 6, 6);
-load data infile '../std_data_ln/loaddata5.dat' replace into table t1 fields terminated
by '' enclosed by '' ignore 1 lines (pk, apk);
+load data infile 'LOAD_FILE5' replace into table t1 fields terminated by '' enclosed by
'' ignore 1 lines (pk, apk);
 select * from t1 order by pk;
 pk	apk	data
 1	1	1
@@ -80,7 +80,7 @@ pk	apk	data
 5	6	NULL
 delete from t1;
 insert into t1 values (1, 1, 1), (3, 3, 3), (5, 5, 5);
-load data infile '../std_data_ln/loaddata5.dat' replace into table t1 fields terminated
by '' enclosed by '' ignore 1 lines (pk, apk);
+load data infile 'LOAD_FILE5' replace into table t1 fields terminated by '' enclosed by
'' ignore 1 lines (pk, apk);
 select * from t1 order by pk;
 pk	apk	data
 1	1	1
diff -Nrup a/mysql-test/r/ndb_trigger.result b/mysql-test/r/ndb_trigger.result
--- a/mysql-test/r/ndb_trigger.result	2007-04-04 12:50:30 +02:00
+++ b/mysql-test/r/ndb_trigger.result	2007-12-04 12:18:54 +01:00
@@ -106,7 +106,7 @@ d	1	2.050000000000000000000000000000
 delete from t1;
 delete from t2;
 insert into t1 values (3, 1, 1.05), (5, 2, 2.05);
-load data infile '../std_data_ln/loaddata5.dat' replace into table t1 fields terminated
by '' enclosed by '' ignore 1 lines (id, a);
+load data infile '../../std_data/loaddata5.dat' replace into table t1 fields terminated
by '' enclosed by '' ignore 1 lines (id, a);
 select * from t1 order by id;
 id	a	b
 3	4	0.000000000000000000000000000000
diff -Nrup a/mysql-test/r/query_cache.result b/mysql-test/r/query_cache.result
--- a/mysql-test/r/query_cache.result	2007-08-21 17:47:03 +02:00
+++ b/mysql-test/r/query_cache.result	2007-12-04 12:18:54 +01:00
@@ -667,7 +667,7 @@ word
 show status like "Qcache_queries_in_cache";
 Variable_name	Value
 Qcache_queries_in_cache	1
-load data infile 'MYSQLTEST_VARDIR/std_data_ln/words.dat' into table t1;
+load data infile 'MYSQLTEST_VARDIR/std_data/words.dat' into table t1;
 show status like "Qcache_queries_in_cache";
 Variable_name	Value
 Qcache_queries_in_cache	0
diff -Nrup a/mysql-test/r/rpl000001.result b/mysql-test/r/rpl000001.result
--- a/mysql-test/r/rpl000001.result	2006-10-03 16:02:39 +02:00
+++ b/mysql-test/r/rpl000001.result	2007-12-04 12:18:54 +01:00
@@ -5,7 +5,7 @@ reset slave;
 drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
 start slave;
 create table t1 (word char(20) not null);
-load data infile '../std_data_ln/words.dat' into table t1;
+load data infile '../../std_data/words.dat' into table t1;
 load data local infile 'MYSQL_TEST_DIR/std_data/words.dat' into table t1;
 select * from t1 limit 10;
 word
diff -Nrup a/mysql-test/r/rpl000004.result b/mysql-test/r/rpl000004.result
--- a/mysql-test/r/rpl000004.result	2006-01-24 08:30:46 +01:00
+++ b/mysql-test/r/rpl000004.result	2007-12-04 12:18:54 +01:00
@@ -6,9 +6,9 @@ drop table if exists t1,t2,t3,t4,t5,t6,t
 start slave;
 set SQL_LOG_BIN=0;
 create table t1 (word char(20) not null, index(word));
-load data infile '../std_data_ln/words.dat' into table t1;
+load data infile '../../std_data/words.dat' into table t1;
 create table t2 (word char(20) not null);
-load data infile '../std_data_ln/words.dat' into table t2;
+load data infile '../../std_data/words.dat' into table t2;
 create table t3 (word char(20) not null primary key);
 load table t1 from master;
 load table t2 from master;
diff -Nrup a/mysql-test/r/rpl_innodb.result b/mysql-test/r/rpl_innodb.result
--- a/mysql-test/r/rpl_innodb.result	2006-01-24 08:30:46 +01:00
+++ b/mysql-test/r/rpl_innodb.result	2007-12-04 12:18:54 +01:00
@@ -12,7 +12,7 @@ PRIMARY KEY  (id),
 UNIQUE KEY unique_rec (name,number)
 ) ENGINE=InnoDB;
 LOAD DATA
-INFILE '../std_data_ln/loaddata_pair.dat'  
+INFILE '../../std_data/loaddata_pair.dat'  
 REPLACE INTO TABLE t4 
 (name,number);
 SELECT * FROM t4;
@@ -24,7 +24,7 @@ id	name	number
 1	XXX	12345
 2	XXY	12345
 LOAD DATA
-INFILE '../std_data_ln/loaddata_pair.dat'  
+INFILE '../../std_data/loaddata_pair.dat'  
 REPLACE INTO TABLE t4
 (name,number);
 SELECT * FROM t4;
diff -Nrup a/mysql-test/r/rpl_loaddata.result b/mysql-test/r/rpl_loaddata.result
--- a/mysql-test/r/rpl_loaddata.result	2007-06-01 16:04:23 +02:00
+++ b/mysql-test/r/rpl_loaddata.result	2007-12-04 12:18:55 +01:00
@@ -6,9 +6,9 @@ drop table if exists t1,t2,t3,t4,t5,t6,t
 start slave;
 reset master;
 create table t1(a int not null auto_increment, b int, primary key(a) );
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t1;
+load data infile '../../std_data/rpl_loaddata.dat' into table t1;
 create temporary table t2 (day date,id int(9),category enum('a','b','c'),name
varchar(60));
-load data infile '../std_data_ln/rpl_loaddata2.dat' into table t2 fields terminated by
',' optionally enclosed by '%' escaped by '@' lines terminated by '\n##\n' starting by
'>' ignore 1 lines;
+load data infile '../../std_data/rpl_loaddata2.dat' into table t2 fields terminated by
',' optionally enclosed by '%' escaped by '@' lines terminated by '\n##\n' starting by
'>' ignore 1 lines;
 create table t3 (day date,id int(9),category enum('a','b','c'),name varchar(60));
 insert into t3 select * from t2;
 select * from t1;
@@ -28,7 +28,7 @@ drop table t2;
 drop table t3;
 create table t1(a int, b int, unique(b));
 insert into t1 values(1,10);
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t1;
+load data infile '../../std_data/rpl_loaddata.dat' into table t1;
 set global sql_slave_skip_counter=1;
 start slave;
 show slave status;
@@ -37,7 +37,7 @@ Slave_IO_State	Master_Host	Master_User	M
 set sql_log_bin=0;
 delete from t1;
 set sql_log_bin=1;
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t1;
+load data infile '../../std_data/rpl_loaddata.dat' into table t1;
 stop slave;
 change master to master_user='test';
 change master to master_user='root';
@@ -49,7 +49,7 @@ start slave;
 set sql_log_bin=0;
 delete from t1;
 set sql_log_bin=1;
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t1;
+load data infile '../../std_data/rpl_loaddata.dat' into table t1;
 stop slave;
 reset slave;
 show slave status;
@@ -58,7 +58,7 @@ Slave_IO_State	Master_Host	Master_User	M
 reset master;
 create table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60),
 unique(day)) engine=MyISAM;
-load data infile '../std_data_ln/rpl_loaddata2.dat' into table t2 fields
+load data infile '../../std_data/rpl_loaddata2.dat' into table t2 fields
 terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by
 '\n##\n' starting by '>' ignore 1 lines;
 ERROR 23000: Duplicate entry '2003-03-22' for key 1
@@ -73,7 +73,7 @@ day	id	category	name
 2003-03-22	2161	c	asdf
 alter table t2 drop key day;
 delete from t2;
-load data infile '../std_data_ln/rpl_loaddata2.dat' into table t2 fields
+load data infile '../../std_data/rpl_loaddata2.dat' into table t2 fields
 terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by
 '\n##\n' starting by '>' ignore 1 lines;
 ERROR 23000: Duplicate entry '2003-03-22' for key 1
@@ -81,6 +81,6 @@ drop table t2;
 drop table t2;
 drop table t1;
 CREATE TABLE t1 (word CHAR(20) NOT NULL PRIMARY KEY) ENGINE=INNODB;
-LOAD DATA INFILE "../std_data_ln/words.dat" INTO TABLE t1;
+LOAD DATA INFILE "../../std_data/words.dat" INTO TABLE t1;
 ERROR 23000: Duplicate entry 'Aarhus' for key 1
 DROP TABLE t1;
diff -Nrup a/mysql-test/r/rpl_loaddata_charset.result
b/mysql-test/r/rpl_loaddata_charset.result
--- a/mysql-test/r/rpl_loaddata_charset.result	2007-03-01 08:50:27 +01:00
+++ b/mysql-test/r/rpl_loaddata_charset.result	2007-12-04 12:18:55 +01:00
@@ -5,17 +5,17 @@ reset slave;
 drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
 start slave;
 create table t1 (a varchar(10) character set utf8);
-load data infile '../std_data_ln/loaddata6.dat' into table t1;
+load data infile '../../std_data/loaddata6.dat' into table t1;
 set @@character_set_database=koi8r;
-load data infile '../std_data_ln/loaddata6.dat' into table t1;
+load data infile '../../std_data/loaddata6.dat' into table t1;
 set @@character_set_database=DEFAULT;
-load data infile '../std_data_ln/loaddata6.dat' into table t1;
-load data infile '../std_data_ln/loaddata6.dat' into table t1;
-load data infile '../std_data_ln/loaddata6.dat' into table t1;
+load data infile '../../std_data/loaddata6.dat' into table t1;
+load data infile '../../std_data/loaddata6.dat' into table t1;
+load data infile '../../std_data/loaddata6.dat' into table t1;
 set @@character_set_database=koi8r;
-load data infile '../std_data_ln/loaddata6.dat' into table t1;
+load data infile '../../std_data/loaddata6.dat' into table t1;
 set @@character_set_database=DEFAULT;
-load data infile '../std_data_ln/loaddata6.dat' into table t1 character set koi8r;
+load data infile '../../std_data/loaddata6.dat' into table t1 character set koi8r;
 select hex(a) from t1;
 hex(a)
 C3BF
diff -Nrup a/mysql-test/r/rpl_loaddata_rule_m.result
b/mysql-test/r/rpl_loaddata_rule_m.result
--- a/mysql-test/r/rpl_loaddata_rule_m.result	2006-01-27 10:47:56 +01:00
+++ b/mysql-test/r/rpl_loaddata_rule_m.result	2007-12-04 12:18:55 +01:00
@@ -9,13 +9,13 @@ stop slave;
 create database mysqltest;
 create table t1(a int, b int, unique(b));
 use mysqltest;
-load data infile '../std_data_ln/rpl_loaddata.dat' into table test.t1;
+load data infile '../../std_data/rpl_loaddata.dat' into table test.t1;
 show binlog events from 98;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 master-bin.000001	#	Query	1	#	drop database if exists mysqltest
 master-bin.000001	#	Query	1	#	create database mysqltest
 master-bin.000001	#	Begin_load_query	1	#	;file_id=1;block_len=12
-master-bin.000001	#	Execute_load_query	1	#	use `mysqltest`; load data infile
'../std_data_ln/rpl_loaddata.dat' into table test.t1 ;file_id=1
+master-bin.000001	#	Execute_load_query	1	#	use `mysqltest`; load data infile
'../../std_data/rpl_loaddata.dat' into table test.t1 ;file_id=1
 drop database mysqltest;
 use test;
 drop table t1;
diff -Nrup a/mysql-test/r/rpl_loaddata_rule_s.result
b/mysql-test/r/rpl_loaddata_rule_s.result
--- a/mysql-test/r/rpl_loaddata_rule_s.result	2006-01-27 10:47:56 +01:00
+++ b/mysql-test/r/rpl_loaddata_rule_s.result	2007-12-04 12:18:55 +01:00
@@ -6,7 +6,7 @@ drop table if exists t1,t2,t3,t4,t5,t6,t
 start slave;
 reset master;
 create table t1(a int, b int, unique(b));
-load data infile '../std_data_ln/rpl_loaddata.dat' into table test.t1;
+load data infile '../../std_data/rpl_loaddata.dat' into table test.t1;
 select count(*) from t1;
 count(*)
 2
diff -Nrup a/mysql-test/r/rpl_loaddatalocal.result b/mysql-test/r/rpl_loaddatalocal.result
--- a/mysql-test/r/rpl_loaddatalocal.result	2006-10-05 18:30:14 +02:00
+++ b/mysql-test/r/rpl_loaddatalocal.result	2007-12-04 12:18:55 +01:00
@@ -5,19 +5,19 @@ reset slave;
 drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
 start slave;
 create table t1(a int);
-select * into outfile 'MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile'
from t1;
+select * into outfile 'MYSQLTEST_VARDIR/mysqld.1/rpl_loaddatalocal.select_outfile' from
t1;
 truncate table t1;
-load data local infile 'MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile'
into table t1;
+load data local infile 'MYSQLTEST_VARDIR/mysqld.1/rpl_loaddatalocal.select_outfile' into
table t1;
 select a,count(*) from t1 group by a;
 a	count(*)
 1	10000
 drop table t1;
 create table t1(a int);
 insert into t1 values (1), (2), (2), (3);
-select * into outfile 'MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile'
from t1;
+select * into outfile 'MYSQLTEST_VARDIR/mysqld.1/rpl_loaddatalocal.select_outfile' from
t1;
 drop table t1;
 create table t1(a int primary key);
-load data local infile 'MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile'
into table t1;
+load data local infile 'MYSQLTEST_VARDIR/mysqld.1/rpl_loaddatalocal.select_outfile' into
table t1;
 select * from t1;
 a
 1
diff -Nrup a/mysql-test/r/rpl_log.result b/mysql-test/r/rpl_log.result
--- a/mysql-test/r/rpl_log.result	2006-10-19 11:34:53 +02:00
+++ b/mysql-test/r/rpl_log.result	2007-12-04 12:18:55 +01:00
@@ -12,7 +12,7 @@ create table t1(n int not null auto_incr
 insert into t1 values (NULL);
 drop table t1;
 create table t1 (word char(20) not null);
-load data infile '../std_data_ln/words.dat' into table t1 ignore 1 lines;
+load data infile '../../std_data/words.dat' into table t1 ignore 1 lines;
 select count(*) from t1;
 count(*)
 69
@@ -26,7 +26,7 @@ master-bin.000001	247	Query	1	338	use `t
 master-bin.000001	338	Query	1	414	use `test`; drop table t1
 master-bin.000001	414	Query	1	517	use `test`; create table t1 (word char(20) not null)
 master-bin.000001	517	Begin_load_query	1	1121	;file_id=1;block_len=581
-master-bin.000001	1121	Execute_load_query	1	1269	use `test`; load data infile
'../std_data_ln/words.dat' into table t1 ignore 1 lines ;file_id=1
+master-bin.000001	1121	Execute_load_query	1	1269	use `test`; load data infile
'../../std_data/words.dat' into table t1 ignore 1 lines ;file_id=1
 master-bin.000001	1269	Query	1	1345	use `test`; drop table t1
 show binlog events from 98 limit 1;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
@@ -56,7 +56,7 @@ master-bin.000001	247	Query	1	338	use `t
 master-bin.000001	338	Query	1	414	use `test`; drop table t1
 master-bin.000001	414	Query	1	517	use `test`; create table t1 (word char(20) not null)
 master-bin.000001	517	Begin_load_query	1	1121	;file_id=1;block_len=581
-master-bin.000001	1121	Execute_load_query	1	1269	use `test`; load data infile
'../std_data_ln/words.dat' into table t1 ignore 1 lines ;file_id=1
+master-bin.000001	1121	Execute_load_query	1	1269	use `test`; load data infile
'../../std_data/words.dat' into table t1 ignore 1 lines ;file_id=1
 master-bin.000001	1269	Query	1	1345	use `test`; drop table t1
 master-bin.000001	1345	Rotate	1	1389	master-bin.000002;pos=4
 show binlog events in 'master-bin.000002';
diff -Nrup a/mysql-test/r/rpl_misc_functions.result
b/mysql-test/r/rpl_misc_functions.result
--- a/mysql-test/r/rpl_misc_functions.result	2007-07-09 21:18:11 +02:00
+++ b/mysql-test/r/rpl_misc_functions.result	2007-12-04 12:18:55 +01:00
@@ -15,7 +15,7 @@ insert into t1 values(3, 0, 0, 0, passwo
 insert into t1 values(4, connection_id(), rand()*1000, rand()*1000,
password('does_this_still_work?'));
 select * into outfile 'rpl_misc_functions.outfile' from t1;
 create table t2 like t1;
-load data local infile 'MYSQLTEST_VARDIR/master-data/test/rpl_misc_functions.outfile'
into table t2;
+load data local infile 'MYSQLTEST_VARDIR/mysqld.1/test/rpl_misc_functions.outfile' into
table t2;
 select * from t1, t2 where (t1.id=t2.id) and not(t1.i=t2.i and t1.r1=t2.r1 and
t1.r2=t2.r2 and t1.p=t2.p);
 id	i	r1	r2	p	id	i	r1	r2	p
 drop table t1;
diff -Nrup a/mysql-test/r/rpl_ndb_innodb_trans.result
b/mysql-test/r/rpl_ndb_innodb_trans.result
--- a/mysql-test/r/rpl_ndb_innodb_trans.result	2006-09-05 16:52:03 +02:00
+++ b/mysql-test/r/rpl_ndb_innodb_trans.result	2007-12-04 12:18:55 +01:00
@@ -23,11 +23,11 @@ select count(*) from t2;
 count(*)
 0
 begin;
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t2;
+load data infile '../../std_data/rpl_loaddata.dat' into table t2;
 Warnings:
 Warning	1262	Row 1 was truncated; it contained more data than there were input columns
 Warning	1262	Row 2 was truncated; it contained more data than there were input columns
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t1;
+load data infile '../../std_data/rpl_loaddata.dat' into table t1;
 Warnings:
 Warning	1262	Row 1 was truncated; it contained more data than there were input columns
 Warning	1262	Row 2 was truncated; it contained more data than there were input columns
@@ -49,11 +49,11 @@ count(*)
 delete from t1;
 delete from t2;
 begin;
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t2;
+load data infile '../../std_data/rpl_loaddata.dat' into table t2;
 Warnings:
 Warning	1262	Row 1 was truncated; it contained more data than there were input columns
 Warning	1262	Row 2 was truncated; it contained more data than there were input columns
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t1;
+load data infile '../../std_data/rpl_loaddata.dat' into table t1;
 Warnings:
 Warning	1262	Row 1 was truncated; it contained more data than there were input columns
 Warning	1262	Row 2 was truncated; it contained more data than there were input columns
@@ -77,11 +77,11 @@ delete from t2;
 begin;
 insert into t2 values(3),(4);
 insert into t1 values(3),(4);
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t2;
+load data infile '../../std_data/rpl_loaddata.dat' into table t2;
 Warnings:
 Warning	1262	Row 1 was truncated; it contained more data than there were input columns
 Warning	1262	Row 2 was truncated; it contained more data than there were input columns
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t1;
+load data infile '../../std_data/rpl_loaddata.dat' into table t1;
 Warnings:
 Warning	1262	Row 1 was truncated; it contained more data than there were input columns
 Warning	1262	Row 2 was truncated; it contained more data than there were input columns
diff -Nrup a/mysql-test/r/rpl_replicate_do.result b/mysql-test/r/rpl_replicate_do.result
--- a/mysql-test/r/rpl_replicate_do.result	2007-02-26 12:25:40 +01:00
+++ b/mysql-test/r/rpl_replicate_do.result	2007-12-04 12:18:55 +01:00
@@ -9,7 +9,7 @@ drop table if exists t11;
 create table t2 (n int);
 insert into t2 values(4);
 create table t2 (s char(20));
-load data infile '../std_data_ln/words.dat' into table t2;
+load data infile '../../std_data/words.dat' into table t2;
 insert into t2 values('five');
 create table t1 (m int);
 insert into t1 values(15),(16),(17);
diff -Nrup a/mysql-test/r/rpl_rewrite_db.result b/mysql-test/r/rpl_rewrite_db.result
--- a/mysql-test/r/rpl_rewrite_db.result	2006-07-20 10:41:05 +02:00
+++ b/mysql-test/r/rpl_rewrite_db.result	2007-12-04 12:18:55 +01:00
@@ -24,7 +24,7 @@ drop database if exists rewrite;
 create database rewrite;
 use test;
 create table t1 (a date, b date, c date not null, d date);
-load data infile '../std_data_ln/loaddata1.dat' into table t1 fields terminated by ',';
+load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',';
 Warnings:
 Warning	1265	Data truncated for column 'a' at row 1
 Warning	1265	Data truncated for column 'c' at row 1
@@ -32,7 +32,7 @@ Warning	1265	Data truncated for column '
 Warning	1265	Data truncated for column 'a' at row 2
 Warning	1265	Data truncated for column 'b' at row 2
 Warning	1265	Data truncated for column 'd' at row 2
-load data infile '../std_data_ln/loaddata1.dat' into table t1 fields terminated by ','
IGNORE 2 LINES;
+load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ','
IGNORE 2 LINES;
 select * from rewrite.t1;
 a	b	c	d
 0000-00-00	NULL	0000-00-00	0000-00-00
@@ -40,7 +40,7 @@ a	b	c	d
 2003-03-03	2003-03-03	2003-03-03	NULL
 2003-03-03	2003-03-03	2003-03-03	NULL
 truncate table t1;
-load data infile '../std_data_ln/loaddata1.dat' into table t1 fields terminated by ','
LINES STARTING BY ',' (b,c,d);
+load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ','
LINES STARTING BY ',' (b,c,d);
 Warnings:
 Warning	1265	Data truncated for column 'c' at row 1
 Warning	1265	Data truncated for column 'd' at row 1
@@ -53,7 +53,7 @@ NULL	0000-00-00	0000-00-00	0000-00-00
 NULL	2003-03-03	2003-03-03	NULL
 drop table t1;
 create table t1 (a text, b text);
-load data infile '../std_data_ln/loaddata2.dat' into table t1 fields terminated by ','
enclosed by '''';
+load data infile '../../std_data/loaddata2.dat' into table t1 fields terminated by ','
enclosed by '''';
 Warnings:
 Warning	1261	Row 3 doesn't contain data for all columns
 select concat('|',a,'|'), concat('|',b,'|') from rewrite.t1;
@@ -65,7 +65,7 @@ Field 3,'Field 4|
 |Field 6|	| 'Field 7'|
 drop table t1;
 create table t1 (a int, b char(10));
-load data infile '../std_data_ln/loaddata3.dat' into table t1 fields terminated by ''
enclosed by '' ignore 1 lines;
+load data infile '../../std_data/loaddata3.dat' into table t1 fields terminated by ''
enclosed by '' ignore 1 lines;
 Warnings:
 Warning	1366	Incorrect integer value: 'error      ' for column 'a' at row 3
 Warning	1262	Row 3 was truncated; it contained more data than there were input columns
@@ -79,7 +79,7 @@ a	b
 3	row 3
 0	1234567890
 truncate table t1;
-load data infile '../std_data_ln/loaddata4.dat' into table t1 fields terminated by ''
enclosed by '' lines terminated by '' ignore 1 lines;
+load data infile '../../std_data/loaddata4.dat' into table t1 fields terminated by ''
enclosed by '' lines terminated by '' ignore 1 lines;
 Warnings:
 Warning	1366	Incorrect integer value: '
 ' for column 'a' at row 4
diff -Nrup a/mysql-test/r/rpl_timezone.result b/mysql-test/r/rpl_timezone.result
--- a/mysql-test/r/rpl_timezone.result	2007-08-06 13:57:26 +02:00
+++ b/mysql-test/r/rpl_timezone.result	2007-12-04 12:18:55 +01:00
@@ -72,7 +72,7 @@ ROLLBACK /* added by mysqlbinlog */;
 /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
 delete from t1;
 set time_zone='UTC';
-load data infile '../std_data_ln/rpl_timezone.dat' into table t1;
+load data infile '../../std_data/rpl_timezone.dat' into table t1;
 select * from t1;
 t
 2004-01-01 00:00:00
diff -Nrup a/mysql-test/r/sp.result b/mysql-test/r/sp.result
--- a/mysql-test/r/sp.result	2007-10-16 19:16:23 +02:00
+++ b/mysql-test/r/sp.result	2007-12-04 12:18:55 +01:00
@@ -4390,9 +4390,9 @@ drop procedure if exists bug13012|
 create procedure bug13012()
 BEGIN
 REPAIR TABLE t1;
-BACKUP TABLE t1 to '../tmp';
+BACKUP TABLE t1 to '../../tmp';
 DROP TABLE t1;
-RESTORE TABLE t1 FROM '../tmp';
+RESTORE TABLE t1 FROM '../../tmp';
 END|
 call bug13012()|
 Table	Op	Msg_type	Msg_text
diff -Nrup a/mysql-test/r/trigger.result b/mysql-test/r/trigger.result
--- a/mysql-test/r/trigger.result	2007-07-18 12:42:03 +02:00
+++ b/mysql-test/r/trigger.result	2007-12-04 12:18:55 +01:00
@@ -406,13 +406,13 @@ create table t1 (i int, j int, k int);
 create trigger trg1 before insert on t1 for each row set new.k = new.i;
 create trigger trg2 after insert on t1 for each row set @b:= "Fired";
 set @b:="";
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t1 (@a, i);
+load data infile '../../std_data/rpl_loaddata.dat' into table t1 (@a, i);
 select *, @b from t1;
 i	j	k	@b
 10	NULL	10	Fired
 15	NULL	15	Fired
 set @b:="";
-load data infile '../std_data_ln/loaddata5.dat' into table t1 fields terminated by ''
enclosed by '' (i, j);
+load data infile '../../std_data/loaddata5.dat' into table t1 fields terminated by ''
enclosed by '' (i, j);
 select *, @b from t1;
 i	j	k	@b
 10	NULL	10	Fired
@@ -449,7 +449,7 @@ ERROR 42S22: Unknown column 'at' in 'OLD
 select * from t1;
 i	k
 1	1
-load data infile '../std_data_ln/loaddata5.dat' into table t1 fields terminated by ''
enclosed by '' (i, k);
+load data infile '../../std_data/loaddata5.dat' into table t1 fields terminated by ''
enclosed by '' (i, k);
 ERROR 42S22: Unknown column 'at' in 'NEW'
 select * from t1;
 i	k
@@ -524,7 +524,7 @@ select * from t1;
 i	k
 1	1
 2	2
-load data infile '../std_data_ln/loaddata5.dat' into table t1 fields terminated by ''
enclosed by '' (i, k);
+load data infile '../../std_data/loaddata5.dat' into table t1 fields terminated by ''
enclosed by '' (i, k);
 ERROR 42S22: Unknown column 'bt' in 'NEW'
 select * from t1;
 i	k
@@ -998,7 +998,7 @@ insert into t1 (a) values
 create trigger t2_ai after insert on t2 for each row
 set @a:= (select max(a) from t2);
 insert into t2 select * from t1;
-load data infile '../std_data_ln/words.dat' into table t1 (a);
+load data infile '../../std_data/words.dat' into table t1 (a);
 drop trigger t1_ai;
 drop trigger t2_ai;
 create function f1() returns int return (select max(b) from t1);
@@ -1007,7 +1007,7 @@ insert into t1 values
 ("And",f1()),("the",f1()),("mome", f1()),("raths",f1()),("outgrabe",f1());
 create function f2() returns int return (select max(b) from t2);
 insert into t2 select a, f2() from t1;
-load data infile '../std_data_ln/words.dat' into table t1 (a) set b:= f1();
+load data infile '../../std_data/words.dat' into table t1 (a) set b:= f1();
 drop table t1, t2;
 drop function f1;
 drop function f2;
diff -Nrup a/mysql-test/r/type_blob.result b/mysql-test/r/type_blob.result
--- a/mysql-test/r/type_blob.result	2007-03-01 17:59:52 +01:00
+++ b/mysql-test/r/type_blob.result	2007-12-04 12:18:55 +01:00
@@ -507,25 +507,25 @@ Warnings:
 Warning	1101	BLOB/TEXT column 'imagem' can't have a default value
 insert into t1 (id) values (1);
 select
-charset(load_file('../std_data_ln/words.dat')),
-collation(load_file('../std_data_ln/words.dat')),
-coercibility(load_file('../std_data_ln/words.dat'));
-charset(load_file('../std_data_ln/words.dat'))	collation(load_file('../std_data_ln/words.dat'))	coercibility(load_file('../std_data_ln/words.dat'))
+charset(load_file('../../std_data/words.dat')),
+collation(load_file('../../std_data/words.dat')),
+coercibility(load_file('../../std_data/words.dat'));
+charset(load_file('../../std_data/words.dat'))	collation(load_file('../../std_data/words.dat'))	coercibility(load_file('../../std_data/words.dat'))
 binary	binary	4
 explain extended select
-charset(load_file('MYSQLTEST_VARDIR/std_data_ln/words.dat')),
-collation(load_file('MYSQLTEST_VARDIR/std_data_ln/words.dat')),
-coercibility(load_file('MYSQLTEST_VARDIR/std_data_ln/words.dat'));
+charset(load_file('MYSQLTEST_VARDIR/std_data/words.dat')),
+collation(load_file('MYSQLTEST_VARDIR/std_data/words.dat')),
+coercibility(load_file('MYSQLTEST_VARDIR/std_data/words.dat'));
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
 Warnings:
-Note	1003	select charset(load_file(_latin1'MYSQLTEST_VARDIR/std_data_ln/words.dat')) AS
`charset(load_file('MYSQLTEST_VARDIR/std_data_ln/words.dat'))`,collation(load_file(_latin1'MYSQLTEST_VARDIR/std_data_ln/words.dat'))
AS
`collation(load_file('MYSQLTEST_VARDIR/std_data_ln/words.dat'))`,coercibility(load_file(_latin1'MYSQLTEST_VARDIR/std_data_ln/words.dat'))
AS `coercibility(load_file('MYSQLTEST_VARDIR/std_data_ln/words.dat'))`
-update t1 set imagem=load_file('MYSQLTEST_VARDIR/std_data_ln/words.dat') where id=1;
+Note	1003	select charset(load_file(_latin1'MYSQLTEST_VARDIR/std_data/words.dat')) AS
`charset(load_file('MYSQLTEST_VARDIR/std_data/words.dat'))`,collation(load_file(_latin1'MYSQLTEST_VARDIR/std_data/words.dat'))
AS
`collation(load_file('MYSQLTEST_VARDIR/std_data/words.dat'))`,coercibility(load_file(_latin1'MYSQLTEST_VARDIR/std_data/words.dat'))
AS `coercibility(load_file('MYSQLTEST_VARDIR/std_data/words.dat'))`
+update t1 set imagem=load_file('MYSQLTEST_VARDIR/std_data/words.dat') where id=1;
 select if(imagem is null, "ERROR", "OK"),length(imagem) from t1 where id = 1;
 if(imagem is null, "ERROR", "OK")	length(imagem)
 OK	581
 drop table t1;
-create table t1 select load_file('MYSQLTEST_VARDIR/std_data_ln/words.dat') l;
+create table t1 select load_file('MYSQLTEST_VARDIR/std_data/words.dat') l;
 show full fields from t1;
 Field	Type	Collation	Null	Key	Default	Extra	Privileges	Comment
 l	longblob	NULL	YES		NULL		#	
diff -Nrup a/mysql-test/r/view.result b/mysql-test/r/view.result
--- a/mysql-test/r/view.result	2007-07-28 14:01:23 +02:00
+++ b/mysql-test/r/view.result	2007-12-04 12:18:55 +01:00
@@ -1308,7 +1308,7 @@ drop view v2, v1;
 drop table t1;
 create table t1 (a int, b char(10));
 create view v1 as select * from t1 where a != 0 with check option;
-load data infile '../std_data_ln/loaddata3.dat' into table v1 fields terminated by ''
enclosed by '' ignore 1 lines;
+load data infile '../../std_data/loaddata3.dat' into table v1 fields terminated by ''
enclosed by '' ignore 1 lines;
 ERROR HY000: CHECK OPTION failed 'test.v1'
 select * from t1;
 a	b
@@ -1319,7 +1319,7 @@ a	b
 1	row 1
 2	row 2
 delete from t1;
-load data infile '../std_data_ln/loaddata3.dat' ignore into table v1 fields terminated by
'' enclosed by '' ignore 1 lines;
+load data infile '../../std_data/loaddata3.dat' ignore into table v1 fields terminated by
'' enclosed by '' ignore 1 lines;
 Warnings:
 Warning	1366	Incorrect integer value: 'error      ' for column 'a' at row 3
 Error	1369	CHECK OPTION failed 'test.v1'
@@ -1339,14 +1339,14 @@ drop view v1;
 drop table t1;
 create table t1 (a text, b text);
 create view v1 as select * from t1 where a <> 'Field A' with check option;
-load data infile '../std_data_ln/loaddata2.dat' into table v1 fields terminated by ','
enclosed by '''';
+load data infile '../../std_data/loaddata2.dat' into table v1 fields terminated by ','
enclosed by '''';
 ERROR HY000: CHECK OPTION failed 'test.v1'
 select concat('|',a,'|'), concat('|',b,'|') from t1;
 concat('|',a,'|')	concat('|',b,'|')
 select concat('|',a,'|'), concat('|',b,'|') from v1;
 concat('|',a,'|')	concat('|',b,'|')
 delete from t1;
-load data infile '../std_data_ln/loaddata2.dat' ignore into table v1 fields terminated by
',' enclosed by '''';
+load data infile '../../std_data/loaddata2.dat' ignore into table v1 fields terminated by
',' enclosed by '''';
 Warnings:
 Error	1369	CHECK OPTION failed 'test.v1'
 Warning	1261	Row 2 doesn't contain data for all columns
diff -Nrup a/mysql-test/r/warnings.result b/mysql-test/r/warnings.result
--- a/mysql-test/r/warnings.result	2007-05-30 14:04:03 +02:00
+++ b/mysql-test/r/warnings.result	2007-12-04 12:18:55 +01:00
@@ -70,7 +70,7 @@ select @@warning_count;
 1
 drop table t1;
 create table t1(a tinyint, b int not null, c date, d char(5));
-load data infile '../std_data_ln/warnings_loaddata.dat' into table t1 fields terminated
by ',';
+load data infile '../../std_data/warnings_loaddata.dat' into table t1 fields terminated
by ',';
 Warnings:
 Warning	1263	Column was set to data type implicit default; NULL supplied for NOT NULL
column 'b' at row 2
 Warning	1265	Data truncated for column 'd' at row 3
diff -Nrup a/mysql-test/t/archive.test b/mysql-test/t/archive.test
--- a/mysql-test/t/archive.test	2007-09-22 12:17:09 +02:00
+++ b/mysql-test/t/archive.test	2007-12-04 12:18:55 +01:00
@@ -1297,7 +1297,7 @@ create table t3 engine=archive select * 
 select * from t3 where fld3='bonfire';
 select count(*) from t3;
 # Clean up path in error message
---replace_result $MYSQL_TEST_DIR . /var/master-data/ /
+--replace_result $MYSQL_TEST_DIR . /var/mysqld.1/ /
 rename table t3 to t4;
 select * from t4 where fld3='bonfire';
 select count(*) from t4;
diff -Nrup a/mysql-test/t/backup.test b/mysql-test/t/backup.test
--- a/mysql-test/t/backup.test	2007-08-29 12:44:42 +02:00
+++ b/mysql-test/t/backup.test	2007-12-04 12:18:55 +01:00
@@ -1,6 +1,6 @@
 
 # The server need to be started in $MYSQLTEST_VARDIR since it
-# uses ../std_data_ln/
+# uses ../../std_data/
 -- source include/uses_vardir.inc
 
 #
@@ -16,41 +16,41 @@ drop table if exists t1, t2, t3;
 --enable_warnings
 create table t4(n int);
 --replace_result ": 1" ": X" ": 2" ": X" ": 22" ": X" ": 23" ": X" $MYSQLTEST_VARDIR
MYSQLTEST_VARDIR
-backup table t4 to '../bogus';
-backup table t4 to '../tmp';
+backup table t4 to '../../bogus';
+backup table t4 to '../../tmp';
 --replace_result ": 7" ": X" ": 17" ": X" $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-backup table t4 to '../tmp';
+backup table t4 to '../../tmp';
 drop table t4;
-restore table t4 from '../tmp';
+restore table t4 from '../../tmp';
 select count(*) from t4;
 
 create table t1(n int);
 insert into t1 values (23),(45),(67);
-backup table t1 to '../tmp';
+backup table t1 to '../../tmp';
 drop table t1;
 --replace_result ": 1" ": X" ": 2" ": X" ": 22" ": X" ": 23" ": X" $MYSQLTEST_VARDIR
MYSQLTEST_VARDIR
-restore table t1 from '../bogus';
-restore table t1 from '../tmp';
+restore table t1 from '../../bogus';
+restore table t1 from '../../tmp';
 select n from t1;
 create table t2(m int not null primary key);
 create table t3(k int not null primary key);
 insert into t2 values (123),(145),(167);
 insert into t3 values (223),(245),(267);
-backup table t2,t3 to '../tmp';
+backup table t2,t3 to '../../tmp';
 drop table t1,t2,t3;
-restore table t1,t2,t3 from '../tmp';
+restore table t1,t2,t3 from '../../tmp';
 select n from t1;
 select m from t2;
 select k from t3;
 drop table t1,t2,t3,t4;
-restore table t1 from '../tmp';
+restore table t1 from '../../tmp';
 connection con2;
 rename table t1 to t5;
 --send
 lock tables t5 write;
 connection con1;
 --send
-backup table t5 to '../tmp';
+backup table t5 to '../../tmp';
 connection con2;
 reap;
 unlock tables;
diff -Nrup a/mysql-test/t/binlog_killed.test b/mysql-test/t/binlog_killed.test
--- a/mysql-test/t/binlog_killed.test	2007-10-18 21:48:14 +02:00
+++ b/mysql-test/t/binlog_killed.test	2007-12-04 12:18:55 +01:00
@@ -39,7 +39,7 @@ connection con2;
 reap;
 let $rows= `select count(*) from t2  /* must be 2 or 0 */`;
 
---exec $MYSQL_BINLOG --start-position=126 $MYSQLTEST_VARDIR/log/master-bin.000001 >
$MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog
+--exec $MYSQL_BINLOG --start-position=126
$MYSQLTEST_VARDIR/mysqld.1/data/master-bin.000001 >
$MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog
 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
 eval select
 (@a:=load_file("$MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog"))
diff -Nrup a/mysql-test/t/blackhole.test b/mysql-test/t/blackhole.test
--- a/mysql-test/t/blackhole.test	2007-06-14 23:15:50 +02:00
+++ b/mysql-test/t/blackhole.test	2007-12-04 12:18:55 +01:00
@@ -7,7 +7,7 @@
 -- source include/have_log_bin.inc
 
 # The server need to be started in $MYSQLTEST_VARDIR since it
-# uses ../std_data_ln/
+# uses ../../std_data/
 -- source include/uses_vardir.inc
 
 --disable_warnings
@@ -114,7 +114,7 @@ insert into t1 values(1);
 insert ignore into t1 values(1);
 replace into t1 values(100);
 create table t2 (a varchar(200)) engine=blackhole;
-eval load data infile '../std_data_ln/words.dat' into table t2;
+eval load data infile '../../std_data/words.dat' into table t2;
 alter table t1 add b int;
 alter table t1 drop b;
 create table t3 like t1;
diff -Nrup a/mysql-test/t/csv.test b/mysql-test/t/csv.test
--- a/mysql-test/t/csv.test	2007-06-15 08:19:34 +02:00
+++ b/mysql-test/t/csv.test	2007-12-04 12:18:55 +01:00
@@ -1398,13 +1398,13 @@ drop table t1;
 
 create table bug15205 (val int(11) default null) engine=csv;
 create table bug15205_2 (val int(11) default null) engine=csv;
---remove_file $MYSQLTEST_VARDIR/master-data/test/bug15205.CSV
+--remove_file $MYSQLTEST_VARDIR/mysqld.1/data/test/bug15205.CSV
 # system error (can't open the datafile)
 --error ER_GET_ERRNO
 select * from bug15205;
 select * from bug15205_2;
 # Create empty file
---write_file $MYSQLTEST_VARDIR/master-data/test/bug15205.CSV
+--write_file $MYSQLTEST_VARDIR/mysqld.1/data/test/bug15205.CSV
 EOF
 select * from bug15205;
 drop table bug15205;
diff -Nrup a/mysql-test/t/ctype_big5.test b/mysql-test/t/ctype_big5.test
--- a/mysql-test/t/ctype_big5.test	2007-07-04 11:21:28 +02:00
+++ b/mysql-test/t/ctype_big5.test	2007-12-04 12:18:55 +01:00
@@ -74,10 +74,10 @@ insert into t1 values (0xEE00);
 select * into outfile 'test/t1.txt' from t1;
 delete from t1;
 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---eval select hex(load_file('$MYSQLTEST_VARDIR/master-data/test/t1.txt'));
+--eval select hex(load_file('$MYSQLTEST_VARDIR/mysqld.1/data/test/t1.txt'));
 load data infile 't1.txt' into table t1;
 select hex(a) from t1;
---exec rm $MYSQLTEST_VARDIR/master-data/test/t1.txt
+remove_file $MYSQLTEST_VARDIR/mysqld.1/data/test/t1.txt;
 drop table t1;
 
 --echo End of 5.0 tests
diff -Nrup a/mysql-test/t/ctype_ucs_binlog.test b/mysql-test/t/ctype_ucs_binlog.test
--- a/mysql-test/t/ctype_ucs_binlog.test	2007-06-14 22:58:22 +02:00
+++ b/mysql-test/t/ctype_ucs_binlog.test	2007-12-04 12:18:55 +01:00
@@ -15,7 +15,7 @@ show binlog events from 98;
 # absolutely need variables names to be quoted and strings to be
 # escaped).
 --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
---exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000001 
+--exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/mysqld.1/data/master-bin.000001 
 drop table t2;
 
 # End of 4.1 tests
diff -Nrup a/mysql-test/t/federated.test b/mysql-test/t/federated.test
--- a/mysql-test/t/federated.test	2007-08-08 09:34:30 +02:00
+++ b/mysql-test/t/federated.test	2007-12-04 12:18:55 +01:00
@@ -1459,7 +1459,7 @@ insert into federated.t1 (a, b) select *
 select * from federated.t1;
 delete from federated.t1;
 # load
-load data infile '../std_data_ln/loaddata5.dat' into table federated.t1 fields terminated
by '' enclosed by '' ignore 1 lines (a, b);
+load data infile '../../std_data/loaddata5.dat' into table federated.t1 fields terminated
by '' enclosed by '' ignore 1 lines (a, b);
 select * from federated.t1;
 drop tables federated.t1, federated.t2;
 
diff -Nrup a/mysql-test/t/gis.test b/mysql-test/t/gis.test
--- a/mysql-test/t/gis.test	2007-07-05 17:24:47 +02:00
+++ b/mysql-test/t/gis.test	2007-12-04 12:18:55 +01:00
@@ -385,7 +385,7 @@ drop table t1;
 create table t1 (a TEXT, b GEOMETRY NOT NULL, SPATIAL KEY(b));
 alter table t1 disable keys;
 --error 1263
-load data infile '../std_data_ln/bad_gis_data.dat' into table t1;
+load data infile '../../std_data/bad_gis_data.dat' into table t1;
 alter table t1 enable keys;
 drop table t1;
 
diff -Nrup a/mysql-test/t/information_schema_chmod.test
b/mysql-test/t/information_schema_chmod.test
--- a/mysql-test/t/information_schema_chmod.test	2007-08-29 11:53:14 +02:00
+++ b/mysql-test/t/information_schema_chmod.test	2007-12-04 12:18:55 +01:00
@@ -17,7 +17,7 @@
 #
 create database mysqltest;
 create table mysqltest.t1(a int);
-chmod 0000 $MYSQLTEST_VARDIR/master-data/mysqltest;
+chmod 0000 $MYSQLTEST_VARDIR/mysqld.1/data/mysqltest;
 select table_schema from information_schema.tables where table_schema='mysqltest';
-chmod 0777 $MYSQLTEST_VARDIR/master-data/mysqltest;
+chmod 0777 $MYSQLTEST_VARDIR/mysqld.1/data/mysqltest;
 drop database mysqltest;
diff -Nrup a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test
--- a/mysql-test/t/innodb.test	2007-07-18 14:22:00 +02:00
+++ b/mysql-test/t/innodb.test	2007-12-04 12:18:55 +01:00
@@ -1179,7 +1179,7 @@ drop table t2;
 
 # Clean up filename -- embedded server reports whole path without .frm,
 # regular server reports relative path with .frm (argh!)
---replace_result \\ / $MYSQL_TEST_DIR . /var/master-data/ / t2.frm t2
+--replace_result \\ / $MYSQL_TEST_DIR . /var/mysqld.1/ / t2.frm t2
 --error ER_WRONG_FK_DEF
 create table t2 (id int(11) not null, id2 int(11) not null, constraint t1_id_fk foreign
key (id2,id) references t1 (id)) engine = innodb;
 
@@ -1373,7 +1373,7 @@ source include/varchar.inc;
 
 # Clean up filename -- embedded server reports whole path without .frm,
 # regular server reports relative path with .frm (argh!)
---replace_result \\ / $MYSQL_TEST_DIR . /var/master-data/ / t1.frm t1
+--replace_result \\ / $MYSQL_TEST_DIR . /var/mysqld.1/ / t1.frm t1
 create table t1 (v varchar(65530), key(v));
 drop table t1;
 create table t1 (v varchar(65536));
@@ -1647,7 +1647,7 @@ disconnect b;
 
 set foreign_key_checks=0;
 create table t2 (a int primary key, b int, foreign key (b) references t1(a)) engine =
innodb;
---replace_result $MYSQLTEST_VARDIR . master-data/ ''
+--replace_result $MYSQLTEST_VARDIR . mysqld.1/ ''
 -- error 1005
 create table t1(a char(10) primary key, b varchar(20)) engine = innodb;
 set foreign_key_checks=1;
@@ -1658,7 +1658,7 @@ drop table t2;
 
 set foreign_key_checks=0;
 create table t1(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=latin1;
---replace_result $MYSQLTEST_VARDIR . master-data/ ''
+--replace_result $MYSQLTEST_VARDIR . mysqld.1/ ''
 -- error 1005
 create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT
CHARSET=utf8;
 set foreign_key_checks=1;
@@ -1688,7 +1688,7 @@ drop table t2,t1;
 set foreign_key_checks=0;
 create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT
CHARSET=latin1;
 create table t3(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=utf8;
---replace_result $MYSQLTEST_VARDIR . master-data/ ''
+--replace_result $MYSQLTEST_VARDIR . mysqld.1/ ''
 -- error 1025
 rename table t3 to t1;
 set foreign_key_checks=1;
@@ -1937,7 +1937,7 @@ select * from t1, t2
 drop table t1, t2;
 
 # bug 18934, "InnoDB crashes when table uses column names like DB_ROW_ID"
---replace_result \\ / $MYSQL_TEST_DIR . /var/master-data/ /
+--replace_result \\ / $MYSQL_TEST_DIR . /var/mysqld.1/ /
 --error 1005
 CREATE TABLE t1 (DB_ROW_ID int) engine=innodb;
 
diff -Nrup a/mysql-test/t/innodb_mysql.test b/mysql-test/t/innodb_mysql.test
--- a/mysql-test/t/innodb_mysql.test	2007-10-26 12:37:37 +02:00
+++ b/mysql-test/t/innodb_mysql.test	2007-12-04 12:18:55 +01:00
@@ -641,7 +641,7 @@ DROP TABLE t1,t2,t3;
 #
 
 create table t1 (a int) engine=innodb;
-copy_file $MYSQLTEST_VARDIR/master-data/test/t1.frm
$MYSQLTEST_VARDIR/master-data/test/t2.frm;
+copy_file $MYSQLTEST_VARDIR/mysqld.1/data/test/t1.frm
$MYSQLTEST_VARDIR/mysqld.1/data/test/t2.frm;
 --error 1146
 select * from t2;
 drop table t1;
diff -Nrup a/mysql-test/t/loaddata.test b/mysql-test/t/loaddata.test
--- a/mysql-test/t/loaddata.test	2007-08-28 16:44:30 +02:00
+++ b/mysql-test/t/loaddata.test	2007-12-04 12:18:55 +01:00
@@ -7,25 +7,25 @@ drop table if exists t1, t2;
 --enable_warnings
 
 create table t1 (a date, b date, c date not null, d date);
-load data infile '../std_data_ln/loaddata1.dat' into table t1 fields terminated by ',';
-load data infile '../std_data_ln/loaddata1.dat' into table t1 fields terminated by ','
IGNORE 2 LINES;
+load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',';
+load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ','
IGNORE 2 LINES;
 SELECT * from t1;
 truncate table t1;
 
-load data infile '../std_data_ln/loaddata1.dat' into table t1 fields terminated by ','
LINES STARTING BY ',' (b,c,d);
+load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ','
LINES STARTING BY ',' (b,c,d);
 SELECT * from t1;
 drop table t1;
 
 create table t1 (a text, b text);
-load data infile '../std_data_ln/loaddata2.dat' into table t1 fields terminated by ','
enclosed by '''';
+load data infile '../../std_data/loaddata2.dat' into table t1 fields terminated by ','
enclosed by '''';
 select concat('|',a,'|'), concat('|',b,'|') from t1;
 drop table t1;
 
 create table t1 (a int, b char(10));
-load data infile '../std_data_ln/loaddata3.dat' into table t1 fields terminated by ''
enclosed by '' ignore 1 lines;
+load data infile '../../std_data/loaddata3.dat' into table t1 fields terminated by ''
enclosed by '' ignore 1 lines;
 select * from t1;
 truncate table t1;
-load data infile '../std_data_ln/loaddata4.dat' into table t1 fields terminated by ''
enclosed by '' lines terminated by '' ignore 1 lines;
+load data infile '../../std_data/loaddata4.dat' into table t1 fields terminated by ''
enclosed by '' lines terminated by '' ignore 1 lines;
 
 # The empty line last comes from the end line field in the file
 select * from t1;
@@ -63,7 +63,7 @@ drop table t1;
 # ENCLOSED
 #
 create table t1 (a varchar(20), b varchar(20));
-load data infile '../std_data_ln/loaddata_dq.dat' into table t1 fields terminated by ','
enclosed by '"' escaped by '"' (a,b);
+load data infile '../../std_data/loaddata_dq.dat' into table t1 fields terminated by ','
enclosed by '"' escaped by '"' (a,b);
 select * from t1;
 drop table t1;
 
@@ -108,40 +108,40 @@ DROP TABLE t1,t2;
 #
 create table t1 (a int default 100, b int, c varchar(60));
 # we can do something like this
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t1 (a, @b) set b=@b+10,
c=concat("b=",@b);
+load data infile '../../std_data/rpl_loaddata.dat' into table t1 (a, @b) set b=@b+10,
c=concat("b=",@b);
 select * from t1;
 truncate table t1;
 # we can use filled fields in expressions 
 # we also assigning NULL value to field with non-NULL default here
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t1 (a, @b) set c= if(a is
null,"oops",a);
+load data infile '../../std_data/rpl_loaddata.dat' into table t1 (a, @b) set c= if(a is
null,"oops",a);
 select * from t1;
 truncate table t1;
 # we even can use variables in set clause, and missed columns will be set
 # with default values
 set @c:=123;
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t1 (@a, b) set c= if(@a is
null,@c,b);
+load data infile '../../std_data/rpl_loaddata.dat' into table t1 (@a, b) set c= if(@a is
null,@c,b);
 select * from t1;
 # let us test side-effect of such load
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t1 (@a, @b);
+load data infile '../../std_data/rpl_loaddata.dat' into table t1 (@a, @b);
 select * from t1;
 select @a, @b;
 truncate table t1;
 # now going to test fixed field-row file format
-load data infile '../std_data_ln/loaddata5.dat' into table t1 fields terminated by ''
enclosed by '' (a, b) set c="Wow";
+load data infile '../../std_data/loaddata5.dat' into table t1 fields terminated by ''
enclosed by '' (a, b) set c="Wow";
 select * from t1;
 truncate table t1;
 # this also should work
-load data infile '../std_data_ln/loaddata5.dat' into table t1 fields terminated by ''
enclosed by '' (a, b) set c=concat(a,"+",b,"+",@c,"+",b,"+",if(c is null,"NIL",c));
+load data infile '../../std_data/loaddata5.dat' into table t1 fields terminated by ''
enclosed by '' (a, b) set c=concat(a,"+",b,"+",@c,"+",b,"+",if(c is null,"NIL",c));
 select * from t1;
 # and this should bark
 --error 1409 
-load data infile '../std_data_ln/loaddata5.dat' into table t1 fields terminated by ''
enclosed by '' (a, @b);
+load data infile '../../std_data/loaddata5.dat' into table t1 fields terminated by ''
enclosed by '' (a, @b);
 
 # Now let us test LOAD DATA with subselect
 create table t2 (num int primary key, str varchar(10));
 insert into t2 values (10,'Ten'), (15,'Fifteen');
 truncate table t1;
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t1 (@dummy,@n) set a= @n,
c= (select str from t2 where num=@n);
+load data infile '../../std_data/rpl_loaddata.dat' into table t1 (@dummy,@n) set a= @n,
c= (select str from t2 where num=@n);
 select * from t1;
 
 #
diff -Nrup a/mysql-test/t/mix_innodb_myisam_binlog.test
b/mysql-test/t/mix_innodb_myisam_binlog.test
--- a/mysql-test/t/mix_innodb_myisam_binlog.test	2007-07-30 17:27:30 +02:00
+++ b/mysql-test/t/mix_innodb_myisam_binlog.test	2007-12-04 12:18:55 +01:00
@@ -255,7 +255,7 @@ select get_lock("a",10); # wait for roll
 # we check that the error code of the "ROLLBACK" event is 0 and not
 # ER_SERVER_SHUTDOWN (i.e. disconnection just rolls back transaction
 # and does not make slave to stop)
---exec $MYSQL_BINLOG --start-position=547 $MYSQLTEST_VARDIR/log/master-bin.000001 >
$MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output
+--exec $MYSQL_BINLOG --start-position=547
$MYSQLTEST_VARDIR/mysqld.1/data/master-bin.000001 >
$MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output
 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
 eval select
 (@a:=load_file("$MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output"))
diff -Nrup a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test
--- a/mysql-test/t/myisam.test	2007-08-29 14:44:21 +02:00
+++ b/mysql-test/t/myisam.test	2007-12-04 12:18:55 +01:00
@@ -1051,14 +1051,14 @@ eval set storage_engine=$default;
 # Test how DROP TABLE works if the index or data file doesn't exists
 
 create table t1 (a int) engine=myisam;
-remove_file $MYSQLTEST_VARDIR/master-data/test/t1.MYI ;
+remove_file $MYSQLTEST_VARDIR/mysqld.1/data/test/t1.MYI ;
 drop table if exists t1;
 create table t1 (a int) engine=myisam;
-remove_file $MYSQLTEST_VARDIR/master-data/test/t1.MYI ;
+remove_file $MYSQLTEST_VARDIR/mysqld.1/data/test/t1.MYI ;
 --error 1051,6
 drop table t1;
 create table t1 (a int) engine=myisam;
-remove_file $MYSQLTEST_VARDIR/master-data/test/t1.MYD ;
+remove_file $MYSQLTEST_VARDIR/mysqld.1/data/test/t1.MYD ;
 --error 1105,6,29
 drop table t1;
 --error 1051
diff -Nrup a/mysql-test/t/mysql_upgrade.test b/mysql-test/t/mysql_upgrade.test
--- a/mysql-test/t/mysql_upgrade.test	2007-05-19 18:15:07 +02:00
+++ b/mysql-test/t/mysql_upgrade.test	2007-12-04 12:18:55 +01:00
@@ -15,7 +15,7 @@ select LENGTH("$MYSQL_UPGRADE")>0 as hav
 --exec $MYSQL_UPGRADE --skip-verbose 2>&1
 
 # It should have created a file in the MySQL Servers datadir
-file_exists $MYSQLTEST_VARDIR/master-data/mysql_upgrade_info;
+file_exists $MYSQLTEST_VARDIR/mysqld.1/data/mysql_upgrade_info;
 
 --echo Run it again - should say already completed
 --replace_result $MYSQL_SERVER_VERSION VERSION
@@ -23,13 +23,13 @@ file_exists $MYSQLTEST_VARDIR/master-dat
 --exec $MYSQL_UPGRADE --skip-verbose 2>&1
 
 # It should have created a file in the MySQL Servers datadir
-file_exists $MYSQLTEST_VARDIR/master-data/mysql_upgrade_info;
+file_exists $MYSQLTEST_VARDIR/mysqld.1/data/mysql_upgrade_info;
 
 --echo Force should run it regardless of wether it's been run before
 --exec $MYSQL_UPGRADE --skip-verbose --force 2>&1
 
 # It should have created a file in the MySQL Servers datadir
-file_exists $MYSQLTEST_VARDIR/master-data/mysql_upgrade_info;
+file_exists $MYSQLTEST_VARDIR/mysqld.1/data/mysql_upgrade_info;
 
 
 #
diff -Nrup a/mysql-test/t/mysqlbinlog-cp932.test b/mysql-test/t/mysqlbinlog-cp932.test
--- a/mysql-test/t/mysqlbinlog-cp932.test	2007-06-14 22:58:22 +02:00
+++ b/mysql-test/t/mysqlbinlog-cp932.test	2007-12-04 12:18:55 +01:00
@@ -11,7 +11,7 @@ create table t4 (f text character set cp
 --exec $MYSQL --default-character-set=cp932 test -e "insert into t4 values(_cp932'ƒ\');"
 flush logs;
 rename table t3 to t03, t4 to t04;
---exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000002 | $MYSQL
--default-character-set=utf8
+--exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/mysqld.1/data/master-bin.000002 |
$MYSQL --default-character-set=utf8
 # original and recovered data must be equal
 select HEX(f) from t03;
 select HEX(f) from t3;
diff -Nrup a/mysql-test/t/mysqlbinlog.test b/mysql-test/t/mysqlbinlog.test
--- a/mysql-test/t/mysqlbinlog.test	2007-08-01 12:27:00 +02:00
+++ b/mysql-test/t/mysqlbinlog.test	2007-12-04 12:18:55 +01:00
@@ -21,11 +21,11 @@ insert into t2 values ();
 
 # test for load data and load data distributed among the several 
 # files (we need to fill up first binlog)
-load data infile '../std_data_ln/words.dat' into table t1;
-load data infile '../std_data_ln/words.dat' into table t1;
-load data infile '../std_data_ln/words.dat' into table t1;
-load data infile '../std_data_ln/words.dat' into table t1;
-load data infile '../std_data_ln/words.dat' into table t1;
+load data infile '../../std_data/words.dat' into table t1;
+load data infile '../../std_data/words.dat' into table t1;
+load data infile '../../std_data/words.dat' into table t1;
+load data infile '../../std_data/words.dat' into table t1;
+load data infile '../../std_data/words.dat' into table t1;
 # simple query to show more in second binlog
 insert into t1 values ("Alas");
 flush logs;
@@ -41,28 +41,28 @@ select "--- Local --" as "";
 #
 
 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/
$MYSQLTEST_VARDIR/log/master-bin.000001
+--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/
$MYSQLTEST_VARDIR/mysqld.1/data/master-bin.000001
 
 # this should not fail but shouldn't produce any working statements
 --disable_query_log
 select "--- Broken LOAD DATA --" as "";
 --enable_query_log
 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/
$MYSQLTEST_VARDIR/log/master-bin.000002 2> /dev/null
+--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/
$MYSQLTEST_VARDIR/mysqld.1/data/master-bin.000002 2> /dev/null
 
 # this should show almost nothing
 --disable_query_log
 select "--- --database --" as "";
 --enable_query_log
 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --database=nottest
$MYSQLTEST_VARDIR/log/master-bin.000001 2> /dev/null
+--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --database=nottest
$MYSQLTEST_VARDIR/mysqld.1/data/master-bin.000001 2> /dev/null
 
 # this test for position option
 --disable_query_log
 select "--- --position --" as "";
 --enable_query_log
 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --position=231
$MYSQLTEST_VARDIR/log/master-bin.000002
+--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --position=231
$MYSQLTEST_VARDIR/mysqld.1/data/master-bin.000002
 
 # These are tests for remote binlog.
 # They should return the same as previous test.
@@ -124,7 +124,7 @@ EOF
 # resulted binlog, parly consisting of multi-byte utf8 chars, 
 # must be digestable for both client and server. In 4.1 the client 
 # should use default-character-set same as the server.
---exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000004 | $MYSQL
+--exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/mysqld.1/data/master-bin.000004 |
$MYSQL
 select * from t5  /* must be (1),(1) */;
 drop table t5;
 
@@ -143,7 +143,7 @@ insert into t5 values (3, date_format('2
 select * from t5 order by c1;
 flush logs;
 drop table t5;
---exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000005 | $MYSQL
+--exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/mysqld.1/data/master-bin.000005 |
$MYSQL
 select * from t5 order by c1;
 drop table t5;
 
@@ -166,8 +166,8 @@ call p1();
 drop procedure p1;
 --error 1305
 call p1();
---exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000007
---exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000007 | $MYSQL
+--exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/mysqld.1/data/master-bin.000007
+--exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/mysqld.1/data/master-bin.000007 |
$MYSQL
 call p1();
 drop procedure p1;
 
@@ -186,22 +186,22 @@ drop procedure p1;
 
 flush logs;
 create table t1 (a varchar(64) character set utf8);
-load data infile '../std_data_ln/loaddata6.dat' into table t1;
+load data infile '../../std_data/loaddata6.dat' into table t1;
 set character_set_database=koi8r;
-load data infile '../std_data_ln/loaddata6.dat' into table t1;
+load data infile '../../std_data/loaddata6.dat' into table t1;
 set character_set_database=latin1;
-load data infile '../std_data_ln/loaddata6.dat' into table t1;
-load data infile '../std_data_ln/loaddata6.dat' into table t1;
+load data infile '../../std_data/loaddata6.dat' into table t1;
+load data infile '../../std_data/loaddata6.dat' into table t1;
 set character_set_database=koi8r;
-load data infile '../std_data_ln/loaddata6.dat' into table t1;
+load data infile '../../std_data/loaddata6.dat' into table t1;
 set character_set_database=latin1;
-load data infile '../std_data_ln/loaddata6.dat' into table t1;
-load data infile '../std_data_ln/loaddata6.dat' into table t1 character set koi8r;
+load data infile '../../std_data/loaddata6.dat' into table t1;
+load data infile '../../std_data/loaddata6.dat' into table t1 character set koi8r;
 select hex(a) from t1;
 drop table t1;
 flush logs;
 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/
$MYSQLTEST_VARDIR/log/master-bin.000009
+--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/
$MYSQLTEST_VARDIR/mysqld.1/data/master-bin.000009
 
 #
 # Bug#28293 missed '#' sign in the hex dump when the dump length
@@ -214,7 +214,7 @@ flush logs;
 INSERT INTO t1 VALUES ('0123456789');
 flush logs;
 DROP TABLE t1;
---exec $MYSQL_BINLOG --hexdump --local-load=$MYSQLTEST_VARDIR/tmp/
$MYSQLTEST_VARDIR/log/master-bin.000011 | grep 'Query' | sed 's/[0-9]\{1,\}/REMOVED/g'
+--exec $MYSQL_BINLOG --hexdump --local-load=$MYSQLTEST_VARDIR/tmp/
$MYSQLTEST_VARDIR/mysqld.1/data/master-bin.000011 | grep 'Query' | sed
's/[0-9]\{1,\}/REMOVED/g'
 
 #
 # Bug #29928: incorrect connection_id() restoring from mysqlbinlog out
@@ -224,7 +224,7 @@ create table t1(a int);
 insert into t1 values(connection_id()); 
 let $a= `select a from t1`;
 flush logs;
---exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000013 >
$MYSQLTEST_VARDIR/tmp/bug29928.sql
+--exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/mysqld.1/data/master-bin.000013 >
$MYSQLTEST_VARDIR/tmp/bug29928.sql
 drop table t1;
 connect (con1, localhost, root, , test);                                            
 connection con1;
diff -Nrup a/mysql-test/t/mysqlbinlog2.test b/mysql-test/t/mysqlbinlog2.test
--- a/mysql-test/t/mysqlbinlog2.test	2007-06-14 23:22:49 +02:00
+++ b/mysql-test/t/mysqlbinlog2.test	2007-12-04 12:18:55 +01:00
@@ -39,32 +39,32 @@ select "--- Local --" as "";
 # be time dependent (the Start events). Better than nothing.
 #
 
---exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000001 
+--exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/mysqld.1/data/master-bin.000001 
 
 --disable_query_log
 select "--- offset --" as "";
 --enable_query_log
---exec $MYSQL_BINLOG --short-form --offset=2 $MYSQLTEST_VARDIR/log/master-bin.000001 
+--exec $MYSQL_BINLOG --short-form --offset=2
$MYSQLTEST_VARDIR/mysqld.1/data/master-bin.000001 
 --disable_query_log
 select "--- start-position --" as "";
 --enable_query_log
---exec $MYSQL_BINLOG --short-form --start-position=600
$MYSQLTEST_VARDIR/log/master-bin.000001 
+--exec $MYSQL_BINLOG --short-form --start-position=600
$MYSQLTEST_VARDIR/mysqld.1/data/master-bin.000001 
 --disable_query_log
 select "--- stop-position --" as "";
 --enable_query_log
---exec $MYSQL_BINLOG --short-form --stop-position=600
$MYSQLTEST_VARDIR/log/master-bin.000001 
+--exec $MYSQL_BINLOG --short-form --stop-position=600
$MYSQLTEST_VARDIR/mysqld.1/data/master-bin.000001 
 --disable_query_log
 select "--- start and stop positions ---" as "";
 --enable_query_log
---exec $MYSQL_BINLOG --short-form --start-position=600 --stop-position 725
$MYSQLTEST_VARDIR/log/master-bin.000001 
+--exec $MYSQL_BINLOG --short-form --start-position=600 --stop-position 725
$MYSQLTEST_VARDIR/mysqld.1/data/master-bin.000001 
 --disable_query_log
 select "--- start-datetime --" as "";
 --enable_query_log
---exec $MYSQL_BINLOG --short-form "--start-datetime=2020-01-21 15:32:24"
$MYSQLTEST_VARDIR/log/master-bin.000001 
+--exec $MYSQL_BINLOG --short-form "--start-datetime=2020-01-21 15:32:24"
$MYSQLTEST_VARDIR/mysqld.1/data/master-bin.000001 
 --disable_query_log
 select "--- stop-datetime --" as "";
 --enable_query_log
---exec $MYSQL_BINLOG --short-form "--stop-datetime=2020-01-21 15:32:24"
$MYSQLTEST_VARDIR/log/master-bin.000001 
+--exec $MYSQL_BINLOG --short-form "--stop-datetime=2020-01-21 15:32:24"
$MYSQLTEST_VARDIR/mysqld.1/data/master-bin.000001 
 
 --disable_query_log
 select "--- Local with 2 binlogs on command line --" as "";
@@ -72,28 +72,28 @@ select "--- Local with 2 binlogs on comm
 
 # This is to verify that some options apply only to first, or last binlog
 
---exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000001
$MYSQLTEST_VARDIR/log/master-bin.000002
+--exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/mysqld.1/data/master-bin.000001
$MYSQLTEST_VARDIR/mysqld.1/data/master-bin.000002
 
 --disable_query_log
 select "--- offset --" as "";
 --enable_query_log
---exec $MYSQL_BINLOG --short-form --offset=2 $MYSQLTEST_VARDIR/log/master-bin.000001
$MYSQLTEST_VARDIR/log/master-bin.000002
+--exec $MYSQL_BINLOG --short-form --offset=2
$MYSQLTEST_VARDIR/mysqld.1/data/master-bin.000001
$MYSQLTEST_VARDIR/mysqld.1/data/master-bin.000002
 --disable_query_log
 select "--- start-position --" as "";
 --enable_query_log
---exec $MYSQL_BINLOG --short-form --start-position=600
$MYSQLTEST_VARDIR/log/master-bin.000001 $MYSQLTEST_VARDIR/log/master-bin.000002
+--exec $MYSQL_BINLOG --short-form --start-position=600
$MYSQLTEST_VARDIR/mysqld.1/data/master-bin.000001
$MYSQLTEST_VARDIR/mysqld.1/data/master-bin.000002
 --disable_query_log
 select "--- stop-position --" as "";
 --enable_query_log
---exec $MYSQL_BINLOG --short-form --stop-position=126
$MYSQLTEST_VARDIR/log/master-bin.000001 $MYSQLTEST_VARDIR/log/master-bin.000002
+--exec $MYSQL_BINLOG --short-form --stop-position=126
$MYSQLTEST_VARDIR/mysqld.1/data/master-bin.000001
$MYSQLTEST_VARDIR/mysqld.1/data/master-bin.000002
 --disable_query_log
 select "--- start-datetime --" as "";
 --enable_query_log
---exec $MYSQL_BINLOG --short-form "--start-datetime=2020-01-21 15:32:24"
$MYSQLTEST_VARDIR/log/master-bin.000001 $MYSQLTEST_VARDIR/log/master-bin.000002
+--exec $MYSQL_BINLOG --short-form "--start-datetime=2020-01-21 15:32:24"
$MYSQLTEST_VARDIR/mysqld.1/data/master-bin.000001
$MYSQLTEST_VARDIR/mysqld.1/data/master-bin.000002
 --disable_query_log
 select "--- stop-datetime --" as "";
 --enable_query_log
---exec $MYSQL_BINLOG --short-form "--stop-datetime=2020-01-21 15:32:24"
$MYSQLTEST_VARDIR/log/master-bin.000001 $MYSQLTEST_VARDIR/log/master-bin.000002
+--exec $MYSQL_BINLOG --short-form "--stop-datetime=2020-01-21 15:32:24"
$MYSQLTEST_VARDIR/mysqld.1/data/master-bin.000001
$MYSQLTEST_VARDIR/mysqld.1/data/master-bin.000002
 
 --disable_query_log
 select "--- Remote --" as "";
diff -Nrup a/mysql-test/t/ndb_autodiscover.test b/mysql-test/t/ndb_autodiscover.test
--- a/mysql-test/t/ndb_autodiscover.test	2006-01-24 08:30:48 +01:00
+++ b/mysql-test/t/ndb_autodiscover.test	2007-12-04 12:18:55 +01:00
@@ -24,7 +24,7 @@ create table t1(
 
 insert into t1 values(1, "Autodiscover");
 flush tables;
-system rm $MYSQLTEST_VARDIR/master-data/test/t1.frm ;
+remove_file  $MYSQLTEST_VARDIR/mysql_cluster.1/mysqld.1/data/test/t1.frm ;
 select * from t1;
 show status like 'handler_discover%';
 
@@ -33,13 +33,13 @@ show status like 'handler_discover%';
 #
 
 flush tables;
-system rm $MYSQLTEST_VARDIR/master-data/test/t1.frm ;
+remove_file  $MYSQLTEST_VARDIR/mysql_cluster.1/mysqld.1/data/test/t1.frm ;
 insert into t1 values (2, "Auto 2");
 show status like 'handler_discover%';
 insert into t1 values (3, "Discover 3");
 show status like 'handler_discover%';
 flush tables;
-system rm $MYSQLTEST_VARDIR/master-data/test/t1.frm ;
+remove_file  $MYSQLTEST_VARDIR/mysql_cluster.1/mysqld.1/data/test/t1.frm ;
 select * from t1 order by id;
 show status like 'handler_discover%';
 
@@ -48,7 +48,7 @@ show status like 'handler_discover%';
 #
 
 flush tables;
-system rm $MYSQLTEST_VARDIR/master-data/test/t1.frm ;
+remove_file  $MYSQLTEST_VARDIR/mysql_cluster.1/mysqld.1/data/test/t1.frm ;
 update t1 set name="Autodiscover" where id = 2;
 show status like 'handler_discover%';
 select * from t1 order by id;
@@ -59,7 +59,7 @@ show status like 'handler_discover%';
 #
 
 flush tables;
-system rm $MYSQLTEST_VARDIR/master-data/test/t1.frm ;
+remove_file  $MYSQLTEST_VARDIR/mysql_cluster.1/mysqld.1/data/test/t1.frm ;
 delete from  t1 where id = 3;
 select * from t1 order by id;
 show status like 'handler_discover%';
@@ -85,7 +85,7 @@ show status like 'handler_discover%';
 flush tables;
 
 # Modify the frm file on disk
-system echo "blaj" >> $MYSQLTEST_VARDIR/master-data/test/t2.frm ;
+system echo "blaj" >> $MYSQLTEST_VARDIR/mysql_cluster.1/mysqld.1/data/test/t2.frm ;
 select * from t2;
 
 show status like 'handler_discover%';
@@ -111,7 +111,7 @@ show status like 'handler_discover%';
 flush tables;
 
 # Remove the frm file from disk
-system rm $MYSQLTEST_VARDIR/master-data/test/t3.frm ;
+remove_file  $MYSQLTEST_VARDIR/mysql_cluster.1/mysqld.1/data/test/t3.frm ;
 
 --error 1050
 create table t3(
@@ -168,14 +168,14 @@ show status like 'handler_discover%';
 
 # Remove the frm file from disk
 flush tables;
-system rm $MYSQLTEST_VARDIR/master-data/test/t7.frm ;
+remove_file  $MYSQLTEST_VARDIR/mysql_cluster.1/mysqld.1/data/test/t7.frm ;
 
 show tables from test;
 show status like 'handler_discover%';
 
 # Remove the frm file from disk again
 flush tables;
-system rm $MYSQLTEST_VARDIR/master-data/test/t7.frm ;
+remove_file  $MYSQLTEST_VARDIR/mysql_cluster.1/mysqld.1/data/test/t7.frm ;
 
 --replace_column 7 # 8 # 9 # 12 # 13 # 15 # 18 #
 show table status;
@@ -290,8 +290,8 @@ insert into t9 values (9);
 system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t3 >>
$NDB_TOOLS_OUTPUT ;
 system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t5 >>
$NDB_TOOLS_OUTPUT ;
 # Remove t6, t7 from disk
-system rm $MYSQLTEST_VARDIR/master-data/test/t6.frm > /dev/null ; 
-system rm $MYSQLTEST_VARDIR/master-data/test/t7.frm > /dev/null ; 
+remove_file $MYSQLTEST_VARDIR/mysql_cluster.1/mysqld.1/data/test/t6.frm;
+remove_file  $MYSQLTEST_VARDIR/mysql_cluster.1/mysqld.1/data/test/t7.frm;
 
 SHOW TABLES;
 
@@ -332,8 +332,8 @@ insert into t9 values (9);
 system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t3 > /dev/null  ;
 system exec $NDB_TOOLS_DIR/ndb_drop_table --no-defaults -d test t5 > /dev/null  ;
 # Remove t6, t7 from disk
-system rm $MYSQLTEST_VARDIR/master-data/test/t6.frm > /dev/null ; 
-system rm $MYSQLTEST_VARDIR/master-data/test/t7.frm > /dev/null ; 
+remove_file  $MYSQLTEST_VARDIR/mysql_cluster.1/mysqld.1/data/test/t6.frm;
+remove_file  $MYSQLTEST_VARDIR/mysql_cluster.1/mysqld.1/data/test/t7.frm;
 
 
 SHOW TABLES LIKE 't6';
@@ -375,9 +375,9 @@ insert into t3 values (3, "ndb table 3")
 insert into t4 values (4);
 
 # Remove t1, t2, t3 from disk
-system rm $MYSQLTEST_VARDIR/master-data/test/t1.frm > /dev/null ; 
-system rm $MYSQLTEST_VARDIR/master-data/test/t2.frm > /dev/null ; 
-system rm $MYSQLTEST_VARDIR/master-data/test/t3.frm > /dev/null ; 
+remove_file  $MYSQLTEST_VARDIR/mysql_cluster.1/mysqld.1/data/test/t1.frm;
+remove_file  $MYSQLTEST_VARDIR/mysql_cluster.1/mysqld.1/data/test/t2.frm;
+remove_file  $MYSQLTEST_VARDIR/mysql_cluster.1/mysqld.1/data/test/t3.frm;
 flush tables;
 
 # Select from the table which only exists in NDB.
@@ -530,7 +530,7 @@ CREATE TABLE t9 (
 insert t9 values(1, 2), (2,3), (3, 4), (4, 5);
 
 #Don't drop the table, instead remove the frm file
-system rm $MYSQLTEST_VARDIR/master-data/test/t9.frm ;
+remove_file $MYSQLTEST_VARDIR/mysql_cluster.1/mysqld.1/data/test/t9.frm ;
 
 # Now leave test case, when ndb_autodiscover2 will  run, this 
 # MySQL Server will have been restarted because it has a 
diff -Nrup a/mysql-test/t/ndb_load.test b/mysql-test/t/ndb_load.test
--- a/mysql-test/t/ndb_load.test	2006-02-14 17:15:09 +01:00
+++ b/mysql-test/t/ndb_load.test	2007-12-04 12:18:55 +01:00
@@ -8,16 +8,18 @@ DROP TABLE IF EXISTS t1;
 #
 # Basic test for different types of loading data
 #
-
+let $load_file= $MYSQLTEST_VARDIR/std_data/words.dat;
 # should give duplicate key
 CREATE TABLE t1 (word CHAR(20) NOT NULL PRIMARY KEY) ENGINE=NDB;
+--replace_result $load_file LOAD_FILE
 --error 1022
-LOAD DATA INFILE '../std_data_ln/words.dat' INTO TABLE t1 ;
+eval LOAD DATA INFILE '$load_file' INTO TABLE t1 ;
 DROP TABLE t1;
 
 # now without a primary key we should be ok
 CREATE TABLE t1 (word CHAR(20) NOT NULL) ENGINE=NDB;
-LOAD DATA INFILE '../std_data_ln/words.dat' INTO TABLE t1 ;
+--replace_result $load_file LOAD_FILE
+eval LOAD DATA INFILE '$load_file' INTO TABLE t1 ;
 SELECT * FROM t1 ORDER BY word;
 DROP TABLE t1;
 
diff -Nrup a/mysql-test/t/ndb_loaddatalocal.test b/mysql-test/t/ndb_loaddatalocal.test
--- a/mysql-test/t/ndb_loaddatalocal.test	2006-06-14 20:16:28 +02:00
+++ b/mysql-test/t/ndb_loaddatalocal.test	2007-12-04 12:18:55 +01:00
@@ -6,64 +6,77 @@ DROP TABLE IF EXISTS t1;
 --enable_warnings
 
 create table t1(a int) engine=myisam;
-let $1=10000;
+let $1=100;
 disable_query_log;
 set SQL_LOG_BIN=0;
 while ($1)
 {
- insert into t1 values(1);
+eval INSERT INTO t1 VALUES
+($1+1),($1+2),($1+3),($1+4),($1+5),($1+6),($1+7),($1+8),($1+9),($1+10),
+($1+11),($1+12),($1+13),($1+14),($1+15),($1+16),($1+17),($1+18),($1+19),($1+20),
+($1+21),($1+22),($1+23),($1+24),($1+25),($1+26),($1+27),($1+28),($1+29),($1+30),
+($1+31),($1+32),($1+33),($1+34),($1+35),($1+36),($1+37),($1+38),($1+39),($1+40),
+($1+41),($1+42),($1+43),($1+44),($1+45),($1+46),($1+47),($1+48),($1+49),($1+50),
+($1+51),($1+52),($1+53),($1+54),($1+55),($1+56),($1+57),($1+58),($1+59),($1+60),
+($1+61),($1+62),($1+63),($1+64),($1+65),($1+66),($1+67),($1+68),($1+69),($1+70),
+($1+71),($1+72),($1+73),($1+74),($1+75),($1+76),($1+77),($1+78),($1+79),($1+80),
+($1+81),($1+82),($1+83),($1+84),($1+85),($1+86),($1+87),($1+88),($1+89),($1+90),
+($1+91),($1+92),($1+93),($1+94),($1+95),($1+96),($1+97),($1+98),($1+99),($1+100);
  dec $1;
 }
 set SQL_LOG_BIN=1;
 enable_query_log;
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-eval select * into outfile
'$MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' from t1;
+
+let $load_file= $MYSQLTEST_VARDIR/tmp/ndb_loaddatalocal.select_outfile;
+
+--replace_result $load_file LOAD_FILE
+eval select * into outfile '$load_file' from t1;
 #This will generate a 20KB file, now test LOAD DATA LOCAL
 drop table t1;
 
 create table t1(a int) engine=ndb;
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-eval load data local infile
'$MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' into table t1;
+--replace_result $load_file LOAD_FILE
+eval load data local infile '$load_file' into table t1;
 select count(*) from t1;
-system rm $MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile ;
+remove_file $load_file ;
 drop table t1;
 
 create table t1(a int) engine=myisam;
 insert into t1 values (1), (2), (2), (3);
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-eval select * into outfile
'$MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' from t1;
+--replace_result $load_file LOAD_FILE
+eval select * into outfile '$load_file' from t1;
 drop table t1;
 
 create table t1(a int primary key) engine=ndb;
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-eval load data local infile
'$MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' into table t1;
-system rm $MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile;
+--replace_result $load_file LOAD_FILE
+eval load data local infile '$load_file' into table t1;
+remove_file $load_file;
 select * from t1 order by a;
 drop table t1;
 
 create table t1(a int) engine=myisam;
 insert into t1 values (1), (1), (2), (3);
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-eval select * into outfile
'$MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' from t1;
+--replace_result $load_file LOAD_FILE
+eval select * into outfile '$load_file' from t1;
 drop table t1;
 
 create table t1(a int primary key) engine=ndb;
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-eval load data local infile
'$MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' into table t1;
-system rm $MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile;
+--replace_result $load_file LOAD_FILE
+eval load data local infile '$load_file' into table t1;
+remove_file $load_file;
 select * from t1 order by a;
 drop table t1;
 
 create table t1(a int) engine=myisam;
 insert into t1 values (1), (2), (3), (3);
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-eval select * into outfile
'$MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' from t1;
+--replace_result $load_file LOAD_FILE
+eval select * into outfile '$load_file' from t1;
 drop table t1;
 
 create table t1(a int primary key) engine=ndb;
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-eval load data local infile
'$MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' into table t1;
-system rm $MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile;
+--replace_result $load_file LOAD_FILE
+eval load data local infile '$load_file' into table t1;
+remove_file $load_file;
 select * from t1 order by a;
 drop table t1;
 
diff -Nrup a/mysql-test/t/ndb_replace.test b/mysql-test/t/ndb_replace.test
--- a/mysql-test/t/ndb_replace.test	2006-07-01 23:51:01 +02:00
+++ b/mysql-test/t/ndb_replace.test	2007-12-04 12:18:55 +01:00
@@ -72,6 +72,9 @@ DROP TABLE t2;
 --disable_warnings
 drop table if exists t1;
 --enable_warnings
+
+let $load_file5= $MYSQLTEST_VARDIR/std_data/loaddata5.dat;
+
 create table t1 (pk int primary key, apk int unique, data int) engine=ndbcluster;
 # Test for plain replace which updates pk
 insert into t1 values (1, 1, 1), (2, 2, 2), (3, 3, 3);
@@ -85,12 +88,14 @@ select * from t1 order by pk;
 delete from t1;
 # Test for load data replace which updates pk
 insert into t1 values (1, 1, 1), (4, 4, 4), (6, 6, 6);
-load data infile '../std_data_ln/loaddata5.dat' replace into table t1 fields terminated
by '' enclosed by '' ignore 1 lines (pk, apk);
+--replace_result $load_file5 LOAD_FILE5
+eval load data infile '$load_file5' replace into table t1 fields terminated by ''
enclosed by '' ignore 1 lines (pk, apk);
 select * from t1 order by pk;
 delete from t1;
 # Now test for load data replace which doesn't touch pk
 insert into t1 values (1, 1, 1), (3, 3, 3), (5, 5, 5);
-load data infile '../std_data_ln/loaddata5.dat' replace into table t1 fields terminated
by '' enclosed by '' ignore 1 lines (pk, apk);
+--replace_result $load_file5 LOAD_FILE5
+eval load data infile '$load_file5' replace into table t1 fields terminated by ''
enclosed by '' ignore 1 lines (pk, apk);
 select * from t1 order by pk;
 delete from t1;
 # Finally test for both types of replace ... select
diff -Nrup a/mysql-test/t/ndb_single_user.test b/mysql-test/t/ndb_single_user.test
--- a/mysql-test/t/ndb_single_user.test	2007-04-16 14:07:29 +02:00
+++ b/mysql-test/t/ndb_single_user.test	2007-12-04 12:18:55 +01:00
@@ -16,8 +16,8 @@ drop table if exists t1,t2,t3,t4,t5,t6,t
 --eval set @node_id= SUBSTRING('$node_id', 20)+0
 --enable_query_log
 --let $node_id= `SELECT @node_id`
---exec $NDB_MGM --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -e "enter
single user mode $node_id" >> $NDB_TOOLS_OUTPUT
---exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults
--ndb-connectstring="localhost:$NDBCLUSTER_PORT" --single-user >> $NDB_TOOLS_OUTPUT
+--exec $NDB_MGM --no-defaults --ndb-connectstring=$NDB_CONNECTSTRING -e "enter single
user mode $node_id" >> $NDB_TOOLS_OUTPUT
+--exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults --ndb-connectstring=$NDB_CONNECTSTRING
--single-user >> $NDB_TOOLS_OUTPUT
 
 # verify that we are indeed in single user mode
 --connection server2
@@ -71,7 +71,7 @@ update t1 set b=b+100;
 --error 1296
 update t1 set b=b+100 where a > 7;
 
---exec $NDB_MGM --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -e "exit
single user mode" >> $NDB_TOOLS_OUTPUT
+--exec $NDB_MGM --no-defaults --ndb-connectstring=$NDB_CONNECTSTRING -e "exit single user
mode" >> $NDB_TOOLS_OUTPUT
 --exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults >> $NDB_TOOLS_OUTPUT
 
 #
@@ -86,8 +86,8 @@ BEGIN;
 update t1 set b=b+100 where a=2;
 
 # enter single user mode
---exec $NDB_MGM --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -e "enter
single user mode $node_id" >> $NDB_TOOLS_OUTPUT
---exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults
--ndb-connectstring="localhost:$NDBCLUSTER_PORT" --single-user >> $NDB_TOOLS_OUTPUT
+--exec $NDB_MGM --no-defaults --ndb-connectstring=$NDB_CONNECTSTRING -e "enter single
user mode $node_id" >> $NDB_TOOLS_OUTPUT
+--exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults --ndb-connectstring=$NDB_CONNECTSTRING
--single-user >> $NDB_TOOLS_OUTPUT
 
 --connection server1
 update t1 set b=b+100 where a=3;
@@ -107,7 +107,7 @@ create table t2 (a int) engine myisam;
 alter table t2 add column (b int);
 
 # exit single user mode
---exec $NDB_MGM --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -e "exit
single user mode" >> $NDB_TOOLS_OUTPUT
+--exec $NDB_MGM --no-defaults --ndb-connectstring=$NDB_CONNECTSTRING -e "exit single user
mode" >> $NDB_TOOLS_OUTPUT
 --exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults >> $NDB_TOOLS_OUTPUT
 
 # cleanup
diff -Nrup a/mysql-test/t/ndb_trigger.test b/mysql-test/t/ndb_trigger.test
--- a/mysql-test/t/ndb_trigger.test	2007-04-04 12:50:30 +02:00
+++ b/mysql-test/t/ndb_trigger.test	2007-12-04 12:18:55 +01:00
@@ -83,7 +83,7 @@ delete from t1;
 delete from t2;
 # Check for load data replace
 insert into t1 values (3, 1, 1.05), (5, 2, 2.05);
-load data infile '../std_data_ln/loaddata5.dat' replace into table t1 fields terminated
by '' enclosed by '' ignore 1 lines (id, a);
+load data infile '../../std_data/loaddata5.dat' replace into table t1 fields terminated
by '' enclosed by '' ignore 1 lines (id, a);
 select * from t1 order by id;
 select * from t2 order by op, a, b;
 
diff -Nrup a/mysql-test/t/ps_1general.test b/mysql-test/t/ps_1general.test
--- a/mysql-test/t/ps_1general.test	2007-06-22 11:55:46 +02:00
+++ b/mysql-test/t/ps_1general.test	2007-12-04 12:18:55 +01:00
@@ -592,7 +592,7 @@ prepare stmt1 from ' rename table t5 to 
 create table t5 (a int) ;
 # rename must fail, t7 does not exist
 # Clean up the filename here because embedded server reports whole path
---replace_result \\ / $MYSQLTEST_VARDIR . /master-data/ / t7.frm t7
+--replace_result \\ / $MYSQLTEST_VARDIR . /mysqld.1/ / t7.frm t7
 --error 1017
 execute stmt1 ;
 create table t7 (a int) ;
diff -Nrup a/mysql-test/t/query_cache.test b/mysql-test/t/query_cache.test
--- a/mysql-test/t/query_cache.test	2007-08-21 17:47:03 +02:00
+++ b/mysql-test/t/query_cache.test	2007-12-04 12:18:55 +01:00
@@ -419,7 +419,7 @@ create table t1 (word char(20) not null)
 select * from t1;
 show status like "Qcache_queries_in_cache";
 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-eval load data infile '$MYSQLTEST_VARDIR/std_data_ln/words.dat' into table t1;
+eval load data infile '$MYSQLTEST_VARDIR/std_data/words.dat' into table t1;
 show status like "Qcache_queries_in_cache";
 select count(*) from t1;
 drop table t1;
diff -Nrup a/mysql-test/t/repair.test b/mysql-test/t/repair.test
--- a/mysql-test/t/repair.test	2007-10-17 08:31:59 +02:00
+++ b/mysql-test/t/repair.test	2007-12-04 12:18:56 +01:00
@@ -29,7 +29,7 @@ repair table t1 use_frm;
 
 create table t1 engine=myisam SELECT 1,"table 1";
 flush tables;
-system echo 1 > $MYSQLTEST_VARDIR/master-data/test/t1.MYI ;
+system echo 1 > $MYSQLTEST_VARDIR/mysqld.1/data/test/t1.MYI ;
 repair table t1;
 repair table t1 use_frm;
 drop table t1;
diff -Nrup a/mysql-test/t/rpl000001.test b/mysql-test/t/rpl000001.test
--- a/mysql-test/t/rpl000001.test	2006-01-27 10:47:56 +01:00
+++ b/mysql-test/t/rpl000001.test	2007-12-04 12:18:56 +01:00
@@ -1,7 +1,7 @@
 source include/master-slave.inc;
 
 create table t1 (word char(20) not null);
-load data infile '../std_data_ln/words.dat' into table t1;
+load data infile '../../std_data/words.dat' into table t1;
 --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
 eval load data local infile '$MYSQL_TEST_DIR/std_data/words.dat' into table t1;
 select * from t1 limit 10;
diff -Nrup a/mysql-test/t/rpl000004.test b/mysql-test/t/rpl000004.test
--- a/mysql-test/t/rpl000004.test	2006-01-24 08:30:48 +01:00
+++ b/mysql-test/t/rpl000004.test	2007-12-04 12:18:56 +01:00
@@ -2,9 +2,9 @@ source include/master-slave.inc;
 
 set SQL_LOG_BIN=0;
 create table t1 (word char(20) not null, index(word));
-load data infile '../std_data_ln/words.dat' into table t1;
+load data infile '../../std_data/words.dat' into table t1;
 create table t2 (word char(20) not null);
-load data infile '../std_data_ln/words.dat' into table t2;
+load data infile '../../std_data/words.dat' into table t2;
 create table t3 (word char(20) not null primary key);
 connection slave;
 load table t1 from master;
diff -Nrup a/mysql-test/t/rpl000009.test b/mysql-test/t/rpl000009.test
--- a/mysql-test/t/rpl000009.test	2006-01-24 08:30:48 +01:00
+++ b/mysql-test/t/rpl000009.test	2007-12-04 12:18:56 +01:00
@@ -138,10 +138,10 @@ select * from mysqltest.t1;
 # DISABLED FOR NOW AS chmod IS NOT PORTABLE ON NON-UNIX
 # insert into mysqltest.t1 values(10, 'should be there');
 # flush tables;
-# system chmod 500 $MYSQLTEST_VARDIR/slave-data/mysqltest/;
+# system chmod 500 $MYSQLTEST_VARDIR/mysqld.2/mysqltest/;
 # --error 6
 # load data from master;  # should fail (errno 13)
-# system chmod 700 $MYSQLTEST_VARDIR/slave-data/mysqltest/;
+# system chmod 700 $MYSQLTEST_VARDIR/mysqld.2/mysqltest/;
 # select * from mysqltest.t1; # should contain the row (10, ...)
 
 
diff -Nrup a/mysql-test/t/rpl000015-master.opt b/mysql-test/t/rpl000015-master.opt
--- a/mysql-test/t/rpl000015-master.opt	2007-10-24 16:48:03 +02:00
+++ b/mysql-test/t/rpl000015-master.opt	2007-12-04 12:18:56 +01:00
@@ -1,2 +1,2 @@
---slave-num=1
+--config-file-template=rpl_1slave_base.cnf
 
diff -Nrup a/mysql-test/t/rpl000015-slave.sh b/mysql-test/t/rpl000015-slave.sh
--- a/mysql-test/t/rpl000015-slave.sh	2006-01-24 08:30:48 +01:00
+++ b/mysql-test/t/rpl000015-slave.sh	2007-12-04 12:18:56 +01:00
@@ -1 +1 @@
-rm -f $MYSQLTEST_VARDIR/slave-data/master.info
+rm -f $MYSQLTEST_VARDIR/mysqld.2/master.info
diff -Nrup a/mysql-test/t/rpl000015.slave-mi b/mysql-test/t/rpl000015.slave-mi
--- a/mysql-test/t/rpl000015.slave-mi	2003-02-25 23:14:17 +01:00
+++ /dev/null	Wed Dec 31 16:00:00 196900
@@ -1 +0,0 @@
---server-id=22 --master-connect-retry=7
diff -Nrup a/mysql-test/t/rpl000017-master.opt b/mysql-test/t/rpl000017-master.opt
--- a/mysql-test/t/rpl000017-master.opt	2007-10-24 16:48:03 +02:00
+++ b/mysql-test/t/rpl000017-master.opt	2007-12-04 12:18:56 +01:00
@@ -1,2 +1,2 @@
---slave-num=1
+--config-file-template=rpl_1slave.cnf
 
diff -Nrup a/mysql-test/t/rpl000017-slave.sh b/mysql-test/t/rpl000017-slave.sh
--- a/mysql-test/t/rpl000017-slave.sh	2007-11-06 09:01:57 +01:00
+++ b/mysql-test/t/rpl000017-slave.sh	2007-12-04 12:18:56 +01:00
@@ -1,6 +1,6 @@
 rm -f $MYSQLTEST_VARDIR/log/*relay*
-rm -f $MYSQLTEST_VARDIR/slave-data/relay-log.info
-cat > $MYSQLTEST_VARDIR/slave-data/master.info <<EOF
+rm -f $MYSQLTEST_VARDIR/mysqld.2/relay-log.info
+cat > $MYSQLTEST_VARDIR/mysqld.2/master.info <<EOF
 master-bin.000001
 4
 127.0.0.1
diff -Nrup a/mysql-test/t/rpl_EE_error.test b/mysql-test/t/rpl_EE_error.test
--- a/mysql-test/t/rpl_EE_error.test	2006-01-24 08:30:48 +01:00
+++ b/mysql-test/t/rpl_EE_error.test	2007-12-04 12:18:56 +01:00
@@ -8,7 +8,7 @@ source include/master-slave.inc;
 
 create table t1 (a int) engine=myisam;
 flush tables;
-system rm $MYSQLTEST_VARDIR/master-data/test/t1.MYI ;
+system rm $MYSQLTEST_VARDIR/mysqld.1/data/test/t1.MYI ;
 drop table if exists t1;
 save_master_pos;
 connection slave;
diff -Nrup a/mysql-test/t/rpl_charset.test b/mysql-test/t/rpl_charset.test
--- a/mysql-test/t/rpl_charset.test	2006-10-04 23:18:00 +02:00
+++ b/mysql-test/t/rpl_charset.test	2007-12-04 12:18:56 +01:00
@@ -153,7 +153,7 @@ select hex(c1), hex(c2) from t1;
 connection master;
 # Let's have a look at generated SETs.
 --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
---exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000001 
+--exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/mysqld.1/data/master-bin.000001 
 drop table t1;
 sync_slave_with_master;
 
diff -Nrup a/mysql-test/t/rpl_drop_db.test b/mysql-test/t/rpl_drop_db.test
--- a/mysql-test/t/rpl_drop_db.test	2006-11-15 10:23:23 +01:00
+++ b/mysql-test/t/rpl_drop_db.test	2007-12-04 12:18:56 +01:00
@@ -57,6 +57,6 @@ drop database mysqltest1;
 
 connection master;
 # Remove the "extra" file created above
---remove_file $MYSQLTEST_VARDIR/master-data/mysqltest1/f1.txt
+--remove_file $MYSQLTEST_VARDIR/mysqld.1/data/mysqltest1/f1.txt
 drop database mysqltest1;
 
diff -Nrup a/mysql-test/t/rpl_flush_log_loop-master.opt
b/mysql-test/t/rpl_flush_log_loop-master.opt
--- a/mysql-test/t/rpl_flush_log_loop-master.opt	2006-01-24 08:30:48 +01:00
+++ b/mysql-test/t/rpl_flush_log_loop-master.opt	2007-12-04 12:18:56 +01:00
@@ -1 +1 @@
--O max_binlog_size=1M  --relay-log=$MYSQLTEST_VARDIR/master-data/relay-log
+-O max_binlog_size=1M  --relay-log=$MYSQLTEST_VARDIR/mysqld.1/data/relay-log
diff -Nrup a/mysql-test/t/rpl_flush_log_loop-master.sh
b/mysql-test/t/rpl_flush_log_loop-master.sh
--- a/mysql-test/t/rpl_flush_log_loop-master.sh	2006-01-24 08:30:48 +01:00
+++ b/mysql-test/t/rpl_flush_log_loop-master.sh	2007-12-04 12:18:56 +01:00
@@ -1,5 +1,5 @@
-rm -f $MYSQLTEST_VARDIR/slave-data/*-bin.*
-rm -f $MYSQLTEST_VARDIR/slave-data/master.info
-rm -f $MYSQLTEST_VARDIR/slave-data/*.index
+rm -f $MYSQLTEST_VARDIR/mysqld.2/*-bin.*
+rm -f $MYSQLTEST_VARDIR/mysqld.2/master.info
+rm -f $MYSQLTEST_VARDIR/mysqld.2/*.index
 
 
diff -Nrup a/mysql-test/t/rpl_flush_log_loop-slave.opt
b/mysql-test/t/rpl_flush_log_loop-slave.opt
--- a/mysql-test/t/rpl_flush_log_loop-slave.opt	2006-01-24 08:30:48 +01:00
+++ b/mysql-test/t/rpl_flush_log_loop-slave.opt	2007-12-04 12:18:56 +01:00
@@ -1 +1 @@
--O max_binlog_size=1M --relay-log=$MYSQLTEST_VARDIR/slave-data/relay-log
+-O max_binlog_size=1M --relay-log=$MYSQLTEST_VARDIR/mysqld.2/relay-log
diff -Nrup a/mysql-test/t/rpl_flush_log_loop-slave.sh
b/mysql-test/t/rpl_flush_log_loop-slave.sh
--- a/mysql-test/t/rpl_flush_log_loop-slave.sh	2006-01-24 08:30:48 +01:00
+++ b/mysql-test/t/rpl_flush_log_loop-slave.sh	2007-12-04 12:18:56 +01:00
@@ -1,4 +1,4 @@
-rm -f $MYSQLTEST_VARDIR/master-data/master.info
-rm -f $MYSQLTEST_VARDIR/master-data/*-bin.*
-rm -f $MYSQLTEST_VARDIR/master-data/*.index
+rm -f $MYSQLTEST_VARDIR/mysqld.1/data/master.info
+rm -f $MYSQLTEST_VARDIR/mysqld.1/data/*-bin.*
+rm -f $MYSQLTEST_VARDIR/mysqld.1/data/*.index
 
diff -Nrup a/mysql-test/t/rpl_innodb.test b/mysql-test/t/rpl_innodb.test
--- a/mysql-test/t/rpl_innodb.test	2006-01-24 08:30:48 +01:00
+++ b/mysql-test/t/rpl_innodb.test	2007-12-04 12:18:56 +01:00
@@ -18,7 +18,7 @@ CREATE TABLE t4 (
 
 --disable_warnings
 LOAD DATA
-     INFILE '../std_data_ln/loaddata_pair.dat'  
+     INFILE '../../std_data/loaddata_pair.dat'  
      REPLACE INTO TABLE t4 
      (name,number);
 --enable_warnings
@@ -30,7 +30,7 @@ SELECT * FROM t4;
 connection master;
 --disable_warnings
 LOAD DATA
-     INFILE '../std_data_ln/loaddata_pair.dat'  
+     INFILE '../../std_data/loaddata_pair.dat'  
      REPLACE INTO TABLE t4
      (name,number);
 --enable_warnings
diff -Nrup a/mysql-test/t/rpl_loaddata.test b/mysql-test/t/rpl_loaddata.test
--- a/mysql-test/t/rpl_loaddata.test	2007-06-01 16:04:23 +02:00
+++ b/mysql-test/t/rpl_loaddata.test	2007-12-04 12:18:56 +01:00
@@ -19,10 +19,10 @@ reset master;
 connection master;
 
 create table t1(a int not null auto_increment, b int, primary key(a) );
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t1;
+load data infile '../../std_data/rpl_loaddata.dat' into table t1;
 
 create temporary table t2 (day date,id int(9),category enum('a','b','c'),name
varchar(60));
-load data infile '../std_data_ln/rpl_loaddata2.dat' into table t2 fields terminated by
',' optionally enclosed by '%' escaped by '@' lines terminated by '\n##\n' starting by
'>' ignore 1 lines;
+load data infile '../../std_data/rpl_loaddata2.dat' into table t2 fields terminated by
',' optionally enclosed by '%' escaped by '@' lines terminated by '\n##\n' starting by
'>' ignore 1 lines;
 
 create table t3 (day date,id int(9),category enum('a','b','c'),name varchar(60));
 insert into t3 select * from t2;
@@ -57,7 +57,7 @@ sync_with_master;
 insert into t1 values(1,10);
 
 connection master;
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t1;
+load data infile '../../std_data/rpl_loaddata.dat' into table t1;
 
 save_master_pos;
 connection slave;
@@ -81,7 +81,7 @@ connection master;
 set sql_log_bin=0;
 delete from t1;
 set sql_log_bin=1;
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t1;
+load data infile '../../std_data/rpl_loaddata.dat' into table t1;
 save_master_pos;
 connection slave;
 # The SQL slave thread should be stopped now. 
@@ -106,7 +106,7 @@ connection master;
 set sql_log_bin=0;
 delete from t1;
 set sql_log_bin=1;
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t1;
+load data infile '../../std_data/rpl_loaddata.dat' into table t1;
 save_master_pos;
 connection slave;
 # The SQL slave thread should be stopped now.
@@ -126,7 +126,7 @@ reset master;
 create table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60),
 unique(day)) engine=MyISAM; # no transactions
 --error 1062
-load data infile '../std_data_ln/rpl_loaddata2.dat' into table t2 fields
+load data infile '../../std_data/rpl_loaddata2.dat' into table t2 fields
 terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by
 '\n##\n' starting by '>' ignore 1 lines;
 select * from t2;
@@ -142,7 +142,7 @@ alter table t2 drop key day;
 connection master;
 delete from t2;
 --error 1062
-load data infile '../std_data_ln/rpl_loaddata2.dat' into table t2 fields
+load data infile '../../std_data/rpl_loaddata2.dat' into table t2 fields
 terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by
 '\n##\n' starting by '>' ignore 1 lines;
 connection slave;
@@ -156,7 +156,7 @@ drop table t1;
 CREATE TABLE t1 (word CHAR(20) NOT NULL PRIMARY KEY) ENGINE=INNODB;
 
 --error 1062
-LOAD DATA INFILE "../std_data_ln/words.dat" INTO TABLE t1;
+LOAD DATA INFILE "../../std_data/words.dat" INTO TABLE t1;
 
 DROP TABLE t1;
 
diff -Nrup a/mysql-test/t/rpl_loaddata_charset.test
b/mysql-test/t/rpl_loaddata_charset.test
--- a/mysql-test/t/rpl_loaddata_charset.test	2007-03-01 08:50:13 +01:00
+++ b/mysql-test/t/rpl_loaddata_charset.test	2007-12-04 12:18:56 +01:00
@@ -9,17 +9,17 @@ source include/master-slave.inc;
 #
 connection master;
 create table t1 (a varchar(10) character set utf8);
-load data infile '../std_data_ln/loaddata6.dat' into table t1;
+load data infile '../../std_data/loaddata6.dat' into table t1;
 set @@character_set_database=koi8r;
-load data infile '../std_data_ln/loaddata6.dat' into table t1;
+load data infile '../../std_data/loaddata6.dat' into table t1;
 set @@character_set_database=DEFAULT;
-load data infile '../std_data_ln/loaddata6.dat' into table t1;
-load data infile '../std_data_ln/loaddata6.dat' into table t1;
-load data infile '../std_data_ln/loaddata6.dat' into table t1;
+load data infile '../../std_data/loaddata6.dat' into table t1;
+load data infile '../../std_data/loaddata6.dat' into table t1;
+load data infile '../../std_data/loaddata6.dat' into table t1;
 set @@character_set_database=koi8r;
-load data infile '../std_data_ln/loaddata6.dat' into table t1;
+load data infile '../../std_data/loaddata6.dat' into table t1;
 set @@character_set_database=DEFAULT;
-load data infile '../std_data_ln/loaddata6.dat' into table t1 character set koi8r;
+load data infile '../../std_data/loaddata6.dat' into table t1 character set koi8r;
 
 select hex(a) from t1;
 
diff -Nrup a/mysql-test/t/rpl_loaddata_rule_m.test b/mysql-test/t/rpl_loaddata_rule_m.test
--- a/mysql-test/t/rpl_loaddata_rule_m.test	2006-01-27 10:47:56 +01:00
+++ b/mysql-test/t/rpl_loaddata_rule_m.test	2007-12-04 12:18:56 +01:00
@@ -18,7 +18,7 @@ connection master;
 create database mysqltest;
 create table t1(a int, b int, unique(b));
 use mysqltest;
-load data infile '../std_data_ln/rpl_loaddata.dat' into table test.t1;
+load data infile '../../std_data/rpl_loaddata.dat' into table test.t1;
 # Starting from 5.0.3 LOAD DATA is replicated much in the same way as ordinary
 # query so "show binlog ..." should show two events (before 5.0.3 no events
 # were returned).
diff -Nrup a/mysql-test/t/rpl_loaddata_rule_s.test b/mysql-test/t/rpl_loaddata_rule_s.test
--- a/mysql-test/t/rpl_loaddata_rule_s.test	2006-01-27 10:47:56 +01:00
+++ b/mysql-test/t/rpl_loaddata_rule_s.test	2007-12-04 12:18:56 +01:00
@@ -9,7 +9,7 @@ reset master;
 connection master;
 # 'test' is the current database
 create table t1(a int, b int, unique(b));
-load data infile '../std_data_ln/rpl_loaddata.dat' into table test.t1;
+load data infile '../../std_data/rpl_loaddata.dat' into table test.t1;
 
 # Test logging on slave;
 
diff -Nrup a/mysql-test/t/rpl_loaddatalocal.test b/mysql-test/t/rpl_loaddatalocal.test
--- a/mysql-test/t/rpl_loaddatalocal.test	2006-10-05 18:45:37 +02:00
+++ b/mysql-test/t/rpl_loaddatalocal.test	2007-12-04 12:18:56 +01:00
@@ -20,12 +20,12 @@ while ($1)
 set SQL_LOG_BIN=1;
 enable_query_log;
 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-eval select * into outfile
'$MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile' from t1;
+eval select * into outfile
'$MYSQLTEST_VARDIR/mysqld.1/data/rpl_loaddatalocal.select_outfile' from t1;
 #This will generate a 20KB file, now test LOAD DATA LOCAL
 truncate table t1;
 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-eval load data local infile
'$MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile' into table t1;
-system rm $MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile ;
+eval load data local infile
'$MYSQLTEST_VARDIR/mysqld.1/data/rpl_loaddatalocal.select_outfile' into table t1;
+system rm $MYSQLTEST_VARDIR/mysqld.1/data/rpl_loaddatalocal.select_outfile ;
 save_master_pos;
 connection slave;
 sync_with_master;
@@ -47,12 +47,12 @@ connection master;
 create table t1(a int);
 insert into t1 values (1), (2), (2), (3);
 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-eval select * into outfile
'$MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile' from t1;
+eval select * into outfile
'$MYSQLTEST_VARDIR/mysqld.1/data/rpl_loaddatalocal.select_outfile' from t1;
 drop table t1;
 create table t1(a int primary key);
 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-eval load data local infile
'$MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile' into table t1;
-system rm $MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile ;
+eval load data local infile
'$MYSQLTEST_VARDIR/mysqld.1/data/rpl_loaddatalocal.select_outfile' into table t1;
+system rm $MYSQLTEST_VARDIR/mysqld.1/data/rpl_loaddatalocal.select_outfile ;
 select * from t1;
 save_master_pos;
 connection slave;
diff -Nrup a/mysql-test/t/rpl_log.test b/mysql-test/t/rpl_log.test
--- a/mysql-test/t/rpl_log.test	2006-10-19 11:34:32 +02:00
+++ b/mysql-test/t/rpl_log.test	2007-12-04 12:18:56 +01:00
@@ -33,7 +33,7 @@ create table t1(n int not null auto_incr
 insert into t1 values (NULL);
 drop table t1;
 create table t1 (word char(20) not null);
-load data infile '../std_data_ln/words.dat' into table t1 ignore 1 lines;
+load data infile '../../std_data/words.dat' into table t1 ignore 1 lines;
 select count(*) from t1;
 drop table t1;
 --replace_result $VERSION VERSION
diff -Nrup a/mysql-test/t/rpl_misc_functions-slave.sh
b/mysql-test/t/rpl_misc_functions-slave.sh
--- a/mysql-test/t/rpl_misc_functions-slave.sh	2006-01-24 08:30:49 +01:00
+++ b/mysql-test/t/rpl_misc_functions-slave.sh	2007-12-04 12:18:56 +01:00
@@ -1 +1 @@
-rm -f $MYSQLTEST_VARDIR/master-data/test/rpl_misc_functions.outfile
+rm -f $MYSQLTEST_VARDIR/mysqld.1/data/test/rpl_misc_functions.outfile
diff -Nrup a/mysql-test/t/rpl_misc_functions.test b/mysql-test/t/rpl_misc_functions.test
--- a/mysql-test/t/rpl_misc_functions.test	2007-07-09 21:18:11 +02:00
+++ b/mysql-test/t/rpl_misc_functions.test	2007-12-04 12:18:56 +01:00
@@ -25,7 +25,7 @@ sync_slave_with_master;
 create table t2 like t1; 
 # read the values from the master table
 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-eval load data local infile
'$MYSQLTEST_VARDIR/master-data/test/rpl_misc_functions.outfile' into table t2;
+eval load data local infile
'$MYSQLTEST_VARDIR/mysqld.1/data/test/rpl_misc_functions.outfile' into table t2;
 # compare them with the replica; the SELECT below should return no row
 select * from t1, t2 where (t1.id=t2.id) and not(t1.i=t2.i and t1.r1=t2.r1 and
t1.r2=t2.r2 and t1.p=t2.p);
 
diff -Nrup a/mysql-test/t/rpl_ndb_innodb_trans.test
b/mysql-test/t/rpl_ndb_innodb_trans.test
--- a/mysql-test/t/rpl_ndb_innodb_trans.test	2006-09-05 16:52:03 +02:00
+++ b/mysql-test/t/rpl_ndb_innodb_trans.test	2007-12-04 12:18:56 +01:00
@@ -21,8 +21,8 @@ select count(*) from t2;
 connection master;
 
 begin;
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t2;
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t1;
+load data infile '../../std_data/rpl_loaddata.dat' into table t2;
+load data infile '../../std_data/rpl_loaddata.dat' into table t1;
 rollback;
 
 select count(*) from t1;
@@ -35,8 +35,8 @@ connection master;
 delete from t1;
 delete from t2;
 begin;
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t2;
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t1;
+load data infile '../../std_data/rpl_loaddata.dat' into table t2;
+load data infile '../../std_data/rpl_loaddata.dat' into table t1;
 rollback;
 
 select count(*) from t1;
@@ -51,8 +51,8 @@ delete from t2;
 begin;
 insert into t2 values(3),(4);
 insert into t1 values(3),(4);
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t2;
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t1;
+load data infile '../../std_data/rpl_loaddata.dat' into table t2;
+load data infile '../../std_data/rpl_loaddata.dat' into table t1;
 rollback;
 
 select count(*) from t1;
diff -Nrup a/mysql-test/t/rpl_replicate_do.test b/mysql-test/t/rpl_replicate_do.test
--- a/mysql-test/t/rpl_replicate_do.test	2007-02-26 12:25:40 +01:00
+++ b/mysql-test/t/rpl_replicate_do.test	2007-12-04 12:18:56 +01:00
@@ -12,7 +12,7 @@ create table t2 (n int);
 insert into t2 values(4);
 connection master;
 create table t2 (s char(20));
-load data infile '../std_data_ln/words.dat' into table t2;
+load data infile '../../std_data/words.dat' into table t2;
 insert into t2 values('five');
 create table t1 (m int);
 insert into t1 values(15),(16),(17);
diff -Nrup a/mysql-test/t/rpl_rewrite_db.test b/mysql-test/t/rpl_rewrite_db.test
--- a/mysql-test/t/rpl_rewrite_db.test	2006-05-12 18:40:34 +02:00
+++ b/mysql-test/t/rpl_rewrite_db.test	2007-12-04 12:18:56 +01:00
@@ -31,8 +31,8 @@ create database rewrite;
 connection master;
 use test;
 create table t1 (a date, b date, c date not null, d date);
-load data infile '../std_data_ln/loaddata1.dat' into table t1 fields terminated by ',';
-load data infile '../std_data_ln/loaddata1.dat' into table t1 fields terminated by ','
IGNORE 2 LINES;
+load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',';
+load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ','
IGNORE 2 LINES;
 sync_slave_with_master;
 
 connection slave;
@@ -40,7 +40,7 @@ select * from rewrite.t1;
 
 connection master;
 truncate table t1;
-load data infile '../std_data_ln/loaddata1.dat' into table t1 fields terminated by ','
LINES STARTING BY ',' (b,c,d);
+load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ','
LINES STARTING BY ',' (b,c,d);
 sync_slave_with_master;
 
 connection slave;
@@ -49,7 +49,7 @@ select * from rewrite.t1;
 connection master;
 drop table t1;
 create table t1 (a text, b text);
-load data infile '../std_data_ln/loaddata2.dat' into table t1 fields terminated by ','
enclosed by '''';
+load data infile '../../std_data/loaddata2.dat' into table t1 fields terminated by ','
enclosed by '''';
 sync_slave_with_master;
 
 connection slave;
@@ -58,7 +58,7 @@ select concat('|',a,'|'), concat('|',b,'
 connection master;
 drop table t1;
 create table t1 (a int, b char(10));
-load data infile '../std_data_ln/loaddata3.dat' into table t1 fields terminated by ''
enclosed by '' ignore 1 lines;
+load data infile '../../std_data/loaddata3.dat' into table t1 fields terminated by ''
enclosed by '' ignore 1 lines;
 sync_slave_with_master;
 
 connection slave;
@@ -66,7 +66,7 @@ select * from rewrite.t1;
 
 connection master;
 truncate table t1;
-load data infile '../std_data_ln/loaddata4.dat' into table t1 fields terminated by ''
enclosed by '' lines terminated by '' ignore 1 lines;
+load data infile '../../std_data/loaddata4.dat' into table t1 fields terminated by ''
enclosed by '' lines terminated by '' ignore 1 lines;
 sync_slave_with_master;
 
 connection slave;
diff -Nrup a/mysql-test/t/rpl_rotate_logs-slave.sh b/mysql-test/t/rpl_rotate_logs-slave.sh
--- a/mysql-test/t/rpl_rotate_logs-slave.sh	2006-01-24 08:30:49 +01:00
+++ /dev/null	Wed Dec 31 16:00:00 196900
@@ -1,2 +0,0 @@
-rm -f $MYSQLTEST_VARDIR/slave-data/master.info
-rm -f $MYSQLTEST_VARDIR/slave-data/*relay*
diff -Nrup a/mysql-test/t/rpl_rotate_logs.test b/mysql-test/t/rpl_rotate_logs.test
--- a/mysql-test/t/rpl_rotate_logs.test	2007-07-05 10:09:54 +02:00
+++ b/mysql-test/t/rpl_rotate_logs.test	2007-12-04 12:18:56 +01:00
@@ -20,9 +20,9 @@ drop table if exists t1, t2, t3, t4;
 --enable_warnings
 connect (slave,localhost,root,,test,$SLAVE_MYPORT,$SLAVE_MYSOCK);
 # Create empty file
-write_file $MYSQLTEST_VARDIR/slave-data/master.info;
+write_file $MYSQLTEST_VARDIR/mysqld.2/master.info;
 EOF
-chmod 0000 $MYSQLTEST_VARDIR/slave-data/master.info;
+chmod 0000 $MYSQLTEST_VARDIR/mysqld.2/master.info;
 connection slave;
 --disable_warnings
 drop table if exists t1, t2, t3, t4;
@@ -33,7 +33,7 @@ drop table if exists t1, t2, t3, t4;
 --replace_result $MYSQL_TEST_DIR TESTDIR
 --error 1105,1105,29
 start slave;
-chmod 0600  $MYSQLTEST_VARDIR/slave-data/master.info;
+chmod 0600  $MYSQLTEST_VARDIR/mysqld.2/master.info;
 # It will fail again because the file is empty so the slave cannot get valuable
 # info about how to connect to the master from it (failure in
 # init_strvar_from_file() in init_master_info()).
diff -Nrup a/mysql-test/t/rpl_timezone.test b/mysql-test/t/rpl_timezone.test
--- a/mysql-test/t/rpl_timezone.test	2007-08-06 13:57:26 +02:00
+++ b/mysql-test/t/rpl_timezone.test	2007-12-04 12:18:56 +01:00
@@ -50,14 +50,14 @@ set time_zone='Europe/Moscow';
 select * from t1;
 connection master;
 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000001 
+--exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/mysqld.1/data/master-bin.000001 
 
 # Let us check with LOAD DATA INFILE
 # (we do it after mysqlbinlog because the temp files names are not constant)
 connection master;
 delete from t1;
 set time_zone='UTC';
-load data infile '../std_data_ln/rpl_timezone.dat' into table t1;
+load data infile '../../std_data/rpl_timezone.dat' into table t1;
 select * from t1;
 sync_slave_with_master;
 set time_zone='UTC';
diff -Nrup a/mysql-test/t/rpl_trigger.test b/mysql-test/t/rpl_trigger.test
--- a/mysql-test/t/rpl_trigger.test	2006-11-13 23:38:34 +01:00
+++ b/mysql-test/t/rpl_trigger.test	2007-12-04 12:18:56 +01:00
@@ -289,7 +289,7 @@ STOP SLAVE;
 
 connection master;
 FLUSH LOGS;
-exec cp $MYSQL_TEST_DIR/std_data/bug16266.000001 $MYSQLTEST_VARDIR/log/master-bin.000001;
+exec cp $MYSQL_TEST_DIR/std_data/bug16266.000001
$MYSQLTEST_VARDIR/mysqld.1/data/master-bin.000001;
 
 # Make the slave to replay the new binlog.
 
diff -Nrup a/mysql-test/t/show_check.test b/mysql-test/t/show_check.test
--- a/mysql-test/t/show_check.test	2007-08-02 15:23:14 +02:00
+++ b/mysql-test/t/show_check.test	2007-12-04 12:18:56 +01:00
@@ -427,7 +427,7 @@ DROP TABLE t1;
 flush tables;
 
 # Create a junk frm file on disk
-system echo "this is a junk file for test" >>
$MYSQLTEST_VARDIR/master-data/test/t1.frm ;
+system echo "this is a junk file for test" >>
$MYSQLTEST_VARDIR/mysqld.1/data/test/t1.frm ;
 --replace_column 6 # 7 # 8 # 9 #
 SHOW TABLE STATUS like 't1';
 --error 1033
diff -Nrup a/mysql-test/t/sp-destruct.test b/mysql-test/t/sp-destruct.test
--- a/mysql-test/t/sp-destruct.test	2007-08-07 11:40:02 +02:00
+++ b/mysql-test/t/sp-destruct.test	2007-12-04 12:18:56 +01:00
@@ -8,9 +8,9 @@
 #
 
 # Backup proc table
---copy_file $MYSQLTEST_VARDIR/master-data/mysql/proc.frm $MYSQLTEST_VARDIR/tmp/proc.frm
---copy_file $MYSQLTEST_VARDIR/master-data/mysql/proc.MYD $MYSQLTEST_VARDIR/tmp/proc.MYD
---copy_file $MYSQLTEST_VARDIR/master-data/mysql/proc.MYI $MYSQLTEST_VARDIR/tmp/proc.MYI
+--copy_file $MYSQLTEST_VARDIR/mysqld.1/data/mysql/proc.frm $MYSQLTEST_VARDIR/tmp/proc.frm
+--copy_file $MYSQLTEST_VARDIR/mysqld.1/data/mysql/proc.MYD $MYSQLTEST_VARDIR/tmp/proc.MYD
+--copy_file $MYSQLTEST_VARDIR/mysqld.1/data/mysql/proc.MYI $MYSQLTEST_VARDIR/tmp/proc.MYI
 
 use test;
 
@@ -42,26 +42,26 @@ insert into t1 values (0);
 flush table mysql.proc;
 
 # Thrashing the .frm file
---remove_file $MYSQLTEST_VARDIR/master-data/mysql/proc.frm
---write_file $MYSQLTEST_VARDIR/master-data/mysql/proc.frm
+--remove_file $MYSQLTEST_VARDIR/mysqld.1/data/mysql/proc.frm
+--write_file $MYSQLTEST_VARDIR/mysqld.1/data/mysql/proc.frm
 saljdfa
 EOF
---replace_result $MYSQLTEST_VARDIR . master-data// '' '\\' '/'
+--replace_result $MYSQLTEST_VARDIR . mysqld.1// '' '\\' '/'
 --error ER_NOT_FORM_FILE
 call bug14233();
---replace_result $MYSQLTEST_VARDIR . master-data// '' '\\' '/'
+--replace_result $MYSQLTEST_VARDIR . mysqld.1// '' '\\' '/'
 --error ER_NOT_FORM_FILE
 create view v1 as select bug14233_f();
---replace_result $MYSQLTEST_VARDIR . master-data// '' '\\' '/'
+--replace_result $MYSQLTEST_VARDIR . mysqld.1// '' '\\' '/'
 --error ER_NOT_FORM_FILE
 insert into t1 values (0);
 
 flush table mysql.proc;
 
 # Drop the mysql.proc table
---remove_file $MYSQLTEST_VARDIR/master-data/mysql/proc.frm
---remove_file $MYSQLTEST_VARDIR/master-data/mysql/proc.MYD
---remove_file $MYSQLTEST_VARDIR/master-data/mysql/proc.MYI
+--remove_file $MYSQLTEST_VARDIR/mysqld.1/data/mysql/proc.frm
+--remove_file $MYSQLTEST_VARDIR/mysqld.1/data/mysql/proc.MYD
+--remove_file $MYSQLTEST_VARDIR/mysqld.1/data/mysql/proc.MYI
 --error ER_NO_SUCH_TABLE
 call bug14233();
 --error ER_NO_SUCH_TABLE
@@ -70,9 +70,9 @@ create view v1 as select bug14233_f();
 insert into t1 values (0);
 
 # Restore mysql.proc
---copy_file $MYSQLTEST_VARDIR/tmp/proc.frm $MYSQLTEST_VARDIR/master-data/mysql/proc.frm
---copy_file $MYSQLTEST_VARDIR/tmp/proc.MYD $MYSQLTEST_VARDIR/master-data/mysql/proc.MYD
---copy_file $MYSQLTEST_VARDIR/tmp/proc.MYI $MYSQLTEST_VARDIR/master-data/mysql/proc.MYI 
+--copy_file $MYSQLTEST_VARDIR/tmp/proc.frm $MYSQLTEST_VARDIR/mysqld.1/data/mysql/proc.frm
+--copy_file $MYSQLTEST_VARDIR/tmp/proc.MYD $MYSQLTEST_VARDIR/mysqld.1/data/mysql/proc.MYD
+--copy_file $MYSQLTEST_VARDIR/tmp/proc.MYI $MYSQLTEST_VARDIR/mysqld.1/data/mysql/proc.MYI

 --remove_file $MYSQLTEST_VARDIR/tmp/proc.frm
 --remove_file $MYSQLTEST_VARDIR/tmp/proc.MYD
 --remove_file $MYSQLTEST_VARDIR/tmp/proc.MYI
diff -Nrup a/mysql-test/t/sp.test b/mysql-test/t/sp.test
--- a/mysql-test/t/sp.test	2007-10-16 19:16:23 +02:00
+++ b/mysql-test/t/sp.test	2007-12-04 12:18:56 +01:00
@@ -5241,9 +5241,9 @@ drop procedure if exists bug13012|
 create procedure bug13012()
 BEGIN
   REPAIR TABLE t1;
-  BACKUP TABLE t1 to '../tmp';
+  BACKUP TABLE t1 to '../../tmp';
   DROP TABLE t1;
-  RESTORE TABLE t1 FROM '../tmp';
+  RESTORE TABLE t1 FROM '../../tmp';
 END|
 call bug13012()|
 drop procedure bug13012|
diff -Nrup a/mysql-test/t/symlink.test b/mysql-test/t/symlink.test
--- a/mysql-test/t/symlink.test	2007-07-13 15:32:27 +02:00
+++ b/mysql-test/t/symlink.test	2007-12-04 12:18:56 +01:00
@@ -129,12 +129,12 @@ drop table t1;
 # have been chosen. (Bug #8707)
 #
 disable_query_log;
-eval create table t1 (i int) data directory = "$MYSQLTEST_VARDIR/master-data/test/";
+eval create table t1 (i int) data directory = "$MYSQLTEST_VARDIR/mysqld.1/data/test/";
 enable_query_log;
 show create table t1;
 drop table t1;
 disable_query_log;
-eval create table t1 (i int) index directory = "$MYSQLTEST_VARDIR/master-data/test/";
+eval create table t1 (i int) index directory = "$MYSQLTEST_VARDIR/mysqld.1/data/test/";
 enable_query_log;
 show create table t1;
 drop table t1;
@@ -188,7 +188,7 @@ CREATE DATABASE db2;
 USE db2;
 --disable_query_log
 eval CREATE TABLE t1 (b INT) ENGINE MYISAM
-DATA DIRECTORY = '$MYSQLTEST_VARDIR/master-data/db1/';
+DATA DIRECTORY = '$MYSQLTEST_VARDIR/mysqld.1/data/db1/';
 --enable_query_log
 
 INSERT INTO db2.t1 VALUES (1);
diff -Nrup a/mysql-test/t/trigger-compat.test b/mysql-test/t/trigger-compat.test
--- a/mysql-test/t/trigger-compat.test	2006-01-27 10:47:56 +01:00
+++ b/mysql-test/t/trigger-compat.test	2007-12-04 12:18:56 +01:00
@@ -61,8 +61,8 @@ CREATE TRIGGER wl2818_trg1 BEFORE INSERT
 --echo
 --echo ---> patching t1.TRG...
 
---exec grep -v 'definers=' $MYSQLTEST_VARDIR/master-data/mysqltest_db1/t1.TRG >
$MYSQLTEST_VARDIR/tmp/t1.TRG
---exec mv $MYSQLTEST_VARDIR/tmp/t1.TRG $MYSQLTEST_VARDIR/master-data/mysqltest_db1/t1.TRG
+--exec grep -v 'definers=' $MYSQLTEST_VARDIR/mysqld.1/data/mysqltest_db1/t1.TRG >
$MYSQLTEST_VARDIR/tmp/t1.TRG
+--exec mv $MYSQLTEST_VARDIR/tmp/t1.TRG
$MYSQLTEST_VARDIR/mysqld.1/data/mysqltest_db1/t1.TRG
 
 #
 # Create a new trigger.
diff -Nrup a/mysql-test/t/trigger-grant.test b/mysql-test/t/trigger-grant.test
--- a/mysql-test/t/trigger-grant.test	2007-02-26 09:24:02 +01:00
+++ b/mysql-test/t/trigger-grant.test	2007-12-04 12:18:56 +01:00
@@ -236,7 +236,7 @@ CREATE TRIGGER trg5 BEFORE DELETE ON t1
 perl;
 use strict;
 use warnings;
-my $fname= "$ENV{'MYSQLTEST_VARDIR'}/master-data/mysqltest_db1/t1.TRG";
+my $fname= "$ENV{'MYSQLTEST_VARDIR'}/mysqld.1/data/mysqltest_db1/t1.TRG";
 open(FILE, "<", $fname) or die;
 my @content= grep($_ !~ /^definers=/, <FILE>);
 close FILE;
diff -Nrup a/mysql-test/t/trigger.test b/mysql-test/t/trigger.test
--- a/mysql-test/t/trigger.test	2007-07-18 12:42:03 +02:00
+++ b/mysql-test/t/trigger.test	2007-12-04 12:18:56 +01:00
@@ -472,11 +472,11 @@ create trigger trg1 before insert on t1 
 create trigger trg2 after insert on t1 for each row set @b:= "Fired"; 
 set @b:="";
 # Test triggers with file with separators
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t1 (@a, i);
+load data infile '../../std_data/rpl_loaddata.dat' into table t1 (@a, i);
 select *, @b from t1;
 set @b:="";
 # Test triggers with fixed size row file
-load data infile '../std_data_ln/loaddata5.dat' into table t1 fields terminated by ''
enclosed by '' (i, j);
+load data infile '../../std_data/loaddata5.dat' into table t1 fields terminated by ''
enclosed by '' (i, j);
 select *, @b from t1;
 # This also will drop triggers
 drop table t1;
@@ -510,7 +510,7 @@ delete from t1 where i = 2;
 select * from t1;
 # Should fail and insert only 1 row
 --error ER_BAD_FIELD_ERROR
-load data infile '../std_data_ln/loaddata5.dat' into table t1 fields terminated by ''
enclosed by '' (i, k);
+load data infile '../../std_data/loaddata5.dat' into table t1 fields terminated by ''
enclosed by '' (i, k);
 select * from t1;
 --error ER_BAD_FIELD_ERROR
 insert into t1 select 3, 3;
@@ -567,7 +567,7 @@ select * from t1;
 delete from t1;
 select * from t1;
 --error ER_BAD_FIELD_ERROR
-load data infile '../std_data_ln/loaddata5.dat' into table t1 fields terminated by ''
enclosed by '' (i, k);
+load data infile '../../std_data/loaddata5.dat' into table t1 fields terminated by ''
enclosed by '' (i, k);
 select * from t1;
 --error ER_BAD_FIELD_ERROR
 insert into t1 select 3, 3;
@@ -1142,11 +1142,11 @@ select trigger_schema, trigger_name, eve
        event_object_table, action_statement from information_schema.triggers
        where event_object_schema = 'test';
 # Trick which makes update of second .TRN file impossible
-write_file $MYSQLTEST_VARDIR/master-data/test/t1_ai.TRN~;
+write_file $MYSQLTEST_VARDIR/mysqld.1/data/test/t1_ai.TRN~;
 dummy
 EOF
-chmod 0000 $MYSQLTEST_VARDIR/master-data/test/t1_ai.TRN~;
---replace_result $MYSQLTEST_VARDIR . master-data/ ''
+chmod 0000 $MYSQLTEST_VARDIR/mysqld.1/data/test/t1_ai.TRN~;
+--replace_result $MYSQLTEST_VARDIR . mysqld.1/ ''
 --error 1
 rename table t1 to t2;
 # 't1' should be still there and triggers should work correctly
@@ -1155,8 +1155,8 @@ select @a, @b;
 select trigger_schema, trigger_name, event_object_schema,
        event_object_table, action_statement from information_schema.triggers
        where event_object_schema = 'test';
-chmod 0600 $MYSQLTEST_VARDIR/master-data/test/t1_ai.TRN~;
-remove_file $MYSQLTEST_VARDIR/master-data/test/t1_ai.TRN~;
+chmod 0600 $MYSQLTEST_VARDIR/mysqld.1/data/test/t1_ai.TRN~;
+remove_file $MYSQLTEST_VARDIR/mysqld.1/data/test/t1_ai.TRN~;
 # Let us check that updates to .TRN files were rolled back too
 drop trigger t1_bi;
 drop trigger t1_ai;
@@ -1189,7 +1189,7 @@ insert into t1 (a) values
 create trigger t2_ai after insert on t2 for each row
   set @a:= (select max(a) from t2);
 insert into t2 select * from t1;
-load data infile '../std_data_ln/words.dat' into table t1 (a);
+load data infile '../../std_data/words.dat' into table t1 (a);
 drop trigger t1_ai;
 drop trigger t2_ai;
 # Test that the problem for functions is fixed as well
@@ -1199,7 +1199,7 @@ insert into t1 values
   ("And",f1()),("the",f1()),("mome", f1()),("raths",f1()),("outgrabe",f1());
 create function f2() returns int return (select max(b) from t2);
 insert into t2 select a, f2() from t1;
-load data infile '../std_data_ln/words.dat' into table t1 (a) set b:= f1();
+load data infile '../../std_data/words.dat' into table t1 (a) set b:= f1();
 drop table t1, t2;
 drop function f1;
 drop function f2;
diff -Nrup a/mysql-test/t/type_blob.test b/mysql-test/t/type_blob.test
--- a/mysql-test/t/type_blob.test	2007-02-14 14:44:31 +01:00
+++ b/mysql-test/t/type_blob.test	2007-12-04 12:18:56 +01:00
@@ -308,20 +308,20 @@ create table t1 (id integer auto_increme
 insert into t1 (id) values (1);
 # We have to clean up the path in the results for safe comparison
 eval select
-  charset(load_file('../std_data_ln/words.dat')),
-  collation(load_file('../std_data_ln/words.dat')),
-  coercibility(load_file('../std_data_ln/words.dat'));
+  charset(load_file('../../std_data/words.dat')),
+  collation(load_file('../../std_data/words.dat')),
+  coercibility(load_file('../../std_data/words.dat'));
 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
 eval explain extended select
-  charset(load_file('$MYSQLTEST_VARDIR/std_data_ln/words.dat')),
-  collation(load_file('