summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <msvensson@pilot.mysql.com>2007-12-12 18:19:24 +0100
committerunknown <msvensson@pilot.mysql.com>2007-12-12 18:19:24 +0100
commit1370500c0d1dbe051deaedd0fc6815a321b1379b (patch)
treed8f656e22aba024da4a03e6e02e35d33d6f184a8 /mysql-test
parentabd1317033c435e8028a0f4bd4cabd9f58cd17ff (diff)
downloadmariadb-git-1370500c0d1dbe051deaedd0fc6815a321b1379b.tar.gz
WL#4189
- dynamic configuration support - safe process - cleanups - create new suite for fedarated BitKeeper/deleted/.del-basic.test: Rename: mysql-test/ndb/basic.test -> BitKeeper/deleted/.del-basic.test BitKeeper/deleted/.del-basic_log.result: Rename: mysql-test/ndb/basic_log.result -> BitKeeper/deleted/.del-basic_log.result mysql-test/suite/federated/federated_transactions.result: Rename: mysql-test/r/federated_transactions.result -> mysql-test/suite/federated/federated_transactions.result BitKeeper/deleted/.del-have_bug25714.require: Rename: mysql-test/r/have_bug25714.require -> BitKeeper/deleted/.del-have_bug25714.require BitKeeper/deleted/.del-kill_master.sh: Rename: mysql-test/misc/kill_master.sh -> BitKeeper/deleted/.del-kill_master.sh BitKeeper/deleted/.del-ndb_config_4_node.ini~d8e572e9b68f933a: Rename: mysql-test/ndb/ndb_config_4_node.ini -> BitKeeper/deleted/.del-ndb_config_4_node.ini~d8e572e9b68f933a BitKeeper/deleted/.del-restart.result: Rename: mysql-test/ndb/restart.result -> BitKeeper/deleted/.del-restart.result mysql-test/suite/federated/federated_cleanup.inc: Rename: mysql-test/include/federated_cleanup.inc -> mysql-test/suite/federated/federated_cleanup.inc mysql-test/suite/rpl/t/rpl_rotate_logs-slave.opt: Rename: mysql-test/suite/rpl/t/rpl_rotate_logs.slave-mi -> mysql-test/suite/rpl/t/rpl_rotate_logs-slave.opt BitKeeper/deleted/.del-install_test_db.sh: Rename: mysql-test/install_test_db.sh -> BitKeeper/deleted/.del-install_test_db.sh BitKeeper/deleted/.del-ndb_config_1_node.ini~7ec640ed25570e16: Rename: mysql-test/ndb/ndb_config_1_node.ini -> BitKeeper/deleted/.del-ndb_config_1_node.ini~7ec640ed25570e16 BitKeeper/deleted/.del-mtr_timer.pl: Rename: mysql-test/lib/mtr_timer.pl -> BitKeeper/deleted/.del-mtr_timer.pl BitKeeper/deleted/.del-create-test-result: Rename: mysql-test/create-test-result -> BitKeeper/deleted/.del-create-test-result BitKeeper/deleted/.del-fix-result: Rename: mysql-test/fix-result -> BitKeeper/deleted/.del-fix-result BitKeeper/deleted/.del-mysql-test-run-shell.sh: Rename: mysql-test/mysql-test-run-shell.sh -> BitKeeper/deleted/.del-mysql-test-run-shell.sh BitKeeper/deleted/.del-mysql-test_V1.9.pl: Rename: mysql-test/misc/mysql-test_V1.9.pl -> BitKeeper/deleted/.del-mysql-test_V1.9.pl BitKeeper/deleted/.del-resolve-stack: Rename: mysql-test/resolve-stack -> BitKeeper/deleted/.del-resolve-stack BitKeeper/deleted/.del-restart_log.result: Rename: mysql-test/ndb/restart_log.result -> BitKeeper/deleted/.del-restart_log.result mysql-test/suite/rpl/t/rpl_000015-slave.opt: Rename: mysql-test/suite/rpl/t/rpl_000015.slave-mi -> mysql-test/suite/rpl/t/rpl_000015-slave.opt BitKeeper/deleted/.del-ndb_config_2_node.ini: Rename: mysql-test/ndb/ndb_config_2_node.ini -> BitKeeper/deleted/.del-ndb_config_2_node.ini BitKeeper/deleted/.del-ndbcluster.sh: Rename: mysql-test/ndb/ndbcluster.sh -> BitKeeper/deleted/.del-ndbcluster.sh BitKeeper/deleted/.del-basic.result: Rename: mysql-test/ndb/basic.result -> BitKeeper/deleted/.del-basic.result BitKeeper/deleted/.del-restart.test: Rename: mysql-test/ndb/restart.test -> BitKeeper/deleted/.del-restart.test BitKeeper/deleted/.del-have_bug25714.inc: Rename: mysql-test/include/have_bug25714.inc -> BitKeeper/deleted/.del-have_bug25714.inc BitKeeper/deleted/.del-mtr_diff.pl: Rename: mysql-test/lib/mtr_diff.pl -> BitKeeper/deleted/.del-mtr_diff.pl mysql-test/suite/federated/federated_transactions-slave.opt: Rename: mysql-test/t/federated_transactions-slave.opt -> mysql-test/suite/federated/federated_transactions-slave.opt BitKeeper/deleted/.del-Makefile.am~343467da4d0f211b: Rename: mysql-test/ndb/Makefile.am -> BitKeeper/deleted/.del-Makefile.am~343467da4d0f211b BitKeeper/deleted/.del-mtr_im.pl~9762b0336c28949: Rename: mysql-test/lib/mtr_im.pl -> BitKeeper/deleted/.del-mtr_im.pl~9762b0336c28949 mysql-test/suite/federated/federated_innodb-slave.opt: Rename: mysql-test/t/federated_innodb-slave.opt -> mysql-test/suite/federated/federated_innodb-slave.opt client/mysqltest.c: Use current files path first when looking for include file configure.in: Remove mysql-test/nbd mysql-test/Makefile.am: Cleanup mysql-test/Makefile.am mysql-test/extra/binlog_tests/blackhole.test: Use new paths mysql-test/extra/binlog_tests/ctype_ucs_binlog.test: Use new paths mysql-test/mysql-test-run.pl: Dynamic configuration support Safe process mysql-test/extra/binlog_tests/mix_innodb_myisam_side_effects.test: Use new paths mysql-test/extra/rpl_tests/rpl_EE_err.test: Use new paths mysql-test/extra/rpl_tests/rpl_loaddata.test: Use new paths mysql-test/extra/rpl_tests/rpl_log.test: Use new paths mysql-test/extra/rpl_tests/rpl_row_001.test: Use new paths mysql-test/extra/rpl_tests/rpl_row_charset.test: Use new paths mysql-test/extra/rpl_tests/rpl_stm_000001.test: Use new paths mysql-test/extra/rpl_tests/rpl_stm_charset.test: Use new paths mysql-test/include/have_blackhole.inc: Use new paths mysql-test/include/have_ndbapi_examples.inc: Use new paths mysql-test/include/loaddata_autocom.inc: Use new paths mysql-test/include/mix1.inc: Use new paths mysql-test/include/ndb_backup.inc: Use new paths mysql-test/include/ndb_restore_master.inc: Use new paths mysql-test/include/ndb_restore_slave_eoption.inc: Use new paths mysql-test/include/testdb_only.inc: Use new paths mysql-test/lib/My/Config.pm: dynamic configuration safe process cleanups mysql-test/lib/mtr_cases.pm: dynamic configuration safe process cleanups mysql-test/lib/mtr_io.pl: dynamic configuration safe process cleanups mysql-test/lib/mtr_misc.pl: dynamic configuration safe process cleanups mysql-test/lib/mtr_process.pl: dynamic configuration safe process cleanups mysql-test/lib/mtr_report.pl: dynamic configuration safe process cleanups mysql-test/lib/mtr_stress.pl: dynamic configuration safe process cleanups mysql-test/r/backup.result: Use new paths mysql-test/r/ctype_big5.result: Use new paths mysql-test/r/gis.result: Use new paths mysql-test/r/loaddata.result: Use new paths mysql-test/r/loaddata_autocom_innodb.result: Use new paths mysql-test/r/mysqlbinlog.result: Use new paths mysql-test/r/mysqlbinlog_base64.result: Use new paths mysql-test/r/outfile.result: Use new paths mysql-test/r/partition_error.result: Use new paths mysql-test/r/partition_not_windows.result: Use new paths mysql-test/r/partition_symlink.result: Use new paths mysql-test/r/query_cache.result: Use new paths mysql-test/r/sp.result: Use new paths mysql-test/r/symlink.result: Use new paths mysql-test/r/system_mysql_db.result: Use new paths mysql-test/r/trigger.result: Use new paths mysql-test/r/type_blob.result: Use new paths mysql-test/r/view.result: Use new paths mysql-test/r/warnings.result: Use new paths mysql-test/suite/binlog/r/binlog_killed_simulate.result: Use new paths mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result: Use new paths mysql-test/suite/binlog/r/binlog_stm_blackhole.result: Use new paths mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result: Use new paths mysql-test/suite/binlog/t/binlog_killed.test: Use new paths mysql-test/suite/binlog/t/binlog_killed_simulate.test: Use new paths mysql-test/suite/binlog/t/binlog_row_mix_innodb_myisam.test: Use new paths mysql-test/suite/binlog/t/binlog_stm_mix_innodb_myisam.test: Use new paths mysql-test/suite/federated/federated.inc: Use new paths mysql-test/suite/federated/federated.result: Use new paths mysql-test/suite/federated/federated.test: Use new paths mysql-test/suite/federated/federated_archive.result: Use new paths mysql-test/suite/federated/federated_archive.test: Use new paths mysql-test/suite/federated/federated_bug_13118.result: Use new paths mysql-test/suite/federated/federated_bug_13118.test: Use new paths mysql-test/suite/federated/federated_bug_25714.result: Use new paths mysql-test/suite/federated/federated_bug_25714.test: Use new paths mysql-test/suite/federated/federated_innodb.result: Use new paths mysql-test/suite/federated/federated_innodb.test: Use new paths mysql-test/suite/federated/federated_server.result: Use new paths mysql-test/suite/federated/federated_server.test: Use new paths mysql-test/suite/federated/federated_transactions.test: Use new paths mysql-test/suite/federated/have_federated_db.inc: Use new paths mysql-test/suite/ndb/r/loaddata_autocom_ndb.result: Use new paths mysql-test/suite/ndb/r/ndb_config.result: Use new paths mysql-test/suite/ndb/r/ndb_dd_backuprestore.result: Use new paths mysql-test/suite/ndb/r/ndb_load.result: Use new paths mysql-test/suite/ndb/r/ndb_loaddatalocal.result: Use new paths mysql-test/suite/ndb/r/ndb_replace.result: Use new paths mysql-test/suite/ndb/r/ndb_restore.result: Use new paths mysql-test/suite/ndb/r/ndb_restore_partition.result: Use new paths mysql-test/suite/ndb/r/ndb_restore_print.result: Use new paths mysql-test/suite/ndb/r/ndb_trigger.result: Use new paths mysql-test/suite/ndb/t/ndb_alter_table.test: Use new paths mysql-test/suite/ndb/t/ndb_config.test: Use new paths mysql-test/suite/ndb/t/ndb_load.test: Use new paths mysql-test/suite/ndb/t/ndb_loaddatalocal.test: Use new paths mysql-test/suite/ndb/t/ndb_replace.test: Use new paths mysql-test/suite/ndb/t/ndb_restore.test: Use new paths mysql-test/suite/ndb/t/ndb_single_user.test: Use new paths mysql-test/suite/ndb/t/ndb_trigger.test: Use new paths mysql-test/suite/ndb/t/ndbapi.test: Use new paths mysql-test/suite/rpl/include/rpl_mixed_dml.inc: Use new paths mysql-test/suite/rpl/r/rpl_LD_INFILE.result: Use new paths mysql-test/suite/rpl/r/rpl_flushlog_loop.result: Use new paths mysql-test/suite/rpl/r/rpl_innodb.result: Use new paths mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result: Use new paths mysql-test/suite/rpl/r/rpl_load_table_from_master.result: Use new paths mysql-test/suite/rpl/r/rpl_loaddata.result: Use new paths mysql-test/suite/rpl/r/rpl_loaddata_charset.result: Use new paths mysql-test/suite/rpl/r/rpl_loaddata_fatal.result: Use new paths mysql-test/suite/rpl/r/rpl_loaddata_m.result: Use new paths mysql-test/suite/rpl/r/rpl_loaddata_s.result: Use new paths mysql-test/suite/rpl/r/rpl_loaddata_simple.result: Use new paths mysql-test/suite/rpl/r/rpl_loaddatalocal.result: Use new paths mysql-test/suite/rpl/r/rpl_loadfile.result: Use new paths mysql-test/suite/rpl/r/rpl_misc_functions.result: Use new paths mysql-test/suite/rpl/r/rpl_replicate_do.result: Use new paths mysql-test/suite/rpl/r/rpl_rewrt_db.result: Use new paths mysql-test/suite/rpl/r/rpl_row_001.result: Use new paths mysql-test/suite/rpl/r/rpl_row_loaddata_m.result: Use new paths mysql-test/suite/rpl/r/rpl_row_log.result: Use new paths mysql-test/suite/rpl/r/rpl_row_log_innodb.result: Use new paths mysql-test/suite/rpl/r/rpl_row_stop_middle_update.result: Use new paths mysql-test/suite/rpl/r/rpl_stm_000001.result: Use new paths mysql-test/suite/rpl/r/rpl_stm_log.result: Use new paths mysql-test/suite/rpl/r/rpl_timezone.result: Use new paths mysql-test/suite/rpl/t/disabled.def: Use new paths mysql-test/suite/rpl/t/rpl000017-slave.sh: Use new paths mysql-test/suite/rpl/t/rpl_LD_INFILE.test: Use new paths mysql-test/suite/rpl/t/rpl_drop_db.test: Use new paths mysql-test/suite/rpl/t/rpl_flushlog_loop-master.opt: Use new paths mysql-test/suite/rpl/t/rpl_flushlog_loop-slave.opt: Use new paths mysql-test/suite/rpl/t/rpl_flushlog_loop.test: Use new paths mysql-test/suite/rpl/t/rpl_innodb.test: Use new paths mysql-test/suite/rpl/t/rpl_innodb_bug30919.test: Use new paths mysql-test/suite/rpl/t/rpl_load_from_master.test: Use new paths mysql-test/suite/rpl/t/rpl_load_table_from_master.test: Use new paths mysql-test/suite/rpl/t/rpl_loaddata_charset.test: Use new paths mysql-test/suite/rpl/t/rpl_loaddata_fatal.test: Use new paths mysql-test/suite/rpl/t/rpl_loaddata_m.test: Use new paths mysql-test/suite/rpl/t/rpl_loaddata_s.test: Use new paths mysql-test/suite/rpl/t/rpl_loaddata_simple.test: Use new paths mysql-test/suite/rpl/t/rpl_loaddatalocal.test: Use new paths mysql-test/suite/rpl/t/rpl_loadfile.test: Use new paths mysql-test/suite/rpl/t/rpl_misc_functions.test: Use new paths mysql-test/suite/rpl/t/rpl_replicate_do.test: Use new paths mysql-test/suite/rpl/t/rpl_rewrt_db.test: Use new paths mysql-test/suite/rpl/t/rpl_rotate_logs-master.opt: Use new paths mysql-test/suite/rpl/t/rpl_rotate_logs.test: Use new paths mysql-test/suite/rpl/t/rpl_row_charset_innodb.test: Use new paths mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test: Use new paths mysql-test/suite/rpl/t/rpl_row_stop_middle_update.test: Use new paths mysql-test/suite/rpl/t/rpl_timezone.test: Use new paths mysql-test/suite/rpl/t/rpl_trigger.test: Use new paths mysql-test/suite/rpl_ndb/r/rpl_ndb_dd_advance.result: Use new paths mysql-test/suite/rpl_ndb/r/rpl_ndb_innodb_trans.result: Use new paths mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result: Use new paths mysql-test/suite/rpl_ndb/r/rpl_ndb_multi.result: Use new paths mysql-test/suite/rpl_ndb/r/rpl_ndb_row_001.result: Use new paths mysql-test/suite/rpl_ndb/r/rpl_ndb_sync.result: Use new paths mysql-test/suite/rpl_ndb/t/rpl_ndb_bank.test: Use new paths mysql-test/suite/rpl_ndb/t/rpl_ndb_dd_advance.test: Use new paths mysql-test/suite/rpl_ndb/t/rpl_ndb_innodb_trans.test: Use new paths mysql-test/suite/rpl_ndb/t/rpl_ndb_load.test: Use new paths mysql-test/suite/rpl_ndb/t/rpl_ndb_sync.test: Use new paths mysql-test/suite/rpl_ndb/t/rpl_ndbapi_multi.test: Use new paths mysql-test/t/backup.test: Use new paths mysql-test/t/bootstrap.test: Use new paths mysql-test/t/crash_commit_before.test: Use new paths mysql-test/t/create_not_windows.test: Use new paths mysql-test/t/csv.test: Use new paths mysql-test/t/ctype_big5.test: Use new paths mysql-test/t/disabled.def: Use new paths mysql-test/t/distinct.test: Use new paths mysql-test/t/gis.test: Use new paths mysql-test/t/grant_cache_no_prot.test: Use new paths mysql-test/t/grant_cache_ps_prot.test: Use new paths mysql-test/t/information_schema_chmod.test: Use new paths mysql-test/t/loaddata.test: Use new paths mysql-test/t/log_state.test: Use new paths mysql-test/t/myisam-system.test: Use new paths mysql-test/t/mysql_upgrade.test: Use new paths mysql-test/t/mysqlbinlog-cp932.test: Use new paths mysql-test/t/mysqlbinlog.test: Use new paths mysql-test/t/mysqlbinlog2.test: Use new paths mysql-test/t/mysqlbinlog_base64.test: Use new paths mysql-test/t/mysqldump.test: Use new paths mysql-test/t/outfile.test: Use new paths mysql-test/t/partition.test: Use new paths mysql-test/t/partition_error.test: Use new paths mysql-test/t/partition_federated.test: Use new paths mysql-test/t/partition_mgm.test: Use new paths mysql-test/t/partition_not_windows.test: Use new paths mysql-test/t/partition_symlink.test: Use new paths mysql-test/t/query_cache.test: Use new paths mysql-test/t/repair.test: Use new paths mysql-test/t/show_check.test: Use new paths mysql-test/t/sp-destruct.test: Use new paths mysql-test/t/sp.test: Use new paths mysql-test/t/symlink.test: Use new paths mysql-test/t/system_mysql_db.test: Use new paths mysql-test/t/system_mysql_db_fix30020.test: Use new paths mysql-test/t/system_mysql_db_fix40123.test: Use new paths mysql-test/t/system_mysql_db_fix50030.test: Use new paths mysql-test/t/system_mysql_db_fix50117.test: Use new paths mysql-test/t/trigger-compat.test: Use new paths mysql-test/t/trigger-grant.test: Use new paths mysql-test/t/trigger.test: Use new paths mysql-test/t/type_blob.test: Use new paths mysql-test/t/type_varchar.test: Use new paths mysql-test/t/upgrade.test: Use new paths mysql-test/t/user_var-binlog.test: Use new paths mysql-test/t/varbinary.test: Use new paths mysql-test/t/view.test: Use new paths mysql-test/t/warnings.test: Use new paths mysql-test/lib/My/ConfigFactory.pm: Initial version mysql-test/lib/My/Find.pm: Initial version mysql-test/lib/My/SafeProcess.pm: Initial version mysql-test/std_data/ndb_config_config.ini: Add "old" style config.ini for ndb mysql-test/suite/federated/disabled.def: Move disabled federated to it's new suite mysql-test/suite/federated/my.cnf: Add config for federated mysql-test/suite/ndb/my.cnf: Add config for ndb mysql-test/suite/rpl/my.cnf: Add config for rpl mysql-test/suite/rpl/rpl_1slave_base.cnf: Add base config for rpl mysql-test/suite/rpl/t/rpl_000015-master.opt: Use new paths mysql-test/suite/rpl_ndb/my.cnf: Add config for rpl_ndb mysql-test/lib/My/File/Path.pm: Initial version mysql-test/lib/My/SafeProcess/Base.pm: Initial version mysql-test/lib/My/SafeProcess/safe_kill_win.cc: Initial version mysql-test/lib/My/SafeProcess/safe_process.pl: Initial version mysql-test/lib/My/SafeProcess/safe_process_win.cc: Initial version mysql-test/lib/t/Base.t: Initial version mysql-test/lib/t/Find.t: Initial version mysql-test/lib/t/SafeProcess.t: Initial version mysql-test/lib/t/SafeProcessStress.pl: Initial version mysql-test/lib/t/copytree.t: Initial version mysql-test/lib/t/dummyd.pl: Initial version mysql-test/lib/t/rmtree.t: Initial version mysql-test/lib/t/testMyConfig.t: Initial version mysql-test/lib/t/testMyConfigFactory.t: Initial version mysql-test/lib/t/test_child.pl: Initial version mysql-test/include/default_my.cnf: Add default config file used when no suite specific file is found mysql-test/include/default_mysqld.cnf: New BitKeeper file ``mysql-test/include/default_mysqld.cnf'' mysql-test/include/default_ndbd.cnf: Add default settings for all ndbds mysql-test/lib/mtr_settings.pl: Initial version
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/Makefile.am141
-rwxr-xr-xmysql-test/create-test-result65
-rw-r--r--mysql-test/extra/binlog_tests/blackhole.test4
-rw-r--r--mysql-test/extra/binlog_tests/ctype_ucs_binlog.test3
-rw-r--r--mysql-test/extra/binlog_tests/mix_innodb_myisam_side_effects.test2
-rw-r--r--mysql-test/extra/rpl_tests/rpl_EE_err.test3
-rw-r--r--mysql-test/extra/rpl_tests/rpl_loaddata.test16
-rw-r--r--mysql-test/extra/rpl_tests/rpl_log.test2
-rw-r--r--mysql-test/extra/rpl_tests/rpl_row_001.test2
-rw-r--r--mysql-test/extra/rpl_tests/rpl_row_charset.test3
-rw-r--r--mysql-test/extra/rpl_tests/rpl_stm_000001.test2
-rw-r--r--mysql-test/extra/rpl_tests/rpl_stm_charset.test3
-rwxr-xr-xmysql-test/fix-result22
-rw-r--r--mysql-test/include/default_my.cnf25
-rw-r--r--mysql-test/include/default_mysqld.cnf18
-rw-r--r--mysql-test/include/default_ndbd.cnf27
-rw-r--r--mysql-test/include/federated.inc28
-rw-r--r--mysql-test/include/have_blackhole.inc7
-rw-r--r--mysql-test/include/have_bug25714.inc7
-rw-r--r--mysql-test/include/have_federated_db.inc4
-rw-r--r--mysql-test/include/have_ndbapi_examples.inc2
-rw-r--r--mysql-test/include/loaddata_autocom.inc8
-rw-r--r--mysql-test/include/mix1.inc3
-rw-r--r--mysql-test/include/ndb_backup.inc22
-rw-r--r--mysql-test/include/ndb_restore_master.inc4
-rw-r--r--mysql-test/include/ndb_restore_slave_eoption.inc4
-rw-r--r--mysql-test/include/testdb_only.inc12
-rw-r--r--mysql-test/install_test_db.sh115
-rw-r--r--mysql-test/lib/My/Config.pm96
-rw-r--r--mysql-test/lib/My/ConfigFactory.pm583
-rw-r--r--mysql-test/lib/My/File/Path.pm83
-rw-r--r--mysql-test/lib/My/Find.pm171
-rw-r--r--mysql-test/lib/My/SafeProcess.pm502
-rw-r--r--mysql-test/lib/My/SafeProcess/Base.pm236
-rwxr-xr-xmysql-test/lib/My/SafeProcess/safe_kill_win.cc56
-rw-r--r--mysql-test/lib/My/SafeProcess/safe_process.pl141
-rwxr-xr-xmysql-test/lib/My/SafeProcess/safe_process_win.cc312
-rw-r--r--mysql-test/lib/mtr_cases.pm (renamed from mysql-test/lib/mtr_cases.pl)871
-rw-r--r--mysql-test/lib/mtr_diff.pl297
-rw-r--r--mysql-test/lib/mtr_im.pl775
-rw-r--r--mysql-test/lib/mtr_io.pl150
-rw-r--r--mysql-test/lib/mtr_misc.pl129
-rw-r--r--mysql-test/lib/mtr_process.pl1045
-rw-r--r--mysql-test/lib/mtr_report.pl202
-rw-r--r--mysql-test/lib/mtr_settings.pl16
-rw-r--r--mysql-test/lib/mtr_stress.pl10
-rw-r--r--mysql-test/lib/mtr_timer.pl158
-rw-r--r--mysql-test/lib/t/Base.t27
-rw-r--r--mysql-test/lib/t/Find.t33
-rw-r--r--mysql-test/lib/t/SafeProcess.t102
-rwxr-xr-xmysql-test/lib/t/SafeProcessStress.pl149
-rw-r--r--mysql-test/lib/t/copytree.t34
-rw-r--r--mysql-test/lib/t/dummyd.pl38
-rw-r--r--mysql-test/lib/t/rmtree.t52
-rwxr-xr-xmysql-test/lib/t/testMyConfig.t131
-rwxr-xr-xmysql-test/lib/t/testMyConfigFactory.t98
-rwxr-xr-xmysql-test/lib/t/test_child.pl21
-rw-r--r--mysql-test/misc/kill_master.sh4
-rw-r--r--mysql-test/misc/mysql-test_V1.9.pl1121
-rw-r--r--mysql-test/mysql-test-run-shell.sh2338
-rwxr-xr-xmysql-test/mysql-test-run.pl4445
-rw-r--r--mysql-test/ndb/Makefile.am23
-rw-r--r--mysql-test/ndb/basic.result69
-rw-r--r--mysql-test/ndb/basic.test17
-rw-r--r--mysql-test/ndb/basic_log.result0
-rw-r--r--mysql-test/ndb/ndb_config_1_node.ini47
-rw-r--r--mysql-test/ndb/ndb_config_2_node.ini55
-rw-r--r--mysql-test/ndb/ndb_config_4_node.ini55
-rw-r--r--mysql-test/ndb/ndbcluster.sh414
-rw-r--r--mysql-test/ndb/restart.result16
-rw-r--r--mysql-test/ndb/restart.test12
-rw-r--r--mysql-test/ndb/restart_log.result20
-rw-r--r--mysql-test/r/backup.result26
-rw-r--r--mysql-test/r/ctype_big5.result4
-rw-r--r--mysql-test/r/gis.result2
-rw-r--r--mysql-test/r/have_bug25714.require2
-rw-r--r--mysql-test/r/loaddata.result32
-rw-r--r--mysql-test/r/loaddata_autocom_innodb.result4
-rw-r--r--mysql-test/r/mysqlbinlog.result24
-rw-r--r--mysql-test/r/mysqlbinlog_base64.result4
-rw-r--r--mysql-test/r/outfile.resultbin2135 -> 2150 bytes
-rw-r--r--mysql-test/r/partition_error.result52
-rw-r--r--mysql-test/r/partition_not_windows.result6
-rw-r--r--mysql-test/r/partition_symlink.result32
-rw-r--r--mysql-test/r/query_cache.result2
-rw-r--r--mysql-test/r/sp.result8
-rw-r--r--mysql-test/r/symlink.result6
-rw-r--r--mysql-test/r/system_mysql_db.result1
-rw-r--r--mysql-test/r/trigger.result12
-rw-r--r--mysql-test/r/type_blob.result20
-rw-r--r--mysql-test/r/view.result8
-rw-r--r--mysql-test/r/warnings.result2
-rwxr-xr-xmysql-test/resolve-stack8
-rw-r--r--mysql-test/std_data/ndb_config_config.ini55
-rw-r--r--mysql-test/suite/binlog/r/binlog_killed_simulate.result4
-rw-r--r--mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result4
-rw-r--r--mysql-test/suite/binlog/r/binlog_stm_blackhole.result4
-rw-r--r--mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result4
-rw-r--r--mysql-test/suite/binlog/t/binlog_killed.test7
-rw-r--r--mysql-test/suite/binlog/t/binlog_killed_simulate.test7
-rw-r--r--mysql-test/suite/binlog/t/binlog_row_mix_innodb_myisam.test3
-rw-r--r--mysql-test/suite/binlog/t/binlog_stm_mix_innodb_myisam.test3
-rw-r--r--mysql-test/suite/federated/disabled.def12
-rw-r--r--mysql-test/suite/federated/federated.inc16
-rw-r--r--mysql-test/suite/federated/federated.result (renamed from mysql-test/r/federated.result)9
-rw-r--r--mysql-test/suite/federated/federated.test (renamed from mysql-test/t/federated.test)8
-rw-r--r--mysql-test/suite/federated/federated_archive.result (renamed from mysql-test/r/federated_archive.result)7
-rw-r--r--mysql-test/suite/federated/federated_archive.test (renamed from mysql-test/t/federated_archive.test)6
-rw-r--r--mysql-test/suite/federated/federated_bug_13118.result (renamed from mysql-test/r/federated_bug_13118.result)7
-rw-r--r--mysql-test/suite/federated/federated_bug_13118.test (renamed from mysql-test/t/federated_bug_13118.test)7
-rw-r--r--mysql-test/suite/federated/federated_bug_25714.result (renamed from mysql-test/r/federated_bug_25714.result)7
-rw-r--r--mysql-test/suite/federated/federated_bug_25714.test (renamed from mysql-test/t/federated_bug_25714.test)10
-rw-r--r--mysql-test/suite/federated/federated_cleanup.inc (renamed from mysql-test/include/federated_cleanup.inc)0
-rw-r--r--mysql-test/suite/federated/federated_innodb-slave.opt (renamed from mysql-test/t/federated_innodb-slave.opt)0
-rw-r--r--mysql-test/suite/federated/federated_innodb.result (renamed from mysql-test/r/federated_innodb.result)7
-rw-r--r--mysql-test/suite/federated/federated_innodb.test (renamed from mysql-test/t/federated_innodb.test)4
-rw-r--r--mysql-test/suite/federated/federated_server.result (renamed from mysql-test/r/federated_server.result)7
-rw-r--r--mysql-test/suite/federated/federated_server.test (renamed from mysql-test/t/federated_server.test)7
-rw-r--r--mysql-test/suite/federated/federated_transactions-slave.opt (renamed from mysql-test/t/federated_transactions-slave.opt)0
-rw-r--r--mysql-test/suite/federated/federated_transactions.result (renamed from mysql-test/r/federated_transactions.result)0
-rw-r--r--mysql-test/suite/federated/federated_transactions.test (renamed from mysql-test/t/federated_transactions.test)6
-rw-r--r--mysql-test/suite/federated/have_federated_db.inc4
-rw-r--r--mysql-test/suite/federated/my.cnf12
-rw-r--r--mysql-test/suite/ndb/my.cnf20
-rw-r--r--mysql-test/suite/ndb/r/loaddata_autocom_ndb.result4
-rw-r--r--mysql-test/suite/ndb/r/ndb_config.result2
-rw-r--r--mysql-test/suite/ndb/r/ndb_dd_backuprestore.result24
-rw-r--r--mysql-test/suite/ndb/r/ndb_load.result4
-rw-r--r--mysql-test/suite/ndb/r/ndb_loaddatalocal.result16
-rw-r--r--mysql-test/suite/ndb/r/ndb_replace.result4
-rw-r--r--mysql-test/suite/ndb/r/ndb_restore.result28
-rw-r--r--mysql-test/suite/ndb/r/ndb_restore_partition.result24
-rw-r--r--mysql-test/suite/ndb/r/ndb_restore_print.result24
-rw-r--r--mysql-test/suite/ndb/r/ndb_trigger.result2
-rw-r--r--mysql-test/suite/ndb/t/ndb_alter_table.test9
-rw-r--r--mysql-test/suite/ndb/t/ndb_config.test8
-rw-r--r--mysql-test/suite/ndb/t/ndb_load.test4
-rw-r--r--mysql-test/suite/ndb/t/ndb_loaddatalocal.test41
-rw-r--r--mysql-test/suite/ndb/t/ndb_replace.test4
-rw-r--r--mysql-test/suite/ndb/t/ndb_restore.test6
-rw-r--r--mysql-test/suite/ndb/t/ndb_single_user.test12
-rw-r--r--mysql-test/suite/ndb/t/ndb_trigger.test2
-rw-r--r--mysql-test/suite/ndb/t/ndbapi.test16
-rw-r--r--mysql-test/suite/rpl/include/rpl_mixed_dml.inc6
-rw-r--r--mysql-test/suite/rpl/my.cnf14
-rw-r--r--mysql-test/suite/rpl/r/rpl_LD_INFILE.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_flushlog_loop.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_innodb.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_load_table_from_master.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_loaddata.result18
-rw-r--r--mysql-test/suite/rpl/r/rpl_loaddata_charset.result14
-rw-r--r--mysql-test/suite/rpl/r/rpl_loaddata_fatal.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_loaddata_m.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_loaddata_s.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_loaddata_simple.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_loaddatalocal.result8
-rw-r--r--mysql-test/suite/rpl/r/rpl_loadfile.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_misc_functions.result6
-rw-r--r--mysql-test/suite/rpl/r/rpl_replicate_do.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_rewrt_db.result12
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_001.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_loaddata_m.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_log.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_log_innodb.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_stop_middle_update.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_000001.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_log.result10
-rw-r--r--mysql-test/suite/rpl/r/rpl_timezone.result2
-rw-r--r--mysql-test/suite/rpl/rpl_1slave_base.cnf56
-rw-r--r--mysql-test/suite/rpl/t/disabled.def6
-rwxr-xr-xmysql-test/suite/rpl/t/rpl000017-slave.sh4
-rw-r--r--mysql-test/suite/rpl/t/rpl_000015-master.opt2
-rw-r--r--mysql-test/suite/rpl/t/rpl_000015-slave.opt (renamed from mysql-test/suite/rpl/t/rpl_000015.slave-mi)0
-rw-r--r--mysql-test/suite/rpl/t/rpl_LD_INFILE.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_drop_db.test3
-rw-r--r--mysql-test/suite/rpl/t/rpl_flushlog_loop-master.opt2
-rw-r--r--mysql-test/suite/rpl/t/rpl_flushlog_loop-slave.opt2
-rw-r--r--mysql-test/suite/rpl/t/rpl_flushlog_loop.test3
-rw-r--r--mysql-test/suite/rpl/t/rpl_innodb.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_innodb_bug30919.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_load_from_master.test5
-rw-r--r--mysql-test/suite/rpl/t/rpl_load_table_from_master.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_loaddata_charset.test14
-rw-r--r--mysql-test/suite/rpl/t/rpl_loaddata_fatal.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_loaddata_m.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_loaddata_s.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_loaddata_simple.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_loaddatalocal.test21
-rw-r--r--mysql-test/suite/rpl/t/rpl_loadfile.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_misc_functions.test11
-rw-r--r--mysql-test/suite/rpl/t/rpl_replicate_do.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_rewrt_db.test12
-rw-r--r--mysql-test/suite/rpl/t/rpl_rotate_logs-master.opt2
-rw-r--r--mysql-test/suite/rpl/t/rpl_rotate_logs-slave.opt (renamed from mysql-test/suite/rpl/t/rpl_rotate_logs.slave-mi)0
-rw-r--r--mysql-test/suite/rpl/t/rpl_rotate_logs.test7
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_charset_innodb.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test33
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_stop_middle_update.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_timezone.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_trigger.test4
-rw-r--r--mysql-test/suite/rpl_ndb/my.cnf75
-rw-r--r--mysql-test/suite/rpl_ndb/r/rpl_ndb_dd_advance.result10
-rw-r--r--mysql-test/suite/rpl_ndb/r/rpl_ndb_innodb_trans.result12
-rw-r--r--mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result2
-rw-r--r--mysql-test/suite/rpl_ndb/r/rpl_ndb_multi.result4
-rw-r--r--mysql-test/suite/rpl_ndb/r/rpl_ndb_row_001.result2
-rw-r--r--mysql-test/suite/rpl_ndb/r/rpl_ndb_sync.result8
-rw-r--r--mysql-test/suite/rpl_ndb/t/rpl_ndb_bank.test18
-rw-r--r--mysql-test/suite/rpl_ndb/t/rpl_ndb_dd_advance.test26
-rw-r--r--mysql-test/suite/rpl_ndb/t/rpl_ndb_innodb_trans.test12
-rw-r--r--mysql-test/suite/rpl_ndb/t/rpl_ndb_load.test4
-rw-r--r--mysql-test/suite/rpl_ndb/t/rpl_ndb_sync.test8
-rw-r--r--mysql-test/suite/rpl_ndb/t/rpl_ndbapi_multi.test4
-rw-r--r--mysql-test/t/backup.test28
-rw-r--r--mysql-test/t/bootstrap.test4
-rw-r--r--mysql-test/t/crash_commit_before.test2
-rw-r--r--mysql-test/t/create_not_windows.test3
-rw-r--r--mysql-test/t/csv.test35
-rw-r--r--mysql-test/t/ctype_big5.test7
-rw-r--r--mysql-test/t/disabled.def8
-rw-r--r--mysql-test/t/distinct.test8
-rw-r--r--mysql-test/t/gis.test2
-rw-r--r--mysql-test/t/grant_cache_no_prot.test2
-rw-r--r--mysql-test/t/grant_cache_ps_prot.test2
-rw-r--r--mysql-test/t/information_schema_chmod.test5
-rw-r--r--mysql-test/t/loaddata.test35
-rw-r--r--mysql-test/t/log_state.test3
-rw-r--r--mysql-test/t/myisam-system.test7
-rw-r--r--mysql-test/t/mysql_upgrade.test7
-rw-r--r--mysql-test/t/mysqlbinlog-cp932.test3
-rw-r--r--mysql-test/t/mysqlbinlog.test56
-rw-r--r--mysql-test/t/mysqlbinlog2.test28
-rw-r--r--mysql-test/t/mysqlbinlog_base64.test4
-rw-r--r--mysql-test/t/mysqldump.test4
-rw-r--r--mysql-test/t/outfile.test26
-rw-r--r--mysql-test/t/partition.test6
-rw-r--r--mysql-test/t/partition_error.test27
-rw-r--r--mysql-test/t/partition_federated.test2
-rw-r--r--mysql-test/t/partition_mgm.test21
-rw-r--r--mysql-test/t/partition_not_windows.test73
-rw-r--r--mysql-test/t/partition_symlink.test44
-rw-r--r--mysql-test/t/query_cache.test2
-rw-r--r--mysql-test/t/repair.test3
-rw-r--r--mysql-test/t/show_check.test5
-rw-r--r--mysql-test/t/sp-destruct.test23
-rw-r--r--mysql-test/t/sp.test8
-rw-r--r--mysql-test/t/symlink.test15
-rw-r--r--mysql-test/t/system_mysql_db.test5
-rw-r--r--mysql-test/t/system_mysql_db_fix30020.test4
-rw-r--r--mysql-test/t/system_mysql_db_fix40123.test4
-rw-r--r--mysql-test/t/system_mysql_db_fix50030.test4
-rw-r--r--mysql-test/t/system_mysql_db_fix50117.test4
-rw-r--r--mysql-test/t/trigger-compat.test5
-rw-r--r--mysql-test/t/trigger-grant.test3
-rw-r--r--mysql-test/t/trigger.test21
-rw-r--r--mysql-test/t/type_blob.test16
-rw-r--r--mysql-test/t/type_varchar.test7
-rw-r--r--mysql-test/t/upgrade.test13
-rw-r--r--mysql-test/t/user_var-binlog.test4
-rw-r--r--mysql-test/t/varbinary.test13
-rw-r--r--mysql-test/t/view.test8
-rw-r--r--mysql-test/t/warnings.test2
263 files changed, 6062 insertions, 11545 deletions
diff --git a/mysql-test/Makefile.am b/mysql-test/Makefile.am
index c682cbbd4f7..13bcdbe73cf 100644
--- a/mysql-test/Makefile.am
+++ b/mysql-test/Makefile.am
@@ -17,115 +17,22 @@
## Process this file with automake to create Makefile.in
-SUBDIRS = ndb
+testdir = $(prefix)/mysql-test
-benchdir_root= $(prefix)
-testdir = $(benchdir_root)/mysql-test
-EXTRA_SCRIPTS = mysql-test-run-shell.sh install_test_db.sh \
- valgrind.supp $(PRESCRIPTS)
-EXTRA_DIST = $(EXTRA_SCRIPTS) suite
-GENSCRIPTS = mysql-test-run-shell install_test_db mtr mysql-test-run
-PRESCRIPTS = mysql-test-run.pl mysql-stress-test.pl
-test_SCRIPTS = $(GENSCRIPTS) $(PRESCRIPTS)
-CLEANFILES = $(GENSCRIPTS)
+EXTRA_DIST = README \
+ mysql-test-run.pl \
+ mysql-stress-test.pl \
+ t r include suite extra \
+ lib std_data \
+ valgrind.supp
-INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include -I..
+test_SCRIPTS = mtr mysql-test-run
+CLEANFILES = $(test_SCRIPTS)
-dist-hook:
- mkdir -p \
- $(distdir)/t \
- $(distdir)/extra/binlog_tests \
- $(distdir)/extra/rpl_tests \
- $(distdir)/r \
- $(distdir)/include \
- $(distdir)/std_data \
- $(distdir)/std_data/ndb_backup50 \
- $(distdir)/std_data/ndb_backup51 \
- $(distdir)/std_data/ndb_backup51_data_be \
- $(distdir)/std_data/ndb_backup51_data_le \
- $(distdir)/lib \
- $(distdir)/lib/My
- -$(INSTALL_DATA) $(srcdir)/t/*.def $(distdir)/t
- $(INSTALL_DATA) $(srcdir)/t/*.test $(distdir)/t
- -$(INSTALL_DATA) $(srcdir)/t/*.imtest $(distdir)/t
- $(INSTALL_DATA) $(srcdir)/t/*.sql $(distdir)/t
- -$(INSTALL_DATA) $(srcdir)/t/*.disabled $(distdir)/t
- -$(INSTALL_DATA) $(srcdir)/t/*.opt $(srcdir)/t/*.slave-mi $(distdir)/t
- -$(INSTALL_SCRIPT) $(srcdir)/t/*.sh $(distdir)/t
- $(INSTALL_DATA) $(srcdir)/extra/binlog_tests/*.test $(distdir)/extra/binlog_tests
- $(INSTALL_DATA) $(srcdir)/extra/rpl_tests/*.test $(distdir)/extra/rpl_tests
- -$(INSTALL_DATA) $(srcdir)/extra/binlog_tests/*.opt $(distdir)/extra/binlog_tests
- -$(INSTALL_DATA) $(srcdir)/extra/rpl_tests/*.opt $(distdir)/extra/rpl_tests
- $(INSTALL_DATA) $(srcdir)/include/*.inc $(distdir)/include
- $(INSTALL_DATA) $(srcdir)/include/*.sql $(distdir)/include
- $(INSTALL_DATA) $(srcdir)/include/*.test $(distdir)/include
- $(INSTALL_DATA) $(srcdir)/r/*.result $(srcdir)/r/*.require $(distdir)/r
- $(INSTALL_DATA) $(srcdir)/std_data/Moscow_leap $(distdir)/std_data
- $(INSTALL_DATA) $(srcdir)/std_data/Index.xml $(distdir)/std_data
- $(INSTALL_DATA) $(srcdir)/std_data/*.dat $(srcdir)/std_data/*.000001 $(distdir)/std_data
- $(INSTALL_DATA) $(srcdir)/std_data/des_key_file $(distdir)/std_data
- $(INSTALL_DATA) $(srcdir)/std_data/*.pem $(distdir)/std_data
- $(INSTALL_DATA) $(srcdir)/std_data/*.frm $(distdir)/std_data
- $(INSTALL_DATA) $(srcdir)/std_data/*.MY* $(distdir)/std_data
- $(INSTALL_DATA) $(srcdir)/std_data/*.cnf $(distdir)/std_data
- $(INSTALL_DATA) $(srcdir)/std_data/ndb_backup50/BACKUP* $(distdir)/std_data/ndb_backup50
- $(INSTALL_DATA) $(srcdir)/std_data/ndb_backup51/BACKUP* $(distdir)/std_data/ndb_backup51
- $(INSTALL_DATA) $(srcdir)/std_data/ndb_backup51_data_be/BACKUP* $(distdir)/std_data/ndb_backup51_data_be
- $(INSTALL_DATA) $(srcdir)/std_data/ndb_backup51_data_le/BACKUP* $(distdir)/std_data/ndb_backup51_data_le
- $(INSTALL_DATA) $(srcdir)/lib/*.pl $(distdir)/lib
- $(INSTALL_DATA) $(srcdir)/lib/My/*.pm $(distdir)/lib/My
- -rm -rf `find $(distdir)/suite -type d -name SCCS` $(distdir)/suite/row_lock
-
+# Install all files and files in directories listed in EXTRA_DIST
install-data-local:
- $(mkinstalldirs) \
- $(DESTDIR)$(testdir)/t \
- $(DESTDIR)$(testdir)/extra/binlog_tests \
- $(DESTDIR)$(testdir)/extra/rpl_tests \
- $(DESTDIR)$(testdir)/r \
- $(DESTDIR)$(testdir)/include \
- $(DESTDIR)$(testdir)/std_data \
- $(DESTDIR)$(testdir)/std_data/ndb_backup50 \
- $(DESTDIR)$(testdir)/std_data/ndb_backup51 \
- $(DESTDIR)$(testdir)/std_data/ndb_backup51_data_be \
- $(DESTDIR)$(testdir)/std_data/ndb_backup51_data_le \
- $(DESTDIR)$(testdir)/lib \
- $(DESTDIR)$(testdir)/lib/My
- $(INSTALL_DATA) $(srcdir)/README $(DESTDIR)$(testdir)
- -$(INSTALL_DATA) $(srcdir)/t/*.def $(DESTDIR)$(testdir)/t
- $(INSTALL_DATA) $(srcdir)/t/*.test $(DESTDIR)$(testdir)/t
- -$(INSTALL_DATA) $(srcdir)/t/*.imtest $(DESTDIR)$(testdir)/t
- $(INSTALL_DATA) $(srcdir)/t/*.sql $(DESTDIR)$(testdir)/t
- -$(INSTALL_DATA) $(srcdir)/t/*.disabled $(DESTDIR)$(testdir)/t
- -$(INSTALL_DATA) $(srcdir)/t/*.opt $(DESTDIR)$(testdir)/t
- -$(INSTALL_SCRIPT) $(srcdir)/t/*.sh $(DESTDIR)$(testdir)/t
- -$(INSTALL_DATA) $(srcdir)/t/*.slave-mi $(DESTDIR)$(testdir)/t
- $(INSTALL_DATA) $(srcdir)/r/*.result $(DESTDIR)$(testdir)/r
- $(INSTALL_DATA) $(srcdir)/r/*.require $(DESTDIR)$(testdir)/r
- $(INSTALL_DATA) $(srcdir)/extra/binlog_tests/*.test $(DESTDIR)$(testdir)/extra/binlog_tests
- $(INSTALL_DATA) $(srcdir)/extra/rpl_tests/*.test $(DESTDIR)$(testdir)/extra/rpl_tests
- -$(INSTALL_DATA) $(srcdir)/extra/binlog_tests/*.opt $(DESTDIR)$(testdir)/extra/binlog_tests
- -$(INSTALL_DATA) $(srcdir)/extra/rpl_tests/*.opt $(DESTDIR)$(testdir)/extra/rpl_tests
- $(INSTALL_DATA) $(srcdir)/include/*.inc $(DESTDIR)$(testdir)/include
- $(INSTALL_DATA) $(srcdir)/include/*.sql $(DESTDIR)$(testdir)/include
- $(INSTALL_DATA) $(srcdir)/include/*.test $(DESTDIR)$(testdir)/include
- $(INSTALL_DATA) $(srcdir)/std_data/*.dat $(DESTDIR)$(testdir)/std_data
- $(INSTALL_DATA) $(srcdir)/std_data/*.*001 $(DESTDIR)$(testdir)/std_data
- $(INSTALL_DATA) $(srcdir)/std_data/*.cnf $(DESTDIR)$(testdir)/std_data
- $(INSTALL_DATA) $(srcdir)/std_data/des_key_file $(DESTDIR)$(testdir)/std_data
- $(INSTALL_DATA) $(srcdir)/std_data/Moscow_leap $(DESTDIR)$(testdir)/std_data
- $(INSTALL_DATA) $(srcdir)/std_data/Index.xml $(DESTDIR)$(testdir)/std_data
- $(INSTALL_DATA) $(srcdir)/std_data/*.pem $(DESTDIR)$(testdir)/std_data
- $(INSTALL_DATA) $(srcdir)/std_data/*.frm $(DESTDIR)$(testdir)/std_data
- $(INSTALL_DATA) $(srcdir)/std_data/*.MY* $(DESTDIR)$(testdir)/std_data
- $(INSTALL_DATA) $(srcdir)/std_data/*.cnf $(DESTDIR)$(testdir)/std_data
- $(INSTALL_DATA) $(srcdir)/std_data/ndb_backup50/BACKUP* $(DESTDIR)$(testdir)/std_data/ndb_backup50
- $(INSTALL_DATA) $(srcdir)/std_data/ndb_backup51/BACKUP* $(DESTDIR)$(testdir)/std_data/ndb_backup51
- $(INSTALL_DATA) $(srcdir)/std_data/ndb_backup51_data_be/BACKUP* $(DESTDIR)$(testdir)/std_data/ndb_backup51_data_be
- $(INSTALL_DATA) $(srcdir)/std_data/ndb_backup51_data_le/BACKUP* $(DESTDIR)$(testdir)/std_data/ndb_backup51_data_le
- $(INSTALL_DATA) $(srcdir)/lib/*.pl $(DESTDIR)$(testdir)/lib
- $(INSTALL_DATA) $(srcdir)/lib/My/*.pm $(DESTDIR)$(testdir)/lib/My
- for f in `(cd $(srcdir); find suite -type f | egrep -v 'SCCS|row_lock')`; \
+ for f in `(cd $(srcdir); find $(EXTRA_DIST) -type f)`; \
do \
d=$(DESTDIR)$(testdir)/`dirname $$f`; \
mkdir -p $$d ; \
@@ -145,31 +52,5 @@ mysql-test-run:
$(RM) -f mysql-test-run
$(LN_S) mysql-test-run.pl mysql-test-run
-SUFFIXES = .sh
-
-.sh:
- @RM@ -f $@ $@-t
- @SED@ \
- -e 's!@''testdir''@!$(testdir)!g' \
- -e 's!@''bindir''@!$(bindir)!g' \
- -e 's!@''scriptdir''@!$(bindir)!g' \
- -e 's!@''prefix''@!$(prefix)!g' \
- -e 's!@''datadir''@!$(datadir)!g' \
- -e 's!@''localstatedir''@!$(localstatedir)!g' \
- -e 's!@''libexecdir''@!$(libexecdir)!g' \
- -e 's!@''PERL''@!@PERL@!' \
- -e 's!@''VERSION''@!@VERSION@!' \
- -e 's!@''MYSQL_TCP_PORT''@!@MYSQL_TCP_PORT@!' \
- -e 's!@''MYSQL_TCP_PORT_DEFAULT''@!@MYSQL_TCP_PORT_DEFAULT@!' \
- -e 's!@''MYSQL_BASE_VERSION''@!@MYSQL_BASE_VERSION@!' \
- -e 's!@''MYSQL_UNIX_ADDR''@!@MYSQL_UNIX_ADDR@!' \
- -e 's!@''MYSQL_TCP_PORT''@!@MYSQL_TCP_PORT@!' \
- -e 's!@''MYSQL_NO_DASH_VERSION''@!@MYSQL_NO_DASH_VERSION@!' \
- -e 's!@''MYSQL_SERVER_SUFFIX''@!@MYSQL_SERVER_SUFFIX@!' \
- -e 's!@''USE_NDBCLUSTER''@!@TEST_NDBCLUSTER@!g' \
- $< > $@-t
- @CHMOD@ +x $@-t
- @MV@ $@-t $@
-
# Don't update the files from bitkeeper
%::SCCS/s.%
diff --git a/mysql-test/create-test-result b/mysql-test/create-test-result
deleted file mode 100755
index ad19cdf08a1..00000000000
--- a/mysql-test/create-test-result
+++ /dev/null
@@ -1,65 +0,0 @@
-#! /bin/sh
-
-# This script is a hack for lazy developers who want to get a quick
-# start on the result file. The code here is rather dirty, but it works
-# If you have a spare moment feel free to improve it - the right way is
-# to start mysqld yourself and run mysqltest -r
-
-RESULT_DIR=r
-if [ -z "$EDITOR" ] ; then
- EDITOR=vi
-fi
-
-function die()
-{
- echo $1
- exit 1
-}
-
-function usage()
-{
- echo "Usage: $0 test_name"
- exit 1
-}
-
-test_name=$1
-
-[ -z "$test_name" ] && usage
-
-result_file=$RESULT_DIR/$test_name.result
-reject_file=$RESULT_DIR/$test_name.reject
-
-[ -f $result_file ] && die "result file $result_file has already been created"
-
-touch $result_file
-echo "Running the test case against empty file, will fail, but don't worry"
-./mysql-test-run --local $test_name
-
-if [ -f $reject_file ] ; then
- echo "Below are the contents of the reject file:"
- echo "-----start---------------------"
- cat $reject_file
- echo "-----end-----------------------"
- echo "Is this the output you expected from your test case?(y/n)[n]"
- read yes_no
- if [ x$yes_no = xy ] ; then
- echo "Press any key to edit it in $EDITOR, or Ctrl-C to abort"
- read junk
- $EDITOR $reject_file
- edited="edited"
- fi
- echo "Save $edited file as master result? (y/n)[y]"
- read yes_no
- if [ x$yes_no != xn ]; then
- mv $reject_file $result_file
- fi
-else
- echo "Your test failed so bad, it did not even produce a reject file"
- echo "You need to fix your bugs in the test case, the code, or both"
- exit 1
-fi
-
-
-
-
-
diff --git a/mysql-test/extra/binlog_tests/blackhole.test b/mysql-test/extra/binlog_tests/blackhole.test
index 1ca59955d76..660806eeff7 100644
--- a/mysql-test/extra/binlog_tests/blackhole.test
+++ b/mysql-test/extra/binlog_tests/blackhole.test
@@ -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 --git a/mysql-test/extra/binlog_tests/ctype_ucs_binlog.test b/mysql-test/extra/binlog_tests/ctype_ucs_binlog.test
index fa374502997..b240109f6e6 100644
--- a/mysql-test/extra/binlog_tests/ctype_ucs_binlog.test
+++ b/mysql-test/extra/binlog_tests/ctype_ucs_binlog.test
@@ -16,7 +16,8 @@ source include/show_binlog_events.inc;
# escaped).
flush logs;
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
---exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000001
+let $MYSQLD_DATADIR= `select @@datadir`;
+--exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000001
drop table t2;
# End of 4.1 tests
diff --git a/mysql-test/extra/binlog_tests/mix_innodb_myisam_side_effects.test b/mysql-test/extra/binlog_tests/mix_innodb_myisam_side_effects.test
index 03514bfdb55..4f6a3b8039e 100644
--- a/mysql-test/extra/binlog_tests/mix_innodb_myisam_side_effects.test
+++ b/mysql-test/extra/binlog_tests/mix_innodb_myisam_side_effects.test
@@ -282,7 +282,7 @@ CREATE TABLE t5 (a int, PRIMARY KEY (a)) ENGINE=InnoDB;
# execute
--error ER_DUP_ENTRY
- load data infile '../std_data_ln/rpl_loaddata.dat' into table t4 (a, @b) set b= @b + bug27417(2);
+ load data infile '../../std_data/rpl_loaddata.dat' into table t4 (a, @b) set b= @b + bug27417(2);
# check
select * from t4;
select count(*) from t1 /* must be 2 */;
diff --git a/mysql-test/extra/rpl_tests/rpl_EE_err.test b/mysql-test/extra/rpl_tests/rpl_EE_err.test
index 3dce12b3f4e..24b3c28d2bb 100644
--- a/mysql-test/extra/rpl_tests/rpl_EE_err.test
+++ b/mysql-test/extra/rpl_tests/rpl_EE_err.test
@@ -20,7 +20,8 @@
eval create table t1 (a int) engine=$engine_type;
flush tables;
-system rm $MYSQLTEST_VARDIR/master-data/test/t1.MYI ;
+let $MYSQLD_DATADIR= `select @@datadir`;
+system rm $MYSQLD_DATADIR/test/t1.MYI ;
drop table if exists t1;
save_master_pos;
connection slave;
diff --git a/mysql-test/extra/rpl_tests/rpl_loaddata.test b/mysql-test/extra/rpl_tests/rpl_loaddata.test
index bb6afd73034..1abbe8aba91 100644
--- a/mysql-test/extra/rpl_tests/rpl_loaddata.test
+++ b/mysql-test/extra/rpl_tests/rpl_loaddata.test
@@ -23,12 +23,12 @@ connection master;
select last_insert_id();
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;
# verify that LAST_INSERT_ID() is set by LOAD DATA INFILE
select last_insert_id();
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;
@@ -63,7 +63,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;
@@ -87,7 +87,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.
@@ -112,7 +112,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.
@@ -132,7 +132,7 @@ reset master;
eval create table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60),
unique(day)) engine=$engine_type; # no transactions
--error ER_DUP_ENTRY
-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;
@@ -148,7 +148,7 @@ alter table t2 drop key day;
connection master;
delete from t2;
--error ER_DUP_ENTRY
-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;
@@ -162,7 +162,7 @@ drop table t1;
CREATE TABLE t1 (word CHAR(20) NOT NULL PRIMARY KEY) ENGINE=INNODB;
--error ER_DUP_ENTRY
-LOAD DATA INFILE "../std_data_ln/words.dat" INTO TABLE t1;
+LOAD DATA INFILE "../../std_data/words.dat" INTO TABLE t1;
--disable_warnings
DROP TABLE IF EXISTS t1;
diff --git a/mysql-test/extra/rpl_tests/rpl_log.test b/mysql-test/extra/rpl_tests/rpl_log.test
index a5db4dfab4d..eaf93789fe4 100644
--- a/mysql-test/extra/rpl_tests/rpl_log.test
+++ b/mysql-test/extra/rpl_tests/rpl_log.test
@@ -33,7 +33,7 @@ eval create table t1(n int not null auto_increment primary key)ENGINE=$engine_ty
insert into t1 values (NULL);
drop table t1;
eval create table t1 (word char(20) not null)ENGINE=$engine_type;
-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;
--replace_result $VERSION VERSION
--replace_column 2 # 5 #
diff --git a/mysql-test/extra/rpl_tests/rpl_row_001.test b/mysql-test/extra/rpl_tests/rpl_row_001.test
index 6261659c4ce..98746326fb2 100644
--- a/mysql-test/extra/rpl_tests/rpl_row_001.test
+++ b/mysql-test/extra/rpl_tests/rpl_row_001.test
@@ -1,5 +1,5 @@
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 ORDER BY word LIMIT 10;
diff --git a/mysql-test/extra/rpl_tests/rpl_row_charset.test b/mysql-test/extra/rpl_tests/rpl_row_charset.test
index c1eccff9bd5..fa1013cd340 100644
--- a/mysql-test/extra/rpl_tests/rpl_row_charset.test
+++ b/mysql-test/extra/rpl_tests/rpl_row_charset.test
@@ -160,7 +160,8 @@ select hex(c1), hex(c2) from t1;
connection master;
# Let's have a look at generated SETs.
--replace_result $MYSQLTEST_VARDIR MYSQL_TEST_DIR/var
-#--exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000001
+let $MYSQLD_DATADIR= `select @@datadir`;
+#--exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000001
drop table t1;
sync_slave_with_master;
diff --git a/mysql-test/extra/rpl_tests/rpl_stm_000001.test b/mysql-test/extra/rpl_tests/rpl_stm_000001.test
index d007e433ab6..1f5eb5786dd 100644
--- a/mysql-test/extra/rpl_tests/rpl_stm_000001.test
+++ b/mysql-test/extra/rpl_tests/rpl_stm_000001.test
@@ -2,7 +2,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 --git a/mysql-test/extra/rpl_tests/rpl_stm_charset.test b/mysql-test/extra/rpl_tests/rpl_stm_charset.test
index 629ccdf69f7..6d545621156 100644
--- a/mysql-test/extra/rpl_tests/rpl_stm_charset.test
+++ b/mysql-test/extra/rpl_tests/rpl_stm_charset.test
@@ -156,7 +156,8 @@ connection master;
# Let's have a look at generated SETs.
flush logs;
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
---exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000001
+let $MYSQLD_DATADIR= `select @@datadir`;
+--exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000001
drop table t1;
sync_slave_with_master;
diff --git a/mysql-test/fix-result b/mysql-test/fix-result
deleted file mode 100755
index bd380332ff5..00000000000
--- a/mysql-test/fix-result
+++ /dev/null
@@ -1,22 +0,0 @@
-#! /bin/sh
-
-# Sasha's hack to fix results generated with mysql-test-run --record
-# to be version and test port independent. In some cases, further minor
-# manual edititing may be required, but most of the time it should not
-# happen
-
-#It is assumed we are running the script in mysql-test directory
-
-VERSION=4.0.1-alpha-debug-log
-TEST_CASE=$1
-
-if [ -z "$TEST_CASE" ] ;
-then
- echo "usage: $0 test_case_name"
- exit 1
-fi
-
-../extra/replace $VERSION '$VERSION' 9306 '$MASTER_MYPORT' 9307 \
-'$SLAVE_MYPORT' \\ \\\\ -- r/$TEST_CASE.result
-
-
diff --git a/mysql-test/include/default_my.cnf b/mysql-test/include/default_my.cnf
new file mode 100644
index 00000000000..d77fee0e200
--- /dev/null
+++ b/mysql-test/include/default_my.cnf
@@ -0,0 +1,25 @@
+# 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
+
+
+[mysqlbinlog]
+disable-force-if-open
+
+# mysql_fix_privilege_tables.sh does not read from [client] so it
+# need its own section
+[mysql_fix_privilege_tables]
+socket= @client.socket
+port= @client.port
+user= @client.user
+password= @client.password
+
+[ENV]
+MASTER_MYPORT= @mysqld.1.port
+MASTER_MYSOCK= @mysqld.1.socket
diff --git a/mysql-test/include/default_mysqld.cnf b/mysql-test/include/default_mysqld.cnf
new file mode 100644
index 00000000000..60d12ebe1a6
--- /dev/null
+++ b/mysql-test/include/default_mysqld.cnf
@@ -0,0 +1,18 @@
+# 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
+
+loose-innodb_data_file_path= ibdata1:10M:autoextend
+
+set-variable= slave_net_timeout=120
diff --git a/mysql-test/include/default_ndbd.cnf b/mysql-test/include/default_ndbd.cnf
new file mode 100644
index 00000000000..784d81beabc
--- /dev/null
+++ b/mysql-test/include/default_ndbd.cnf
@@ -0,0 +1,27 @@
+
+[cluster_config]
+MaxNoOfSavedMessages= 1000
+MaxNoOfConcurrentTransactions= 64
+MaxNoOfConcurrentOperations= 10000
+DataMemory= 20M
+IndexMemory= 1M
+Diskless= 0
+TimeBetweenWatchDogCheck= 30000
+MaxNoOfOrderedIndexes= 32
+MaxNoOfAttributes= 2048
+TimeBetweenGlobalCheckpoints= 500
+NoOfFragmentLogFiles= 4
+FragmentLogFileSize= 12M
+DiskPageBufferMemory= 4M
+
+# O_DIRECT has issues on 2.4 whach have not been handled, Bug #29612
+#ODirect= 1
+# the following parametes just function as a small regression
+# test that the parameter exists
+InitialNoOfOpenFiles= 27
+
+# Increase timeouts for slow test-machines
+HeartbeatIntervalDbDb= 30000
+HeartbeatIntervalDbApi= 30000
+
+#TransactionDeadlockDetectionTimeout= 7500
diff --git a/mysql-test/include/federated.inc b/mysql-test/include/federated.inc
deleted file mode 100644
index 925ecdd9682..00000000000
--- a/mysql-test/include/federated.inc
+++ /dev/null
@@ -1,28 +0,0 @@
---source include/have_log_bin.inc
---source include/not_embedded.inc
---source ./include/have_federated_db.inc
-
-source ./include/master-slave.inc;
-
-# remote table creation
-
-# We have to sync with master, to ensure slave had time to start properly
-# before we stop it. If not, we get errors about UNIX_TIMESTAMP() in the log.
-connection master;
-sync_slave_with_master;
-
-connection slave;
-#--replicate-ignore-db=federated
-stop slave;
-
---disable_warnings
-# at this point, we are connected to master
-DROP DATABASE IF EXISTS federated;
---enable_warnings
-CREATE DATABASE federated;
-
-connection master;
---disable_warnings
-DROP DATABASE IF EXISTS federated;
---enable_warnings
-CREATE DATABASE federated;
diff --git a/mysql-test/include/have_blackhole.inc b/mysql-test/include/have_blackhole.inc
index 6c4da01d61d..2ddb0df4eae 100644
--- a/mysql-test/include/have_blackhole.inc
+++ b/mysql-test/include/have_blackhole.inc
@@ -1,4 +1,3 @@
-disable_query_log;
---require r/true.require
-select (support = 'YES' or support = 'DEFAULT') as `TRUE` from information_schema.engines where engine = 'blackhole';
-enable_query_log;
+if (`select (support = 'YES' or support = 'DEFAULT')=0 from information_schema.engines where engine = 'blackhole'`){
+ skip Need blackhole engine;
+}
diff --git a/mysql-test/include/have_bug25714.inc b/mysql-test/include/have_bug25714.inc
deleted file mode 100644
index 0c09ae1a035..00000000000
--- a/mysql-test/include/have_bug25714.inc
+++ /dev/null
@@ -1,7 +0,0 @@
-#
-# Check if the variable MYSQL_BUG25714 is set
-#
---require r/have_bug25714.require
-disable_query_log;
-eval select LENGTH("$MYSQL_BUG25714") > 0 as "have_bug25714_exe";
-enable_query_log;
diff --git a/mysql-test/include/have_federated_db.inc b/mysql-test/include/have_federated_db.inc
deleted file mode 100644
index 041a29f460b..00000000000
--- a/mysql-test/include/have_federated_db.inc
+++ /dev/null
@@ -1,4 +0,0 @@
-disable_query_log;
---require r/true.require
-select (support = 'YES' or support = 'DEFAULT') as `TRUE` from information_schema.engines where engine = 'federated';
-enable_query_log;
diff --git a/mysql-test/include/have_ndbapi_examples.inc b/mysql-test/include/have_ndbapi_examples.inc
index 3ab1f063b61..9ce5dadd510 100644
--- a/mysql-test/include/have_ndbapi_examples.inc
+++ b/mysql-test/include/have_ndbapi_examples.inc
@@ -1,4 +1,4 @@
--require r/have_ndbapi_examples.require
disable_query_log;
-eval select LENGTH("$MY_NDB_EXAMPLES_BINARY") > 0 as "have_ndb_example";
+eval select LENGTH("$NDB_EXAMPLES_BINARY") > 0 as "have_ndb_example";
enable_query_log;
diff --git a/mysql-test/include/loaddata_autocom.inc b/mysql-test/include/loaddata_autocom.inc
index cca56709331..bb286fb4169 100644
--- a/mysql-test/include/loaddata_autocom.inc
+++ b/mysql-test/include/loaddata_autocom.inc
@@ -7,16 +7,20 @@ eval SET SESSION STORAGE_ENGINE = $engine_type;
drop table if exists t1;
--enable_warnings
+let $load_file= $MYSQLTEST_VARDIR/std_data/loaddata2.dat;
+
# NDB does not support the create option 'Binlog of table with BLOB attribute and no PK'
# So use a dummy PK here.
create table t1 (id int unsigned not null auto_increment primary key, a text, b text);
start transaction;
-load data infile '../std_data_ln/loaddata2.dat' into table t1 fields terminated by ',' enclosed by '''' (a, b);
+--replace_result $load_file LOAD_FILE
+eval load data infile '$load_file' into table t1 fields terminated by ',' enclosed by '''' (a, b);
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 '''' (a, b);
+--replace_result $load_file LOAD_FILE
+eval load data infile '$load_file' into table t1 fields terminated by ',' enclosed by '''' (a, b);
rollback;
select count(*) from t1;
diff --git a/mysql-test/include/mix1.inc b/mysql-test/include/mix1.inc
index 7998baa6ccf..799f9dc996d 100644
--- a/mysql-test/include/mix1.inc
+++ b/mysql-test/include/mix1.inc
@@ -623,7 +623,8 @@ 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/bug29807.frm;
+let $MYSQLD_DATADIR= `select @@datadir`;
+copy_file $MYSQLD_DATADIR/test/t1.frm $MYSQLD_DATADIR/test/bug29807.frm;
--error 1146
select * from bug29807;
drop table t1;
diff --git a/mysql-test/include/ndb_backup.inc b/mysql-test/include/ndb_backup.inc
index f0a883d4e11..e6780788fe9 100644
--- a/mysql-test/include/ndb_backup.inc
+++ b/mysql-test/include/ndb_backup.inc
@@ -2,23 +2,21 @@
# 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...
+let $dump_file= $MYSQLTEST_VARDIR/tmp/tmp.dat;
+--exec $NDB_TOOLS_DIR/ndb_select_all --ndb-connectstring="$NDB_CONNECTSTRING" -d sys --delimiter=',' SYSTAB_0 | grep 520093696 > $dump_file
---exec $NDB_TOOLS_DIR/ndb_select_all --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -d sys --delimiter=',' SYSTAB_0 | grep 520093696 > $MYSQLTEST_VARDIR/tmp.dat
+CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
-CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
+--replace_result $dump_file DUMP_FILE
+eval LOAD DATA INFILE '$dump_file' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
-DELETE FROM test.backup_info;
-
-LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
-
---replace_column 1 <the_backup_id>
-
-SELECT @the_backup_id:=backup_id FROM test.backup_info;
+# Load backup id into environment variable
+let the_backup_id=`SELECT backup_id from test.backup_info`;
+DROP TABLE test.backup_info;
-let the_backup_id=`select @the_backup_id`;
+remove_file $dump_file;
-DROP TABLE test.backup_info;
diff --git a/mysql-test/include/ndb_restore_master.inc b/mysql-test/include/ndb_restore_master.inc
index b01a0b58ee9..ae5f055b442 100644
--- a/mysql-test/include/ndb_restore_master.inc
+++ b/mysql-test/include/ndb_restore_master.inc
@@ -3,6 +3,6 @@
# in test cases and can be reused. #
######################################################
---exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -p 8 -b $the_backup_id -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
+--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING" -p 8 -b $the_backup_id -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
---exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -p 8 -b $the_backup_id -n 2 -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
+--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING" -p 8 -b $the_backup_id -n 2 -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
diff --git a/mysql-test/include/ndb_restore_slave_eoption.inc b/mysql-test/include/ndb_restore_slave_eoption.inc
index f1f6cf96881..a8657f68c8d 100644
--- a/mysql-test/include/ndb_restore_slave_eoption.inc
+++ b/mysql-test/include/ndb_restore_slave_eoption.inc
@@ -3,9 +3,9 @@
# in test cases and can be reused. #
######################################################
---exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT_SLAVE" -p 8 -b $the_backup_id -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
+--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING_SLAVE" -p 8 -b $the_backup_id -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
---exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT_SLAVE" -p 8 -b $the_backup_id -n 2 -r -e --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
+--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING_SLAVE" -p 8 -b $the_backup_id -n 2 -r -e --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
diff --git a/mysql-test/include/testdb_only.inc b/mysql-test/include/testdb_only.inc
index ddc3f123d45..528e2f3eb9d 100644
--- a/mysql-test/include/testdb_only.inc
+++ b/mysql-test/include/testdb_only.inc
@@ -19,12 +19,6 @@
# #
###################################################################
---disable_query_log
-eval set @USE_RUNNING_SERVER= '$USE_RUNNING_SERVER';
---require r/testdb_only.require
-SELECT 'use extern server'
- AS "Variable_name ",
- IF(@USE_RUNNING_SERVER= '1','YES',
- IF(@USE_RUNNING_SERVER= '0','NO','UNEXPECTED'))
- AS "Value" ;
---enable_query_log
+if ($USE_RUNNING_SERVER){
+ skip Not with extern server;
+}
diff --git a/mysql-test/install_test_db.sh b/mysql-test/install_test_db.sh
deleted file mode 100644
index e4df8f619cc..00000000000
--- a/mysql-test/install_test_db.sh
+++ /dev/null
@@ -1,115 +0,0 @@
-#!/bin/sh
-# Copyright (C) 1997-2006 MySQL AB
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-# This scripts creates the privilege tables db, host, user, tables_priv,
-# columns_priv in the mysql database, as well as the func table.
-
-if [ x$1 = x"--bin" ]; then
- shift 1
- BINARY_DIST=1
-
- bindir=../bin
- scriptdir=bin
- libexecdir=../libexec
-
- # Check if it's a binary distribution or a 'make install'
- if test -x ../libexec/mysqld
- then
- execdir=../libexec
- elif test -x ../../sbin/mysqld # RPM installation
- then
- execdir=../../sbin
- bindir=../../bin
- scriptdir=../bin
- libexecdir=../../libexec
- else
- execdir=../bin
- fi
- fix_bin=mysql-test
-else
- execdir=../sql
- bindir=../client
- fix_bin=.
- scriptdir=scripts
- libexecdir=../libexec
-fi
-
-vardir=var
-logdir=$vardir/log
-if [ x$1 = x"-slave" ]
-then
- shift 1
- data=var/slave-data
-else
- if [ x$1 = x"-1" ]
- then
- data=var/master-data1
- else
- data=var/master-data
- fi
-fi
-ldata=$fix_bin/$data
-
-mdata=$data/mysql
-EXTRA_ARG=""
-
-mysqld=
-if test -x $execdir/mysqld
-then
- mysqld=$execdir/mysqld
-else
- if test ! -x $libexecdir/mysqld
- then
- echo "mysqld is missing - looked in $execdir and in $libexecdir"
- exit 1
- else
- mysqld=$libexecdir/mysqld
- fi
-fi
-
-# On IRIX hostname is in /usr/bsd so add this to the path
-PATH=$PATH:/usr/bsd
-hostname=`hostname` # Install this too in the user table
-hostname="$hostname%" # Fix if not fully qualified hostname
-
-
-#create the directories
-[ -d $vardir ] || mkdir $vardir
-[ -d $logdir ] || mkdir $logdir
-
-# Create database directories mysql & test
-if [ -d $data ] ; then rm -rf $data ; fi
-mkdir $data $data/mysql $data/test
-
-#for error messages
-if [ x$BINARY_DIST = x1 ] ; then
-basedir=..
-else
-basedir=.
-EXTRA_ARG="--windows"
-fi
-
-INSTALL_CMD="$scriptdir/mysql_install_db --no-defaults $EXTRA_ARG --basedir=$basedir --datadir=mysql-test/$ldata --srcdir=."
-echo "running $INSTALL_CMD"
-
-cd ..
-if $INSTALL_CMD
-then
- exit 0
-else
- echo "Error executing mysqld --bootstrap"
- exit 1
-fi
diff --git a/mysql-test/lib/My/Config.pm b/mysql-test/lib/My/Config.pm
index 5491e341ddc..35273f08cf7 100644
--- a/mysql-test/lib/My/Config.pm
+++ b/mysql-test/lib/My/Config.pm
@@ -4,6 +4,7 @@ package My::Config::Option;
use strict;
use warnings;
+use Carp;
sub new {
@@ -31,7 +32,7 @@ package My::Config::Group;
use strict;
use warnings;
-
+use Carp;
sub new {
my ($class, $group_name)= @_;
@@ -68,7 +69,7 @@ sub remove {
return undef unless defined $option;
# Remove from the hash
- delete($self->{options_by_name}->{$option_name}) or die;
+ delete($self->{options_by_name}->{$option_name}) or croak;
# Remove from the array
@{$self->{options}}= grep { $_->name ne $option_name } @{$self->{options}};
@@ -88,6 +89,33 @@ sub name {
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 after {
+ my ($self, $prefix)= @_;
+ die unless defined $prefix;
+
+ # everything after $prefix
+ my $name= $self->{name};
+ if ($name =~ /^\Q$prefix\E(.*)$/)
+ {
+ return $1;
+ }
+ die "Failed to extract the value after '$prefix' in $name";
+}
+
+
+sub split {
+ my ($self)= @_;
+ # Return an array with name parts
+ return split(/\./, $self->{name});
+}
#
# Return a specific option in the group
@@ -100,23 +128,37 @@ sub option {
#
-# Return a specific value for an option in the group
+# 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);
- die "No option named '$option_name' in this group"
+ croak "No option named '$option_name' in group '$self->{name}'"
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;
@@ -132,13 +174,13 @@ sub new {
my $self= bless { groups => [] }, $class;
my $F= IO::File->new($path, "<")
- or die "Could not open '$path': $!";
+ or croak "Could not open '$path': $!";
while ( my $line= <$F> ) {
chomp($line);
# [group]
- if ( $line =~ /\[(.*)\]/ ) {
+ if ( $line =~ /^\[(.*)\]/ ) {
# New group found
$group_name= $1;
#print "group: $group_name\n";
@@ -149,7 +191,7 @@ sub new {
# Magic #! comments
elsif ( $line =~ /^#\!/) {
my $magic= $line;
- die "Found magic comment '$magic' outside of group"
+ croak "Found magic comment '$magic' outside of group"
unless $group_name;
#print "$magic\n";
@@ -171,8 +213,13 @@ sub new {
# !include <filename>
elsif ( $line =~ /^\!include\s*(.*?)\s*$/ ) {
my $include_file_name= dirname($path)."/".$1;
- # Check that the file exists
- die "The include file '$include_file_name' does not exist"
+
+ # Check that the file exists relative to path of first config file
+ if (! -f $include_file_name){
+ # Try to include file relativ to current dir
+ $include_file_name= $1;
+ }
+ croak "The include file '$include_file_name' does not exist"
unless -f $include_file_name;
$self->append(My::Config->new($include_file_name));
@@ -182,7 +229,7 @@ sub new {
elsif ( $line =~ /^([\@\w-]+)\s*$/ ) {
my $option= $1;
- die "Found option '$option' outside of group"
+ croak "Found option '$option' outside of group"
unless $group_name;
#print "$option\n";
@@ -194,13 +241,13 @@ sub new {
my $option= $1;
my $value= $2;
- die "Found option '$option=$value' outside of group"
+ croak "Found option '$option=$value' outside of group"
unless $group_name;
#print "$option=$value\n";
$self->insert($group_name, $option, $value);
} else {
- die "Unexpected line '$line' found in '$path'";
+ croak "Unexpected line '$line' found in '$path'";
}
}
@@ -231,6 +278,7 @@ sub insert {
# Add the option to the group
$group->insert($option, $value, $if_not_exist);
}
+ return $group;
}
#
@@ -240,11 +288,11 @@ sub remove {
my ($self, $group_name, $option_name)= @_;
my $group= $self->group($group_name);
- die "group '$group_name' does not exist"
+ croak "group '$group_name' does not exist"
unless defined($group);
$group->remove($option_name) or
- die "option '$option_name' does not exist";
+ croak "option '$option_name' does not exist";
}
@@ -267,10 +315,10 @@ sub group_exists {
#
sub _group_insert {
my ($self, $group_name)= @_;
- caller eq __PACKAGE__ or die;
+ caller eq __PACKAGE__ or croak;
# Check that group does not already exist
- die "Group already exists" if $self->group_exists($group_name);
+ croak "Group already exists" if $self->group_exists($group_name);
my $group= My::Config::Group->new($group_name);
push(@{$self->{groups}}, $group);
@@ -354,11 +402,11 @@ sub value {
my ($self, $group_name, $option_name)= @_;
my $group= $self->group($group_name);
- die "group '$group_name' does not exist"
+ croak "group '$group_name' does not exist"
unless defined($group);
my $option= $group->option($option_name);
- die "option '$option_name' does not exist"
+ croak "option '$option_name' does not exist"
unless defined($option);
return $option->value();
@@ -372,7 +420,7 @@ sub exists {
my ($self, $group_name, $option_name)= @_;
my $group= $self->group($group_name);
- die "group '$group_name' does not exist"
+ croak "group '$group_name' does not exist"
unless defined($group);
my $option= $group->option($option_name);
@@ -412,11 +460,11 @@ sub stringify {
# Save the config to named file
#
sub save {
- my ($self, $path)= @_;
- my $F= IO::File->new($path, ">")
- or die "Could not open '$path': $!";
- print $F $self;
- undef $F; # Close the file
+ 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 --git a/mysql-test/lib/My/ConfigFactory.pm b/mysql-test/lib/My/ConfigFactory.pm
new file mode 100644
index 00000000000..f176ccbeab3
--- /dev/null
+++ b/mysql-test/lib/My/ConfigFactory.pm
@@ -0,0 +1,583 @@
+# -*- 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 get_basedir {
+ my ($self, $group)= @_;
+ my $basedir= $group->if_exist('basedir') ||
+ $self->{ARGS}->{basedir};
+ return $basedir;
+}
+
+
+sub fix_charset_dir {
+ my ($self, $config, $group_name, $group)= @_;
+ return my_find_dir($self->get_basedir($group),
+ \@share_locations, "charsets");
+}
+
+sub fix_language {
+ my ($self, $config, $group_name, $group)= @_;
+ return my_find_dir($self->get_basedir($group),
+ \@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 is_unique {
+ my ($config, $name, $value)= @_;
+
+ foreach my $group ( $config->groups() ) {
+ if ($group->option($name)) {
+ if ($group->value($name) eq $value){
+ return 0;
+ }
+ }
+ }
+ return 1;
+}
+
+sub fix_server_id {
+ my ($self, $config, $group_name, $group)= @_;
+#define in the order that mysqlds are listed in my.cnf
+
+ my $server_id= $group->if_exist('server-id');
+ if (defined $server_id){
+ if (!is_unique($config, 'server-id', $server_id)) {
+ croak "The server-id($server_id) for '$group_name' is not unique";
+ }
+ return $server_id;
+ }
+
+ do {
+ $server_id= $self->{SERVER_ID}++;
+ } while(!is_unique($config, 'server-id', $server_id));
+
+ #print "$group_name: server_id: $server_id\n";
+ return $server_id;
+}
+
+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, $config, $group_name, $group)= @_;
+ my $basedir= $self->get_basedir($group);
+ 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_client_cert {
+ my $std_data= fix_std_data(@_);
+ return "$std_data/client-cert.pem"
+}
+
+sub fix_ssl_server_key {
+ my $std_data= fix_std_data(@_);
+ return "$std_data/server-key.pem"
+}
+
+sub fix_ssl_client_key {
+ my $std_data= fix_std_data(@_);
+ return "$std_data/client-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' => \&fix_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";
+}
+
+
+sub fix_cluster_backup_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/";
+}
+
+
+#
+# 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 },
+ { 'BackupDataDir' => \&fix_cluster_backup_dir },
+);
+
+
+#
+# Rules to run for each cluster_config section
+# - will be run in order listed here
+#
+my @cluster_config_rules=
+(
+ { 'ndb_mgmd' => \&fix_host },
+ { 'ndbd' => \&fix_host },
+ { 'mysqld' => \&fix_host },
+ { 'ndbapi' => \&fix_host },
+);
+
+
+#
+# Rules to run for [client] section
+# - will be run in order listed here
+#
+my @client_rules=
+(
+);
+
+
+#
+# Rules to run for [mysqltest] section
+# - will be run in order listed here
+#
+my @mysqltest_rules=
+(
+ { 'loose-ssl-ca' => \&fix_ssl_ca },
+ { 'loose-ssl-cert' => \&fix_ssl_client_cert },
+ { 'loose-ssl-key' => \&fix_ssl_client_key },
+);
+
+
+#
+# Rules to run for [mysqlbinlog] section
+# - will be run in order listed here
+#
+my @mysqlbinlog_rules=
+(
+ { 'character-sets-dir' => \&fix_charset_dir },
+);
+
+
+#
+# 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->after('mysqld'),
+ $mysqld->name())
+ }
+
+}
+
+
+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 croak "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");
+ }
+ }
+ croak "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 $after= $mysqld->after('cluster_config.mysqld');
+ $config->insert("mysqld$after",
+ 'ndb_connectstring', $ndb_connectstring);
+ }
+ }
+ }
+}
+
+#
+# Rules to run last of all
+#
+my @post_rules=
+(
+ \&post_check_client_groups,
+ \&post_fix_mysql_cluster_section,
+ \&post_fix_resolve_at_variables,
+);
+
+
+sub run_rules_for_group {
+ my ($self, $config, $group, @rules)= @_;
+ 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_section_rules {
+ my ($self, $config, $name, @rules)= @_;
+
+ foreach my $group ( $config->like($name) ) {
+ $self->run_rules_for_group($config, $group, @rules);
+ }
+}
+
+
+sub run_generate_sections_from_cluster_config {
+ my ($self, $config)= @_;
+
+ my @options= ('ndb_mgmd', 'ndbd',
+ 'mysqld', 'ndbapi');
+
+ foreach my $group ( $config->like('cluster_config.') ) {
+
+ # Keep track of current index per process type
+ my %idxes;
+ map { $idxes{$_}= 1; } @options;
+
+ foreach my $option_name ( @options ) {
+ my $value= $group->value($option_name);
+ my @hosts= split(/,/, $value, -1); # -1 => return also empty strings
+
+ # Add at least one host
+ push(@hosts, undef) unless scalar(@hosts);
+
+ # 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("mysqld.$idx$suffix",
+ '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);
+
+ # [mysqlbinlog] need additional settings
+ $self->run_rules_for_group($config,
+ $config->insert('mysqlbinlog'),
+ @mysqlbinlog_rules);
+
+ # Additional reuls required for [client]
+ $self->run_rules_for_group($config,
+ $config->insert('client'),
+ @client_rules);
+
+
+ # Additional reuls required for [mysqltest]
+ $self->run_rules_for_group($config,
+ $config->insert('mysqltest'),
+ @mysqltest_rules);
+
+ {
+ # Run post rules
+ foreach my $rule ( @post_rules ) {
+ &$rule($self, $config);
+ }
+ }
+
+ return $config;
+}
+
+
+1;
+
diff --git a/mysql-test/lib/My/File/Path.pm b/mysql-test/lib/My/File/Path.pm
new file mode 100644
index 00000000000..b6056bf470f
--- /dev/null
+++ b/mysql-test/lib/My/File/Path.pm
@@ -0,0 +1,83 @@
+# -*- cperl -*-
+package My::File::Path;
+use strict;
+
+
+#
+# File::Path::rmtree has a problem with deleting files
+# and directories where it hasn't got read permission
+#
+# Patch this by installing a 'rmtree' function in local
+# scope that first chmod all files to 0777 before calling
+# the original rmtree function.
+#
+# This is almost gone in version 1.08 of File::Path -
+# but unfortunately some hosts still suffers
+# from this also in 1.08
+#
+
+use Exporter;
+use base "Exporter";
+our @EXPORT= qw / rmtree mkpath copytree /;
+
+
+use File::Find;
+use File::Path;
+use File::Copy;
+use Carp;
+
+no warnings 'redefine';
+
+sub rmtree {
+ my ($dir)= @_;
+
+ #
+ # chmod all files to 0777 before calling rmtree
+ #
+ find( {
+ no_chdir => 1,
+ wanted => sub {
+ chmod(0777, $_)
+ or warn("couldn't chmod(0777, $_): $!");
+ }
+ },
+ $dir
+ );
+
+
+ # Call rmtree from File::Path
+ goto &File::Path::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 --git a/mysql-test/lib/My/Find.pm b/mysql-test/lib/My/Find.pm
new file mode 100644
index 00000000000..8b996ce45a4
--- /dev/null
+++ b/mysql-test/lib/My/Find.pm
@@ -0,0 +1,171 @@
+# -*- cperl -*-
+# Copyright (C) 2004-2006 MySQL AB
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+
+package My::Find;
+
+#
+# Utility functions to find files in a MySQL source or bindist
+#
+
+use strict;
+
+use base qw(Exporter);
+our @EXPORT= qw(my_find_bin my_find_dir);
+
+our $vs_config_dir;
+
+my $is_win= ($^O eq "MSWin32" or $^O eq "Win32");
+
+#
+# my_find_bin - find an executable with "name_1...name_n" in
+# paths "path_1...path_n" and return the full path
+#
+# Example:
+# my $mysqld_exe= my_find_bin($basedir.
+# ["sql", "bin"],
+# ["mysqld", "mysqld-debug"]);
+# my $mysql_exe= my_find_bin($basedir,
+# ["client", "bin"],
+# "mysql");
+#
+# NOTE: The function honours MTR_VS_CONFIG environment variable
+#
+#
+sub my_find_bin {
+ 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($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 );
+ }
+ find_error($base, $paths, $dirs);
+}
+
+
+sub my_find_paths {
+ my ($base, $paths, $names)= @_;
+
+ # Convert the arguments into two normal arrays to ease
+ # further mappings
+ my (@names, @paths);
+ push(@names, ref $names eq "ARRAY" ? @$names : $names);
+ push(@paths, ref $paths eq "ARRAY" ? @$paths : $paths);
+
+ #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= $vs_config_dir || $ENV{MTR_VS_CONFIG} || $ENV{MTR_BUILD_DIR};
+ push(@extra_dirs, $build_dir) if defined $build_dir;
+
+ # -------------------------------------------------------
+ # Windows specific
+ # -------------------------------------------------------
+ if ($is_win) {
+ # Append .exe to names, if name does not already have extension
+ map { $_.=".exe" unless /\.(.*)+$/ } @names;
+
+ # Add the default extra build dirs unless a specific one has
+ # already been selected
+ push(@extra_dirs,
+ ("release",
+ "relwithdebinfo",
+ "debug")) if @extra_dirs == 0;
+ }
+
+ #print "extra_build_dir: @extra_dirs\n";
+
+ # -------------------------------------------------------
+ # Build cross product of "paths * extra_build_dirs"
+ # -------------------------------------------------------
+ push(@paths, map { my $path= $_;
+ map { "$path/$_" } @extra_dirs
+ } @paths);
+ #print "paths: @paths\n";
+
+ # -------------------------------------------------------
+ # Build cross product of "paths * names"
+ # -------------------------------------------------------
+ @paths= map { my $path= $_;
+ map { "$path/$_" } @names
+ } @paths;
+ #print "paths: @paths\n";
+
+ # -------------------------------------------------------
+ # Prepend base to all paths
+ # -------------------------------------------------------
+ @paths= map { "$base/$_" } @paths;
+ #print "paths: @paths\n";
+
+ # -------------------------------------------------------
+ # 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 --git a/mysql-test/lib/My/SafeProcess.pm b/mysql-test/lib/My/SafeProcess.pm
new file mode 100644
index 00000000000..7e1f699ee25
--- /dev/null
+++ b/mysql-test/lib/My/SafeProcess.pm
@@ -0,0 +1,502 @@
+# -*- cperl -*-
+# Copyright (C) 2004-2006 MySQL AB
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+package My::SafeProcess;
+
+#
+# Class that encapsulates process creation, monitoring and cleanup
+#
+# Spawns a monitor process which spawns a new process locally or
+# remote using subclasses My::Process::Local or My::Process::Remote etc.
+#
+# The monitor process runs a simple event loop more or less just
+# waiting for a reason to zap the process it monitors. Thus the user
+# of this class does not need to care about process cleanup, it's
+# handled automatically.
+#
+# The monitor process wait for:
+# - the parent process to close the pipe, in that case it
+# will zap the "monitored process" and exit
+# - the "monitored process" to exit, in which case it will exit
+# itself with same exit code as the "monitored process"
+# - the parent process to send the "shutdown" signal in wich case
+# monitor will kill the "monitored process" hard and exit
+#
+#
+# When used it will look something like this:
+# $> ps
+# [script.pl]
+# - [monitor for `mysqld`]
+# - [mysqld]
+# - [monitor for `mysqld`]
+# - [mysqld]
+# - [monitor for `mysqld`]
+# - [mysqld]
+#
+#
+
+use strict;
+
+use POSIX qw(WNOHANG);
+
+use My::SafeProcess::Base;
+use base 'My::SafeProcess::Base';
+
+use My::Find;
+
+my %running;
+
+BEGIN {
+ if ($^O eq "MSWin32") {
+ eval 'sub IS_WIN32PERL () { 1 }';
+ }
+ else {
+ eval 'sub IS_WIN32PERL () { 0 }';
+ }
+ if ($^O eq "cygwin") {
+ eval 'sub IS_CYGWIN () { 1 }';
+ # Make sure cygpath works
+ if ((system("cygpath > /dev/null 2>&1") >> 8) != 1){
+ die "Could not execute 'cygpath': $!";
+ }
+ eval 'sub fixpath {
+ my ($path)= @_;
+ return unless defined $path;
+ $path= `cygpath -w $path`;
+ chomp $path;
+ return $path;
+ }';
+ }
+ else {
+ eval 'sub IS_CYGWIN () { 0 }';
+ }
+}
+
+# Find the safe process binary or script
+my $safe_path= $^X; # Path to perl binary
+my $safe_script;
+my $safe_kill;
+if (IS_WIN32PERL or IS_CYGWIN){
+ # Use my_safe_process.exe
+ $safe_path= my_find_bin(("extra","bin"), "my_safe_process.exe");
+ die "Could not find my_safe_process.exe" unless $safe_path;
+
+ # Use my_safe_kill.exe
+ $safe_path= my_find_bin(("extra","bin"), "my_safe_kill");
+ die "Could not find my_safe_kill.exe" unless $safe_kill;
+}
+else {
+ # Use safe_process.pl
+ $safe_script= "lib/My/SafeProcess/safe_process.pl";
+ $safe_script= "../$safe_script" unless -f $safe_script;
+ die "Could not find safe_process.pl" unless -f $safe_script;
+}
+
+
+sub new {
+ my $class= shift;
+
+ my %opts=
+ (
+ verbose => 0,
+ @_
+ );
+
+ my $path = delete($opts{'path'}) or die "path required";
+ my $args = delete($opts{'args'}) or die "args required";
+ my $input = delete($opts{'input'});
+ my $output = delete($opts{'output'});
+ my $error = delete($opts{'error'});
+ my $verbose = delete($opts{'verbose'});
+ my $host = delete($opts{'host'});
+ my $shutdown = delete($opts{'shutdown'});
+
+ if (defined $host) {
+ $safe_script= "lib/My/SafeProcess/safe_process_cpcd.pl";
+ }
+
+ if (IS_CYGWIN){
+ # safe_procss is a windows program and need
+ # windows paths
+ $path= fixpath($path);
+ $input= fixpath($input);
+ $output= fixpath($output);
+ $error= fixpath($error);
+ }
+
+ my @safe_args;
+ push(@safe_args, $safe_script) if defined $safe_script;
+
+ push(@safe_args, "--verbose") if $verbose > 0;
+
+ # Point the safe_process at the right parent if running on cygwin
+ push(@safe_args, "--parent-pid=".Cygwin::pid_to_winpid($$)) if IS_CYGWIN;
+
+ push(@safe_args, "--");
+ push(@safe_args, $path); # The program safe_process should execute
+ push(@safe_args, @$$args);
+
+ print "### safe_path: ", $safe_path, " ", join(" ", @safe_args), "\n"
+ if $verbose > 1;
+
+ my ($pid, $winpid)= create_process(
+ path => $safe_path,
+ input => $input,
+ output => $output,
+ error => $error,
+ append => $opts{append},
+ args => \@safe_args,
+ );
+
+ my $name = delete($opts{'name'}) || "SafeProcess$pid";
+ my $proc= bless
+ ({
+ SAFE_PID => $pid,
+ SAFE_WINPID => $winpid,
+ SAFE_NAME => $name,
+ SAFE_SHUTDOWN => $shutdown,
+ }, $class);
+
+ # Put the new process in list of running
+ $running{$pid}= $proc;
+ return $proc;
+
+}
+
+
+sub run {
+ my $proc= new(@_);
+ $proc->wait_one();
+ return $proc->exit_status();
+}
+
+#
+# Start a process that returns after "duration" seconds
+# or when it's parent process does not exist anymore
+#
+sub timer {
+ my $class= shift;
+ my $duration= shift or die "duration required";
+ my $parent_pid= $$;
+
+ my $pid= My::SafeProcess::Base::_safe_fork();
+ if ($pid){
+ # Parent
+ my $proc= bless
+ ({
+ SAFE_PID => $pid,
+ SAFE_NAME => "timer",
+ }, $class);
+
+ # Put the new process in list of running
+ $running{$pid}= $proc;
+ return $proc;
+ }
+
+ # Child, install signal handlers and sleep for "duration"
+ $SIG{INT}= 'DEFAULT';
+
+ $SIG{TERM}= sub {
+ #print STDERR "timer $$: woken up, exiting!\n";
+ exit(0);
+ };
+
+ $0= "safe_timer($duration)";
+ my $count_down= $duration;
+ while($count_down--){
+
+ # Check that parent is still alive
+ if (kill(0, $parent_pid) == 0){
+ #print STDERR "timer $$: parent gone, exiting!\n";
+ exit(0);
+ }
+
+ sleep(1);
+ }
+ print STDERR "timer $$: expired after $duration seconds\n";
+ exit(0);
+}
+
+
+#
+# Shutdown process nicely, and wait for shutdown_timeout seconds
+# If processes hasn't shutdown, kill them hard and wait for return
+#
+sub shutdown {
+ my $shutdown_timeout= shift;
+ my @processes= @_;
+
+ return if (@processes == 0);
+
+ #print "shutdown: @processes\n";
+
+ # Call shutdown function if process has one, else
+ # use kill
+ foreach my $proc (@processes){
+ my $shutdown= $proc->{SAFE_SHUTDOWN};
+ if ($shutdown_timeout > 0 and defined $shutdown){
+ $shutdown->();
+ }
+ else {
+ $proc->start_kill();
+ }
+ }
+
+ my @kill_processes= ();
+
+ # Wait for shutdown_timeout for processes to exit
+ foreach my $proc (@processes){
+ my $ret= $proc->wait_one($shutdown_timeout);
+ if ($ret != 0) {
+ push(@kill_processes, $proc);
+ }
+ # Only wait for the first process with shutdown timeout
+ $shutdown_timeout= 0;
+ }
+
+ # Return if all servers has exited
+ return if (@kill_processes == 0);
+
+ foreach my $proc (@kill_processes){
+ $proc->start_kill();
+ }
+
+ foreach my $proc (@kill_processes){
+ $proc->wait_one();
+ }
+ return;
+}
+
+
+#
+# Tell the process to die as fast as possible
+#
+sub start_kill {
+ my ($self)= @_;
+ die "usage: \$safe_proc->start_kill()" unless (@_ == 1 and ref $self);
+ #print "start_kill $self\n";
+
+ if (defined $safe_kill and $self->{SAFE_WINPID}){
+ # Use my_safe_kill to tell my_safe_process
+ # it's time to kill it's child and return
+ my $pid= $self->{SAFE_WINPID};
+ my $ret= system($safe_kill, $pid);
+ #print STDERR "start_kill, safe_killed $pid, ret: $ret\n";
+ } else {
+ my $pid= $self->{SAFE_PID};
+ die "Can't kill not started process" unless defined $pid;
+ my $ret= kill(15, $pid);
+ #print STDERR "start_kill, sent signal 15 to $pid, ret: $ret\n";
+ }
+ return 1;
+}
+
+
+#
+# Kill the process as fast as possible
+# and wait for it to return
+#
+sub kill {
+ my ($self)= @_;
+ die "usage: \$safe_proc->kill()" unless (@_ == 1 and ref $self);
+
+ $self->start_kill();
+ $self->wait_one();
+ return 1;
+}
+
+
+sub _collect {
+ my ($self)= @_;
+
+ #print "_collect\n";
+ $self->{EXIT_STATUS}= $?;
+
+ # Take the process out of running list
+ my $pid= $self->{SAFE_PID};
+ die unless delete($running{$pid});
+}
+
+
+# Wait for process to exit
+# optionally with a timeout
+#
+# timeout
+# undef -> wait blocking infinitely
+# 0 -> just poll with WNOHANG
+# >0 -> wait blocking for max timeout seconds
+#
+# RETURN VALUES
+# 0 Not running
+# 1 Still running
+#
+sub wait_one {
+ my ($self, $timeout)= @_;
+ die "usage: \$safe_proc->wait_one([timeout])" unless ref $self;
+
+ #print "wait_one $self, $timeout\n";
+
+ if ( ! defined($self->{SAFE_PID}) ) {
+ # No pid => not running
+ return 0;
+ }
+
+ if ( defined $self->{EXIT_STATUS} ) {
+ # Exit status already set => not running
+ return 0;
+ }
+
+ my $pid= $self->{SAFE_PID};
+
+ 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 $use_alarm;
+
+ $retpid= waitpid($pid, $blocking ? 0 : &WNOHANG);
+
+ alarm(0) if $use_alarm;
+ };
+
+ if ($@)
+ {
+ die "Got unexpected: $@" if ($@ !~ /waitpid timeout/);
+ if (!defined $retpid) {
+ # Got timeout
+ return 1;
+ }
+ # Got pid _and_ alarm, continue
+ }
+
+ if ( $retpid == 0 ) {
+ # 0 => still running
+ return 1;
+ }
+
+ if ( not $blocking and $retpid == -1 ) {
+ # still running
+ return 1;
+ }
+
+ warn "wait_one: expected pid $pid but got $retpid"
+ unless( $retpid == $pid );
+
+ $self->_collect();
+ return 0;
+}
+
+
+#
+# Wait for any process to exit
+#
+# Returns a reference to the SafeProcess that
+# exited or undefined
+#
+sub wait_any {
+ my $ret_pid;
+ if (IS_WIN32PERL) {
+ # Can't wait for -1 => use a polling loop
+ do {
+ Win32::Sleep(10); # 10 milli seconds
+ foreach my $pid (keys %running){
+ $ret_pid= waitpid($pid, &WNOHANG);
+ last if $pid == $ret_pid;
+ }
+ } while ($ret_pid == 0);
+
+ # Special processig of return code
+ # since negative pids are valid
+ if ($ret_pid == 0 or $ret_pid == -1) {
+ print STDERR "wait_any, got invalid pid: $ret_pid\n";
+ return undef;
+ }
+ }
+ else
+ {
+ $ret_pid= waitpid(-1, 0);
+ if ($ret_pid <= 0){
+ # No more processes to wait for
+ print STDERR "wait_any, got invalid pid: $ret_pid\n";
+ return undef;
+ }
+ }
+
+ # Look it up in "running" table
+ my $proc= $running{$ret_pid};
+ unless (defined $proc){
+ print STDERR "Could not find pid in running list\n";
+ print STDERR "running: ". join(", ", keys(%running)). "\n";
+ return undef;
+ }
+ $proc->_collect;
+ return $proc;
+}
+
+#
+# Overload string operator
+# and fallback to default functions if no
+# overloaded function is found
+#
+use overload
+ '""' => \&self2str,
+ fallback => 1;
+
+
+#
+# Return the process as a nicely formatted string
+#
+sub self2str {
+ my ($self)= @_;
+ my $pid= $self->{SAFE_PID};
+ my $winpid= $self->{SAFE_WINPID};
+ my $name= $self->{SAFE_NAME};
+ my $exit_status= $self->{EXIT_STATUS};
+
+ my $str= "[$name - pid: $pid";
+ $str.= ", winpid: $winpid" if defined $winpid;
+ $str.= ", exit: $exit_status" if defined $exit_status;
+ $str.= "]";
+}
+
+
+1;
diff --git a/mysql-test/lib/My/SafeProcess/Base.pm b/mysql-test/lib/My/SafeProcess/Base.pm
new file mode 100644
index 00000000000..2f3cf9d037a
--- /dev/null
+++ b/mysql-test/lib/My/SafeProcess/Base.pm
@@ -0,0 +1,236 @@
+# -*- cperl -*-
+# Copyright (C) 2004-2006 MySQL AB
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+# This is a library file used by the Perl version of mysql-test-run,
+# and is part of the translation of the Bourne shell script with the
+# same name.
+
+use strict;
+
+package My::SafeProcess::Base;
+
+#
+# Utility functions for Process management
+#
+
+use Carp;
+use IO::Pipe;
+
+use base qw(Exporter);
+our @EXPORT= qw(create_process);
+
+
+sub winpid {
+ my ($pid)= @_;
+
+ return undef unless $^O eq "cygwin";
+
+ # The child get a new winpid when the exec takes
+ # place, wait for that to happen
+ my $winpid;
+ my $delay= 0;
+ do
+ {
+ # Yield to the child
+ select(undef, undef, undef, $delay);
+ # Increase the delay slightly for each loop
+ $delay += 0.000001;
+
+ $winpid= Cygwin::pid_to_winpid($pid);
+
+ } until ($winpid != $pid);
+
+ return $winpid;
+}
+
+
+
+#
+# safe_fork
+# Retry a couple of times if fork returns EAGAIN
+#
+sub _safe_fork {
+ my $retries= 5;
+ my $pid;
+
+ FORK:
+ {
+ $pid= fork;
+ if ( not defined($pid)) {
+
+ croak("fork failed after: $!") if (!$retries--);
+
+ warn("fork failed sleep 1 second and redo: $!");
+ sleep(1);
+ redo FORK;
+ }
+ }
+
+ return $pid;
+};
+
+
+#
+# Decode exit status
+#
+sub exit_status {
+ my $self= shift;
+ my $raw= $self->{EXIT_STATUS};
+
+ croak("Can't call exit_status before process has died")
+ unless defined $raw;
+
+ if ($raw & 127)
+ {
+ # Killed by signal
+ my $signal_num= $raw & 127;
+ my $dumped_core= $raw & 128;
+ return 1; # Return error code
+ }
+ else
+ {
+ # Normal process exit
+ return $raw >> 8;
+ };
+}
+
+
+#
+# Create a new process
+# Return pid of the new process
+#
+sub create_process {
+ my %opts=
+ (
+ @_
+ );
+
+ my $path = delete($opts{'path'}) or die "path required";
+ my $args = delete($opts{'args'}) or die "args required";
+ my $input = delete($opts{'input'});
+ my $output = delete($opts{'output'});
+ my $error = delete($opts{'error'});
+
+ my $open_mode= $opts{append} ? ">>" : ">";
+
+ if ($^O eq "MSWin32"){
+
+ #printf STDERR "stdin %d, stdout %d, stderr %d\n",
+ # fileno STDIN, fileno STDOUT, fileno STDERR;
+
+ # input output redirect
+ my ($oldin, $oldout, $olderr);
+ open $oldin, '<&', \*STDIN or die "Failed to save old stdin: $!";
+ open $oldout, '>&', \*STDOUT or die "Failed to save old stdout: $!";
+ open $olderr, '>&', \*STDERR or die "Failed to save old stderr: $!";
+
+ if ( $input ) {
+ if ( ! open(STDIN, "<", $input) ) {
+ croak("can't redirect STDIN to '$input': $!");
+ }
+ }
+
+ if ( $output ) {
+ if ( ! open(STDOUT, $open_mode, $output) ) {
+ croak("can't redirect STDOUT to '$output': $!");
+ }
+ }
+
+ if ( $error ) {
+ if ( $output eq $error ) {
+ if ( ! open(STDERR, ">&STDOUT") ) {
+ croak("can't dup STDOUT: $!");
+ }
+ }
+ elsif ( ! open(STDERR, $open_mode, $error) ) {
+ croak("can't redirect STDERR to '$error': $!");
+ }
+ }
+
+
+ # Magic use of 'system(1, @args)' to spawn a process
+ # and get a proper Win32 pid
+ unshift (@$args, $path);
+ my $pid= system(1, @$args);
+ if ( $pid == 0 ){
+ print $olderr "create_process failed: $^E\n";
+ die "create_process failed: $^E";
+ }
+
+ # Retore IO redirects
+ open STDERR, '>&', $olderr
+ or croak("unable to reestablish STDERR");
+ open STDOUT, '>&', $oldout
+ or croak("unable to reestablish STDOUT");
+ open STDIN, '<&', $oldin
+ 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;
+
+ }
+
+ local $SIG{PIPE}= sub { print STDERR "Got signal $@\n"; };
+ my $pipe= IO::Pipe->new();
+ my $pid= _safe_fork();
+ if ($pid){
+ # Parent
+ $pipe->reader();
+ my $line= <$pipe>; # Wait for child to say it's ready
+ return wantarray ? ($pid, winpid($pid)) : $pid;
+ }
+
+ $SIG{INT}= 'DEFAULT';
+
+ # Make this process it's own process group to be able to kill
+ # it and any childs(that hasn't changed group themself)
+ setpgrp(0,0) if $opts{setpgrp};
+
+ if ( $output and !open(STDOUT, $open_mode, $output) ) {
+ croak("can't redirect STDOUT to '$output': $!");
+ }
+
+ if ( $error ) {
+ if ( defined $output and $output eq $error ) {
+ if ( ! open(STDERR, ">&STDOUT") ) {
+ croak("can't dup STDOUT: $!");
+ }
+ }
+ elsif ( ! open(STDERR, $open_mode, $error) ) {
+ croak("can't redirect STDERR to '$error': $!");
+ }
+ }
+
+ if ( $input ) {
+ if ( ! open(STDIN, "<", $input) ) {
+ croak("can't redirect STDIN to '$input': $!");
+ }
+ }
+
+ # Tell parent to continue
+ $pipe->writer();
+ print $pipe "ready\n";
+
+ if ( !exec($path, @$args) ){
+ croak("Failed to exec '$path': $!");
+ }
+
+ croak("Should never come here");
+
+}
+
+1;
+
diff --git a/mysql-test/lib/My/SafeProcess/safe_kill_win.cc b/mysql-test/lib/My/SafeProcess/safe_kill_win.cc
new file mode 100755
index 00000000000..8049f626c93
--- /dev/null
+++ b/mysql-test/lib/My/SafeProcess/safe_kill_win.cc
@@ -0,0 +1,56 @@
+/* Copyright (C) 2004 MySQL AB
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+
+/*
+ Utility program used to signal a safe_process it's time to shutdown
+
+ Usage:
+ safe_kill <pid>
+*/
+
+#include <windows.h>
+#include <stdio.h>
+
+int main(int argc, const char** argv )
+{
+ DWORD pid= -1;
+ HANDLE shutdown_event;
+ char safe_process_name[32]= {0};
+
+ if (argc != 2) {
+ fprintf(stderr, "safe_kill <pid>\n");
+ exit(2);
+ }
+ pid= atoi(argv[1]);
+
+ _snprintf(safe_process_name, sizeof(safe_process_name), "safe_process[%d]", pid);
+
+ /* Open the event to signal */
+ if ((shutdown_event=
+ OpenEvent(EVENT_MODIFY_STATE, FALSE, safe_process_name)) == NULL){
+ fprintf(stderr, "Failed to open shutdown_event\n");
+ exit(1);
+ }
+
+ if(SetEvent(shutdown_event) == 0) {
+ fprintf(stderr, "Failed to signal shutdown_event\n");
+ CloseHandle(shutdown_event);
+ exit(1);
+ }
+ CloseHandle(shutdown_event);
+ exit(0);
+}
+
diff --git a/mysql-test/lib/My/SafeProcess/safe_process.pl b/mysql-test/lib/My/SafeProcess/safe_process.pl
new file mode 100644
index 00000000000..707f78d36bd
--- /dev/null
+++ b/mysql-test/lib/My/SafeProcess/safe_process.pl
@@ -0,0 +1,141 @@
+#!/usr/bin/perl
+# -*- cperl -*-
+
+use strict;
+use warnings;
+
+use Time::localtime;
+use lib 'lib';
+use My::SafeProcess::Base;
+use POSIX qw(WNOHANG);
+
+###########################################################################
+# Util functions
+###########################################################################
+
+#
+#Print message to stderr
+#
+my $verbose= 0;
+sub message {
+ 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 $terminated= 0;
+
+# Protect against being killed in the middle
+# of child creation, just set the terminated flag
+# to make sure the child will be killed off
+# when program is ready to do that
+$SIG{TERM}= sub { message("!Got signal @_"); $terminated= 1; };
+$SIG{INT}= sub { message("!Got signal @_"); $terminated= 1; };
+
+my $parent_pid= getppid();
+
+use Getopt::Long;
+GetOptions(
+ 'verbose' => \$verbose,
+ ) or die "GetOptions failed";
+shift(@ARGV) if defined($ARGV[0]) and $ARGV[0] eq "--";
+my $path= shift(@ARGV); # Executable
+
+die "usage:\n" .
+ " safe_process.pl [opts] -- <path> [<args> [...<args_n>]]"
+ unless defined $path;
+
+
+message("started");
+#message("path: '$path'");
+message("parent: $parent_pid");
+
+# Start process to monitor
+my $child_pid=
+ create_process(
+ path => $path,
+ args => \@ARGV,
+ setpgrp => 1,
+ );
+message("Started child $child_pid");
+
+eval {
+ sub handle_signal {
+ $terminated= 1;
+ message("Got signal @_");
+
+ # Ignore all signals
+ foreach my $name (keys %SIG){
+ $SIG{$name}= 'IGNORE';
+ }
+
+ die "signaled\n";
+ };
+ local $SIG{TERM}= \&handle_signal;
+ local $SIG{INT}= \&handle_signal;
+ local $SIG{CHLD}= sub {
+ message("Got signal @_");
+ kill(9, -$child_pid);
+ my $ret= waitpid($child_pid, 0);
+ if ($? & 127){
+ exit(65); # Killed by signal
+ }
+ exit($? >> 8);
+ };
+
+ # Monitoring loop
+ while(!$terminated) {
+
+ # Check if parent is still alive
+ if (kill(0, $parent_pid) < 1){
+ message("Parent is not alive anymore");
+ last;
+ }
+
+ # Wait for child to terminate but wakeup every
+ # second to also check that parent is still alive
+ my $ret_pid;
+ $ret_pid= waitpid($child_pid, &WNOHANG);
+ if ($ret_pid == $child_pid) {
+ # Process has exited, collect return status
+ my $ret_code= $? >> 8;
+ message("Child exit: $ret_code");
+ # Exit with exit status of the child
+ exit ($ret_code);
+ }
+ sleep(1);
+ }
+};
+if ( $@ ) {
+ # The monitoring loop should have been
+ # broken by handle_signal
+ warn "Unexpected: $@" unless ( $@ =~ /signaled/ );
+}
+
+# Use negative pid in order to kill the whole
+# process group
+#
+my $ret= kill(9, -$child_pid);
+message("Killed child: $child_pid, ret: $ret");
+if ($ret > 0) {
+ message("Killed child: $child_pid");
+ # Wait blocking for the child to return
+ my $ret_pid= waitpid($child_pid, 0);
+ if ($ret_pid != $child_pid){
+ message("unexpected pid $ret_pid returned from waitpid($child_pid)");
+ }
+}
+
+message("DONE!");
+exit (1);
+
+
diff --git a/mysql-test/lib/My/SafeProcess/safe_process_win.cc b/mysql-test/lib/My/SafeProcess/safe_process_win.cc
new file mode 100755
index 00000000000..1547070ce20
--- /dev/null
+++ b/mysql-test/lib/My/SafeProcess/safe_process_win.cc
@@ -0,0 +1,312 @@
+/* Copyright (C) 2004 MySQL AB
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+
+/*
+ Utility program that encapsulates process creation, monitoring
+ and bulletproof process cleanup
+
+ Usage:
+ safe_process [options to safe_process] -- progname arg1 ... argn
+
+ To safeguard mysqld you would invoke safe_process with a few options
+ for safe_process itself followed by a double dash to indicate start
+ of the command line for the program you really want to start
+
+ $> safe_process --output=output.log -- mysqld --datadir=var/data1 ...
+
+ This would redirect output to output.log and then start mysqld,
+ once it has done that it will continue to monitor the child as well
+ as the parent.
+
+ The safe_process then checks the follwing things:
+ 1. Child exits, propagate the childs return code to the parent
+ by exiting with the same return code as the child.
+
+ 2. Parent dies, immediately kill the child and exit, thus the
+ parent does not need to properly cleanup any child, it is handled
+ automatically.
+
+ 3. Signal's recieced by the process will trigger same action as 2)
+
+ 4. The named event "safe_process[pid]" can be signaled and will
+ trigger same action as 2)
+
+ WARNING! Be careful when using ProcessExplorer, since it will open
+ a handle to each process(and maybe also the Job), the process
+ spawned by safe_process will not be closed off when safe_process
+ is killed.
+*/
+
+/* Requires Windows 2000 or higher */
+#define _WIN32_WINNT 0x0500
+
+#include <windows.h>
+#include <stdio.h>
+#include <tlhelp32.h>
+#include <signal.h>
+
+static int verbose= 0;
+static char safe_process_name[32]= {0};
+
+static void message(const char* fmt, ...)
+{
+ if (!verbose)
+ return;
+ va_list args;
+ fprintf(stderr, "%s: ", safe_process_name);
+ va_start(args, fmt);
+ vfprintf(stderr, fmt, args);
+ fprintf(stderr, "\n");
+ va_end(args);
+ fflush(stderr);
+}
+
+
+static void die(const char* fmt, ...)
+{
+ va_list args;
+ fprintf(stderr, "%s: FATAL ERROR, ", safe_process_name);
+ va_start(args, fmt);
+ vfprintf(stderr, fmt, args);
+ fprintf(stderr, "\n");
+ va_end(args);
+ if (int last_err= GetLastError())
+ fprintf(stderr, "error: %d, %s\n", last_err, strerror(last_err));
+ exit(1);
+}
+
+
+DWORD get_parent_pid(DWORD pid)
+{
+ HANDLE snapshot;
+ DWORD parent_pid= -1;
+ PROCESSENTRY32 pe32;
+ pe32.dwSize= sizeof(PROCESSENTRY32);
+
+ snapshot= CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
+ if (snapshot == INVALID_HANDLE_VALUE)
+ die("CreateToolhelp32Snapshot failed");
+
+ if (!Process32First(snapshot, &pe32))
+ {
+ CloseHandle(snapshot);
+ die("Process32First failed");
+ }
+
+ do
+ {
+ if (pe32.th32ProcessID == pid)
+ parent_pid= pe32.th32ParentProcessID;
+ } while(Process32Next( snapshot, &pe32));
+ CloseHandle(snapshot);
+
+ if (parent_pid == -1)
+ die("Could not find parent pid");
+
+ return parent_pid;
+}
+
+
+enum {
+ PARENT,
+ CHILD,
+ EVENT,
+ NUM_HANDLES
+};
+
+
+HANDLE shutdown_event;
+void handle_signal (int signal)
+{
+ message("Got signal: %d", signal);
+ if(SetEvent(shutdown_event) == 0) {
+ /* exit safe_process and (hopefully) kill off the child */
+ die("Failed to SetEvent");
+ }
+}
+
+
+int main(int argc, const char** argv )
+{
+ char child_args[4096]= {0};
+ DWORD pid= GetCurrentProcessId();
+ DWORD parent_pid= get_parent_pid(pid);
+ HANDLE job_handle;
+ HANDLE wait_handles[NUM_HANDLES]= {0};
+ PROCESS_INFORMATION process_info= {0};
+
+ sprintf(safe_process_name, "safe_process[%d]", pid);
+
+ /* Create an event for the signal handler */
+ if ((shutdown_event=
+ CreateEvent(NULL, TRUE, FALSE, safe_process_name)) == NULL)
+ die("Failed to create shutdown_event");
+ wait_handles[EVENT]= shutdown_event;
+
+ signal(SIGINT, handle_signal);
+ signal(SIGBREAK, handle_signal);
+ signal(SIGTERM, handle_signal);
+
+ message("Started");
+
+ /* Parse arguments */
+ for (int i= 1; i < argc; i++) {
+ const char* arg= argv[i];
+ char* to= child_args;
+ if (strcmp(arg, "--") == 0 && strlen(arg) == 2) {
+ /* Got the "--" delimiter */
+ if (i >= argc)
+ die("No real args -> nothing to do");
+ /* Copy the remaining args to child_arg */
+ for (int j= i+1; j < argc; j++) {
+ to+= _snprintf(to, child_args + sizeof(child_args) - to, "%s ", argv[j]);
+ }
+ break;
+ } else {
+ if ( strcmp(arg, "--verbose") == 0 )
+ verbose++;
+ else if ( strncmp(arg, "--parent-pid", 10) == 0 )
+ {
+ /* Override parent_pid with a value provided by user */
+ const char* start;
+ if ((start= strstr(arg, "=")) == NULL)
+ die("Could not find start of option value in '%s'", arg);
+ start++; /* Step past = */
+ if ((parent_pid= atoi(start)) == 0)
+ die("Invalid value '%s' passed to --parent-id", start);
+ }
+ else
+ die("Unknown option: %s", arg);
+ }
+ }
+ if (*child_args == '\0')
+ die("nothing to do");
+
+ /* Open a handle to the parent process */
+ message("parent_pid: %d", parent_pid);
+ if (parent_pid == pid)
+ die("parent_pid is equal to own pid!");
+
+ if ((wait_handles[PARENT]=
+ OpenProcess(SYNCHRONIZE, FALSE, parent_pid)) == NULL)
+ die("Failed to open parent process with pid: %d", parent_pid);
+
+ /* Create the child process in a job */
+ JOBOBJECT_EXTENDED_LIMIT_INFORMATION jeli = { 0 };
+ STARTUPINFO si = { 0 };
+ si.cb = sizeof(si);
+
+ /*
+ Create the job object to make it possible to kill the process
+ and all of it's children in one go
+ */
+ if ((job_handle= CreateJobObject(NULL, NULL)) == NULL)
+ die("CreateJobObject failed");
+
+ /*
+ Make all processes associated with the job terminate when the
+ last handle to the job is closed.
+ */
+ jeli.BasicLimitInformation.LimitFlags = JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE;
+ if (SetInformationJobObject(job_handle, JobObjectExtendedLimitInformation,
+ &jeli, sizeof(jeli)) == 0)
+ message("SetInformationJobObject failed, continue anyway...");
+
+#if 0
+ /* Setup stdin, stdout and stderr redirect */
+ si.dwFlags= STARTF_USESTDHANDLES;
+ si.hStdInput= GetStdHandle(STD_INPUT_HANDLE);
+ si.hStdOutput= GetStdHandle(STD_OUTPUT_HANDLE);
+ si.hStdError= GetStdHandle(STD_ERROR_HANDLE);
+#endif
+
+ /*
+ Create the process suspended to make sure it's assigned to the
+ Job before it creates any process of it's own
+ */
+ if (CreateProcess(NULL, (LPSTR)child_args,
+ NULL,
+ NULL,
+ TRUE, /* inherit handles */
+ CREATE_SUSPENDED,
+ NULL,
+ NULL,
+ &si,
+ &process_info) == 0)
+ die("CreateProcess failed");
+
+ if (AssignProcessToJobObject(job_handle, process_info.hProcess) == 0)
+ {
+ TerminateProcess(process_info.hProcess, 200);
+ die("AssignProcessToJobObject failed");
+ }
+ ResumeThread(process_info.hThread);
+ CloseHandle(process_info.hThread);
+
+ wait_handles[CHILD]= process_info.hProcess;
+
+ message("Started child %d", process_info.dwProcessId);
+
+ /* Monitor loop */
+ DWORD child_exit_code= 1;
+ DWORD wait_res= WaitForMultipleObjects(NUM_HANDLES, wait_handles,
+ FALSE, INFINITE);
+ switch (wait_res)
+ {
+ case WAIT_OBJECT_0 + PARENT:
+ message("Parent exit");
+ break;
+ case WAIT_OBJECT_0 + CHILD:
+ if (GetExitCodeProcess(wait_handles[CHILD], &child_exit_code) == 0)
+ message("Child exit: could not get exit_code");
+ else
+ message("Child exit: exit_code: %d", child_exit_code);
+ break;
+ case WAIT_OBJECT_0 + EVENT:
+ message("Wake up from shutdown_event");
+ break;
+
+ default:
+ message("Unexpected result %d from WaitForMultipleObjects", wait_res);
+ break;
+ }
+ message("Exiting, child: %d", process_info.dwProcessId);
+
+ if (TerminateJobObject(job_handle, 201) == 0)
+ message("TerminateJobObject failed");
+ CloseHandle(job_handle);
+
+ if (wait_res != WAIT_OBJECT_0 + CHILD)
+ {
+ /* The child has not yet returned, wait for it */
+ message("waiting for child to exit");
+ if ((wait_res= WaitForSingleObject(wait_handles[CHILD], INFINITE)) != WAIT_OBJECT_0)
+ {
+ message("child wait failed: %d", wait_res);
+ }
+ else
+ {
+ message("child wait succeeded");
+ }
+ /* Child's exit code should now be 201, no need to get it */
+ }
+
+ for (int i= 0; i < NUM_HANDLES; i++)
+ CloseHandle(wait_handles[i]);
+
+ exit(child_exit_code);
+}
+
diff --git a/mysql-test/lib/mtr_cases.pl b/mysql-test/lib/mtr_cases.pm
index a4ef9aad897..4d6885f5495 100644
--- a/mysql-test/lib/mtr_cases.pl
+++ b/mysql-test/lib/mtr_cases.pm
@@ -1,15 +1,15 @@
# -*- cperl -*-
# Copyright (C) 2005-2006 MySQL AB
-#
+#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
@@ -18,59 +18,86 @@
# and is part of the translation of the Bourne shell script with the
# same name.
-use File::Basename;
-use IO::File();
+package mtr_cases;
use strict;
-use My::Config;
+use base qw(Exporter);
+our @EXPORT= qw(collect_option collect_test_cases);
+
+# Options used for the collect phase
+our $start_from;
+our $print_testcases;
+our $skip_rpl;
+our $do_test;
+our $skip_test;
+our $opt_skip_combination;
+our $binlog_format;;
+our $enable_disabled;
+our $default_storage_engine;
+our $opt_with_ndbcluster_only;
+our $defaults_file;
+our $defaults_extra_file;
+
+sub collect_option {
+ my ($opt, $value)= @_;
+
+ # Convert - to _ in option name
+ $opt =~ s/-/_/;
+ no strict 'refs';
+ ${$opt}= $value;
+}
-sub collect_test_cases ($);
-sub collect_one_suite ($);
-sub collect_one_test_case ($$$$$$$$$);
+use File::Basename;
+use IO::File();
+use My::Config;
-sub mtr_options_from_test_file($$);
+require "mtr_settings.pl";
+require "mtr_report.pl";
+require "mtr_match.pl";
+require "mtr_misc.pl";
-my $do_test;
-my $skip_test;
+# Precompiled regex's for tests to do or skip
+my $do_test_reg;
+my $skip_test_reg;
sub init_pattern {
my ($from, $what)= @_;
- if ( $from =~ /[a-z0-9]/ ) {
- # Does not contain any regex, make the pattern match
+ return undef unless defined $from;
+ if ( $from =~ /^[a-z0-9\.]*$/ ) {
+ # Does not contain any regex (except . that we allow as
+ # separator betwen suite and testname), make the pattern match
# beginning of string
$from= "^$from";
+ mtr_verbose("$what='$from'");
}
- else {
- # Check that pattern is a valid regex
- eval { "" =~/$from/; 1 } or
- mtr_error("Invalid regex '$from' passed to $what\nPerl says: $@");
- }
+ # Check that pattern is a valid regex
+ eval { "" =~/$from/; 1 } or
+ mtr_error("Invalid regex '$from' passed to $what\nPerl says: $@");
return $from;
}
-
##############################################################################
#
-# Collect information about test cases we are to run
+# Collect information about test cases to be run
#
##############################################################################
sub collect_test_cases ($) {
- $do_test= init_pattern($::opt_do_test, "--do-test");
- $skip_test= init_pattern($::opt_skip_test, "--skip-test");
-
my $suites= shift; # Semicolon separated list of test suites
- my $cases = []; # Array of hash
+ my $cases= []; # Array of hash(one hash for each testcase)
+
+ $do_test_reg= init_pattern($do_test, "--do-test");
+ $skip_test_reg= init_pattern($skip_test, "--skip-test");
foreach my $suite (split(",", $suites))
{
push(@$cases, collect_one_suite($suite));
}
-
if ( @::opt_cases )
{
+ # A list of tests was specified on the command line
# Check that the tests specified was found
# in at least one suite
foreach my $test_name_spec ( @::opt_cases )
@@ -99,14 +126,13 @@ sub collect_test_cases ($) {
# Make a mapping of test name to a string that represents how that test
# should be sorted among the other tests. Put the most important criterion
- # first, then a sub-criterion, then sub-sub-criterion, et c.
+ # first, then a sub-criterion, then sub-sub-criterion, etc.
foreach my $tinfo (@$cases)
{
my @criteria = ();
- # Look for tests that muct be in run in a defined order
- # that is defined by test having the same name except for
- # the ending digit
+ # Look for tests that must be run in a defined order - that is
+ # defined by test having the same name except for the ending digit
# Put variables into hash
my $test_name= $tinfo->{'name'};
@@ -156,25 +182,23 @@ sub collect_test_cases ($) {
$sort_criteria{$a->{'name'}} . $a->{'name'} cmp
$sort_criteria{$b->{'name'}} . $b->{'name'}; } @$cases;
- if ( $::opt_script_debug )
- {
- # For debugging the sort-order
- foreach my $tinfo (@$cases)
- {
- print("$sort_criteria{$tinfo->{'name'}} -> \t$tinfo->{'name'}\n");
- }
- }
+ # For debugging the sort-order
+ # foreach my $tinfo (@$cases)
+ # {
+ # print("$sort_criteria{$tinfo->{'name'}} -> \t$tinfo->{'name'}\n");
+ # }
+
+ }
+
+ if (defined $print_testcases){
+ print_testcases(@$cases);
+ exit(1);
}
return $cases;
}
-# Valid extensions and their corresonding component id
-my %exts = ( 'test' => 'mysqld',
- 'imtest' => 'im'
- );
-
# Returns (suitename, testname, extension)
sub split_testname {
@@ -190,7 +214,7 @@ sub split_testname {
# Either testname.test or suite.testname given
# Ex. main.alias or alias.test
- if (defined $exts{$parts[1]})
+ if ($parts[1] eq "test")
{
return (undef , $parts[0], $parts[1]);
}
@@ -212,7 +236,7 @@ sub split_testname {
sub collect_one_suite($)
{
my $suite= shift; # Test suite name
- my @cases; # Array of hash
+ my @cases; # Array of hash
mtr_verbose("Collecting: $suite");
@@ -222,11 +246,39 @@ sub collect_one_suite($)
$suitedir= mtr_path_exists("$suitedir/suite/$suite",
"$suitedir/$suite");
mtr_verbose("suitedir: $suitedir");
+
+
}
my $testdir= "$suitedir/t";
my $resdir= "$suitedir/r";
+ # Check if t/ exists
+ if (-d $testdir){
+ # t/ exists
+
+ if ( -d $resdir )
+ {
+ # r/exists
+ }
+ else
+ {
+ # No r/, use t/ as result dir
+ $resdir= $testdir;
+ }
+
+ }
+ else {
+ # No t/ dir => there can' be any r/ dir
+ mtr_error("Can't have r/ dir without t/") if -d $resdir;
+
+ # No t/ or r/ => use suitedir
+ $resdir= $testdir= $suitedir;
+ }
+
+ mtr_verbose("testdir: $testdir");
+ mtr_verbose("resdir: $resdir");
+
# ----------------------------------------------------------------------
# Build a hash of disabled testcases for this suite
# ----------------------------------------------------------------------
@@ -249,7 +301,7 @@ sub collect_one_suite($)
my $suite_opts= [];
if ( -f $suite_opt_file )
{
- $suite_opts= mtr_get_opts_from_file($suite_opt_file);
+ $suite_opts= opts_from_file($suite_opt_file);
}
if ( @::opt_cases )
@@ -267,7 +319,6 @@ sub collect_one_suite($)
# Check cirrect suite if suitename is defined
next if (defined $sname and $suite ne $sname);
- my $component_id;
if ( defined $extension )
{
my $full_name= "$testdir/$tname.$extension";
@@ -281,28 +332,26 @@ sub collect_one_suite($)
next;
}
- $component_id= $exts{$extension};
}
else
{
- # No extension was specified
- my ($ext, $component);
- while (($ext, $component)= each %exts) {
- my $full_name= "$testdir/$tname.$ext";
+ # No extension was specified, use default
+ $extension= "test";
+ my $full_name= "$testdir/$tname.$extension";
- if ( ! -f $full_name ) {
- next;
- }
- $component_id= $component;
- $extension= $ext;
- }
# Test not found here, could exist in other suite
- next unless $component_id;
+ next if ( ! -f $full_name );
}
- collect_one_test_case($testdir,$resdir,$suite,$tname,
- "$tname.$extension",\@cases,\%disabled,
- $component_id,$suite_opts);
+ push(@cases,
+ collect_one_test_case($suitedir,
+ $testdir,
+ $resdir,
+ $suite,
+ $tname,
+ "$tname.$extension",
+ \%disabled,
+ $suite_opts));
}
}
else
@@ -311,33 +360,26 @@ sub collect_one_suite($)
foreach my $elem ( sort readdir(TESTDIR) )
{
- my $component_id= undef;
- my $tname= undef;
+ my $tname= mtr_match_extension($elem, 'test');
- if ($tname= mtr_match_extension($elem, 'test'))
- {
- $component_id = 'mysqld';
- }
- elsif ($tname= mtr_match_extension($elem, 'imtest'))
- {
- $component_id = 'im';
- }
- else
- {
- next;
- }
+ next unless defined $tname;
# Skip tests that does not match the --do-test= filter
- next if ($do_test and not $tname =~ /$do_test/o);
-
- collect_one_test_case($testdir,$resdir,$suite,$tname,
- $elem,\@cases,\%disabled,$component_id,
- $suite_opts);
+ next if ($do_test_reg and not $tname =~ /$do_test_reg/o);
+
+ push(@cases,
+ collect_one_test_case($suitedir,
+ $testdir,
+ $resdir,
+ $suite,
+ $tname,
+ $elem,
+ \%disabled,
+ $suite_opts));
}
closedir TESTDIR;
}
-
# Return empty list if no testcases found
return if (@cases == 0);
@@ -345,7 +387,7 @@ sub collect_one_suite($)
# Read combinations for this suite and build testcases x combinations
# if any combinations exists
# ----------------------------------------------------------------------
- if ( ! $::opt_skip_combination )
+ if ( ! $opt_skip_combination )
{
my @combinations;
my $combination_file= "$suitedir/combinations";
@@ -366,7 +408,6 @@ sub collect_one_suite($)
# Read combinations file in my.cnf format
mtr_verbose("Read combinations file");
my $config= My::Config->new($combination_file);
-
foreach my $group ($config->groups()) {
my $comb= {};
$comb->{name}= $group->name();
@@ -414,7 +455,6 @@ sub collect_one_suite($)
#print_testcases(@cases);
}
}
-
optimize_cases(\@cases);
#print_testcases(@cases);
@@ -422,6 +462,7 @@ sub collect_one_suite($)
}
+
#
# Loop through all test cases
# - optimize which test to run by skipping unnecessary ones
@@ -435,169 +476,79 @@ sub optimize_cases {
# Skip processing if already marked as skipped
next if $tinfo->{skip};
- # Replication test needs an adjustment of binlog format
- if (mtr_match_prefix($tinfo->{'name'}, "rpl"))
+ # =======================================================
+ # If a special binlog format was selected with
+ # --mysqld=--binlog-format=x, skip all test that does not
+ # support it
+ # =======================================================
+ if (defined $binlog_format )
{
-
- # =======================================================
- # Get binlog-format used by this test from master_opt
- # =======================================================
- my $test_binlog_format;
- foreach my $opt ( @{$tinfo->{master_opt}} ) {
- $test_binlog_format= $test_binlog_format ||
- mtr_match_prefix($opt, "--binlog-format=");
- }
- # print $tinfo->{name}." uses ".$test_binlog_format."\n";
-
- # =======================================================
- # If a special binlog format was selected with
- # --mysqld=--binlog-format=x, skip all test with different
- # binlog-format
- # =======================================================
- if (defined $::used_binlog_format and
- $test_binlog_format and
- $::used_binlog_format ne $test_binlog_format)
- {
- $tinfo->{'skip'}= 1;
- $tinfo->{'comment'}= "Requires --binlog-format='$test_binlog_format'";
- next;
- }
-
# =======================================================
- # Check that testcase supports the designated binlog-format
+ # Fixed --binlog-format=x specified on command line
# =======================================================
- if ($test_binlog_format and defined $tinfo->{'sup_binlog_formats'} )
+ if ( defined $tinfo->{'binlog_formats'} )
{
+ # The test supports different binlog formats
+ # check if the selected one is ok
my $supported=
- grep { $_ eq $test_binlog_format } @{$tinfo->{'sup_binlog_formats'}};
+ grep { $_ eq $binlog_format } @{$tinfo->{'binlog_formats'}};
if ( !$supported )
{
$tinfo->{'skip'}= 1;
$tinfo->{'comment'}=
- "Doesn't support --binlog-format='$test_binlog_format'";
- next;
+ "Doesn't support --binlog-format='$binlog_format'";
}
}
-
+ }
+ else
+ {
# =======================================================
- # Use dynamic switching of binlog-format if mtr started
- # w/o --mysqld=--binlog-format=xxx and combinations.
+ # Use dynamic switching of binlog format
# =======================================================
- if (!defined $tinfo->{'combination'} and
- !defined $::used_binlog_format)
- {
- $test_binlog_format= $tinfo->{'sup_binlog_formats'}->[0];
+
+ # Get binlog-format used by this test from master_opt
+ my $test_binlog_format;
+ foreach my $opt ( @{$tinfo->{master_opt}} ) {
+ $test_binlog_format=
+ mtr_match_prefix($opt, "--binlog-format=") || $test_binlog_format;
}
- # Save binlog format for dynamic switching
- $tinfo->{binlog_format}= $test_binlog_format;
+ if (defined $test_binlog_format)
+ {
+ if ( defined $tinfo->{binlog_formats} )
+ {
+ my $supported=
+ grep { $_ eq $test_binlog_format } @{$tinfo->{'binlog_formats'}};
+ if ( !$supported )
+ {
+ $tinfo->{'skip'}= 1;
+ $tinfo->{'comment'}=
+ "Doesn't support --binlog-format='$test_binlog_format'";
+ next;
+ }
+ }
+
+ # Save binlog format for dynamic switching
+ $tinfo->{binlog_format_switch}= $test_binlog_format;
+ }
}
}
}
-##############################################################################
#
-# Collect information about a single test case
+# Read options from the given opt file and append them as an array
+# to $tinfo->{$opt_name}
#
-##############################################################################
-
-
-sub collect_one_test_case($$$$$$$$$) {
- my $testdir= shift;
- my $resdir= shift;
- my $suite= shift;
- my $tname= shift;
- my $elem= shift;
- my $cases= shift;
- my $disabled=shift;
- my $component_id= shift;
- my $suite_opts= shift;
-
- my $path= "$testdir/$elem";
-
- # ----------------------------------------------------------------------
- # Skip some tests silently
- # ----------------------------------------------------------------------
-
- if ( $::opt_start_from and $tname lt $::opt_start_from )
- {
- return;
- }
-
-
- my $tinfo= {};
- $tinfo->{'name'}= basename($suite) . ".$tname";
- $tinfo->{'result_file'}= "$resdir/$tname.result";
- $tinfo->{'component_id'} = $component_id;
- push(@$cases, $tinfo);
-
- # ----------------------------------------------------------------------
- # Skip some tests but include in list, just mark them to skip
- # ----------------------------------------------------------------------
-
- if ( $skip_test and $tname =~ /$skip_test/o )
- {
- $tinfo->{'skip'}= 1;
- return;
- }
-
- # ----------------------------------------------------------------------
- # Collect information about test case
- # ----------------------------------------------------------------------
-
- $tinfo->{'path'}= $path;
- $tinfo->{'timezone'}= "GMT-3"; # for UNIX_TIMESTAMP tests to work
-
- $tinfo->{'slave_num'}= 0; # Default, no slave
- $tinfo->{'master_num'}= 1; # Default, 1 master
- if ( defined mtr_match_prefix($tname,"rpl") )
- {
- if ( $::opt_skip_rpl )
- {
- $tinfo->{'skip'}= 1;
- $tinfo->{'comment'}= "No replication tests(--skip-rpl)";
- return;
- }
-
- $tinfo->{'slave_num'}= 1; # Default for rpl* tests, use one slave
-
- }
-
- if ( defined mtr_match_prefix($tname,"federated") )
- {
- # Default, federated uses the first slave as it's federated database
- $tinfo->{'slave_num'}= 1;
- }
+sub process_opts_file {
+ my ($tinfo, $opt_file, $opt_name)= @_;
- my $master_opt_file= "$testdir/$tname-master.opt";
- my $slave_opt_file= "$testdir/$tname-slave.opt";
- my $slave_mi_file= "$testdir/$tname.slave-mi";
- my $master_sh= "$testdir/$tname-master.sh";
- my $slave_sh= "$testdir/$tname-slave.sh";
- my $disabled_file= "$testdir/$tname.disabled";
- my $im_opt_file= "$testdir/$tname-im.opt";
-
- $tinfo->{'master_opt'}= [];
- $tinfo->{'slave_opt'}= [];
- $tinfo->{'slave_mi'}= [];
-
-
- # Add suite opts
- foreach my $opt ( @$suite_opts )
- {
- mtr_verbose($opt);
- push(@{$tinfo->{'master_opt'}}, $opt);
- push(@{$tinfo->{'slave_opt'}}, $opt);
- }
-
- # Add master opts
- if ( -f $master_opt_file )
+ $tinfo->{$opt_name}= [];
+ if ( -f $opt_file )
{
+ my $opts= opts_from_file($opt_file);
- my $master_opt= mtr_get_opts_from_file($master_opt_file);
-
- foreach my $opt ( @$master_opt )
+ foreach my $opt ( @$opts )
{
my $value;
@@ -612,13 +563,6 @@ sub collect_one_test_case($$$$$$$$$) {
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 )
{
@@ -628,6 +572,14 @@ sub collect_one_test_case($$$$$$$$$) {
next;
}
+ $value= mtr_match_prefix($opt, "--config-file-template=");
+ if ( defined $value)
+ {
+ # Specifies the configuration file to use for this test
+ $tinfo->{'template_path'}= dirname($tinfo->{path})."/$value";
+ next;
+ }
+
# If we set default time zone, remove the one we have
$value= mtr_match_prefix($opt, "--default-time-zone=");
if ( defined $value )
@@ -648,36 +600,124 @@ sub collect_one_test_case($$$$$$$$$) {
}
# Ok, this was a real option, add it
- push(@{$tinfo->{'master_opt'}}, $opt);
+ push(@{$tinfo->{$opt_name}}, $opt);
}
}
+}
+
+##############################################################################
+#
+# Collect information about a single test case
+#
+##############################################################################
+
+sub collect_one_test_case {
+ my $suitedir= shift;
+ my $testdir= shift;
+ my $resdir= shift;
+ my $suitename= shift;
+ my $tname= shift;
+ my $filename= shift;
+ my $disabled= shift;
+ my $suite_opts= shift;
- # Add slave opts
- if ( -f $slave_opt_file )
+ #print "collect_one_test_case\n";
+ #print " suitedir: $suitedir\n";
+ #print " testdir: $testdir\n";
+ #print " resdir: $resdir\n";
+ #print " suitename: $suitename\n";
+ #print " tname: $tname\n";
+ #print " filename: $filename\n";
+
+ # ----------------------------------------------------------------------
+ # Skip some tests silently
+ # ----------------------------------------------------------------------
+ if ( $start_from and $tname lt $start_from )
{
- my $slave_opt= mtr_get_opts_from_file($slave_opt_file);
+ return;
+ }
- 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);
+ # ----------------------------------------------------------------------
+ # Set defaults
+ # ----------------------------------------------------------------------
+ my $tinfo= {};
+ $tinfo->{'name'}= basename($suitename) . ".$tname";
+ $tinfo->{'path'}= "$testdir/$filename";
+
+ # TODO allow nonexistsing result file
+ # in that case .test must issue "exit" otherwise test should fail by default
+ $tinfo->{'result_file'}= "$resdir/$tname.result";
+
+ # ----------------------------------------------------------------------
+ # Skip some tests but include in list, just mark them as skipped
+ # ----------------------------------------------------------------------
+ if ( $skip_test_reg and $tname =~ /$skip_test_reg/o )
+ {
+ $tinfo->{'skip'}= 1;
+ return $tinfo;
+ }
+
+ # ----------------------------------------------------------------------
+ # Check for disabled tests
+ # ----------------------------------------------------------------------
+ my $marked_as_disabled= 0;
+ if ( $disabled->{$tname} )
+ {
+ # Test was marked as disabled in suites disabled.def file
+ $marked_as_disabled= 1;
+ $tinfo->{'comment'}= $disabled->{$tname};
+ }
+
+ my $disabled_file= "$testdir/$tname.disabled";
+ if ( -f $disabled_file )
+ {
+ $marked_as_disabled= 1;
+ $tinfo->{'comment'}= mtr_fromfile($disabled_file);
}
- if ( -f $slave_mi_file )
+ if ( $marked_as_disabled )
{
- $tinfo->{'slave_mi'}= mtr_get_opts_from_file($slave_mi_file);
+ if ( $enable_disabled )
+ {
+ # User has selected to run all disabled tests
+ mtr_report(" - $tinfo->{name} wil be run although it's been disabled\n",
+ " due to '$tinfo->{comment}'");
+ }
+ else
+ {
+ $tinfo->{'skip'}= 1;
+ $tinfo->{'disable'}= 1; # Sub type of 'skip'
+ return $tinfo;
+ }
}
+ # ----------------------------------------------------------------------
+ # Append suite extra options to both master and slave
+ # ----------------------------------------------------------------------
+ push(@{$tinfo->{'master_opt'}}, @$suite_opts);
+ push(@{$tinfo->{'slave_opt'}}, @$suite_opts);
+
+ # ----------------------------------------------------------------------
+ # Add master opts, extra options only for master
+ # ----------------------------------------------------------------------
+ process_opts_file($tinfo, "$testdir/$tname-master.opt", 'master_opt');
+
+ # ----------------------------------------------------------------------
+ # Add slave opts, list of extra option only for slave
+ # ----------------------------------------------------------------------
+ process_opts_file($tinfo, "$testdir/$tname-slave.opt", 'slave_opt');
+
+ # ----------------------------------------------------------------------
+ # 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";
- return;
+ return $tinfo;
}
else
{
@@ -685,13 +725,17 @@ sub collect_one_test_case($$$$$$$$$) {
}
}
+ # ----------------------------------------------------------------------
+ # 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";
- return;
+ return $tinfo;
}
else
{
@@ -699,202 +743,178 @@ sub collect_one_test_case($$$$$$$$$) {
}
}
- if ( -f $im_opt_file )
- {
- $tinfo->{'im_opts'} = mtr_get_opts_from_file($im_opt_file);
- }
- else
+ # ----------------------------------------------------------------------
+ # <tname>.slave-mi
+ # ----------------------------------------------------------------------
+ mtr_error("$tname: slave-mi not supported anymore")
+ if ( -f "$testdir/$tname.slave-mi");
+
+
+ tags_from_test_file($tinfo,"$testdir/${tname}.test");
+
+ if ( defined $default_storage_engine )
{
- $tinfo->{'im_opts'} = [];
+ # Different default engine is used
+ # tag test to require that engine
+ $tinfo->{'ndb_test'}= 1
+ if ( $default_storage_engine =~ /^ndb/i );
+
+ $tinfo->{'innodb_test'}= 1
+ if ( $default_storage_engine =~ /^innodb/i );
+
}
- # FIXME why this late?
- my $marked_as_disabled= 0;
- if ( $disabled->{$tname} )
+ if ( $tinfo->{'big_test'} and ! $::opt_big_test )
{
- $marked_as_disabled= 1;
- $tinfo->{'comment'}= $disabled->{$tname};
+ $tinfo->{'skip'}= 1;
+ $tinfo->{'comment'}= "Test need 'big-test' option";
+ return $tinfo
}
- if ( -f $disabled_file )
+ if ( $tinfo->{'ndb_extra'} and ! $::opt_ndb_extra_test )
{
- $marked_as_disabled= 1;
- $tinfo->{'comment'}= mtr_fromfile($disabled_file);
+ $tinfo->{'skip'}= 1;
+ $tinfo->{'comment'}= "Test need 'ndb_extra' option";
+ return $tinfo
}
- # If test was marked as disabled, either opt_enable_disabled is off and then
- # we skip this test, or it is on and then we run this test but warn
-
- if ( $marked_as_disabled )
+ if ( $tinfo->{'need_debug'} && ! $::debug_compiled_binaries )
{
- if ( $::opt_enable_disabled )
- {
- $tinfo->{'dont_skip_though_disabled'}= 1;
- }
- else
- {
- $tinfo->{'skip'}= 1;
- $tinfo->{'disable'}= 1; # Sub type of 'skip'
- return;
- }
+ $tinfo->{'skip'}= 1;
+ $tinfo->{'comment'}= "Test need debug binaries";
+ return $tinfo
}
- if ( $component_id eq 'im' )
+ if ( $tinfo->{'ndb_test'} )
{
- if ( $::glob_use_embedded_server )
+ # This is a NDB test
+ if ( ! $::glob_ndbcluster_supported )
{
+ # Ndb is not supported, skip it
$tinfo->{'skip'}= 1;
- $tinfo->{'comment'}= "No IM with embedded server";
- return;
+ $tinfo->{'comment'}= "No ndbcluster support";
+ return $tinfo;
}
- elsif ( $::opt_ps_protocol )
+ elsif ( $::opt_skip_ndbcluster )
{
+ # All ndb test's should be skipped
$tinfo->{'skip'}= 1;
- $tinfo->{'comment'}= "No IM with --ps-protocol";
- return;
- }
- elsif ( $::opt_skip_im )
- {
- $tinfo->{'skip'}= 1;
- $tinfo->{'comment'}= "No IM tests(--skip-im)";
- return;
+ $tinfo->{'comment'}= "No ndbcluster tests(--skip-ndbcluster)";
+ return $tinfo;
}
}
else
{
- mtr_options_from_test_file($tinfo,"$testdir/${tname}.test");
-
- if ( defined $::used_default_engine )
- {
- # Different default engine is used
- # tag test to require that engine
- $tinfo->{'ndb_test'}= 1
- if ( $::used_default_engine =~ /^ndb/i );
-
- $tinfo->{'innodb_test'}= 1
- if ( $::used_default_engine =~ /^innodb/i );
- }
-
- if ( $tinfo->{'big_test'} and ! $::opt_big_test )
+ # This is not a ndb test
+ if ( $opt_with_ndbcluster_only )
{
+ # Only the ndb test should be run, all other should be skipped
$tinfo->{'skip'}= 1;
- $tinfo->{'comment'}= "Test need 'big-test' option";
- return;
+ $tinfo->{'comment'}= "Only ndbcluster tests";
+ return $tinfo;
}
+ }
- if ( $tinfo->{'ndb_extra'} and ! $::opt_ndb_extra_test )
+ if ( $tinfo->{'innodb_test'} )
+ {
+ # This is a test that need innodb
+ if ( $::mysqld_variables{'innodb'} ne "TRUE" )
{
+ # innodb is not supported, skip it
$tinfo->{'skip'}= 1;
- $tinfo->{'comment'}= "Test need 'ndb_extra' option";
- return;
+ $tinfo->{'comment'}= "No innodb support";
+ return $tinfo;
}
+ }
+ else
+ {
+ push(@{$tinfo->{'master_opt'}}, "--loose-skip-innodb");
+ push(@{$tinfo->{'slave_opt'}}, "--loose-skip-innodb");
+ }
- if ( $tinfo->{'require_manager'} )
+ if ( $tinfo->{'need_binlog'} )
+ {
+ if (grep(/^--skip-log-bin/, @::opt_extra_mysqld_opt) )
{
$tinfo->{'skip'}= 1;
- $tinfo->{'comment'}= "Test need the _old_ manager(to be removed)";
- return;
+ $tinfo->{'comment'}= "Test need binlog";
+ return $tinfo;
}
+ }
+ else
+ {
+ # Test does not need binlog, add --skip-binlog to
+ # the options used when starting
+ push(@{$tinfo->{'master_opt'}}, "--loose-skip-log-bin");
+ push(@{$tinfo->{'slave_opt'}}, "--loose-skip-log-bin");
+ }
- if ( $tinfo->{'need_debug'} && ! $::debug_compiled_binaries )
+ if ( $tinfo->{'rpl_test'} )
+ {
+ if ( $skip_rpl )
{
$tinfo->{'skip'}= 1;
- $tinfo->{'comment'}= "Test need debug binaries";
- return;
- }
-
- if ( $tinfo->{'ndb_test'} )
- {
- # This is a NDB test
- if ( ! $::glob_ndbcluster_supported )
- {
- # Ndb is not supported, skip it
- $tinfo->{'skip'}= 1;
- $tinfo->{'comment'}= "No ndbcluster support";
- return;
- }
- elsif ( $::opt_skip_ndbcluster )
- {
- # All ndb test's should be skipped
- $tinfo->{'skip'}= 1;
- $tinfo->{'comment'}= "No ndbcluster tests(--skip-ndbcluster)";
- return;
- }
- # Ndb tests run with two mysqld masters
- $tinfo->{'master_num'}= 2;
- }
- else
- {
- # This is not a ndb test
- if ( $::opt_with_ndbcluster_only )
- {
- # Only the ndb test should be run, all other should be skipped
- $tinfo->{'skip'}= 1;
- $tinfo->{'comment'}= "Only ndbcluster tests(--with-ndbcluster-only)";
- return;
- }
- }
-
- if ( $tinfo->{'innodb_test'} )
- {
- # This is a test that need innodb
- if ( $::mysqld_variables{'innodb'} ne "TRUE" )
- {
- # innodb is not supported, skip it
- $tinfo->{'skip'}= 1;
- $tinfo->{'comment'}= "No innodb support";
- return;
- }
+ $tinfo->{'comment'}= "No replication tests(--skip-rpl)";
+ return $tinfo;
}
+ }
- if ( $tinfo->{'need_binlog'} )
- {
- if (grep(/^--skip-log-bin/, @::opt_extra_mysqld_opt) )
- {
- $tinfo->{'skip'}= 1;
- $tinfo->{'comment'}= "Test need binlog";
- return;
- }
- }
- else
+ # ----------------------------------------------------------------------
+ # Find config file to use if not already selected in <testname>.opt file
+ # ----------------------------------------------------------------------
+ if (defined $defaults_file) {
+ # Using same config file for all tests
+ $tinfo->{template_path}= $defaults_file;
+ }
+ elsif (! $tinfo->{template_path} )
+ {
+ my $config= "$suitedir/my.cnf";
+ if (! -f $config )
{
- if ( $::mysql_version_id >= 50100 )
- {
- # Test does not need binlog, add --skip-binlog to
- # the options used when starting it
- push(@{$tinfo->{'master_opt'}}, "--skip-log-bin");
- }
+ # Suite has no config, use default.cnf
+ $config= "include/default_my.cnf";
}
+ $tinfo->{template_path}= $config;
+ }
+ # Set extra config file to use
+ if (defined $defaults_extra_file) {
+ $tinfo->{extra_template_path}= $defaults_extra_file;
}
+
+ 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", "sup_binlog_formats", ["row"]],
- ["include/have_log_bin.inc", "need_binlog", 1],
- ["include/have_binlog_format_statement.inc",
- "sup_binlog_formats", ["statement"]],
- ["include/have_binlog_format_mixed.inc", "sup_binlog_formats", ["mixed"]],
+ ["include/have_binlog_format_row.inc", "binlog_formats", ["row"]],
+ ["include/have_binlog_format_statement.inc", "binlog_formats", ["statement"]],
+ ["include/have_binlog_format_mixed.inc", "binlog_formats", ["mixed"]],
["include/have_binlog_format_mixed_or_row.inc",
- "sup_binlog_formats", ["mixed","row"]],
+ "binlog_formats", ["mixed", "row"]],
["include/have_binlog_format_mixed_or_statement.inc",
- "sup_binlog_formats", ["mixed","statement"]],
+ "binlog_formats", ["mixed", "statement"]],
["include/have_binlog_format_row_or_statement.inc",
- "sup_binlog_formats", ["row","statement"]],
+ "binlog_formats", ["row", "statement"]],
+
+ ["include/have_log_bin.inc", "need_binlog", 1],
+
+ ["include/have_innodb.inc", "innodb_test", 1],
["include/big_test.inc", "big_test", 1],
["include/have_debug.inc", "need_debug", 1],
["include/have_ndb.inc", "ndb_test", 1],
["include/have_multi_ndb.inc", "ndb_test", 1],
["include/have_ndb_extra.inc", "ndb_extra", 1],
- ["require_manager", "require_manager", 1],
+ ["include/master-slave.inc", "rpl_test", 1],
+ ["include/ndb_master-slave.inc", "rpl_test", 1],
+ ["include/federated.inc", "federated_test", 1],
);
-sub mtr_options_from_test_file($$) {
+
+sub tags_from_test_file {
my $tinfo= shift;
my $file= shift;
#mtr_verbose("$file");
@@ -911,8 +931,8 @@ sub mtr_options_from_test_file($$) {
{
if ( index($line, $tag->[0]) >= 0 )
{
- # Tag matched, assign value to "tinfo"
- $tinfo->{"$tag->[1]"}= $tag->[2];
+ # Tag matched, assign value to "tinfo"
+ $tinfo->{"$tag->[1]"}= $tag->[2];
}
}
@@ -930,12 +950,83 @@ sub mtr_options_from_test_file($$) {
# Only source the file if it exists, we may get
# false positives in the regexes above if someone
# writes "source nnnn;" in a test case(such as mysqltest.test)
- mtr_options_from_test_file($tinfo, $sourced_file);
+ tags_from_test_file($tinfo, $sourced_file);
}
}
+
}
}
+sub unspace {
+ my $string= shift;
+ my $quote= shift;
+ $string =~ s/[ \t]/\x11/g;
+ return "$quote$string$quote";
+}
+
+
+
+sub envsubst {
+ my $string= shift;
+
+ if ( ! defined $ENV{$string} )
+ {
+ mtr_error("opt file referense \$$string that is unknown");
+ }
+
+ return $ENV{$string};
+}
+
+
+sub opts_from_file ($) {
+ my $file= shift;
+
+ open(FILE,"<",$file) or mtr_error("can't open file \"$file\": $!");
+ my @args;
+ while ( <FILE> )
+ {
+ chomp;
+
+ # --set-variable=init_connect=set @a='a\\0c'
+ s/^\s+//; # Remove leading space
+ s/\s+$//; # Remove ending space
+
+ # This is strange, but we need to fill whitespace inside
+ # quotes with something, to remove later. We do this to
+ # be able to split on space. Else, we have trouble with
+ # options like
+ #
+ # --someopt="--insideopt1 --insideopt2"
+ #
+ # But still with this, we are not 100% sure it is right,
+ # we need a shell to do it right.
+
+ s/\'([^\'\"]*)\'/unspace($1,"\x0a")/ge;
+ s/\"([^\'\"]*)\"/unspace($1,"\x0b")/ge;
+ s/\'([^\'\"]*)\'/unspace($1,"\x0a")/ge;
+ s/\"([^\'\"]*)\"/unspace($1,"\x0b")/ge;
+
+ foreach my $arg (split(/[ \t]+/))
+ {
+ $arg =~ tr/\x11\x0a\x0b/ \'\"/; # Put back real chars
+ # The outermost quotes has to go
+ $arg =~ s/^([^\'\"]*)\'(.*)\'([^\'\"]*)$/$1$2$3/
+ or $arg =~ s/^([^\'\"]*)\"(.*)\"([^\'\"]*)$/$1$2$3/;
+ $arg =~ s/\\\\/\\/g;
+
+ # Expand environment variables
+ $arg =~ s/\$\{(\w+)\}/envsubst($1)/ge;
+ $arg =~ s/\$(\w+)/envsubst($1)/ge;
+
+ # Do not pass empty string since my_getopt is not capable to handle it.
+ if (length($arg)) {
+ push(@args, $arg);
+ }
+ }
+ }
+ close FILE;
+ return \@args;
+}
sub print_testcases {
my (@cases)= @_;
@@ -944,9 +1035,9 @@ sub print_testcases {
foreach my $test (@cases){
print "[", $test->{name}, "]", "\n";
while ((my ($key, $value)) = each(%$test)) {
- print " ", $key, "=";
+ print " ", $key, "= ";
if (ref $value eq "ARRAY") {
- print join(", ", @$value);
+ print "[", join(", ", @$value), "]";
} else {
print $value;
}
diff --git a/mysql-test/lib/mtr_diff.pl b/mysql-test/lib/mtr_diff.pl
deleted file mode 100644
index 26e556de5e8..00000000000
--- a/mysql-test/lib/mtr_diff.pl
+++ /dev/null
@@ -1,297 +0,0 @@
-# -*- cperl -*-
-# Copyright (C) 2005 MySQL AB
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-# This is a library file used by the Perl version of mysql-test-run,
-# and is part of the translation of the Bourne shell script with the
-# same name.
-
-#use Data::Dumper;
-use strict;
-
-# $Data::Dumper::Indent= 1;
-
-sub mtr_diff($$);
-
-##############################################################################
-#
-# This is a simplified unified diff, with some special handling
-# of unsorted result sets
-#
-##############################################################################
-
-# FIXME replace die with mtr_error
-
-#require "mtr_report.pl";
-#mtr_diff("a.txt","b.txt");
-
-sub mtr_diff ($$) {
- my $file1 = shift;
- my $file2 = shift;
-
- # ----------------------------------------------------------------------
- # We read in all of the files at once
- # ----------------------------------------------------------------------
-
- unless ( open(FILE1, $file1) )
- {
- mtr_warning("can't open \"$file1\": $!");
- return;
- }
-
- unless ( open(FILE2, $file2) )
- {
- mtr_warning("can't open \"$file2\": $!");
- return;
- }
-
- my $lines1= collect_lines(<FILE1>);
- my $lines2= collect_lines(<FILE2>);
- close FILE1;
- close FILE2;
-
-# print Dumper($lines1);
-# print Dumper($lines2);
-
- # ----------------------------------------------------------------------
- # We compare line by line, but don't shift off elements until we know
- # what to do. This way we use the "restart" method, do simple change
- # and restart by entering the diff loop from the beginning again.
- # ----------------------------------------------------------------------
-
- my @context;
- my @info; # Collect information, and output later
- my $lno1= 1;
- my $lno2= 1;
-
- while ( @$lines1 or @$lines2 )
- {
- unless ( @$lines1 )
- {
- push(@info, map {['+',$lno1,$lno2++,$_]} @$lines2);
- last;
- }
- unless ( @$lines2 )
- {
- push(@info, map {['-',$lno1++,$lno2,$_]} @$lines1);
- last;
- }
-
- # ----------------------------------------------------------------------
- # We know both have lines
- # ----------------------------------------------------------------------
-
- if ( $lines1->[0] eq $lines2->[0] )
- {
- # Simple case, first line match and all is well
- push(@info, ['',$lno1++,$lno2++,$lines1->[0]]);
- shift @$lines1;
- shift @$lines2;
- next;
- }
-
- # ----------------------------------------------------------------------
- # Now, we know they differ
- # ----------------------------------------------------------------------
-
- # How far in the other one, is there a match?
-
- my $idx2= find_next_match($lines1->[0], $lines2);
- my $idx1= find_next_match($lines2->[0], $lines1);
-
- # Here we could test "if ( !defined $idx2 or !defined $idx1 )" and
- # use a more complicated diff algorithm in the case both contains
- # each others lines, just dislocated. But for this application, there
- # should be no need.
-
- if ( !defined $idx2 )
- {
- push(@info, ['-',$lno1++,$lno2,$lines1->[0]]);
- shift @$lines1;
- }
- else
- {
- push(@info, ['+',$lno1,$lno2++,$lines2->[0]]);
- shift @$lines2;
- }
- }
-
- # ----------------------------------------------------------------------
- # Try to output nicely
- # ----------------------------------------------------------------------
-
-# print Dumper(\@info);
-
- # We divide into "chunks" to output
- # We want at least three lines of context
-
- my @chunks;
- my @chunk;
- my $state= 'pre'; # 'pre', 'in' and 'post' difference
- my $post_count= 0;
-
- foreach my $info ( @info )
- {
- if ( $info->[0] eq '' and $state eq 'pre' )
- {
- # Collect no more than three lines of context before diff
- push(@chunk, $info);
- shift(@chunk) if @chunk > 3;
- next;
- }
-
- if ( $info->[0] =~ /(\+|\-)/ and $state =~ /(pre|in)/ )
- {
- # Start/continue collecting diff
- $state= 'in';
- push(@chunk, $info);
- next;
- }
-
- if ( $info->[0] eq '' and $state eq 'in' )
- {
- # Stop collecting diff, and collect context after diff
- $state= 'post';
- $post_count= 1;
- push(@chunk, $info);
- next;
- }
-
- if ( $info->[0] eq '' and $state eq 'post' and $post_count < 6 )
- {
- # We might find a new diff sequence soon, continue to collect
- # non diffs but five up on 6.
- $post_count++;
- push(@chunk, $info);
- next;
- }
-
- if ( $info->[0] eq '' and $state eq 'post' )
- {
- # We put an end to this, giving three non diff lines to
- # the old chunk, and three to the new one.
- my @left= splice(@chunk, -3, 3);
- push(@chunks, [@chunk]);
- $state= 'pre';
- $post_count= 0;
- @chunk= @left;
- next;
- }
-
- if ( $info->[0] =~ /(\+|\-)/ and $state eq 'post' )
- {
- # We didn't split, continue collect diff
- $state= 'in';
- push(@chunk, $info);
- next;
- }
-
- }
-
- if ( $post_count > 3 )
- {
- $post_count -= 3;
- splice(@chunk, -$post_count, $post_count);
- }
- push(@chunks, [@chunk]) if @chunk and $state ne 'pre';
-
- foreach my $chunk ( @chunks )
- {
- my $from_file_start= $chunk->[0]->[1];
- my $to_file_start= $chunk->[0]->[2];
- my $from_file_offset= $chunk->[$#$chunk]->[1] - $from_file_start;
- my $to_file_offset= $chunk->[$#$chunk]->[2] - $to_file_start;
- print "\@\@ -$from_file_start,$from_file_offset ",
- "+$to_file_start,$to_file_offset \@\@\n";
-
- foreach my $info ( @$chunk )
- {
- if ( $info->[0] eq '' )
- {
- print " $info->[3]\n";
- }
- elsif ( $info->[0] eq '-' )
- {
- print "- $info->[3]\n";
- }
- elsif ( $info->[0] eq '+' )
- {
- print "+ $info->[3]\n";
- }
- }
- }
-
-# print Dumper(\@chunks);
-
-}
-
-
-##############################################################################
-# Find if the string is found in the array, return the index if found,
-# if not found, return "undef"
-##############################################################################
-
-sub find_next_match {
- my $line= shift;
- my $lines= shift;
-
- for ( my $idx= 0; $idx < @$lines; $idx++ )
- {
- return $idx if $lines->[$idx] eq $line;
- }
-
- return undef; # No match found
-}
-
-
-##############################################################################
-# Just read the lines, but handle "sets" of lines that are unordered
-##############################################################################
-
-sub collect_lines {
-
- my @recordset;
- my @lines;
-
- while (@_)
- {
- my $line= shift @_;
- chomp($line);
-
- if ( $line =~ /^\Q%unordered%\E\t/ )
- {
- push(@recordset, $line);
- }
- elsif ( @recordset )
- {
- push(@lines, sort @recordset);
- @recordset= (); # Clear it
- }
- else
- {
- push(@lines, $line);
- }
- }
-
- if ( @recordset )
- {
- push(@lines, sort @recordset);
- @recordset= (); # Clear it
- }
-
- return \@lines;
-}
-
-1;
diff --git a/mysql-test/lib/mtr_im.pl b/mysql-test/lib/mtr_im.pl
deleted file mode 100644
index c8e332498d7..00000000000
--- a/mysql-test/lib/mtr_im.pl
+++ /dev/null
@@ -1,775 +0,0 @@
-# -*- cperl -*-
-# Copyright (C) 2006 MySQL AB
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-# This is a library file used by the Perl version of mysql-test-run,
-# and is part of the translation of the Bourne shell script with the
-# same name.
-
-use strict;
-
-# Private IM-related operations.
-
-sub mtr_im_kill_process ($$$$);
-sub mtr_im_load_pids ($);
-sub mtr_im_terminate ($);
-sub mtr_im_check_alive ($);
-sub mtr_im_check_main_alive ($);
-sub mtr_im_check_angel_alive ($);
-sub mtr_im_check_mysqlds_alive ($);
-sub mtr_im_check_mysqld_alive ($);
-sub mtr_im_cleanup ($);
-sub mtr_im_rm_file ($);
-sub mtr_im_errlog ($);
-sub mtr_im_kill ($);
-sub mtr_im_wait_for_connection ($$$);
-sub mtr_im_wait_for_mysqld($$$);
-
-# Public IM-related operations.
-
-sub mtr_im_start ($$);
-sub mtr_im_stop ($);
-
-##############################################################################
-#
-# Private operations.
-#
-##############################################################################
-
-sub mtr_im_kill_process ($$$$) {
- my $pid_lst= shift;
- my $signal= shift;
- my $total_retries= shift;
- my $timeout= shift;
-
- my %pids;
-
- foreach my $pid ( @{$pid_lst} )
- {
- $pids{$pid}= 1;
- }
-
- for ( my $cur_attempt= 1; $cur_attempt <= $total_retries; ++$cur_attempt )
- {
- foreach my $pid ( keys %pids )
- {
- mtr_debug("Sending $signal to $pid...");
-
- kill($signal, $pid);
-
- unless ( kill (0, $pid) )
- {
- mtr_debug("Process $pid died.");
- delete $pids{$pid};
- }
- }
-
- return if scalar keys %pids == 0;
-
- mtr_debug("Sleeping $timeout second(s) waiting for processes to die...");
-
- sleep($timeout);
- }
-
- mtr_debug("Process(es) " .
- join(' ', keys %pids) .
- " is still alive after $total_retries " .
- "of sending signal $signal.");
-}
-
-###########################################################################
-
-sub mtr_im_load_pids($) {
- my $im= shift;
-
- mtr_debug("Loading PID files...");
-
- # Obtain mysqld-process pids.
-
- my $instances = $im->{'instances'};
-
- for ( my $idx= 0; $idx < 2; ++$idx )
- {
- mtr_debug("IM-guarded mysqld[$idx] PID file: '" .
- $instances->[$idx]->{'path_pid'} . "'.");
-
- my $mysqld_pid;
-
- if ( -r $instances->[$idx]->{'path_pid'} )
- {
- $mysqld_pid= mtr_get_pid_from_file($instances->[$idx]->{'path_pid'});
- mtr_debug("IM-guarded mysqld[$idx] PID: $mysqld_pid.");
- }
- else
- {
- $mysqld_pid= undef;
- mtr_debug("IM-guarded mysqld[$idx]: no PID file.");
- }
-
- $instances->[$idx]->{'pid'}= $mysqld_pid;
- }
-
- # Re-read Instance Manager PIDs from the file, since during tests Instance
- # Manager could have been restarted, so its PIDs could have been changed.
-
- # - IM-main
-
- mtr_debug("IM-main PID file: '$im->{path_pid}'.");
-
- if ( -f $im->{'path_pid'} )
- {
- $im->{'pid'} =
- mtr_get_pid_from_file($im->{'path_pid'});
-
- mtr_debug("IM-main PID: $im->{pid}.");
- }
- else
- {
- mtr_debug("IM-main: no PID file.");
- $im->{'pid'}= undef;
- }
-
- # - IM-angel
-
- mtr_debug("IM-angel PID file: '$im->{path_angel_pid}'.");
-
- if ( -f $im->{'path_angel_pid'} )
- {
- $im->{'angel_pid'} =
- mtr_get_pid_from_file($im->{'path_angel_pid'});
-
- mtr_debug("IM-angel PID: $im->{'angel_pid'}.");
- }
- else
- {
- mtr_debug("IM-angel: no PID file.");
- $im->{'angel_pid'} = undef;
- }
-}
-
-###########################################################################
-
-sub mtr_im_terminate($) {
- my $im= shift;
-
- # Load pids from pid-files. We should do it first of all, because IM deletes
- # them on shutdown.
-
- mtr_im_load_pids($im);
-
- mtr_debug("Shutting Instance Manager down...");
-
- # Ignoring SIGCHLD so that all children could rest in peace.
-
- start_reap_all();
-
- # Send SIGTERM to IM-main.
-
- if ( defined $im->{'pid'} )
- {
- mtr_debug("IM-main pid: $im->{pid}.");
- mtr_debug("Stopping IM-main...");
-
- mtr_im_kill_process([ $im->{'pid'} ], 'TERM', 10, 1);
- }
- else
- {
- mtr_debug("IM-main pid: n/a.");
- }
-
- # If IM-angel was alive, wait for it to die.
-
- if ( defined $im->{'angel_pid'} )
- {
- mtr_debug("IM-angel pid: $im->{'angel_pid'}.");
- mtr_debug("Waiting for IM-angel to die...");
-
- my $total_attempts= 10;
-
- for ( my $cur_attempt=1; $cur_attempt <= $total_attempts; ++$cur_attempt )
- {
- unless ( kill (0, $im->{'angel_pid'}) )
- {
- mtr_debug("IM-angel died.");
- last;
- }
-
- sleep(1);
- }
- }
- else
- {
- mtr_debug("IM-angel pid: n/a.");
- }
-
- stop_reap_all();
-
- # Re-load PIDs.
-
- mtr_im_load_pids($im);
-}
-
-###########################################################################
-
-sub mtr_im_check_alive($) {
- my $im= shift;
-
- mtr_debug("Checking whether IM-components are alive...");
-
- return 1 if mtr_im_check_main_alive($im);
-
- return 1 if mtr_im_check_angel_alive($im);
-
- return 1 if mtr_im_check_mysqlds_alive($im);
-
- return 0;
-}
-
-###########################################################################
-
-sub mtr_im_check_main_alive($) {
- my $im= shift;
-
- # Check that the process, that we know to be IM's, is dead.
-
- if ( defined $im->{'pid'} )
- {
- if ( kill (0, $im->{'pid'}) )
- {
- mtr_debug("IM-main (PID: $im->{pid}) is alive.");
- return 1;
- }
- else
- {
- mtr_debug("IM-main (PID: $im->{pid}) is dead.");
- }
- }
- else
- {
- mtr_debug("No PID file for IM-main.");
- }
-
- # Check that IM does not accept client connections.
-
- if ( mtr_ping_port($im->{'port'}) )
- {
- mtr_debug("IM-main (port: $im->{port}) " .
- "is accepting connections.");
-
- mtr_im_errlog("IM-main is accepting connections on port " .
- "$im->{port}, but there is no " .
- "process information.");
- return 1;
- }
- else
- {
- mtr_debug("IM-main (port: $im->{port}) " .
- "does not accept connections.");
- return 0;
- }
-}
-
-###########################################################################
-
-sub mtr_im_check_angel_alive($) {
- my $im= shift;
-
- # Check that the process, that we know to be the Angel, is dead.
-
- if ( defined $im->{'angel_pid'} )
- {
- if ( kill (0, $im->{'angel_pid'}) )
- {
- mtr_debug("IM-angel (PID: $im->{angel_pid}) is alive.");
- return 1;
- }
- else
- {
- mtr_debug("IM-angel (PID: $im->{angel_pid}) is dead.");
- return 0;
- }
- }
- else
- {
- mtr_debug("No PID file for IM-angel.");
- return 0;
- }
-}
-
-###########################################################################
-
-sub mtr_im_check_mysqlds_alive($) {
- my $im= shift;
-
- mtr_debug("Checking for IM-guarded mysqld instances...");
-
- my $instances = $im->{'instances'};
-
- for ( my $idx= 0; $idx < 2; ++$idx )
- {
- mtr_debug("Checking mysqld[$idx]...");
-
- return 1
- if mtr_im_check_mysqld_alive($instances->[$idx]);
- }
-}
-
-###########################################################################
-
-sub mtr_im_check_mysqld_alive($) {
- my $mysqld_instance= shift;
-
- # Check that the process is dead.
-
- if ( defined $mysqld_instance->{'pid'} )
- {
- if ( kill (0, $mysqld_instance->{'pid'}) )
- {
- mtr_debug("Mysqld instance (PID: $mysqld_instance->{pid}) is alive.");
- return 1;
- }
- else
- {
- mtr_debug("Mysqld instance (PID: $mysqld_instance->{pid}) is dead.");
- }
- }
- else
- {
- mtr_debug("No PID file for mysqld instance.");
- }
-
- # Check that mysqld does not accept client connections.
-
- if ( mtr_ping_port($mysqld_instance->{'port'}) )
- {
- mtr_debug("Mysqld instance (port: $mysqld_instance->{port}) " .
- "is accepting connections.");
-
- mtr_im_errlog("Mysqld is accepting connections on port " .
- "$mysqld_instance->{port}, but there is no " .
- "process information.");
- return 1;
- }
- else
- {
- mtr_debug("Mysqld instance (port: $mysqld_instance->{port}) " .
- "does not accept connections.");
- return 0;
- }
-}
-
-###########################################################################
-
-sub mtr_im_cleanup($) {
- my $im= shift;
-
- mtr_im_rm_file($im->{'path_pid'});
- mtr_im_rm_file($im->{'path_sock'});
-
- mtr_im_rm_file($im->{'path_angel_pid'});
-
- for ( my $idx= 0; $idx < 2; ++$idx )
- {
- mtr_im_rm_file($im->{'instances'}->[$idx]->{'path_pid'});
- mtr_im_rm_file($im->{'instances'}->[$idx]->{'path_sock'});
- }
-}
-
-###########################################################################
-
-sub mtr_im_rm_file($)
-{
- my $file_path= shift;
-
- if ( -f $file_path )
- {
- mtr_debug("Removing '$file_path'...");
-
- unless ( unlink($file_path) )
- {
- mtr_warning("Can not remove '$file_path'.")
- }
- }
- else
- {
- mtr_debug("File '$file_path' does not exist already.");
- }
-}
-
-###########################################################################
-
-sub mtr_im_errlog($) {
- my $msg= shift;
-
- # Complain in error log so that a warning will be shown.
- #
- # TODO: unless BUG#20761 is fixed, we will print the warning to stdout, so
- # that it can be seen on console and does not produce pushbuild error.
-
- # my $errlog= "$opt_vardir/log/mysql-test-run.pl.err";
- #
- # open (ERRLOG, ">>$errlog") ||
- # mtr_error("Can not open error log ($errlog)");
- #
- # my $ts= localtime();
- # print ERRLOG
- # "Warning: [$ts] $msg\n";
- #
- # close ERRLOG;
-
- my $ts= localtime();
- print "Warning: [$ts] $msg\n";
-}
-
-###########################################################################
-
-sub mtr_im_kill($) {
- my $im= shift;
-
- # Re-load PIDs. That can be useful because some processes could have been
- # restarted.
-
- mtr_im_load_pids($im);
-
- # Ignoring SIGCHLD so that all children could rest in peace.
-
- start_reap_all();
-
- # Kill IM-angel first of all.
-
- if ( defined $im->{'angel_pid'} )
- {
- mtr_debug("Killing IM-angel (PID: $im->{angel_pid})...");
- mtr_im_kill_process([ $im->{'angel_pid'} ], 'KILL', 10, 1)
- }
- else
- {
- mtr_debug("IM-angel is dead.");
- }
-
- # Re-load PIDs again.
-
- mtr_im_load_pids($im);
-
- # Kill IM-main.
-
- if ( defined $im->{'pid'} )
- {
- mtr_debug("Killing IM-main (PID: $im->pid})...");
- mtr_im_kill_process([ $im->{'pid'} ], 'KILL', 10, 1);
- }
- else
- {
- mtr_debug("IM-main is dead.");
- }
-
- # Re-load PIDs again.
-
- mtr_im_load_pids($im);
-
- # Kill guarded mysqld instances.
-
- my @mysqld_pids;
-
- mtr_debug("Collecting PIDs of mysqld instances to kill...");
-
- for ( my $idx= 0; $idx < 2; ++$idx )
- {
- my $pid= $im->{'instances'}->[$idx]->{'pid'};
-
- unless ( defined $pid )
- {
- next;
- }
-
- mtr_debug(" - IM-guarded mysqld[$idx] PID: $pid.");
-
- push (@mysqld_pids, $pid);
- }
-
- if ( scalar @mysqld_pids > 0 )
- {
- mtr_debug("Killing IM-guarded mysqld instances...");
- mtr_im_kill_process(\@mysqld_pids, 'KILL', 10, 1);
- }
-
- # That's all.
-
- stop_reap_all();
-}
-
-##############################################################################
-
-sub mtr_im_wait_for_connection($$$) {
- my $im= shift;
- my $total_attempts= shift;
- my $connect_timeout= shift;
-
- mtr_debug("Waiting for IM on port $im->{port} " .
- "to start accepting connections...");
-
- for ( my $cur_attempt= 1; $cur_attempt <= $total_attempts; ++$cur_attempt )
- {
- mtr_debug("Trying to connect to IM ($cur_attempt of $total_attempts)...");
-
- if ( mtr_ping_port($im->{'port'}) )
- {
- mtr_debug("IM is accepting connections " .
- "on port $im->{port}.");
- return 1;
- }
-
- mtr_debug("Sleeping $connect_timeout...");
- sleep($connect_timeout);
- }
-
- mtr_debug("IM does not accept connections " .
- "on port $im->{port} after " .
- ($total_attempts * $connect_timeout) . " seconds.");
-
- return 0;
-}
-
-##############################################################################
-
-sub mtr_im_wait_for_mysqld($$$) {
- my $mysqld= shift;
- my $total_attempts= shift;
- my $connect_timeout= shift;
-
- mtr_debug("Waiting for IM-guarded mysqld on port $mysqld->{port} " .
- "to start accepting connections...");
-
- for ( my $cur_attempt= 1; $cur_attempt <= $total_attempts; ++$cur_attempt )
- {
- mtr_debug("Trying to connect to mysqld " .
- "($cur_attempt of $total_attempts)...");
-
- if ( mtr_ping_port($mysqld->{'port'}) )
- {
- mtr_debug("Mysqld is accepting connections " .
- "on port $mysqld->{port}.");
- return 1;
- }
-
- mtr_debug("Sleeping $connect_timeout...");
- sleep($connect_timeout);
- }
-
- mtr_debug("Mysqld does not accept connections " .
- "on port $mysqld->{port} after " .
- ($total_attempts * $connect_timeout) . " seconds.");
-
- return 0;
-}
-
-##############################################################################
-#
-# Public operations.
-#
-##############################################################################
-
-sub mtr_im_start($$) {
- my $im = shift;
- my $opts = shift;
-
- mtr_debug("Starting Instance Manager...");
-
- my $args;
- mtr_init_args(\$args);
- mtr_add_arg($args, "--defaults-file=%s", $im->{'defaults_file'});
-
- foreach my $opt ( @{$opts} )
- {
- mtr_add_arg($args, $opt);
- }
-
- $im->{'spawner_pid'} =
- mtr_spawn(
- $::exe_im, # path to the executable
- $args, # cmd-line args
- '', # stdin
- $im->{'path_log'}, # stdout
- $im->{'path_err'}, # stderr
- '', # pid file path (not used)
- { append_log_file => 1 } # append log files
- );
-
- unless ( $im->{'spawner_pid'} )
- {
- mtr_error('Could not start Instance Manager.')
- }
-
- # Instance Manager can be run in daemon mode. In this case, it creates
- # several processes and the parent process, created by mtr_spawn(), exits just
- # after start. So, we have to obtain Instance Manager PID from the PID file.
-
- mtr_debug("Waiting for IM to create PID file (" .
- "path: '$im->{path_pid}'; " .
- "timeout: $im->{start_timeout})...");
-
- unless ( sleep_until_file_created($im->{'path_pid'},
- $im->{'start_timeout'},
- -1) ) # real PID is still unknown
- {
- mtr_debug("IM has not created PID file in $im->{start_timeout} secs.");
- mtr_debug("Aborting test suite...");
-
- mtr_kill_leftovers();
-
- mtr_report("IM has not created PID file in $im->{start_timeout} secs.");
- return 0;
- }
-
- $im->{'pid'}= mtr_get_pid_from_file($im->{'path_pid'});
-
- mtr_debug("Instance Manager started. PID: $im->{pid}.");
-
- # Wait until we can connect to IM.
-
- my $IM_CONNECT_TIMEOUT= 30;
-
- unless ( mtr_im_wait_for_connection($im,
- $IM_CONNECT_TIMEOUT, 1) )
- {
- mtr_debug("Can not connect to Instance Manager " .
- "in $IM_CONNECT_TIMEOUT seconds after start.");
- mtr_debug("Aborting test suite...");
-
- mtr_kill_leftovers();
-
- mtr_report("Can not connect to Instance Manager " .
- "in $IM_CONNECT_TIMEOUT seconds after start.");
- return 0;
- }
-
- # Wait for IM to start guarded instances:
- # - wait for PID files;
-
- mtr_debug("Waiting for guarded mysqlds instances to create PID files...");
-
- for ( my $idx= 0; $idx < 2; ++$idx )
- {
- my $mysqld= $im->{'instances'}->[$idx];
-
- if ( exists $mysqld->{'nonguarded'} )
- {
- next;
- }
-
- mtr_debug("Waiting for mysqld[$idx] to create PID file (" .
- "path: '$mysqld->{path_pid}'; " .
- "timeout: $mysqld->{start_timeout})...");
-
- unless ( sleep_until_file_created($mysqld->{'path_pid'},
- $mysqld->{'start_timeout'},
- -1) ) # real PID is still unknown
- {
- mtr_debug("mysqld[$idx] has not created PID file in " .
- "$mysqld->{start_timeout} secs.");
- mtr_debug("Aborting test suite...");
-
- mtr_kill_leftovers();
-
- mtr_report("mysqld[$idx] has not created PID file in " .
- "$mysqld->{start_timeout} secs.");
- return 0;
- }
-
- mtr_debug("PID file for mysqld[$idx] ($mysqld->{path_pid} created.");
- }
-
- # Wait until we can connect to guarded mysqld-instances
- # (in other words -- wait for IM to start guarded instances).
-
- mtr_debug("Waiting for guarded mysqlds to start accepting connections...");
-
- for ( my $idx= 0; $idx < 2; ++$idx )
- {
- my $mysqld= $im->{'instances'}->[$idx];
-
- if ( exists $mysqld->{'nonguarded'} )
- {
- next;
- }
-
- mtr_debug("Waiting for mysqld[$idx] to accept connection...");
-
- unless ( mtr_im_wait_for_mysqld($mysqld, 30, 1) )
- {
- mtr_debug("Can not connect to mysqld[$idx] " .
- "in $IM_CONNECT_TIMEOUT seconds after start.");
- mtr_debug("Aborting test suite...");
-
- mtr_kill_leftovers();
-
- mtr_report("Can not connect to mysqld[$idx] " .
- "in $IM_CONNECT_TIMEOUT seconds after start.");
- return 0;
- }
-
- mtr_debug("mysqld[$idx] started.");
- }
-
- mtr_debug("Instance Manager and its components are up and running.");
-
- return 1;
-}
-
-##############################################################################
-
-sub mtr_im_stop($) {
- my $im= shift;
-
- mtr_debug("Stopping Instance Manager...");
-
- # Try graceful shutdown.
-
- mtr_im_terminate($im);
-
- # Check that all processes died.
-
- unless ( mtr_im_check_alive($im) )
- {
- mtr_debug("Instance Manager has been stopped successfully.");
- mtr_im_cleanup($im);
- return 1;
- }
-
- # Instance Manager don't want to die. We should kill it.
-
- mtr_im_errlog("Instance Manager did not shutdown gracefully.");
-
- mtr_im_kill($im);
-
- # Check again that all IM-related processes have been killed.
-
- my $im_is_alive= mtr_im_check_alive($im);
-
- mtr_im_cleanup($im);
-
- if ( $im_is_alive )
- {
- mtr_debug("Can not kill Instance Manager or its children.");
- return 0;
- }
-
- mtr_debug("Instance Manager has been killed successfully.");
- return 1;
-}
-
-###########################################################################
-
-1;
diff --git a/mysql-test/lib/mtr_io.pl b/mysql-test/lib/mtr_io.pl
index aa671c0f4f7..6712c19b829 100644
--- a/mysql-test/lib/mtr_io.pl
+++ b/mysql-test/lib/mtr_io.pl
@@ -20,135 +20,14 @@
use strict;
-sub mtr_get_pid_from_file ($);
-sub mtr_get_opts_from_file ($);
sub mtr_fromfile ($);
sub mtr_tofile ($@);
sub mtr_tonewfile($@);
-sub mtr_lastlinefromfile($);
sub mtr_appendfile_to_file ($$);
sub mtr_grab_file($);
+sub mtr_printfile($);
-##############################################################################
-#
-#
-#
-##############################################################################
-
-sub mtr_get_pid_from_file ($) {
- my $pid_file_path= shift;
- my $TOTAL_ATTEMPTS= 30;
- my $timeout= 1;
-
- # We should read from the file until we get correct pid. As it is
- # stated in BUG#21884, pid file can be empty at some moment. So, we should
- # read it until we get valid data.
-
- for (my $cur_attempt= 1; $cur_attempt <= $TOTAL_ATTEMPTS; ++$cur_attempt)
- {
- mtr_debug("Reading pid file '$pid_file_path' " .
- "($cur_attempt of $TOTAL_ATTEMPTS)...");
-
- open(FILE, '<', $pid_file_path)
- or mtr_error("can't open file \"$pid_file_path\": $!");
-
- # Read pid number from file
- my $pid= <FILE>;
- chomp $pid;
- close FILE;
-
- return $pid if $pid=~ /^(\d+)/;
-
- mtr_debug("Pid file '$pid_file_path' does not yet contain pid number.\n" .
- "Sleeping $timeout second(s) more...");
-
- sleep($timeout);
- }
-
- mtr_error("Pid file '$pid_file_path' is corrupted. " .
- "Can not retrieve PID in " .
- ($timeout * $TOTAL_ATTEMPTS) . " seconds.");
-}
-
-sub mtr_get_opts_from_file ($) {
- my $file= shift;
-
- open(FILE,"<",$file) or mtr_error("can't open file \"$file\": $!");
- my @args;
- while ( <FILE> )
- {
- chomp;
-
- # --set-variable=init_connect=set @a='a\\0c'
- s/^\s+//; # Remove leading space
- s/\s+$//; # Remove ending space
-
- # This is strange, but we need to fill whitespace inside
- # quotes with something, to remove later. We do this to
- # be able to split on space. Else, we have trouble with
- # options like
- #
- # --someopt="--insideopt1 --insideopt2"
- #
- # But still with this, we are not 100% sure it is right,
- # we need a shell to do it right.
-
-# print STDERR "\n";
-# print STDERR "AAA: $_\n";
-
- s/\'([^\'\"]*)\'/unspace($1,"\x0a")/ge;
- s/\"([^\'\"]*)\"/unspace($1,"\x0b")/ge;
- s/\'([^\'\"]*)\'/unspace($1,"\x0a")/ge;
- s/\"([^\'\"]*)\"/unspace($1,"\x0b")/ge;
-
-# print STDERR "BBB: $_\n";
-
-# foreach my $arg (/(--?\w.*?)(?=\s+--?\w|$)/)
-
- # FIXME ENV vars should be expanded!!!!
-
- foreach my $arg (split(/[ \t]+/))
- {
- $arg =~ tr/\x11\x0a\x0b/ \'\"/; # Put back real chars
- # The outermost quotes has to go
- $arg =~ s/^([^\'\"]*)\'(.*)\'([^\'\"]*)$/$1$2$3/
- or $arg =~ s/^([^\'\"]*)\"(.*)\"([^\'\"]*)$/$1$2$3/;
- $arg =~ s/\\\\/\\/g;
-
- $arg =~ s/\$\{(\w+)\}/envsubst($1)/ge;
- $arg =~ s/\$(\w+)/envsubst($1)/ge;
-
-# print STDERR "ARG: $arg\n";
- # Do not pass empty string since my_getopt is not capable to handle it.
- if (length($arg))
- {
- push(@args, $arg)
- }
- }
- }
- close FILE;
- return \@args;
-}
-
-sub envsubst {
- my $string= shift;
-
- if ( ! defined $ENV{$string} )
- {
- mtr_error("opt file referense \$$string that is unknown");
- }
-
- return $ENV{$string};
-}
-
-sub unspace {
- my $string= shift;
- my $quote= shift;
- $string =~ s/[ \t]/\x11/g;
- return "$quote$string$quote";
-}
-
# Read a whole file, stripping leading and trailing whitespace.
sub mtr_fromfile ($) {
my $file= shift;
@@ -161,19 +40,6 @@ sub mtr_fromfile ($) {
return $text;
}
-sub mtr_lastlinefromfile ($) {
- my $file= shift;
- my $text;
-
- open(FILE,"<",$file) or mtr_error("can't open file \"$file\": $!");
- while (my $line= <FILE>)
- {
- $text= $line;
- }
- close FILE;
- return $text;
-}
-
sub mtr_tofile ($@) {
my $file= shift;
@@ -183,6 +49,7 @@ sub mtr_tofile ($@) {
close FILE;
}
+
sub mtr_tonewfile ($@) {
my $file= shift;
@@ -191,6 +58,7 @@ sub mtr_tonewfile ($@) {
close FILE;
}
+
sub mtr_appendfile_to_file ($$) {
my $from_file= shift;
my $to_file= shift;
@@ -203,6 +71,7 @@ sub mtr_appendfile_to_file ($$) {
close TOFILE;
}
+
# Read a whole file verbatim.
sub mtr_grab_file($) {
my $file= shift;
@@ -215,4 +84,15 @@ sub mtr_grab_file($) {
}
+# Print the file to STDOUT
+sub mtr_printfile($) {
+ my $file= shift;
+ open(FILE, '<', $file)
+ or warn $!;
+ print while(<FILE>);
+ close FILE;
+ return;
+}
+
+
1;
diff --git a/mysql-test/lib/mtr_misc.pl b/mysql-test/lib/mtr_misc.pl
index 0173e8b8572..95f5bf584f0 100644
--- a/mysql-test/lib/mtr_misc.pl
+++ b/mysql-test/lib/mtr_misc.pl
@@ -19,18 +19,16 @@
# same name.
use strict;
-use File::Find;
sub mtr_native_path($);
sub mtr_init_args ($);
sub mtr_add_arg ($$@);
+sub mtr_args2str($@);
sub mtr_path_exists(@);
sub mtr_script_exists(@);
sub mtr_file_exists(@);
sub mtr_exe_exists(@);
sub mtr_exe_maybe_exists(@);
-sub mtr_copy_dir($$);
-sub mtr_rmtree($);
sub mtr_same_opts($$);
sub mtr_cmp_opts($$);
@@ -56,7 +54,11 @@ sub mtr_native_path($)
}
-# FIXME move to own lib
+##############################################################################
+#
+# Args
+#
+##############################################################################
sub mtr_init_args ($) {
my $args = shift;
@@ -68,9 +70,18 @@ sub mtr_add_arg ($$@) {
my $format= shift;
my @fargs = @_;
+ # Quote args if args contain space
+ $format= "\"$format\""
+ if ($::glob_win32 and grep(/\s/, @fargs));
+
push(@$args, sprintf($format, @fargs));
}
+sub mtr_args2str($@) {
+ my $exe= shift or die;
+ return join(" ", mtr_native_path($exe), @_);
+}
+
##############################################################################
#
@@ -141,7 +152,6 @@ sub mtr_exe_maybe_exists (@) {
my @path= @_;
map {$_.= ".exe"} @path if $::glob_win32;
- map {$_.= ".nlm"} @path if $::glob_netware;
foreach my $path ( @path )
{
if($::glob_win32)
@@ -179,79 +189,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_rmtree($) {
- my ($dir)= @_;
- mtr_verbose("mtr_rmtree: $dir");
-
- # Try to use File::Path::rmtree. Recent versions
- # handles removal of directories and files that don't
- # have full permissions, while older versions
- # may have a problem with that and we use our own version
-
- eval { rmtree($dir); };
- if ( $@ ) {
- mtr_warning("rmtree($dir) failed, trying with File::Find...");
-
- my $errors= 0;
-
- # chmod
- find( {
- no_chdir => 1,
- wanted => sub {
- chmod(0777, $_)
- or mtr_warning("couldn't chmod(0777, $_): $!") and $errors++;
- }
- },
- $dir
- );
-
- # rm
- finddepth( {
- no_chdir => 1,
- wanted => sub {
- my $file= $_;
- # Use special underscore (_) filehandle, caches stat info
- if (!-l $file and -d _ ) {
- rmdir($file) or
- mtr_warning("couldn't rmdir($file): $!") and $errors++;
- } else {
- unlink($file)
- or mtr_warning("couldn't unlink($file): $!") and $errors++;
- }
- }
- },
- $dir
- );
-
- mtr_error("Failed to remove '$dir'") if $errors;
-
- mtr_report("OK, that worked!");
- }
-}
-
sub mtr_same_opts ($$) {
my $l1= shift;
@@ -280,33 +217,41 @@ sub mtr_cmp_opts ($$) {
return 0; # They are the same
}
+
+sub mtr_milli_sleep {
+ die "usage: mtr_milli_sleep(milliseconds)" unless @_ == 1;
+ my ($millis)= @_;
+
+ select(undef, undef, undef, ($millis/1000));
+}
+
#
# Compare two arrays and put all unequal elements into a new one
#
sub mtr_diff_opts ($$) {
my $l1= shift;
my $l2= shift;
- my $f;
- my $l= [];
- foreach my $e1 (@$l1)
- {
- $f= undef;
- foreach my $e2 (@$l2)
+ my $found;
+ my @result;
+ foreach my $e1 (@$l1)
+ {
+ $found= undef;
+ foreach my $e2 (@$l2)
{
- $f= 1 unless ($e1 ne $e2);
+ $found= 1 unless ($e1 ne $e2);
}
- push(@$l, $e1) unless (defined $f);
+ push(@result, $e1) unless (defined $found);
}
- foreach my $e2 (@$l2)
+ foreach my $e2 (@$l2)
{
- $f= undef;
- foreach my $e1 (@$l1)
+ $found= undef;
+ foreach my $e1 (@$l1)
{
- $f= 1 unless ($e1 ne $e2);
+ $found= 1 unless ($e1 ne $e2);
}
- push(@$l, $e2) unless (defined $f);
+ push(@result, $e2) unless (defined $found);
}
- return $l;
+ return @result;
}
1;
diff --git a/mysql-test/lib/mtr_process.pl b/mysql-test/lib/mtr_process.pl
index 8fd900330da..a99119a199d 100644
--- a/mysql-test/lib/mtr_process.pl
+++ b/mysql-test/lib/mtr_process.pl
@@ -18,985 +18,13 @@
# and is part of the translation of the Bourne shell script with the
# same name.
+use strict;
use Socket;
use Errno;
-use strict;
-
-use POSIX qw(WNOHANG SIGHUP);
-sub mtr_run ($$$$$$;$);
-sub mtr_spawn ($$$$$$;$);
-sub mtr_check_stop_servers ($);
-sub mtr_kill_leftovers ();
-sub mtr_wait_blocking ($);
-sub mtr_record_dead_children ();
-sub mtr_ndbmgm_start($$);
-sub mtr_mysqladmin_start($$$);
-sub mtr_exit ($);
sub sleep_until_file_created ($$$);
-sub mtr_kill_processes ($);
-sub mtr_ping_with_timeout($);
sub mtr_ping_port ($);
-# Local function
-sub spawn_impl ($$$$$$$);
-
-##############################################################################
-#
-# Execute an external command
-#
-##############################################################################
-
-sub mtr_run ($$$$$$;$) {
- my $path= shift;
- my $arg_list_t= shift;
- my $input= shift;
- my $output= shift;
- my $error= shift;
- my $pid_file= shift; # Not used
- my $spawn_opts= shift;
-
- return spawn_impl($path,$arg_list_t,'run',$input,$output,$error,
- $spawn_opts);
-}
-
-sub mtr_run_test ($$$$$$;$) {
- my $path= shift;
- my $arg_list_t= shift;
- my $input= shift;
- my $output= shift;
- my $error= shift;
- my $pid_file= shift; # Not used
- my $spawn_opts= shift;
-
- return spawn_impl($path,$arg_list_t,'test',$input,$output,$error,
- $spawn_opts);
-}
-
-sub mtr_spawn ($$$$$$;$) {
- my $path= shift;
- my $arg_list_t= shift;
- my $input= shift;
- my $output= shift;
- my $error= shift;
- my $pid_file= shift; # Not used
- my $spawn_opts= shift;
-
- return spawn_impl($path,$arg_list_t,'spawn',$input,$output,$error,
- $spawn_opts);
-}
-
-
-
-sub spawn_impl ($$$$$$$) {
- my $path= shift;
- my $arg_list_t= shift;
- my $mode= shift;
- my $input= shift;
- my $output= shift;
- my $error= shift;
- my $spawn_opts= shift;
-
- if ( $::opt_script_debug )
- {
- mtr_report("");
- mtr_debug("-" x 73);
- mtr_debug("STDIN $input") if $input;
- mtr_debug("STDOUT $output") if $output;
- mtr_debug("STDERR $error") if $error;
- mtr_debug("$mode: $path ", join(" ",@$arg_list_t));
- mtr_debug("spawn options:");
- if ($spawn_opts)
- {
- foreach my $key (sort keys %{$spawn_opts})
- {
- mtr_debug(" - $key: $spawn_opts->{$key}");
- }
- }
- else
- {
- mtr_debug(" none");
- }
- mtr_debug("-" x 73);
- mtr_report("");
- }
-
- mtr_error("Can't spawn with empty \"path\"") unless defined $path;
-
-
- FORK:
- {
- my $pid= fork();
-
- if ( ! defined $pid )
- {
- if ( $! == $!{EAGAIN} ) # See "perldoc Errno"
- {
- mtr_warning("Got EAGAIN from fork(), sleep 1 second and redo");
- sleep(1);
- redo FORK;
- }
-
- mtr_error("$path ($pid) can't be forked, error: $!");
-
- }
-
- if ( $pid )
- {
- select(STDOUT) if $::glob_win32_perl;
- return spawn_parent_impl($pid,$mode,$path);
- }
- else
- {
- # Child, redirect output and exec
-
- $SIG{INT}= 'DEFAULT'; # Parent do some stuff, we don't
-
- my $log_file_open_mode = '>';
-
- if ($spawn_opts and $spawn_opts->{'append_log_file'})
- {
- $log_file_open_mode = '>>';
- }
-
- if ( $output )
- {
- if ( $::glob_win32_perl )
- {
- # Don't redirect stdout on ActiveState perl since this is
- # just another thread in the same process.
- }
- elsif ( ! open(STDOUT,$log_file_open_mode,$output) )
- {
- mtr_child_error("can't redirect STDOUT to \"$output\": $!");
- }
- }
-
- if ( $error )
- {
- if ( !$::glob_win32_perl and $output eq $error )
- {
- if ( ! open(STDERR,">&STDOUT") )
- {
- mtr_child_error("can't dup STDOUT: $!");
- }
- }
- else
- {
- if ( ! open(STDERR,$log_file_open_mode,$error) )
- {
- mtr_child_error("can't redirect STDERR to \"$error\": $!");
- }
- }
- }
-
- if ( $input )
- {
- if ( ! open(STDIN,"<",$input) )
- {
- mtr_child_error("can't redirect STDIN to \"$input\": $!");
- }
- }
-
- if ( ! exec($path,@$arg_list_t) )
- {
- mtr_child_error("failed to execute \"$path\": $!");
- }
- mtr_error("Should never come here 1!");
- }
- mtr_error("Should never come here 2!");
- }
- mtr_error("Should never come here 3!");
-}
-
-
-sub spawn_parent_impl {
- my $pid= shift;
- my $mode= shift;
- my $path= shift;
-
- if ( $mode eq 'run' or $mode eq 'test' )
- {
- if ( $mode eq 'run' )
- {
- # Simple run of command, wait blocking for it to return
- my $ret_pid= waitpid($pid,0);
- if ( $ret_pid != $pid )
- {
- # The "simple" waitpid has failed, print debug info
- # and try to handle the error
- mtr_warning("waitpid($pid, 0) returned $ret_pid " .
- "when waiting for '$path', error: '$!'");
- if ( $ret_pid == -1 )
- {
- # waitpid returned -1, that would indicate the process
- # no longer exist and waitpid couldn't wait for it.
- return 1;
- }
- mtr_error("Error handling failed");
- }
-
- return mtr_process_exit_status($?);
- }
- else
- {
- # We run mysqltest and wait for it to return. But we try to
- # catch dying mysqld processes as well.
- #
- # We do blocking waitpid() until we get the return from the
- # "mysqltest" call. But if a mysqld process dies that we
- # started, we take this as an error, and kill mysqltest.
-
-
- my $exit_value= -1;
- my $saved_exit_value;
- my $ret_pid; # What waitpid() returns
-
- while ( ($ret_pid= waitpid(-1,0)) != -1 )
- {
- # Someone terminated, don't know who. Collect
- # status info first before $? is lost,
- # but not $exit_value, this is flagged from
-
- my $timer_name= mtr_timer_timeout($::glob_timers, $ret_pid);
- if ( $timer_name )
- {
- if ( $timer_name eq "suite" )
- {
- # We give up here
- # FIXME we should only give up the suite, not all of the run?
- print STDERR "\n";
- mtr_error("Test suite timeout");
- }
- elsif ( $timer_name eq "testcase" )
- {
- $saved_exit_value= 63; # Mark as timeout
- kill(9, $pid); # Kill mysqltest
- next; # Go on and catch the termination
- }
- }
-
- if ( $ret_pid == $pid )
- {
- # We got termination of mysqltest, we are done
- $exit_value= mtr_process_exit_status($?);
- last;
- }
-
- # One of the child processes died, unless this was expected
- # mysqltest should be killed and test aborted
-
- check_expected_crash_and_restart($ret_pid);
- }
-
- if ( $ret_pid != $pid )
- {
- # We terminated the waiting because a "mysqld" process died.
- # Kill the mysqltest process.
- mtr_verbose("Kill mysqltest because another process died");
- kill(9,$pid);
-
- $ret_pid= waitpid($pid,0);
-
- if ( $ret_pid != $pid )
- {
- mtr_error("$path ($pid) got lost somehow");
- }
- }
-
- return $saved_exit_value || $exit_value;
- }
- }
- else
- {
- # We spawned a process we don't wait for
- return $pid;
- }
-}
-
-
-# ----------------------------------------------------------------------
-# We try to emulate how an Unix shell calculates the exit code
-# ----------------------------------------------------------------------
-
-sub mtr_process_exit_status {
- my $raw_status= shift;
-
- if ( $raw_status & 127 )
- {
- return ($raw_status & 127) + 128; # Signal num + 128
- }
- else
- {
- return $raw_status >> 8; # Exit code
- }
-}
-
-
-##############################################################################
-#
-# Kill processes left from previous runs
-#
-##############################################################################
-
-
-# Kill all processes(mysqld, ndbd, ndb_mgmd and im) that would conflict with
-# this run
-# Make sure to remove the PID file, if any.
-# kill IM manager first, else it will restart the servers
-sub mtr_kill_leftovers () {
-
- mtr_report("Killing Possible Leftover Processes");
- mtr_debug("mtr_kill_leftovers(): started.");
-
- my @kill_pids;
- my %admin_pids;
-
- foreach my $srv (@{$::master}, @{$::slave})
- {
- mtr_debug(" - mysqld " .
- "(pid: $srv->{pid}; " .
- "pid file: '$srv->{path_pid}'; " .
- "socket: '$srv->{path_sock}'; ".
- "port: $srv->{port})");
-
- my $pid= mtr_mysqladmin_start($srv, "shutdown", 20);
-
- # Save the pid of the mysqladmin process
- $admin_pids{$pid}= 1;
-
- push(@kill_pids,{
- pid => $srv->{'pid'},
- pidfile => $srv->{'path_pid'},
- sockfile => $srv->{'path_sock'},
- port => $srv->{'port'},
- });
- $srv->{'pid'}= 0; # Assume we are done with it
- }
-
- if ( ! $::opt_skip_ndbcluster )
- {
-
- foreach my $cluster (@{$::clusters})
- {
-
- # Don't shut down a "running" cluster
- next if $cluster->{'use_running'};
-
- mtr_debug(" - cluster " .
- "(pid: $cluster->{pid}; " .
- "pid file: '$cluster->{path_pid})");
-
- my $pid= mtr_ndbmgm_start($cluster, "shutdown");
-
- # Save the pid of the ndb_mgm process
- $admin_pids{$pid}= 1;
-
- push(@kill_pids,{
- pid => $cluster->{'pid'},
- pidfile => $cluster->{'path_pid'}
- });
-
- $cluster->{'pid'}= 0; # Assume we are done with it
-
- foreach my $ndbd (@{$cluster->{'ndbds'}})
- {
- mtr_debug(" - ndbd " .
- "(pid: $ndbd->{pid}; " .
- "pid file: '$ndbd->{path_pid})");
-
- push(@kill_pids,{
- pid => $ndbd->{'pid'},
- pidfile => $ndbd->{'path_pid'},
- });
- $ndbd->{'pid'}= 0; # Assume we are done with it
- }
- }
- }
-
- # Wait for all the admin processes to complete
- mtr_wait_blocking(\%admin_pids);
-
- # If we trusted "mysqladmin --shutdown_timeout= ..." we could just
- # terminate now, but we don't (FIXME should be debugged).
- # So we try again to ping and at least wait the same amount of time
- # mysqladmin would for all to die.
-
- mtr_ping_with_timeout(\@kill_pids);
-
- # We now have tried to terminate nice. We have waited for the listen
- # port to be free, but can't really tell if the mysqld process died
- # or not. We now try to find the process PID from the PID file, and
- # send a kill to that process. Note that Perl let kill(0,@pids) be
- # a way to just return the numer of processes the kernel can send
- # signals to. So this can be used (except on Cygwin) to determine
- # if there are processes left running that we cound out might exists.
- #
- # But still after all this work, all we know is that we have
- # the ports free.
-
- # We scan the "var/run/" directory for other process id's to kill
-
- my $rundir= "$::opt_vardir/run";
-
- mtr_debug("Processing PID files in directory '$rundir'...");
-
- if ( -d $rundir )
- {
- opendir(RUNDIR, $rundir)
- or mtr_error("can't open directory \"$rundir\": $!");
-
- my @pids;
-
- while ( my $elem= readdir(RUNDIR) )
- {
- # Only read pid from files that end with .pid
- if ( $elem =~ /.*[.]pid$/)
- {
- my $pidfile= "$rundir/$elem";
-
- if ( -f $pidfile )
- {
- mtr_debug("Processing PID file: '$pidfile'...");
-
- my $pid= mtr_get_pid_from_file($pidfile);
-
- mtr_debug("Got pid: $pid from file '$pidfile'");
-
- if ( $::glob_cygwin_perl or kill(0, $pid) )
- {
- mtr_debug("There is process with pid $pid -- scheduling for kill.");
- push(@pids, $pid); # We know (cygwin guess) it exists
- }
- else
- {
- mtr_debug("There is no process with pid $pid -- skipping.");
- }
- }
- }
- else
- {
- mtr_warning("Found non pid file $elem in $rundir")
- if -f "$rundir/$elem";
- next;
- }
- }
- closedir(RUNDIR);
-
- if ( @pids )
- {
- mtr_debug("Killing the following processes with PID files: " .
- join(' ', @pids) . "...");
-
- start_reap_all();
-
- if ( $::glob_cygwin_perl )
- {
- # We have no (easy) way of knowing the Cygwin controlling
- # process, in the PID file we only have the Windows process id.
- system("kill -f " . join(" ",@pids)); # Hope for the best....
- mtr_debug("Sleep 5 seconds waiting for processes to die");
- sleep(5);
- }
- else
- {
- my $retries= 10; # 10 seconds
- do
- {
- mtr_debug("Sending SIGKILL to pids: " . join(' ', @pids));
- kill(9, @pids);
- mtr_report("Sleep 1 second waiting for processes to die");
- sleep(1) # Wait one second
- } while ( $retries-- and kill(0, @pids) );
-
- if ( kill(0, @pids) ) # Check if some left
- {
- mtr_warning("can't kill process(es) " . join(" ", @pids));
- }
- }
-
- stop_reap_all();
- }
- }
- else
- {
- mtr_debug("Directory for PID files ($rundir) does not exist.");
- }
-
- # We may have failed everything, but we now check again if we have
- # the listen ports free to use, and if they are free, just go for it.
-
- mtr_debug("Checking known mysqld servers...");
-
- foreach my $srv ( @kill_pids )
- {
- if ( defined $srv->{'port'} and mtr_ping_port($srv->{'port'}) )
- {
- mtr_warning("can't kill old process holding port $srv->{'port'}");
- }
- }
-
- mtr_debug("mtr_kill_leftovers(): finished.");
-}
-
-
-#
-# Check that all processes in "spec" are shutdown gracefully
-# else kill them off hard
-#
-sub mtr_check_stop_servers ($) {
- my $spec= shift;
-
- # Return if no processes are defined
- return if ! @$spec;
-
- mtr_verbose("mtr_check_stop_servers");
-
- # ----------------------------------------------------------------------
- # Wait until servers in "spec" has stopped listening
- # to their ports or timeout occurs
- # ----------------------------------------------------------------------
- mtr_ping_with_timeout(\@$spec);
-
- # ----------------------------------------------------------------------
- # Use waitpid() nonblocking for a little while, to see how
- # many process's will exit sucessfully.
- # This is the normal case.
- # ----------------------------------------------------------------------
- my $wait_counter= 50; # Max number of times to redo the loop
- foreach my $srv ( @$spec )
- {
- my $pid= $srv->{'pid'};
- my $ret_pid;
- if ( $pid )
- {
- $ret_pid= waitpid($pid,&WNOHANG);
- if ($ret_pid == $pid)
- {
- mtr_verbose("Caught exit of process $ret_pid");
- $srv->{'pid'}= 0;
- }
- elsif ($ret_pid == 0)
- {
- mtr_verbose("Process $pid is still alive");
- if ($wait_counter-- > 0)
- {
- # Give the processes more time to exit
- select(undef, undef, undef, (0.1));
- redo;
- }
- }
- else
- {
- mtr_warning("caught exit of unknown child $ret_pid");
- }
- }
- }
-
- # ----------------------------------------------------------------------
- # The processes that haven't yet exited need to
- # be killed hard, put them in "kill_pids" hash
- # ----------------------------------------------------------------------
- my %kill_pids;
- foreach my $srv ( @$spec )
- {
- my $pid= $srv->{'pid'};
- if ( $pid )
- {
- # Server is still alive, put it in list to be hard killed
- if ($::glob_win32_perl)
- {
- # Kill the real process if it's known
- $pid= $srv->{'real_pid'} if ($srv->{'real_pid'});
- }
- $kill_pids{$pid}= 1;
-
- # Write a message to the process's error log (if it has one)
- # that it's being killed hard.
- if ( defined $srv->{'errfile'} )
- {
- mtr_tofile($srv->{'errfile'}, "Note: Forcing kill of process $pid\n");
- }
- mtr_warning("Forcing kill of process $pid");
-
- }
- else
- {
- # Server is dead, remove the pidfile if it exists
- #
- # Race, could have been removed between test with -f
- # and the unlink() below, so better check again with -f
- if ( -f $srv->{'pidfile'} and ! unlink($srv->{'pidfile'}) and
- -f $srv->{'pidfile'} )
- {
- mtr_error("can't remove $srv->{'pidfile'}");
- }
- }
- }
-
- if ( ! keys %kill_pids )
- {
- # All processes has exited gracefully
- return;
- }
-
- mtr_kill_processes(\%kill_pids);
-
- # ----------------------------------------------------------------------
- # All processes are killed, cleanup leftover files
- # ----------------------------------------------------------------------
- {
- my $errors= 0;
- foreach my $srv ( @$spec )
- {
- if ( $srv->{'pid'} )
- {
- # Server has been hard killed, clean it's resources
- foreach my $file ($srv->{'pidfile'}, $srv->{'sockfile'})
- {
- # Know it is dead so should be no race, careful anyway
- if ( defined $file and -f $file and ! unlink($file) and -f $file )
- {
- $errors++;
- mtr_warning("couldn't delete $file");
- }
- }
-
- if ($::glob_win32_perl and $srv->{'real_pid'})
- {
- # Wait for the pseudo pid - if the real_pid was known
- # the pseudo pid has not been waited for yet, wai blocking
- # since it's "such a simple program"
- mtr_verbose("Wait for pseudo process $srv->{'pid'}");
- my $ret_pid= waitpid($srv->{'pid'}, 0);
- mtr_verbose("Pseudo process $ret_pid died");
- }
-
- $srv->{'pid'}= 0;
- }
- }
- if ( $errors )
- {
- # There where errors killing processes
- # do one last attempt to ping the servers
- # and if they can't be pinged, assume they are dead
- if ( ! mtr_ping_with_timeout( \@$spec ) )
- {
- mtr_error("we could not kill or clean up all processes");
- }
- else
- {
- mtr_verbose("All ports were free, continuing");
- }
- }
- }
-}
-
-
-# Wait for all the process in the list to terminate
-sub mtr_wait_blocking($) {
- my $admin_pids= shift;
-
-
- # Return if no processes defined
- return if ! %$admin_pids;
-
- mtr_verbose("mtr_wait_blocking");
-
- # Wait for all the started processes to exit
- # As mysqladmin is such a simple program, we trust it to terminate itself.
- # I.e. we wait blocking, and wait for them all before we go on.
- foreach my $pid (keys %{$admin_pids})
- {
- my $ret_pid= waitpid($pid,0);
-
- }
-}
-
-# Start "mysqladmin <command>" for a specific mysqld
-sub mtr_mysqladmin_start($$$) {
- my $srv= shift;
- my $command= shift;
- my $adm_shutdown_tmo= shift;
-
- my $args;
- mtr_init_args(\$args);
-
- mtr_add_arg($args, "--no-defaults");
- mtr_add_arg($args, "--user=%s", $::opt_user);
- mtr_add_arg($args, "--password=");
- mtr_add_arg($args, "--silent");
- if ( -e $srv->{'path_sock'} )
- {
- mtr_add_arg($args, "--socket=%s", $srv->{'path_sock'});
- }
- if ( $srv->{'port'} )
- {
- mtr_add_arg($args, "--port=%s", $srv->{'port'});
- }
- if ( $srv->{'port'} and ! -e $srv->{'path_sock'} )
- {
- mtr_add_arg($args, "--protocol=tcp"); # Needed if no --socket
- }
- mtr_add_arg($args, "--connect_timeout=5");
-
- # Shutdown time must be high as slave may be in reconnect
- mtr_add_arg($args, "--shutdown_timeout=$adm_shutdown_tmo");
- mtr_add_arg($args, "$command");
- my $pid= mtr_spawn($::exe_mysqladmin, $args,
- "", "", "", "",
- { append_log_file => 1 });
- mtr_verbose("mtr_mysqladmin_start, pid: $pid");
- return $pid;
-
-}
-
-# Start "ndb_mgm shutdown" for a specific cluster, it will
-# shutdown all data nodes and leave the ndb_mgmd running
-sub mtr_ndbmgm_start($$) {
- my $cluster= shift;
- my $command= shift;
-
- my $args;
-
- mtr_init_args(\$args);
-
- mtr_add_arg($args, "--no-defaults");
- mtr_add_arg($args, "--core");
- mtr_add_arg($args, "--try-reconnect=1");
- mtr_add_arg($args, "--ndb_connectstring=%s", $cluster->{'connect_string'});
- mtr_add_arg($args, "-e");
- mtr_add_arg($args, "$command");
-
- my $pid= mtr_spawn($::exe_ndb_mgm, $args,
- "", "/dev/null", "/dev/null", "",
- {});
- mtr_verbose("mtr_ndbmgm_start, pid: $pid");
- return $pid;
-
-}
-
-
-# Ping all servers in list, exit when none of them answers
-# or when timeout has passed
-sub mtr_ping_with_timeout($) {
- my $spec= shift;
- my $timeout= 200; # 20 seconds max
- my $res= 1; # If we just fall through, we are done
- # in the sense that the servers don't
- # listen to their ports any longer
-
- mtr_debug("Waiting for mysqld servers to stop...");
-
- TIME:
- while ( $timeout-- )
- {
- foreach my $srv ( @$spec )
- {
- $res= 1; # We are optimistic
- if ( $srv->{'pid'} and defined $srv->{'port'} )
- {
- if ( mtr_ping_port($srv->{'port'}) )
- {
- mtr_verbose("waiting for process $srv->{'pid'} to stop ".
- "using port $srv->{'port'}");
-
- # Millisceond sleep emulated with select
- select(undef, undef, undef, (0.1));
- $res= 0;
- next TIME;
- }
- else
- {
- # Process was not using port
- }
- }
- }
- last; # If we got here, we are done
- }
-
- if ($res)
- {
- mtr_debug("mtr_ping_with_timeout(): All mysqld instances are down.");
- }
- else
- {
- mtr_report("mtr_ping_with_timeout(): At least one server is alive.");
- }
-
- return $res;
-}
-
-
-#
-# Loop through our list of processes and look for and entry
-# with the provided pid
-# Set the pid of that process to 0 if found
-#
-sub mark_process_dead($)
-{
- my $ret_pid= shift;
-
- foreach my $mysqld (@{$::master}, @{$::slave})
- {
- if ( $mysqld->{'pid'} eq $ret_pid )
- {
- mtr_verbose("$mysqld->{'type'} $mysqld->{'idx'} exited, pid: $ret_pid");
- $mysqld->{'pid'}= 0;
- return;
- }
- }
-
- foreach my $cluster (@{$::clusters})
- {
- if ( $cluster->{'pid'} eq $ret_pid )
- {
- mtr_verbose("$cluster->{'name'} cluster ndb_mgmd exited, pid: $ret_pid");
- $cluster->{'pid'}= 0;
- return;
- }
-
- foreach my $ndbd (@{$cluster->{'ndbds'}})
- {
- if ( $ndbd->{'pid'} eq $ret_pid )
- {
- mtr_verbose("$cluster->{'name'} cluster ndbd exited, pid: $ret_pid");
- $ndbd->{'pid'}= 0;
- return;
- }
- }
- }
- mtr_warning("mark_process_dead couldn't find an entry for pid: $ret_pid");
-
-}
-
-#
-# Loop through our list of processes and look for and entry
-# with the provided pid, if found check for the file indicating
-# expected crash and restart it.
-#
-sub check_expected_crash_and_restart($)
-{
- my $ret_pid= shift;
-
- foreach my $mysqld (@{$::master}, @{$::slave})
- {
- if ( $mysqld->{'pid'} eq $ret_pid )
- {
- mtr_verbose("$mysqld->{'type'} $mysqld->{'idx'} exited, pid: $ret_pid");
- $mysqld->{'pid'}= 0;
-
- # Check if crash expected and restart if it was
- my $expect_file= "$::opt_vardir/tmp/" . "$mysqld->{'type'}" .
- "$mysqld->{'idx'}" . ".expect";
- if ( -f $expect_file )
- {
- mtr_verbose("Crash was expected, file $expect_file exists");
- mysqld_start($mysqld, $mysqld->{'start_opts'},
- $mysqld->{'start_slave_master_info'});
- unlink($expect_file);
- }
-
- return;
- }
- }
-
- foreach my $cluster (@{$::clusters})
- {
- if ( $cluster->{'pid'} eq $ret_pid )
- {
- mtr_verbose("$cluster->{'name'} cluster ndb_mgmd exited, pid: $ret_pid");
- $cluster->{'pid'}= 0;
-
- # Check if crash expected and restart if it was
- my $expect_file= "$::opt_vardir/tmp/ndb_mgmd_" . "$cluster->{'type'}" .
- ".expect";
- if ( -f $expect_file )
- {
- mtr_verbose("Crash was expected, file $expect_file exists");
- ndbmgmd_start($cluster);
- unlink($expect_file);
- }
- return;
- }
-
- foreach my $ndbd (@{$cluster->{'ndbds'}})
- {
- if ( $ndbd->{'pid'} eq $ret_pid )
- {
- mtr_verbose("$cluster->{'name'} cluster ndbd exited, pid: $ret_pid");
- $ndbd->{'pid'}= 0;
-
- # Check if crash expected and restart if it was
- my $expect_file= "$::opt_vardir/tmp/ndbd_" . "$cluster->{'type'}" .
- "$ndbd->{'idx'}" . ".expect";
- if ( -f $expect_file )
- {
- mtr_verbose("Crash was expected, file $expect_file exists");
- ndbd_start($cluster, $ndbd->{'idx'},
- $ndbd->{'start_extra_args'});
- unlink($expect_file);
- }
- return;
- }
- }
- }
-
- if ($::instance_manager->{'spawner_pid'} eq $ret_pid)
- {
- return;
- }
-
- mtr_warning("check_expected_crash_and_restart couldn't find an entry for pid: $ret_pid");
-
-}
-
-##############################################################################
-#
-# The operating system will keep information about dead children,
-# we read this information here, and if we have records the process
-# is alive, we mark it as dead.
-#
-##############################################################################
-
-sub mtr_record_dead_children () {
-
- my $process_died= 0;
- my $ret_pid;
-
- # Wait without blockinng to see if any processes had died
- # -1 or 0 means there are no more procesess to wait for
- while ( ($ret_pid= waitpid(-1,&WNOHANG)) != 0 and $ret_pid != -1)
- {
- mtr_warning("mtr_record_dead_children: $ret_pid");
- mark_process_dead($ret_pid);
- $process_died= 1;
- }
- return $process_died;
-}
-
-sub start_reap_all {
- # This causes terminating processes to not become zombies, avoiding
- # the need for (or possibility of) explicit waitpid().
- $SIG{CHLD}= 'IGNORE';
-
- # On some platforms (Linux, QNX, OSX, ...) there is potential race
- # here. If a process terminated before setting $SIG{CHLD} (but after
- # any attempt to waitpid() it), it will still be a zombie. So we
- # have to handle any such process here.
- my $pid;
- while(($pid= waitpid(-1, &WNOHANG)) != 0 and $pid != -1)
- {
- mtr_warning("start_reap_all pid: $pid");
- mark_process_dead($pid);
- };
-}
-
-sub stop_reap_all {
- $SIG{CHLD}= 'DEFAULT';
-}
-
-
sub mtr_ping_port ($) {
my $port= shift;
@@ -1041,7 +69,7 @@ sub mtr_ping_port ($) {
sub sleep_until_file_created ($$$) {
my $pidfile= shift;
my $timeout= shift;
- my $pid= shift;
+ my $proc= shift;
my $sleeptime= 100; # Milliseconds
my $loops= ($timeout * 1000) / $sleeptime;
@@ -1053,9 +81,9 @@ sub sleep_until_file_created ($$$) {
}
# Check if it died after the fork() was successful
- if ( $pid != 0 && waitpid($pid,&WNOHANG) == $pid )
+ if ( defined $proc and ! $proc->wait_one(0) )
{
- mtr_warning("Process $pid died");
+ mtr_warning("Process $proc died");
return 0;
}
@@ -1070,73 +98,12 @@ sub sleep_until_file_created ($$$) {
"still waiting for $left seconds...");
}
- # Millisceond sleep emulated with select
- select(undef, undef, undef, ($sleeptime/1000));
- }
-
- return 0;
-}
-
+ mtr_milli_sleep($sleeptime);
-sub mtr_kill_processes ($) {
- my $pids = shift;
-
- mtr_verbose("mtr_kill_processes (" . join(" ", keys %{$pids}) . ")");
-
- foreach my $pid (keys %{$pids})
- {
-
- if ($pid <= 0)
- {
- mtr_warning("Trying to kill illegal pid: $pid");
- next;
- }
-
- my $signaled_procs= kill(9, $pid);
- if ($signaled_procs == 0)
- {
- # No such process existed, assume it's killed
- mtr_verbose("killed $pid(no such process)");
- }
- else
- {
- my $ret_pid= waitpid($pid,0);
- if ($ret_pid == $pid)
- {
- mtr_verbose("killed $pid(got the pid)");
- }
- elsif ($ret_pid == -1)
- {
- mtr_verbose("killed $pid(got -1)");
- }
- }
}
- mtr_verbose("done killing processes");
-}
-
-
-##############################################################################
-#
-# When we exit, we kill off all children
-#
-##############################################################################
-sub mtr_exit ($) {
- my $code= shift;
- mtr_timer_stop_all($::glob_timers);
- local $SIG{HUP} = 'IGNORE';
- # ToDo: Signalling -$$ will only work if we are the process group
- # leader (in fact on QNX it will signal our session group leader,
- # which might be Do-compile or Pushbuild, causing tests to be
- # aborted). So we only do it if we are the group leader. We might
- # set ourselves as the group leader at startup (with
- # POSIX::setpgrp(0,0)), but then care must be needed to always do
- # proper child process cleanup.
- POSIX::kill(SIGHUP, -$$) if !$::glob_win32_perl and $$ == getpgrp();
-
- exit($code);
+ return 0;
}
-###########################################################################
1;
diff --git a/mysql-test/lib/mtr_report.pl b/mysql-test/lib/mtr_report.pl
index d345740c5c2..f3b950e4d3a 100644
--- a/mysql-test/lib/mtr_report.pl
+++ b/mysql-test/lib/mtr_report.pl
@@ -21,46 +21,42 @@
use strict;
use warnings;
-sub mtr_report_test_name($);
-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_test_not_skipped_though_disabled($);
-
sub mtr_report_stats ($);
+
sub mtr_print_line ();
-sub mtr_print_thick_line ();
+sub mtr_print_thick_line ($);
sub mtr_print_header ();
sub mtr_report (@);
sub mtr_warning (@);
sub mtr_error (@);
-sub mtr_child_error (@);
sub mtr_debug (@);
sub mtr_verbose (@);
my $tot_real_time= 0;
-
-
-##############################################################################
-#
-#
-#
-##############################################################################
-
sub mtr_report_test_name ($) {
my $tinfo= shift;
my $tname= $tinfo->{name};
+
+ # Remove suite part of name
+ $tname =~ s/.*\.// unless SHOW_SUITE_NAME;
+
+ # Add combination name if any
$tname.= " '$tinfo->{combination}'"
if defined $tinfo->{combination};
- _mtr_log($tname);
+ _mtr_log("$tname");
printf "%-30s ", $tname;
}
+
sub mtr_report_test_skipped ($) {
my $tinfo= shift;
+ mtr_report_test_name($tinfo);
$tinfo->{'result'}= 'MTR_RES_SKIPPED';
if ( $tinfo->{'disable'} )
@@ -69,36 +65,26 @@ sub mtr_report_test_skipped ($) {
}
elsif ( $tinfo->{'comment'} )
{
- mtr_report("[ skipped ] $tinfo->{'comment'}");
+ if ( $tinfo->{skip_detected_by_test} )
+ {
+ mtr_report("[ skip.] $tinfo->{'comment'}");
+ } else {
+ mtr_report("[ skip ] $tinfo->{'comment'}");
+ }
}
else
{
- mtr_report("[ skipped ]");
+ mtr_report("[ skip ]");
}
}
-sub mtr_report_tests_not_skipped_though_disabled ($) {
- my $tests= shift;
-
- if ( $::opt_enable_disabled )
- {
- my @disabled_tests= grep {$_->{'dont_skip_though_disabled'}} @$tests;
- if ( @disabled_tests )
- {
- print "\nTest(s) which will be run though they are marked as disabled:\n";
- foreach my $tinfo ( sort {$a->{'name'} cmp $b->{'name'}} @disabled_tests )
- {
- printf " %-20s : %s\n", $tinfo->{'name'}, $tinfo->{'comment'};
- }
- }
- }
-}
-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);
@@ -108,8 +94,10 @@ sub mtr_report_test_passed ($) {
mtr_report("[ pass ] $timer");
}
-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';
if ( defined $tinfo->{'timeout'} )
@@ -129,12 +117,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 it's report
+ # Test failure was detected by test tool and its report
# about what failed has been saved to file. Display the report.
print "\n";
- print mtr_fromfile($::path_timefile); # FIXME print_file() instead
+ mtr_printfile($logfile);
print "\n";
}
else
@@ -145,6 +133,7 @@ sub mtr_report_test_failed ($) {
}
}
+
sub mtr_report_stats ($) {
my $tests= shift;
@@ -184,28 +173,7 @@ sub mtr_report_stats ($) {
# ----------------------------------------------------------------------
# Print out a summary report to screen
# ----------------------------------------------------------------------
-
- if ( ! $tot_failed )
- {
- print "All $tot_tests tests were successful.\n";
- }
- else
- {
- my $ratio= $tot_passed * 100 / $tot_tests;
- print "Failed $tot_failed/$tot_tests tests, ";
- printf("%.2f", $ratio);
- print "\% were successful.\n\n";
- print
- "The log files in var/log may give you some hint\n",
- "of what went wrong.\n",
- "If you want to report this error, please read first ",
- "the documentation at\n",
- "http://dev.mysql.com/doc/mysql/en/mysql-test-suite.html\n";
- }
- if (!$::opt_extern)
- {
- print "The servers were restarted $tot_restarts times\n";
- }
+ print "The servers were restarted $tot_restarts times\n";
if ( $::opt_timer )
{
@@ -220,7 +188,7 @@ sub mtr_report_stats ($) {
# the "var/log/*.err" files. We save this info in "var/log/warnings"
# ----------------------------------------------------------------------
- if ( ! $::glob_use_running_server )
+ if ( $::opt_warnings )
{
# Save and report if there was any fatal warnings/errors in err logs
@@ -346,19 +314,11 @@ sub mtr_report_stats ($) {
# BUG#29807 - innodb_mysql.test: Cannot find table test/t2
# from the internal data dictionary
- /Cannot find or open table test\/bug29807 from/ or
+ /Cannot find table test\/bug29807 from the internal data dictionary/ or
# BUG#29839 - lowercase_table3.test: Cannot find table test/T1
# from the internal data dictiona
- /Cannot find table test\/BUG29839 from the internal data dictionary/ or
-
- # rpl_extrColmaster_*.test, the slave thread produces warnings
- # when it get updates to a table that has more columns on the
- # master
- /Slave: Unknown column 'c7' in 't15' Error_code: 1054/ or
- /Slave: Can't DROP 'c7'.* 1091/ or
- /Slave: Key column 'c6'.* 1072/
-
+ /Cannot find table test\/BUG29839 from the internal data dictionary/
)
{
next; # Skip these lines
@@ -400,23 +360,6 @@ sub mtr_report_stats ($) {
print "\n";
- # Print a list of testcases that failed
- if ( $tot_failed != 0 )
- {
- my $test_mode= join(" ", @::glob_test_mode) || "default";
- print "mysql-test-run in $test_mode mode: *** Failing the test(s):";
-
- foreach my $tinfo (@$tests)
- {
- if ( $tinfo->{'result'} eq 'MTR_RES_FAILED' )
- {
- print " $tinfo->{'name'}";
- }
- }
- print "\n";
-
- }
-
# Print a list of check_testcases that failed(if any)
if ( $::opt_check_testcases )
{
@@ -438,12 +381,47 @@ sub mtr_report_stats ($) {
}
}
+ # Print a list of testcases that failed
+ if ( $tot_failed != 0 )
+ {
+ my $ratio= $tot_passed * 100 / $tot_tests;
+ print "Failed $tot_failed/$tot_tests tests, ";
+ printf("%.2f", $ratio);
+ print "\% were successful.\n\n";
+
+ # Print the list of test that failed in a format
+ # that can be copy pasted to rerun only failing tests
+ print "Failing test(s):";
+
+ foreach my $tinfo (@$tests)
+ {
+ if ( $tinfo->{'result'} eq 'MTR_RES_FAILED' )
+ {
+ print " $tinfo->{'name'}";
+ }
+ }
+ print "\n\n";
+
+ # Print info about reporting the error
+ print
+ "The log files in var/log may give you some hint of what went wrong.\n\n",
+ "If you want to report this error, please read first ",
+ "the documentation\n",
+ "at http://dev.mysql.com/doc/mysql/en/mysql-test-suite.html\n\n";
+
+ }
+ else
+ {
+ print "All $tot_tests tests were successful.\n";
+ }
+
if ( $tot_failed != 0 || $found_problems)
{
mtr_error("there were failing test cases");
}
}
+
##############################################################################
#
# Text formatting
@@ -451,22 +429,25 @@ sub mtr_report_stats ($) {
##############################################################################
sub mtr_print_line () {
- print '-' x 55, "\n";
+ print '-' x 60, "\n";
}
-sub mtr_print_thick_line () {
- print '=' x 55, "\n";
+
+sub mtr_print_thick_line ($) {
+ my $char= shift || '=';
+ print $char x 60, "\n";
}
+
sub mtr_print_header () {
print "\n";
if ( $::opt_timer )
{
- print "TEST RESULT TIME (ms)\n";
+ print "TEST RESULT TIME (ms)\n";
}
else
{
- print "TEST RESULT\n";
+ print "TEST RESULT\n";
}
mtr_print_line();
print "\n";
@@ -480,6 +461,14 @@ sub mtr_print_header () {
##############################################################################
use IO::File;
+use Time::localtime;
+
+sub _timestamp {
+ my $tm= localtime();
+ return sprintf("%02d%02d%02d %2d:%02d:%02d ",
+ $tm->year % 100, $tm->mon+1, $tm->mday,
+ $tm->hour, $tm->min, $tm->sec);
+}
my $log_file_ref= undef;
@@ -492,46 +481,44 @@ sub mtr_log_init ($) {
mtr_warning("Could not create logfile $filename: $!");
}
+
sub _mtr_log (@) {
- print $log_file_ref join(" ", @_),"\n"
+ print $log_file_ref join(" ", _timestamp(), @_),"\n"
if defined $log_file_ref;
}
+
sub mtr_report (@) {
# Print message to screen and log
_mtr_log(@_);
print join(" ", @_),"\n";
}
+
sub mtr_warning (@) {
# Print message to screen and log
_mtr_log("WARNING: ", @_);
print STDERR "mysql-test-run: WARNING: ",join(" ", @_),"\n";
}
+
sub mtr_error (@) {
# Print message to screen and log
_mtr_log("ERROR: ", @_);
print STDERR "mysql-test-run: *** ERROR: ",join(" ", @_),"\n";
- mtr_exit(1);
-}
-
-sub mtr_child_error (@) {
- # Print message to screen and log
- _mtr_log("ERROR(child): ", @_);
- print STDERR "mysql-test-run: *** ERROR(child): ",join(" ", @_),"\n";
exit(1);
}
+
sub mtr_debug (@) {
- # Only print if --script-debug is used
- if ( $::opt_script_debug )
+ if ( $::opt_verbose > 1 )
{
_mtr_log("###: ", @_);
print STDERR "####: ",join(" ", @_),"\n";
}
}
+
sub mtr_verbose (@) {
# Always print to log, print to screen only when --verbose is used
_mtr_log("> ",@_);
@@ -541,4 +528,5 @@ sub mtr_verbose (@) {
}
}
+
1;
diff --git a/mysql-test/lib/mtr_settings.pl b/mysql-test/lib/mtr_settings.pl
new file mode 100644
index 00000000000..01ba4c9516e
--- /dev/null
+++ b/mysql-test/lib/mtr_settings.pl
@@ -0,0 +1,16 @@
+#
+# Defines used to control how mysql-test-run.pl
+# should work in the current version of MySQL
+#
+
+# Control if the suite name should be output before testname
+sub SHOW_SUITE_NAME { return 1; };
+
+
+# Control which suites are run by default
+sub DEFAULT_SUITES { return "main,binlog,federated,rpl,rpl_ndb,ndb"; };
+
+
+
+1;
+
diff --git a/mysql-test/lib/mtr_stress.pl b/mysql-test/lib/mtr_stress.pl
index 93b06b32c5f..cd5c7b0dbb7 100644
--- a/mysql-test/lib/mtr_stress.pl
+++ b/mysql-test/lib/mtr_stress.pl
@@ -135,7 +135,7 @@ sub run_stress_test ()
}
mtr_init_args(\$args);
-
+ mtr_add_args($args, "$::glob_mysql_test_dir/mysql-stress-test.pl");
mtr_add_arg($args, "--server-socket=%s", $::master->[0]->{'path_sock'});
mtr_add_arg($args, "--server-user=%s", $::opt_user);
mtr_add_arg($args, "--server-database=%s", "test");
@@ -181,7 +181,13 @@ sub run_stress_test ()
}
#Run stress test
- mtr_run("$::glob_mysql_test_dir/mysql-stress-test.pl", $args, "", "", "", "");
+ My::SafeProcess->run
+ (
+ name => "stress test",
+ path => $^X,
+ args => \$args,
+ );
+
if ( ! $::glob_use_embedded_server )
{
stop_all_servers();
diff --git a/mysql-test/lib/mtr_timer.pl b/mysql-test/lib/mtr_timer.pl
deleted file mode 100644
index 326fbea74ec..00000000000
--- a/mysql-test/lib/mtr_timer.pl
+++ /dev/null
@@ -1,158 +0,0 @@
-# -*- cperl -*-
-# Copyright (C) 2005-2006 MySQL AB
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-# This is a library file used by the Perl version of mysql-test-run,
-# and is part of the translation of the Bourne shell script with the
-# same name.
-
-use Errno;
-use strict;
-
-sub mtr_init_timers ();
-sub mtr_timer_start($$$);
-sub mtr_timer_stop($$);
-sub mtr_timer_stop_all($);
-
-
-##############################################################################
-#
-# Initiate the structure shared by all timers
-#
-##############################################################################
-
-sub mtr_init_timers () {
- my $timers = { timers => {}, pids => {}};
- return $timers;
-}
-
-
-##############################################################################
-#
-# Start, stop and poll a timer
-#
-# As alarm() isn't portable to Windows, we use separate processes to
-# implement timers.
-#
-##############################################################################
-
-sub mtr_timer_start($$$) {
- my ($timers,$name,$duration)= @_;
-
- if ( exists $timers->{'timers'}->{$name} )
- {
- # We have an old running timer, kill it
- mtr_warning("There is an old timer running");
- mtr_timer_stop($timers,$name);
- }
-
- FORK:
- {
- my $tpid= fork();
-
- if ( ! defined $tpid )
- {
- if ( $! == $!{EAGAIN} ) # See "perldoc Errno"
- {
- mtr_warning("Got EAGAIN from fork(), sleep 1 second and redo");
- sleep(1);
- redo FORK;
- }
- else
- {
- mtr_error("can't fork timer, error: $!");
- }
- }
-
- if ( $tpid )
- {
- # Parent, record the information
- mtr_verbose("Starting timer for '$name',",
- "duration: $duration, pid: $tpid");
- $timers->{'timers'}->{$name}->{'pid'}= $tpid;
- $timers->{'timers'}->{$name}->{'duration'}= $duration;
- $timers->{'pids'}->{$tpid}= $name;
- }
- else
- {
- # Child, install signal handlers and sleep for "duration"
-
- # Don't do the ^C cleanup in the timeout child processes!
- # There is actually a race here, if we get ^C after fork(), but before
- # clearing the signal handler.
- $SIG{INT}= 'DEFAULT';
-
- $SIG{TERM}= sub {
- mtr_verbose("timer $$ woke up, exiting!");
- exit(0);
- };
-
- $0= "mtr_timer(timers,$name,$duration)";
- sleep($duration);
- mtr_verbose("timer $$ expired after $duration seconds");
- exit(0);
- }
- }
-}
-
-
-sub mtr_timer_stop ($$) {
- my ($timers,$name)= @_;
-
- if ( exists $timers->{'timers'}->{$name} )
- {
- my $tpid= $timers->{'timers'}->{$name}->{'pid'};
- mtr_verbose("Stopping timer for '$name' with pid $tpid");
-
- # FIXME as Cygwin reuses pids fast, maybe check that is
- # the expected process somehow?!
- kill(15, $tpid);
-
- # As the timers are so simple programs, we trust them to terminate,
- # and use blocking wait for it. We wait just to avoid a zombie.
- waitpid($tpid,0);
-
- delete $timers->{'timers'}->{$name}; # Remove the timer information
- delete $timers->{'pids'}->{$tpid}; # and PID reference
-
- return 1;
- }
-
- mtr_error("Asked to stop timer '$name' not started");
-}
-
-
-sub mtr_timer_stop_all ($) {
- my $timers= shift;
-
- foreach my $name ( keys %{$timers->{'timers'}} )
- {
- mtr_timer_stop($timers, $name);
- }
- return 1;
-}
-
-
-sub mtr_timer_timeout ($$) {
- my ($timers,$pid)= @_;
-
- return "" unless exists $timers->{'pids'}->{$pid};
-
- # Got a timeout(the process with $pid is recorded as being a timer)
- # return the name of the timer
- return $timers->{'pids'}->{$pid};
-}
-
-1;
diff --git a/mysql-test/lib/t/Base.t b/mysql-test/lib/t/Base.t
new file mode 100644
index 00000000000..6ca7657d421
--- /dev/null
+++ b/mysql-test/lib/t/Base.t
@@ -0,0 +1,27 @@
+# -*- cperl -*-
+use Test::More qw(no_plan);
+use strict;
+
+use_ok ("My::SafeProcess::Base");
+
+
+my $count= 0;
+for (1..100){
+ my $pid= My::SafeProcess::Base::_safe_fork();
+ exit unless $pid;
+ (waitpid($pid, 0) == $pid) and $count++;
+}
+ok($count == 100, "safe_fork");
+
+# A nice little forkbomb
+SKIP: {
+ skip("forkbomb", 1);
+ eval {
+ while(1){
+ my $pid= My::SafeProcess::Base::_safe_fork();
+ exit unless $pid;
+ }
+ };
+ ok($@, "forkbomb");
+}
+
diff --git a/mysql-test/lib/t/Find.t b/mysql-test/lib/t/Find.t
new file mode 100644
index 00000000000..90489ba06dd
--- /dev/null
+++ b/mysql-test/lib/t/Find.t
@@ -0,0 +1,33 @@
+# -*- cperl -*-
+use Test::More qw(no_plan);
+use strict;
+
+use_ok ("My::Find");
+my $basedir= "../..";
+
+print "=" x 40, "\n";
+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($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 --git a/mysql-test/lib/t/SafeProcess.t b/mysql-test/lib/t/SafeProcess.t
new file mode 100644
index 00000000000..d4a62ff8cca
--- /dev/null
+++ b/mysql-test/lib/t/SafeProcess.t
@@ -0,0 +1,102 @@
+# -*- cperl -*-
+
+use strict;
+use FindBin;
+use IO::File;
+
+use Test::More qw(no_plan);
+use_ok ("My::SafeProcess");
+
+
+my $perl_path= $^X;
+
+{
+ # Test exit codes
+ my $count= 32;
+ my $ok_count= 0;
+ for my $code (0..$count-1) {
+
+ my $args= [ "$FindBin::Bin/test_child.pl", "--exit-code=$code" ];
+ my $proc= My::SafeProcess->new
+ (
+ path => $perl_path,
+ args => \$args,
+ output => "/dev/null",
+ error => "/dev/null",
+ );
+ # Wait max 10 seconds for the process to finish
+ $ok_count++ if ($proc->wait_one(10) == 0 and
+ $proc->exit_status() == $code);
+ }
+ ok($count == $ok_count, "check exit_status, $ok_count");
+}
+
+
+{
+ # spawn a number of concurrent processes
+ my $count= 16;
+ my $ok_count= 0;
+ my %procs;
+ for my $code (0..$count-1) {
+
+ my $args= [ "$FindBin::Bin/test_child.pl", "--exit-code=$code" ];
+ $procs{$code}= My::SafeProcess->new
+ (
+ path => $perl_path,
+ args => \$args,
+ output => "/dev/null",
+ error => "/dev/null",
+ );
+ }
+
+ for my $code (0..$count-1) {
+ $ok_count++ if ($procs{$code}->wait_one(10) == 0 and
+ $procs{$code}->exit_status() == $code);
+ }
+ ok($count == $ok_count, "concurrent, $ok_count");
+}
+
+
+#
+# Test stdout, stderr
+#
+{
+ use File::Temp qw / tempdir /;
+ my $dir = tempdir( CLEANUP => 1 );
+
+ my $args= [ "$FindBin::Bin/test_child.pl" ];
+ my $proc= My::SafeProcess->new
+ (
+ path => $perl_path,
+ args => \$args,
+ output => "$dir/output.txt",
+ error => "$dir/error.txt",
+ );
+
+ $proc->wait_one(2); # Wait max 2 seconds for the process to finish
+
+ my $fh= IO::File->new("$dir/output.txt");
+ my @text= <$fh>;
+ ok(grep(/Hello stdout/, @text), "check stdout");
+ $fh= IO::File->new("$dir/error.txt");
+ my @text= <$fh>;
+ ok(grep(/Hello stderr/, @text), "check stderr");
+
+ # To same file
+ $proc= My::SafeProcess->new
+ (
+ path => $perl_path,
+ args => \$args,
+ output => "$dir/output.txt",
+ error => "$dir/output.txt",
+ debug => 1,
+ );
+
+ $proc->wait_one(2); # Wait max 2 seconds for the process to finish
+
+ my $fh= IO::File->new("$dir/output.txt");
+ my @text= <$fh>;
+ ok((grep(/Hello stdout/, @text) and grep(/Hello stderr/, @text)),
+ "check stdout and stderr");
+
+}
diff --git a/mysql-test/lib/t/SafeProcessStress.pl b/mysql-test/lib/t/SafeProcessStress.pl
new file mode 100755
index 00000000000..a31f3031262
--- /dev/null
+++ b/mysql-test/lib/t/SafeProcessStress.pl
@@ -0,0 +1,149 @@
+#!/usr/bin/perl
+# -*- cperl -*-
+
+use strict;
+use FindBin;
+use My::SafeProcess;
+
+#
+# Test longterm running of SafeProcess
+#
+
+my $perl_path= $^X;
+my $verbose= 0;
+my $loops= 1000;
+
+print "kill one and wait for one\n";
+for (1...$loops){
+ use File::Temp qw / tempdir /;
+ my $dir = tempdir( CLEANUP => 1 );
+
+ my @procs;
+ for (1..10){
+
+ my $args= [ "$FindBin::Bin/dummyd.pl", "--vardir=$dir" ];
+ my $proc= My::SafeProcess->new
+ (
+ path => $perl_path,
+ args => \$args,
+ verbose => $verbose,
+ );
+ push(@procs, $proc);
+ }
+
+ foreach my $proc (@procs) {
+ $proc->kill();
+ # dummyd will always be kiled and thus
+ # exit_status should have been set to 1
+ die "oops, exit_status: ", $proc->exit_status()
+ unless $proc->exit_status() == 1;
+ }
+
+ print "=" x 60, "\n";
+}
+
+
+print "With 1 second sleep in dummyd\n";
+for (1...$loops){
+ use File::Temp qw / tempdir /;
+ my $dir = tempdir( CLEANUP => 1 );
+
+ my @procs;
+ for (1..10){
+
+ my $args= [ "$FindBin::Bin/dummyd.pl",
+ "--vardir=$dir",
+ "--sleep=1" ];
+ my $proc= My::SafeProcess->new
+ (
+ path => $perl_path,
+ args => \$args,
+ verbose => $verbose,
+ );
+ push(@procs, $proc);
+ }
+
+ foreach my $proc (@procs) {
+ $proc->kill();
+ }
+
+ print "=" x 60, "\n";
+}
+
+print "kill all and wait for one\n";
+for (1...$loops){
+ use File::Temp qw / tempdir /;
+ my $dir = tempdir( CLEANUP => 1 );
+
+ my @procs;
+ for (1..10){
+
+ my $args= [ "$FindBin::Bin/dummyd.pl", "--vardir=$dir" ];
+ my $proc= My::SafeProcess->new
+ (
+ path => $perl_path,
+ args => \$args,
+ verbose => $verbose,
+ );
+ push(@procs, $proc);
+ }
+
+ foreach my $proc (@procs) {
+ $proc->start_kill();
+ }
+
+ foreach my $proc (@procs) {
+ $proc->wait_one();
+ }
+
+ print "=" x 60, "\n";
+}
+
+print "kill all using shutdown without callback\n";
+for (1...$loops){
+ use File::Temp qw / tempdir /;
+ my $dir = tempdir( CLEANUP => 1 );
+
+ my @procs;
+ for (1..10){
+
+ my $args= [ "$FindBin::Bin/dummyd.pl", "--vardir=$dir" ];
+ my $proc= My::SafeProcess->new
+ (
+ path => $perl_path,
+ args => \$args,
+ verbose => $verbose,
+ );
+ push(@procs, $proc);
+ }
+
+ My::SafeProcess::shutdown(2, @procs);
+
+ print "=" x 60, "\n";
+}
+
+print "kill all using shutdown\n";
+for (1...$loops){
+ use File::Temp qw / tempdir /;
+ my $dir = tempdir( CLEANUP => 1 );
+
+ my @procs;
+ for (1..10){
+
+ my $args= [ "$FindBin::Bin/dummyd.pl", "--vardir=$dir" ];
+ my $proc= My::SafeProcess->new
+ (
+ path => $perl_path,
+ args => \$args,
+ verbose => $verbose,
+ shutdown => sub { }, # Does nothing
+ );
+ push(@procs, $proc);
+ }
+
+ My::SafeProcess::shutdown(2, @procs);
+
+ print "=" x 60, "\n";
+}
+
+exit(0);
diff --git a/mysql-test/lib/t/copytree.t b/mysql-test/lib/t/copytree.t
new file mode 100644
index 00000000000..15e4d1a7b1b
--- /dev/null
+++ b/mysql-test/lib/t/copytree.t
@@ -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 --git a/mysql-test/lib/t/dummyd.pl b/mysql-test/lib/t/dummyd.pl
new file mode 100644
index 00000000000..07336e3c2d2
--- /dev/null
+++ b/mysql-test/lib/t/dummyd.pl
@@ -0,0 +1,38 @@
+#!/usr/bin/perl
+# -*- cperl -*-
+
+use strict;
+use Getopt::Long;
+use IO::File;
+
+my $vardir;
+my $randie= 0;
+my $sleep= 0;
+GetOptions
+ (
+ # Directory where to write files
+ 'vardir=s' => \$vardir,
+ 'die-randomly' => \$randie,
+ 'sleep=i' => \$sleep,
+ );
+
+die("invalid vardir ") unless defined $vardir and -d $vardir;
+
+my $pid= $$;
+while(1){
+ for my $i (1..64){
+ # Write to file
+ my $name= "$vardir/$pid.$i.tmp";
+ my $F= IO::File->new($name, "w")
+ or warn "$$, Could not open $name: $!" and next;
+ print $F rand($.) for (1..1000);
+ $F->close();
+ sleep($sleep);
+ die "ooops!" if $randie and rand() < 0.0001
+ }
+}
+
+
+exit (0);
+
+
diff --git a/mysql-test/lib/t/rmtree.t b/mysql-test/lib/t/rmtree.t
new file mode 100644
index 00000000000..08c9077d001
--- /dev/null
+++ b/mysql-test/lib/t/rmtree.t
@@ -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 --git a/mysql-test/lib/t/testMyConfig.t b/mysql-test/lib/t/testMyConfig.t
new file mode 100755
index 00000000000..da08cb8b4d1
--- /dev/null
+++ b/mysql-test/lib/t/testMyConfig.t
@@ -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 --git a/mysql-test/lib/t/testMyConfigFactory.t b/mysql-test/lib/t/testMyConfigFactory.t
new file mode 100755
index 00000000000..16fdd9db539
--- /dev/null
+++ b/mysql-test/lib/t/testMyConfigFactory.t
@@ -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 --git a/mysql-test/lib/t/test_child.pl b/mysql-test/lib/t/test_child.pl
new file mode 100755
index 00000000000..99f4e68003d
--- /dev/null
+++ b/mysql-test/lib/t/test_child.pl
@@ -0,0 +1,21 @@
+#!/usr/bin/perl
+# -*- cperl -*-
+
+use strict;
+use Getopt::Long;
+
+my $opt_exit_code= 0;
+
+GetOptions
+ (
+ # Exit with the specified exit code
+ 'exit-code=i' => \$opt_exit_code
+ );
+
+
+print "Hello stdout\n";
+print STDERR "Hello stderr\n";
+
+exit ($opt_exit_code);
+
+
diff --git a/mysql-test/misc/kill_master.sh b/mysql-test/misc/kill_master.sh
deleted file mode 100644
index 7938c9d3ac2..00000000000
--- a/mysql-test/misc/kill_master.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-kill -9 `cat var/run/master.pid`
-# The kill may fail if process has already gone away,
-# so don't use the exit code of the kill. Use 0.
-exit 0
diff --git a/mysql-test/misc/mysql-test_V1.9.pl b/mysql-test/misc/mysql-test_V1.9.pl
deleted file mode 100644
index 129ec41b4d5..00000000000
--- a/mysql-test/misc/mysql-test_V1.9.pl
+++ /dev/null
@@ -1,1121 +0,0 @@
-#!/usr/bin/perl
-#
-# Tests MySQL. Output is given to the stderr. Use
-# diff to check the possible differencies.
-#
-
-use DBI;
-use Getopt::Long;
-
-$VER = "1.9";
-$| = 1;
-
-$opt_db = "test";
-$opt_user = $opt_password = $opt_without = "";
-$opt_host = "localhost";
-$opt_port = "3306";
-$opt_socket = "/tmp/mysql.sock";
-$opt_help = 0;
-
-$NO_ERR = 0; # No error
-$EXP_ERR = 1; # Expect error
-$MAY_ERR = 2; # Maybe error
-$HS = 0; # Horizontal style of output
-$VS = 1; # Vertical style of output
-$VERBOSE = 0; # Print the results
-$SILENT = 1; # No output
-
-@test_packages = ("FUNC", "PROC", "SHOW");
-
-####
-#### main program
-####
-
-main();
-
-sub main()
-{
- GetOptions("help", "db=s", "port=i", "host=s", "password=s", "user=s", "socket=s",
- "without=s") || usage();
-
- usage() if ($opt_help);
-
- $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host:port=$opt_port:mysql_socket=$opt_socket", $opt_user, $opt_password, { PrintError => 0 })
- || die $DBI::errstr;
-
-## QQ ######################################
-
-$sth = $dbh->prepare("show felds from t2")
-|| die "Couldn't prepare query: $DBI::errstr\n";
-if (!$sth->execute)
-{
- print "Couldn't execute query: $DBI::errstr\n";
- $sth->finish;
- die;
-}
-while (($row = $sth->fetchrow_arrayref))
-{
- print "$row->[1]\n";
-}
-
-
-exit(0);
-
-## QQ ######################################
-
- printf("####\n#### THIS IS mysql-test script RUNNING\n");
- printf("#### mysql-test version $VER\n####\n");
-
- test_mysql_functions() if (&chk_package($opt_without, $test_packages[0]));
- test_mysql_procedures() if (&chk_package($opt_without, $test_packages[1]));
- test_mysql_show() if (&chk_package($opt_without, $test_packages[2]));
-
- print "\n";
- return;
-}
-
-####
-#### test show -command of MySQL
-####
-
-sub test_mysql_show
-{
- my ($query, $i);
-
- $query = create_show_tables();
- &exec_query(["drop table my_t"], $MAY_ERR, $SILENT);
- for ($i = 0; $query[$i]; $i++)
- {
- &exec_query([$query[$i]], $NO_ERR, $VERBOSE, $HS);
- &exec_query(["show fields from my_t"], $NO_ERR, $VERBOSE, $HS);
- &exec_query(["show keys from my_t"], $NO_ERR, $VERBOSE, $HS);
- &exec_query(["drop table my_t"], $NO_ERR, $SILENT);
- }
-}
-
-sub create_show_tables
-{
- my ($query, $i);
-
- $query[0] = <<EOF;
-create table my_t (i int, f float, s char(64), b blob, t text)
-EOF
- $query[1] = <<EOF;
-create table my_t (i int, f float, s char(64), b blob, t text, primary key (i))
-EOF
- $query[2] = <<EOF;
-create table my_t (i int, f float, s char(64), b blob, t text, unique (i), unique(s))
-EOF
- for ($i = 0; $query[$i]; $i++) { chop($query[$i]); }
- return $query;
-}
-
-####
-#### test procedures, currently only procedure analyze()
-####
-
-sub test_mysql_procedures
-{
- test_analyze();
-}
-
-sub test_analyze
-{
- my ($query, $i, $j);
-
- if ($opt_help)
- {
- usage();
- }
- # invalid queries
- &exec_query(["select * from mails procedure analyse(-1)"],
- $EXP_ERR, $VERBOSE, $HS);
- &exec_query(["select * from mails procedure analyse(10, -1)"],
- $EXP_ERR, $VERBOSE, $HS);
- &exec_query(["select * from mails procedure analyse(1, 2, 3)"],
- $EXP_ERR, $VERBOSE, $HS);
- &exec_query(["select * from mails procedure analyse(-10, 10)"],
- $EXP_ERR, $VERBOSE, $HS);
- &exec_query(["select * from mails procedure analyse('a', 'a')"],
- $EXP_ERR, $VERBOSE, $HS);
- # valid queries
-# &exec_query(["select * from mails procedure analyse(10)"], 0, 0);
-# &exec_query(["select * from mails procedure analyse(10, 10)"], 0, 0);
-# &exec_query(["select hash from mails procedure analyse()"], 0, 0);
- &exec_query(["use mysql_test"], $NO_ERR, $VERBOSE, $HS);
-# &exec_query(["select timestamp from w32_user procedure analyse(0)"], 0, 0);
- $query = create_test_tables();
- &exec_query(["drop table my_t"], $MAY_ERR, $SILENT);
- for ($i = 0; $query[$i][0]; $i++)
- {
- &exec_query([$query[$i][0]], $NO_ERR, $SILENT); # create table
- for ($j = 1; $query[$i][$j]; $j++)
- {
- &exec_query([$query[$i][$j]], $NO_ERR, $SILENT); # do inserts
- }
- &exec_query(["select * from my_t procedure analyse(0,0)"],
- $NO_ERR, $VERBOSE, $HS);
- &exec_query(["select * from my_t procedure analyse()"],
- $NO_ERR, $VERBOSE, $HS);
- &exec_query(["drop table my_t"], $NO_ERR, $SILENT);
- }
-}
-
-####
-#### if $opt is found as a part from the '--without=...' option string
-#### return 0, else 1. if zero is returned, then that part of MySQL
-#### won't be tested
-####
-
-sub chk_package
-{
- my ($opt_str, $opt) = @_;
-
- $sub_opt_str = '';
- for ($i = 0, $ptr = substr($opt_str, $i, 1); $ptr || $ptr eq '0';
- $i++, $ptr = substr($opt_str, $i, 1))
- {
- $sub_opt_str .= $ptr;
- if ($sub_opt_str eq $opt)
- {
- $next_chr = substr($opt_str, ($i + 1), 1);
- if ($next_chr eq ',' || (!$next_chr && $next_chr ne '0'))
- {
- return 0;
- }
- }
- if ($ptr eq ',')
- {
- # next word on the opt_str
- $sub_opt_str = '';
- }
- }
- return 1;
-}
-
-####
-#### Tests given function(s) with given value(s) $count rounds
-#### If function doesn't have an arg, test it once and continue.
-#### ulargs (number of unlimited args) is the number of arguments
-#### to be placed in place of '.' . '.' means that any number
-#### of the last argument type is possible to the function.
-#### If force is given, never mind about errors
-#### args: $func: list of functions to be tested
-#### $value: list of values to be used with functions
-#### $count: number of times one function should be tested
-#### $ulargs: number of unlimited args to be used when possible
-#### $table_info: information about the table to be used, contains:
-#### table name, info about the fields in the table, for example:
-#### [mysql_test1, "Zi", "Rd"], where mysql_test1 is the name of the
-#### table, "Zi" tells, that the first field name is 'i' and it is
-#### type 'Z' (integer), see test_mysql_functions, 'Rd' tells that
-#### the second field name is 'd' and the type is 'R' (real number)
-#### $force: if given, never mind about errors
-#### $mix: if 0, use the same argument at a time in a
-#### function that has two or more same type arguments
-#### if 1, use different values
-####
-
-sub test_func()
-{
- my ($func, $value, $count, $ulargs, $table_info, $force, $mix) = @_;
- my ($query, $i, $j, $k, $no_arg, $row, $ulimit, $tbinfo, $tbused, $arg);
-
- if (!$func->[0][0])
- {
- printf("No function found!\n");
- if (!$force) { die; }
- }
-
- for ($i = 0; $func->[$i][0]; $i++)
- {
- $tbused = 0;
- $no_arg = 0;
- for ($j = 0; $j < $count && !$no_arg; $j++)
- {
- if ($tbused || $no_arg) { next; }
- $query = "select $func->[$i][0](";
- #search the values for the args
- for ($k = 0; $k < length($func->[$i][1]) && !$no_arg; $k++)
- {
- if ($mix)
- {
- $arg = $j + 1 + $k;
- }
- else
- {
- $arg = $j + 1;
- }
- if (substr($func->[$i][1], $k, 1) eq 'E')
- {
- $no_arg = 1;
- next;
- }
- if ($k) { $query .= ','; }
-
- if (substr($func->[$i][1], $k, 1) eq 'S')
- {
- $query .= &find_value(\@value, 'S', $arg);
- }
- elsif (substr($func->[$i][1], $k, 1) eq 'N')
- {
- $query .= &find_value(\@value, 'N', $arg);
- }
- elsif (substr($func->[$i][1], $k, 1) eq 'Z')
- {
- $query .= &find_value(\@value, 'Z', $arg);
- }
- elsif ((substr($func->[$i][1], $k, 1) eq 'R'))
- {
- $query .= &find_value(\@value, 'R', $arg);
- }
- elsif (substr($func->[$i][1], $k, 1) eq 'T')
- {
- $query .= &find_value(\@value, 'T', $arg);
- }
- elsif (substr($func->[$i][1], $k, 1) eq 'D')
- {
- $query .= &find_value(\@value, 'D', $arg);
- }
- elsif (substr($func->[$i][1], $k, 1) eq 'B')
- {
- $query .= &find_value(\@value, 'B', $arg);
- }
- elsif (substr($func->[$i][1], $k, 1) eq 'C')
- {
- $query .= &find_value(\@value, 'C', $arg);
- }
- elsif (substr($func->[$i][1], $k, 1) eq 'F')
- {
- $query .= &find_value(\@value, 'F', $arg);
- }
- elsif (substr($func->[$i][1], $k, 1) eq '.')
- {
- chop($query);
- for ($ulimit = 0; $ulimit < $ulargs; $ulimit++)
- {
- $query .= ',';
- $query .= &find_value(\@value,
- substr($func->[$i][1], $k - 1, 1),
- $j + $ulimit + 2);
- }
- }
- elsif (substr($func->[$i][1], $k, 1) eq 'A')
- {
- for ($tbinfo = 1; substr($table_info->[$tbinfo], 0, 1) ne
- substr($func->[$i][1], $k + 1, 1); $tbinfo++)
- {
- if (!defined($table_info->[$tbinfo]))
- {
- printf("Illegal function structure!\n");
- printf("A table was needed, but no type specified!\n");
- printf("Unready query was: $query\n");
- if (!$force) { die; }
- else { next; }
- }
- }
- if ($k) { $query .= ","; }
- $query .= substr($table_info->[$tbinfo], 1,
- length($table_info->[$tbinfo]) - 1);
- $k++;
- $tbused = 1;
- }
- else
- {
- printf("Not a valid type: \n");
- printf(substr($func->[$i][1], $k, 1));
- printf("\nAttempted to be used with unready query: \n");
- printf("$query\n");
- }
- }
- $query .= ")";
- if ($tbused)
- {
- $query .= " from ";
- $query .= $table_info->[0];
- }
- if (!($sth = $dbh->prepare($query)))
- {
- printf("Couldn't prepare: $query\n");
- if (!$force) { die; }
- }
- if (!$sth->execute)
- {
- printf("Execution failed: $DBI::errstr\n");
- printf("Attempted query was:\n$query\n");
- $sth->finish;
- if (!$force) { die; }
- }
- else
- {
- printf("mysql> $query;\n");
- display($sth, 1);
- printf("Query OK\n\n");
- }
- }
- }
-}
-
-####
-#### mk_str returns a string where the first arg is repeated second arg times
-#### if repeat is 1, return the original str
-####
-
-sub mk_str()
-{
- my ($str, $repeat) = @_;
- my ($res_str);
-
- if ($repeat <= 0)
- {
- die "Invalid repeat times!\n";
- }
-
- for ($repeat--, $res_str = $str; $repeat > 0; $repeat--)
- {
- $res_str .= $str;
- }
- return $res_str;
-}
-
-####
-#### find_value: returns a value from list of values
-#### args: $values: list of values
-#### $type: type of argument (S = string, N = integer etc.)
-#### $ordinal: the ordinal number of an argument in the list
-####
-
-sub find_value()
-{
- my ($values, $type, $ordinal) = @_;
- my ($total, $i, $j, $tmp, $val);
-
- $total = -1; # The first one is the type
-
- for ($i = 0; $values[$i][0]; $i++)
- {
- if ($values[$i][0] eq $type)
- {
- $tmp = $values[$i];
- foreach $val (@$tmp) { $total++; }
- for ( ;$total < $ordinal; )
- {
- $ordinal -= $total;
- }
- return $values[$i][$ordinal];
- }
- }
- printf("No type '$type' found in values\n");
- die;
-}
-
-####
-#### exec_query: execute a query, print information if wanted and exit
-#### args: $queries: list of queries to be executed
-#### $expect_error: if 0, error is not expected. In this case if an
-#### error occurs, inform about it and quit
-#### if 1, error is expected. In this case if sql server
-#### doesn't give an error message, inform about it
-#### and quit
-#### if 2, error may happen or not, don't care
-#### $silent: if true, reduce output
-#### $style: type of output, 0 == horizontal, 1 == vertical
-####
-
-sub exec_query()
-{
- my ($queries, $expect_error, $silent, $style) = @_;
- my ($query);
-
- foreach $query (@$queries)
- {
- if (!($sth = $dbh->prepare($query)))
- {
- printf("Couldn't prepare: $query\n");
- die;
- }
- if (!$sth->execute)
- {
- if ($expect_error == 1)
- {
- printf("An invalid instruction was purposely made,\n");
- printf("server failed succesfully:\n");
- printf("$DBI::errstr\n");
- printf("Everything OK, continuing...\n");
- return;
- }
- if ($expect_error != 2)
- {
- printf("Execution failed: $DBI::errstr\n");
- printf("Attempted query was:\n$query\n");
- die;
- }
- }
- if ($expect_error == 1)
- {
- printf("An invalid instruction was purposely made,\n");
- printf("server didn't note, ALARM!\n");
- printf("The query made was: $query\n");
- printf("The output from the server:\n");
- }
- if ($expect_error == 2) { return; }
- if (!$silent) { printf("mysql> $query;\n"); }
- display($sth, $style);
- if (!$silent) { printf("Query OK\n\n"); }
- if ($expect_error) { die; }
- }
- return;
-}
-
-####
-#### Display to stderr
-#### Args: 1: ($sth) statememt handler
-#### 2: ($style) 0 == horizontal style, 1 == vertical style
-####
-
-sub display()
-{
- my ($sth, $style) = @_;
- my (@data, @max_length, $row, $nr_rows, $nr_cols, $i, $j, $tmp, $mxl);
-
- # Store the field names and values in @data.
- # Store the max field lengths in @max_length
- for ($i = 0; ($row = $sth->fetchrow_arrayref); $i++)
- {
- if (!$i)
- {
- $nr_cols = $#$row;
- for ($j = 0; $j <= $#$row; $j++)
- {
- $data[$i][$j] = $sth->{NAME}->[$j];
- $max_length[$j] = length($data[$i][$j]);
- }
- $i++;
- }
- for ($j = 0; $j <= $#$row; $j++)
- {
- $data[$i][$j] = $row->[$j];
- $max_length[$j] = $tmp if ($max_length[$j] <
- ($tmp = length($data[$i][$j])));
- }
- }
- if (!($nr_rows = $i))
- {
- return;
- }
- # Display data
- if ($style == 0)
- {
- for ($i = 0; $i < $nr_rows; $i++)
- {
- if (!$i)
- {
- for ($j = 0; $j <= $nr_cols; $j++)
- {
- print "+"; print "-" x ($max_length[$j] + 2);
- }
- print "+\n";
- }
- print "|";
- for ($j = 0; $j <= $nr_cols; $j++)
- {
- print " ";
- if (defined($data[$i][$j]))
- {
- print $data[$i][$j];
- $tmp = length($data[$i][$j]);
- }
- else
- {
- print "NULL";
- $tmp = 4;
- }
- print " " x ($max_length[$j] - $tmp);
- print " |";
- }
- print "\n";
- if (!$i)
- {
- for ($j = 0; $j <= $nr_cols; $j++)
- {
- print "+"; print "-" x ($max_length[$j] + 2);
- }
- print "+\n";
- }
- }
- for ($j = 0; $j <= $nr_cols; $j++)
- {
- print "+"; print "-" x ($max_length[$j] + 2);
- }
- print "+\n";
- return;
- }
- if ($style == 1)
- {
- for ($i = 0; $max_length[$i]; $i++)
- {
- $mxl = $max_length[$i] if ($mxl < $max_length[$i]);
- }
-
- for ($i = 1; $i < $nr_rows; $i++)
- {
- print "*" x 27;
- print " " . $i . ". row ";
- print "*" x 27;
- print "\n";
- for ($j = 0; $j <= $nr_cols; $j++)
- {
- print " " x ($mxl - length($data[0][$j]));
- print "$data[0][$j]: ";
- if (defined($data[$i][$j]))
- {
- print "$data[$i][$j] \n";
- }
- else
- {
- print "NULL\n";
- }
- }
- }
- return;
- }
-}
-
-####
-#### usage
-####
-
-sub usage
-{
- print <<EOF;
-mysql-test $VER by Jani Tolonen
-
-Usage: mysql-test [options]
-
-Options:
---help Show this help
---db= Database to use (Default: $opt_db)
---port= TCP/IP port to use for connection (Default: $opt_port)
---socket= UNIX socket to use for connection (Default: $opt_socket)
---host= Connect to host (Default: $opt_host)
---user= User for login if not current user
---password Password to use when connecting to server
-
---without=PART_NAME1,PART_NAME2,...
- test without a certain part of MySQL, optional parts listed below
-
-Optional parts:
-
-FUNC Ignore MySQL basic functions
-PROC Ignore MySQL procedure functions
-EOF
- exit(0);
-}
-
-
-sub test_mysql_functions
-{
-
- ####
- #### MySQL functions
- ####
- #### Types: S = string (or real number) , N = unsigned integer, Z = integer,
- #### R = real number, T = time_stamp, E = no argument, D = date,
- #### B = boolean, C = character
- #### F = format (usually used with the date-types)
- #### . = any number of the last argument type possible
- #### A = require table for test, the following argument
- #### is the argument for the function
-
- # Muista get_lock,group_unique_users,
- # position, unique_users
-
- # ks. kaikki date function, kerää yhteen, testaa erikseen
- # adddate, date_add, subdate, date_sub, between, benchmark, count
-
- # decode, encode, get_lock, make_set, position
-
- @functions = (["abs","R"],["acos","R"],["ascii","C"],["asin","R"],
- ["atan","R"],["atan2","R"],["avg","AR"],["bin","Z"],
- ["bit_count","Z"],["bit_or","AZ"],["bit_and","AZ"],
- ["ceiling","R"],["char","N."],["char_length","S"],
- ["concat","SS."],["conv","ZZZ"],
- ["cos","R"],["cot","R"],["curdate","E"],
- ["curtime","E"],["database","E"],["date_format","DF"],
- ["dayofmonth","D"],["dayofyear","D"],["dayname","D"],
- ["degrees","R"],["elt","NS."],["encode","SS"],
- ["encrypt","S"],["encrypt","SS"],["exp","R"],["field","SS."],
- ["find_in_set","SS"],["floor","R"],["format","RN"],
- ["from_days","N"],["from_unixtime","N"],
- ["from_unixtime","NF"],["greatest","RR."],["hex","Z"],
- ["hour","D"],["if","ZSS"],["ifnull","SS"],["insert","SNNS"],
- ["instr","SS"],["interval","RR."],["isnull","S"],
- ["last_insert_id","E"],["lcase","S"],["least","RR."],
- ["left","SN"],["length","S"],["locate","SS"],
- ["log","R"],["log10","R"],["lpad","SNS"],["ltrim","S"],
- ["max","AR"],["mid","SNN"],["min","AR"],["minute","D"],
- ["mod","ZZ"],["monthname","D"],
- ["month","D"],["now","E"],["oct","Z"],
- ["octet_length","S"],["password","S"],["period_add","DD"],
- ["period_diff","DD"],["pi","E"],
- ["pow","RR"],["quarter","D"],["radians","R"],
- ["rand","E"],["rand","R"],["release_lock","S"],
- ["repeat","SN"],["replace","SSS"],["reverse","S"],
- ["right","SN"],["round","R"],["round","RN"],
- ["rpad","SNS"],["rtrim","S"],["sec_to_time","N"],
- ["second","T"],["sign","R"],["sin","R"],
- ["space","N"],["soundex","S"],["sqrt","R"],["std","AR"],
- ["strcmp","SS"],["substring","SN"],["substring","SNN"],
- ["substring_index","SSZ"],["sum","AR"],
- ["tan","R"],["time_format","TF"],["time_to_sec","T"],
- ["to_days","D"],["trim","S"],
- ["truncate","RN"],["ucase","S"],
- ["unix_timestamp","E"],["unix_timestamp","D"],["user","E"],
- ["version","E"],["week","D"],["weekday","D"],["year","D"]);
-
- ####
- #### Various tests for the functions above
- ####
-
- &exec_query(["drop table mysql_test1"], $MAY_ERR, $SILENT);
-
- $query .= <<EOF;
-create table mysql_test1 (
- i int,
- d double
-)
-EOF
- chop($query);
- &exec_query([$query], $NO_ERR, $SILENT);
-
- ####
- #### Basic tests
- ####
-
- printf("####\n#### BASIC TESTS FOR FUNCTIONS\n####\n\n");
-
- @bunch = ("insert into mysql_test1 values(-20,-10.5),(20,10.5),(50,100.00)",
- "insert into mysql_test1 values(100,500.333)");
- &exec_query(\@bunch, $NO_ERR, $SILENT);
-
- printf("\n####\n#### First basic test part\n####\n\n");
-
- @values = (["S", "'a'", "'abc'", "'abc def'", "'abcd'", "'QWERTY'",
- "'\\\\'", "'*.!\"#¤%&/()'", "'" . &mk_str('a',1024) . "'",
- "?", "<>", "#__#"],
- ["N", -1000, -500, -100, -1, 0, 1, 40, 50, 70, 90,
- 100, 500, 1000],
- ["Z", -100, -50, 200, 1000],
- ["R", -500.5, -10.333, 100.667, 400.0],
- ["T", 19980728154204, 19980728154205, 19980728154206,
- 19980728154207],
- ["D", "'1997-12-06'", "'1997-12-07'", "'1997-12-08'",
- "'1997-12-09'"],
- ["B", 1, 0, 0, 1],
- ["C", "'a'", "'e'", "'r'", "'q'"],
- ["F", "'%a'", "'%b'", "'%d'", "'%H'"]);
- &test_func(\@functions, \@values, 4, 5, ["mysql_test1","Zi","Rd"]);
-
- printf("\n####\n#### Second basic test part\n####\n\n");
-
- @values = (["S", "'a'", "'BC'", "'def'", "'HIJK'", "'lmnop'", "'QRSTUV'"],
- ["N", 0, 1, 2, 3, 4, 5],
- ["Z", 0, 1, 2, 3, 4, 5],
- ["R", 0, 1, 2, 3, 4, 5],
- ["T", 19990608234530, 20000709014631, 20010810024732,
- 20020911034833, 20031012044934, 20041113055035],
- ["D", "'1999-06-08'", "'2000-07-09'", "'2001-08-10'",
- "'2002-09-11'", "'2003-10-12'", "'2004-11-13'"],
- ["B", 0, 1, 0, 1, 0, 1],
- ["C", "'a'", "'BC'", "'def'", "'HIJK'", "'lmnop'", "'QRSTUV'"],
- ["F", "'%a'", "'%b'", "'%d'", "'%h'", "'%H'", "'%i'"]);
- &test_func(\@functions, \@values, 6, 6, ["mysql_test1","Zi","Rd"], 0, 1);
-
- printf("\n####\n#### Third basic test part\n####\n\n");
-
- @values = (["S", "'Monty'", "'Jani'", "'MySQL'", "''"],
- ["N", 10, 54, -70, -499],
- ["Z", 11.03, "'Abo'", 54.333, "''"],
- ["R", 12, "'gnome'", -34.211, "''"],
- ["T", 3, "'Redhat'", -19984021774433, "''"],
- ["D", "'1990-01-31'", "'-3333-10-23'", -5631_23_12, "''"],
- ["B", 0, "'asb'", -4, "''"],
- ["C", "'a'", 503, -45353453, "''"],
- ["F", "'%a'", -231, "'Mitsubishi'", "''"]);
- &test_func(\@functions, \@values, 3, 3, ["mysql_test1","Zi","Rd"], 0, 1);
-
- &exec_query(["delete from mysql_test1"], $NO_ERR, $SILENT);
-
- ####
- #### Null tests
- ####
-
- printf("\n\n####\n#### NULL TESTS FOR FUNCTIONS\n####\n\n\n");
-
- &exec_query(["insert into mysql_test1 values(null,null)"], $NO_ERR,
- $SILENT);
- @values = (["S", "NULL"],
- ["N", "NULL"],
- ["Z", "NULL"],
- ["R", "NULL"],
- ["T", "NULL"],
- ["D", "NULL"],
- ["B", "NULL"],
- ["C", "NULL"],
- ["F", "NULL"]);
- &test_func(\@functions, \@values, 1, 5, ["mysql_test1","Zi","Rd"], 1);
- &exec_query(["delete from mysql_test1"], $NO_ERR, $SILENT);
-
- ####
- #### Tests to fulfill the main part of function tests above
- ####
-
- printf("\n\n####\n#### FULFILL TESTS \n####\n\n\n");
-
- &exec_query(["drop table my_t"], $MAY_ERR, $SILENT);
- &exec_query(["create table my_t (s1 char(64), s2 char(64))"],
- $NO_ERR, $VERBOSE, $HS);
- $query = <<EOF;
-insert into my_t values('aaa','aaa'),('aaa|qqq','qqq'),('gheis','^[^a-dXYZ]+\$'),('aab','^aa?b'),('Baaan','^Ba*n'),('aaa','qqq|aaa'),('qqq','qqq|aaa'),('bbb','qqq|aaa'),('bbb','qqq'),('aaa','aba'),(null,'abc'),('def',null),(null,null),('ghi','ghi[')
-EOF
- chop($query);
- &exec_query([$query], $NO_ERR, $VERBOSE, $HS);
- &exec_query(["select s1 regexp s2 from my_t"],
- $NO_ERR, $VERBOSE, $HS);
-
-
- ####
- #### ["position","SS"],
- ####
-
-}
-
-sub create_test_tables
-{
- $query[0][0] = <<EOF;
- CREATE TABLE my_t (
- auto int(5) unsigned DEFAULT '0' NOT NULL auto_increment,
- string varchar(10) DEFAULT 'hello',
- binary_string varchar(10) binary DEFAULT '' NOT NULL,
- tiny tinyint(4) DEFAULT '0' NOT NULL,
- short smallint(6) DEFAULT '1' NOT NULL,
- medium mediumint(8) DEFAULT '0' NOT NULL,
- longint int(11) DEFAULT '0' NOT NULL,
- longlong bigint(13) DEFAULT '0' NOT NULL,
- num decimal(5,2) DEFAULT '0.00' NOT NULL,
- num_fill decimal(6,2) unsigned zerofill DEFAULT '0000.00' NOT NULL,
- real_float float(13,1) DEFAULT '0.0' NOT NULL,
- real_double double(13,1),
- utiny tinyint(3) unsigned DEFAULT '0' NOT NULL,
- ushort smallint(5) unsigned zerofill DEFAULT '00000' NOT NULL,
- umedium mediumint(8) unsigned DEFAULT '0' NOT NULL,
- ulong int(11) unsigned DEFAULT '0' NOT NULL,
- ulonglong bigint(13) unsigned DEFAULT '0' NOT NULL,
- zero int(5) unsigned zerofill,
- time_stamp timestamp(14),
- date_field date,
- time_field time,
- date_time datetime,
- blob_col blob,
- tinyblob_col tinyblob,
- mediumblob_col mediumblob NOT NULL,
- longblob_col longblob NOT NULL,
- options enum('one','two','three'),
- flags set('one','two','three'),
- PRIMARY KEY (auto)
-)
-EOF
- chop($query[0][0]);
- $query[0][1] = <<EOF;
- INSERT INTO my_t VALUES (1,'hello','',0,1,0,0,0,0.00,0000.00,0.0,NULL,0,
- 00000,0,0,0,NULL,19980728154204,NULL,'01:00:00',
- NULL,NULL,NULL,'','',NULL,NULL)
-EOF
- chop($query[0][1]);
- $query[0][2] = <<EOF;
- INSERT INTO my_t VALUES (2,'hello','',0,1,0,0,0,0.00,0000.00,
- -340282346638528859811704183484516925440.0,NULL,0,
- 00000,0,0,0,NULL,19980728154205,NULL,NULL,NULL,NULL,
- NULL,'','',NULL,NULL)
-EOF
- chop($query[0][2]);
- $query[0][3] = <<EOF;
- INSERT INTO my_t VALUES (3,'hello','',0,1,0,0,0,0.00,0000.00,0.0,NULL,0,00000,
- 0,0,0,NULL,19980728154205,NULL,NULL,
- '2002-12-30 22:04:02',NULL,NULL,'','',NULL,NULL)
-EOF
- chop($query[0][3]);
- $query[0][4] = <<EOF;
- INSERT INTO my_t VALUES (4,'hello','',0,1,0,0,0,0.00,0000.00,0.0,NULL,0,00000,
- 0,0,0,NULL,19980728154205,'1997-12-06',NULL,NULL,
- NULL,NULL,'','',NULL,NULL)
-EOF
- chop($query[0][4]);
- $query[0][5] = <<EOF;
- INSERT INTO my_t VALUES (5,'hello','',0,1,0,0,0,0.00,0000.00,0.0,NULL,0,00000,
- 0,0,0,NULL,19980728154205,NULL,'20:10:08',NULL,NULL,
- NULL,'','',NULL,NULL)
-EOF
- chop($query[0][5]);
- $query[0][6] = <<EOF;
- INSERT INTO my_t VALUES (6,'hello','',0,1,0,0,0,-0.22,0000.00,0.0,NULL,0,
- 00000,0,0,0,NULL,19980728154205,NULL,NULL,NULL,
- NULL,NULL,'','',NULL,NULL)
-EOF
- chop($query[0][6]);
- $query[0][7] = <<EOF;
- INSERT INTO my_t VALUES (7,'hello','',0,1,0,0,0,-0.00,0000.00,0.0,NULL,0,
- 00000,0,0,0,NULL,19980728154205,NULL,NULL,NULL,
- NULL,NULL,'','',NULL,NULL)
-EOF
- chop($query[0][7]);
- $query[0][8] = <<EOF;
- INSERT INTO my_t VALUES (8,'hello','',0,1,0,0,0,+0.00,0000.00,0.0,NULL,0,
- 00000,0,0,0,NULL,19980728154205,NULL,NULL,NULL,
- NULL,NULL,'','',NULL,NULL)
-EOF
- chop($query[0][8]);
- $query[0][9] = <<EOF;
- INSERT INTO my_t VALUES (9,'hello','',0,1,0,0,0,+0.90,0000.00,0.0,NULL,0,
- 00000,0,0,0,NULL,19980728154205,NULL,NULL,NULL,
- NULL,NULL,'','',NULL,NULL)
-EOF
- chop($query[0][9]);
- $query[0][10] = <<EOF;
- INSERT INTO my_t VALUES (10,'hello','',0,1,0,0,0,-999.99,0000.00,0.0,NULL,0,
- 00000,0,0,0,NULL,19980728154206,NULL,NULL,NULL,NULL,
- NULL,'','',NULL,NULL)
-EOF
- chop($query[0][10]);
- $query[0][11] = <<EOF;
- INSERT INTO my_t VALUES (11,'hello','',127,32767,8388607,2147483647,
- 9223372036854775807,9999.99,9999.99,
- 329999996548271212625250308919809540096.0,9.0,255,
- 65535,16777215,4294967295,18446744073709551615,
- 4294967295,00000000000000,'9999-12-31','23:59:59',
- '9999-12-31 23:59:59',NULL,NULL,' ',' ','',
- 'one,two,three')
-EOF
- chop($query[0][11]);
- $query[0][12] = <<EOF;
- INSERT INTO my_t VALUES (12,'hello','',-128,-32768,-8388608,-2147483648,
- -9223372036854775808,-999.99,0000.00,
- -329999996548271212625250308919809540096.0,10.0,0,
- 00000,0,0,0,00000,00000000000000,
- '9999-12-31','23:59:59','9999-12-31 23:59:59',NULL,
- NULL,' ,-',' ,-','','one,two,three')
-EOF
- chop($query[0][12]);
- $query[0][13] = <<EOF;
- INSERT INTO my_t VALUES (13,'hello','',0,1,0,0,0,0.09,0000.00,0.0,NULL,0,
- 00000,0,0,0,NULL,19980728154223,NULL,NULL,NULL,
- NULL,NULL,'','',NULL,NULL)
-EOF
- chop($query[0][13]);
- $query[0][14] = <<EOF;
- INSERT INTO my_t VALUES (14,'hello','',0,1,0,0,0,0.00,0000.00,0.0,NULL,0,
- 00000,0,0,0,NULL,19980728154223,NULL,NULL,NULL,
- NULL,NULL,'','',NULL,NULL)
-EOF
- chop($query[0][14]);
- $query[0][15] = <<EOF;
- INSERT INTO my_t VALUES (15,'hello','',0,1,0,0,0,0.00,0044.00,0.0,NULL,0,
- 00000,0,0,0,NULL,19980728154223,NULL,NULL,NULL,
- NULL,NULL,'','',NULL,NULL)
-EOF
- chop($query[0][15]);
- $query[0][16] = <<EOF;
- INSERT INTO my_t VALUES (16,'hello','',0,1,0,0,0,0.00,9999.99,0.0,NULL,0,
- 00000,0,0,0,NULL,19980728154223,NULL,NULL,NULL,
- NULL,NULL,'','',NULL,NULL)
-EOF
- chop($query[0][16]);
- $query[0][17] = <<EOF;
- INSERT INTO my_t VALUES (17,'hello','',127,32767,8388607,2147483647,
- 9223372036854775807,9999.99,9999.99,
- 329999996548271212625250308919809540096.0,9.0,255,
- 65535,16777215,4294967295,18446744073709551615,
- 4294967295,00000000000000,'9999-12-31','23:59:59',
- '9999-12-31 23:59:59',NULL,NULL,' ',' ','',
- 'one,two,three')
-EOF
- chop($query[0][17]);
- $query[0][18] = <<EOF;
- INSERT INTO my_t VALUES (18,'hello','',127,32767,8388607,2147483647,
- 9223372036854775807,9999.99,9999.99,0.0,NULL,255,
- 65535,16777215,4294967295,18446744073709551615,
- 4294967295,19980728154224,NULL,NULL,NULL,NULL,
- NULL,'','',NULL,NULL)
-EOF
- chop($query[0][18]);
- $query[0][19] = <<EOF;
- INSERT INTO my_t VALUES (19,'hello','',127,32767,8388607,2147483647,
- 9223372036854775807,9999.99,9999.99,0.0,NULL,255,
- 65535,16777215,4294967295,0,4294967295,
- 19980728154224,NULL,NULL,NULL,NULL,NULL,'','',
- NULL,NULL)
-EOF
- chop($query[0][19]);
- $query[0][20] = <<EOF;
- INSERT INTO my_t VALUES (20,'hello','',-128,-32768,-8388608,-2147483648,
- -9223372036854775808,-999.99,0000.00,0.0,NULL,0,
- 00000,0,0,18446744073709551615,00000,19980728154224,
- NULL,NULL,NULL,NULL,NULL,'','',NULL,NULL)
-EOF
- chop($query[0][20]);
- $query[0][21] = <<EOF;
- INSERT INTO my_t VALUES (21,'hello','',-128,-32768,-8388608,-2147483648,
- -9223372036854775808,-999.99,0000.00,0.0,NULL,0,
- 00000,0,0,0,00000,19980728154225,NULL,NULL,NULL,
- NULL,NULL,'','',NULL,NULL)
-EOF
- chop($query[0][21]);
- $query[0][22] = <<EOF;
- INSERT INTO my_t VALUES (22,NULL,'1',1,1,1,1,1,1.00,0001.00,1.0,NULL,1,00001,
- 1,1,1,00001,19980728154244,NULL,NULL,NULL,NULL,NULL,
- '1','1',NULL,NULL)
-EOF
- chop($query[0][22]);
- $query[0][23] = <<EOF;
- INSERT INTO my_t VALUES (23,'2','2',2,2,2,2,2,2.00,0002.00,2.0,2.0,2,00002,
- 2,2,2,00002,00000000000000,'0000-00-00','02:00:00',
- '0000-00-00 00:00:00','2','2','2','2','','')
-EOF
- chop($query[0][23]);
- $query[0][24] = <<EOF;
- INSERT INTO my_t VALUES (24,'3','3',3,3,3,3,3,3.00,0003.00,3.0,3.0,3,00003,
- 3,3,3,00003,00000000000000,'2000-00-03','00:00:03',
- '0000-00-00 00:00:03','3.00','3.00','3.00','3.00',
- 'three','one,two')
-EOF
- chop($query[0][24]);
- $query[0][25] = <<EOF;
- INSERT INTO my_t VALUES (25,'-4.7','-4.7',-5,-5,-5,-5,-5,-4.70,0000.00,-4.7,
- -4.7,0,00000,0,0,0,00000,00000000000000,'0000-00-00',
- '00:00:00','0000-00-00 00:00:00','-4.70','-4.70',
- '-4.70','-4.70','','three')
-EOF
- chop($query[0][25]);
- $query[0][26] = <<EOF;
- INSERT INTO my_t VALUES (26,'+0.09','+0.09',0,0,0,0,0,+0.09,0000.00,0.1,0.1,
- 0,00000,0,0,0,00000,00000000000000,'0000-00-00',
- '00:09:00','0000-00-00 00:00:00','+0.09','+0.09',
- '+0.09','+0.09','','')
-EOF
- chop($query[0][26]);
- $query[0][27] = <<EOF;
- INSERT INTO my_t VALUES (27,'1','1',1,1,1,1,1,1.00,0001.00,1.0,1.0,1,00001,
- 1,1,1,00001,00000000000000,'2000-00-01','00:00:01',
- '0000-00-00 00:00:01','1','1','1','1','one','one')
-EOF
- chop($query[0][27]);
- $query[0][28] = <<EOF;
- INSERT INTO my_t VALUES (28,'-1','-1',-1,-1,-1,-1,-1,-1.00,0000.00,-1.0,-1.0,
- 0,00000,0,0,18446744073709551615,00000,
- 00000000000000,'0000-00-00','00:00:00',
- '0000-00-00 00:00:00','-1','-1','-1','-1','',
- 'one,two,three')
-EOF
- chop($query[0][28]);
- $query[0][29] = <<EOF;
- INSERT INTO my_t VALUES (29,'','',0,0,0,0,0,0.00,0000.00,0.0,0.0,0,00000,0,0,
- 0,00000,00000000000000,'0000-00-00','00:00:00',
- '0000-00-00 00:00:00','','','','','','')
-EOF
- chop($query[0][29]);
- $query[1][0] = "CREATE TABLE my_t (str char(64))";
- $query[1][1] = "INSERT INTO my_t VALUES ('5.5')";
- $query[1][2] = "INSERT INTO my_t VALUES ('6.8')";
- $query[2][0] = "CREATE TABLE my_t (str char(64))";
- $query[2][1] = <<EOF;
- INSERT INTO my_t VALUES
- ('9999999999993242342442323423443534529999.02235000054213')
-EOF
- chop($query[2][1]);
- $query[3][0] = "CREATE TABLE my_t (str char(64))";
- $query[3][1] = <<EOF;
- INSERT INTO my_t VALUES
- ('8494357934579347593475349579347593845948793454350349543348736453')
-EOF
- chop($query[3][1]);
- $query[4][0] = "CREATE TABLE my_t (d double(20,10))";
- $query[4][1] = "INSERT INTO my_t VALUES (10.0000000000)";
- $query[4][2] = "INSERT INTO my_t VALUES (-10.0000000000)";
- $query[5][0] = "CREATE TABLE my_t (d double(20,10))";
- $query[5][1] = "INSERT INTO my_t VALUES (50000.0000000000)";
- $query[6][0] = "CREATE TABLE my_t (d double(20,10))";
- $query[6][1] = "INSERT INTO my_t VALUES (5000000.0000000000)";
- $query[7][0] = "CREATE TABLE my_t (d double(20,10))";
- $query[7][1] = "INSERT INTO my_t VALUES (500000000.0000000000)";
- $query[8][0] = "CREATE TABLE my_t (d double(20,10))";
- $query[8][1] = "INSERT INTO my_t VALUES (50000000000.0000000000)";
- $query[8][2] = "INSERT INTO my_t VALUES (NULL)";
- $query[9][0] = "CREATE TABLE my_t (d double(60,10))";
- $query[9][1] = "INSERT INTO my_t VALUES (93850983054983462912.0000000000)";
- $query[9][2] = "INSERT INTO my_t VALUES (93850983.3495762944)";
- $query[9][3] = <<EOF;
- INSERT INTO my_t VALUES (938509832438723448371221493568778534912.0000000000)
-EOF
- chop($query[9][3]);
- $query[10][0] = "CREATE TABLE my_t (i int(11))";
- $query[10][1] = "INSERT INTO my_t VALUES (-100)";
- $query[10][2] = "INSERT INTO my_t VALUES (-200)";
- $query[11][0] = "CREATE TABLE my_t (s char(64))";
- $query[11][1] = "INSERT INTO my_t VALUES ('100.')";
- $query[12][0] = "CREATE TABLE my_t (s char(64))";
- $query[12][1] = "INSERT INTO my_t VALUES ('1e+50')";
- $query[13][0] = "CREATE TABLE my_t (s char(64))";
- $query[13][1] = "INSERT INTO my_t VALUES ('1E+50u')";
- $query[14][0] = "CREATE TABLE my_t (s char(64))";
- $query[14][1] = "INSERT INTO my_t VALUES ('1EU50')";
- $query[15][0] = "CREATE TABLE my_t (s char(64))";
- $query[15][1] = "INSERT INTO my_t VALUES ('123.000')";
- $query[15][2] = "INSERT INTO my_t VALUES ('123.000abc')";
- $query[16][0] = "CREATE TABLE my_t (s char(128))";
- $query[16][1] = <<EOF;
- INSERT INTO my_t VALUES
- ('-999999999999999999999999999999999999999999999999999999999999999999999999')
-EOF
- chop($query[16][1]);
- $query[17][0] = "CREATE TABLE my_t (s char(128))";
- $query[17][1] = "INSERT INTO my_t VALUES ('-9999999999999999')";
- $query[18][0] = "CREATE TABLE my_t (s char(128))";
- $query[18][1] = "INSERT INTO my_t VALUES ('28446744073709551615001')";
- $query[18][2] = "INSERT INTO my_t VALUES ('184467440737095516150000000')";
- $query[19][0] = "CREATE TABLE my_t (s char(128))";
- $query[19][1] = "INSERT INTO my_t VALUES ('18446744073709551615')";
- $query[20][0] = "CREATE TABLE my_t (s char(128))";
- $query[20][1] = "INSERT INTO my_t VALUES ('18446744073709551616')";
- $query[21][0] = "CREATE TABLE my_t (s char(64))";
- $query[21][1] = "INSERT INTO my_t VALUES ('00740')";
- $query[21][2] = "INSERT INTO my_t VALUES ('00740.')";
- $query[22][0] = "CREATE TABLE my_t (s char(128))";
- $query[22][1] = "INSERT INTO my_t VALUES ('-18446744073709551615')";
- $query[23][0] = "CREATE TABLE my_t (s char(32))";
- $query[23][1] = "INSERT INTO my_t VALUES ('740')";
- $query[23][2] = "INSERT INTO my_t VALUES ('12345')";
- $query[23][3] = "INSERT INTO my_t VALUES ('12345')";
- $query[24][0] = "CREATE TABLE my_t (s char(32))";
- $query[24][1] = "INSERT INTO my_t VALUES ('00740')";
- $query[24][2] = "INSERT INTO my_t VALUES ('00730')";
- $query[24][3] = "INSERT INTO my_t VALUES ('00720')";
- $query[24][4] = "INSERT INTO my_t VALUES ('12345.02')";
- $query[25][0] = "CREATE TABLE my_t (i bigint(20) unsigned)";
- $query[25][1] = "INSERT INTO my_t VALUES (3000)";
- $query[25][2] = "INSERT INTO my_t VALUES (NULL)";
- $query[25][3] = "INSERT INTO my_t VALUES (900000000003)";
- $query[25][4] = "INSERT INTO my_t VALUES (90)";
- $query[26][0] = "CREATE TABLE my_t (i int(11))";
- $query[26][1] = "INSERT INTO my_t VALUES (NULL)";
- $query[27][0] = "CREATE TABLE my_t (d date)";
- $query[27][1] = "INSERT INTO my_t VALUES ('1999-05-01')";
- $query[28][0] = "CREATE TABLE my_t (y year(4))";
- $query[28][1] = "INSERT INTO my_t VALUES (1999)";
- $query[29][0] = "CREATE TABLE my_t (s char(128))";
- $query[29][1] = "INSERT INTO my_t VALUES ('453453444451.7976')";
- $query[30][0] = "CREATE TABLE my_t (s char(128))";
- $query[30][1] = "INSERT INTO my_t VALUES('')";
- $query[31][0] = "CREATE TABLE my_t (s char(128))";
- $query[31][1] = "INSERT INTO my_t VALUES(' ')";
- return $query;
-}
diff --git a/mysql-test/mysql-test-run-shell.sh b/mysql-test/mysql-test-run-shell.sh
deleted file mode 100644
index ea8ce1b76d4..00000000000
--- a/mysql-test/mysql-test-run-shell.sh
+++ /dev/null
@@ -1,2338 +0,0 @@
-#!/bin/sh
-# mysql-test-run - originally written by Matt Wagner <matt@mysql.com>
-# modified by Sasha Pachev <sasha@mysql.com>
-# Slightly updated by Monty
-# Cleaned up again by Matt
-# Fixed by Sergei
-# List of failed cases (--force) backported from 4.1 by Joerg
-# :-)
-
-#echo "##################################################";
-#echo "This script is deprecated and will soon be removed";
-#echo "Use mysql-test-run.pl instead";
-#echo "##################################################";
-#echo
-
-#++
-# Access Definitions
-#--
-DB=test
-DBPASSWD=""
-VERBOSE=""
-USE_MANAGER=0
-MY_TZ=GMT-3
-TZ=$MY_TZ; export TZ # for UNIX_TIMESTAMP tests to work
-LOCAL_SOCKET=@MYSQL_UNIX_ADDR@
-
-if [ -z "$MYSQL_TCP_PORT" ]; then
- MYSQL_TCP_PORT=@MYSQL_TCP_PORT@
- if [ @MYSQL_TCP_PORT_DEFAULT@ -eq 0 ]; then
- ESP=`getent services mysql/tcp`
- if [ $? -eq 0 ]; then
- MYSQL_TCP_PORT=`echo "$ESP"|sed -e's-^[a-z]*[ ]*\([0-9]*\)/[a-z]*$-\1-g'`
- fi
- fi
-fi
-
-umask 022
-
-# For query_cache test
-case `uname` in
- SCO_SV | UnixWare | OpenUNIX )
- # do nothing (Causes strange behavior)
- ;;
- QNX)
- # do nothing (avoid error message)
- ;;
- * )
- ulimit -n 1024
- ;;
-esac
-
-#++
-# Program Definitions
-#--
-
-LC_COLLATE=C
-export LC_COLLATE
-PATH=/bin:/usr/bin:/usr/local/bin:/usr/bsd:/usr/X11R6/bin:/usr/openwin/bin:/usr/bin/X11:$PATH
-MASTER_40_ARGS="--rpl-recovery-rank=1 --init-rpl-role=master"
-
-# Standard functions
-
-which ()
-{
- IFS="${IFS= }"; save_ifs="$IFS"; IFS=':'
- for file
- do
- for dir in $PATH
- do
- if test -f $dir/$file
- then
- echo "$dir/$file"
- continue 2
- fi
- done
- echo "Fatal error: Cannot find program $file in $PATH" 1>&2
- exit 1
- done
- IFS="$save_ifs"
- exit 0
-}
-
-
-sleep_until_file_deleted ()
-{
- pid=$1;
- file=$2
- loop=$SLEEP_TIME_FOR_DELETE
- while (test $loop -gt 0)
- do
- if [ ! -r $file ]
- then
- if test $pid != "0"
- then
- wait_for_pid $pid
- fi
- return
- fi
- sleep 1
- loop=`expr $loop - 1`
- done
-}
-
-sleep_until_file_created ()
-{
- file=$1
- loop=$2
- org_time=$2
- while (test $loop -gt 0)
- do
- if [ -r $file ]
- then
- return 0
- fi
- sleep 1
- loop=`expr $loop - 1`
- done
- echo "ERROR: $file was not created in $org_time seconds; Aborting"
- exit 1;
-}
-
-# For the future
-
-wait_for_pid()
-{
- pid=$1
- #$WAIT_PID pid $SLEEP_TIME_FOR_DELETE
-}
-
-# Check that valgrind is installed
-find_valgrind()
-{
- FIND_VALGRIND=`which valgrind` # this will print an error if not found
- # Give good warning to the user and stop
- if [ -z "$FIND_VALGRIND" ] ; then
- $ECHO "You need to have the 'valgrind' program in your PATH to run mysql-test-run with option --valgrind. Valgrind's home page is http://valgrind.kde.org ."
- exit 1
- fi
- # >=2.1.2 requires the --tool option, some versions write to stdout, some to stderr
- valgrind --help 2>&1 | grep "\-\-tool" > /dev/null && FIND_VALGRIND="$FIND_VALGRIND --tool=memcheck"
- FIND_VALGRIND="$FIND_VALGRIND --alignment=8 --leak-check=yes --num-callers=16 --suppressions=$MYSQL_TEST_DIR/valgrind.supp"
-}
-
-# No paths below as we can't be sure where the program is!
-
-SED=sed
-
-BASENAME=`which basename`
-if test $? != 0; then exit 1; fi
-DIFF=`which diff | $SED q`
-if test $? != 0; then exit 1; fi
-CAT=cat
-CUT=cut
-HEAD=head
-TAIL=tail
-ECHO=echo # use internal echo if possible
-EXPR=expr # use internal if possible
-FIND=find
-GREP=grep
-if test $? != 0; then exit 1; fi
-PRINTF=printf
-RM=rm
-if test $? != 0; then exit 1; fi
-TR=tr
-XARGS=`which xargs`
-if test $? != 0; then exit 1; fi
-SORT=sort
-
-# Are we using a source or a binary distribution?
-
-testdir=@testdir@
-if [ -d bin/mysqld ] && [ -d mysql-test ] ; then
- cd mysql-test
-else
- if [ -d $testdir/mysql-test ] ; then
- cd $testdir
- fi
-fi
-
-if [ ! -f ./mysql-test-run ] ; then
- $ECHO "Can't find the location for the mysql-test-run script"
-
- $ECHO "Go to to the mysql-test directory and execute the script as follows:"
- $ECHO "./mysql-test-run."
- exit 1
-fi
-
-#++
-# Misc. Definitions
-#--
-
-# BASEDIR is always above mysql-test directory ...
-MYSQL_TEST_DIR=`pwd`
-cd ..
-
-if [ -d ./sql ] ; then
- SOURCE_DIST=1
-else
- BINARY_DIST=1
-
- # ... one level for tar.gz, two levels for a RPM installation
- if [ ! -f ./bin/mysql_upgrade ] ; then
- # Has to be RPM installation
- cd ..
- fi
-fi
-BASEDIR=`pwd`
-
-cd $MYSQL_TEST_DIR
-MYSQL_TEST_WINDIR=$MYSQL_TEST_DIR
-MYSQLTEST_VARDIR=$MYSQL_TEST_DIR/var
-export MYSQL_TEST_DIR MYSQL_TEST_WINDIR MYSQLTEST_VARDIR
-STD_DATA=$MYSQL_TEST_DIR/std_data
-hostname=`hostname` # Installed in the mysql privilege table
-
-MANAGER_QUIET_OPT="-q"
-TESTDIR="$MYSQL_TEST_DIR/t"
-TESTSUFFIX=test
-TOT_SKIP=0
-TOT_PASS=0
-TOT_FAIL=0
-TOT_TEST=0
-GOT_WARNINGS=0
-USERT=0
-SYST=0
-REALT=0
-FAST_START=""
-MYSQL_TMP_DIR=$MYSQL_TEST_DIR/var/tmp
-export MYSQL_TMP_DIR
-
-# Use a relative path for where the slave will find the dumps
-# generated by "LOAD DATA" on the master. The path is relative
-# since it must have fixed length to test logging
-# i.e otherwise the output from "SHOW MASTER STATUS" will vary
-# with the strlen() of MYSQL_TEST_DIR
-SLAVE_LOAD_TMPDIR=../tmp
-
-RES_SPACE=" "
-MYSQLD_SRC_DIRS="strings mysys include extra regex myisam \
- myisammrg heap sql"
-MY_LOG_DIR="$MYSQL_TEST_DIR/var/log"
-#
-# Set LD_LIBRARY_PATH if we are using shared libraries
-#
-LD_LIBRARY_PATH="$BASEDIR/lib:$BASEDIR/libmysql/.libs:$BASEDIR/libmysql_r/.libs:$BASEDIR/zlib/.libs:$LD_LIBRARY_PATH"
-DYLD_LIBRARY_PATH="$BASEDIR/lib:$BASEDIR/libmysql/.libs:$BASEDIR/libmysql_r/.libs:$BASEDIR/zlib/.libs:$DYLD_LIBRARY_PATH"
-export LD_LIBRARY_PATH DYLD_LIBRARY_PATH
-
-#
-# Allow anyone in the group to see the generated database files
-#
-UMASK=0660
-UMASK_DIR=0770
-export UMASK UMASK_DIR
-
-MASTER_RUNNING=0
-MASTER1_RUNNING=0
-MASTER_MYHOST=127.0.0.1
-MASTER_MYPORT=9306
-SLAVE_RUNNING=0
-SLAVE_MYHOST=127.0.0.1
-SLAVE_MYPORT=9308 # leave room for 2 masters for cluster tests
-MYSQL_MANAGER_LOG=$MYSQL_TEST_DIR/var/log/manager.log
-NDBCLUSTER_PORT=9350
-NDBCLUSTER_PORT_SLAVE=9358
-
-#
-# To make it easier for different devs to work on the same host,
-# an environment variable can be used to control all ports. A small
-# number is to be used, 0 - 16 or similar.
-#
-# Note the MASTER_MYPORT has to be set the same in all 4.x and 5.x
-# versions of this script, else a 4.0 test run might conflict with a
-# 5.1 test run, even if different MTR_BUILD_THREAD is used. This means
-# all port numbers might not be used in this version of the script.
-#
-if [ -n "$MTR_BUILD_THREAD" ] ; then
- MASTER_MYPORT=`expr $MTR_BUILD_THREAD '*' 10 + 10000`
- SLAVE_MYPORT=`expr $MASTER_MYPORT + 3`
- NDBCLUSTER_PORT=`expr $MASTER_MYPORT + 6`
- NDBCLUSTER_PORT_SLAVE=`expr $MASTER_MYPORT + 7`
-
- echo "Using MTR_BUILD_THREAD = $MTR_BUILD_THREAD"
- echo "Using MASTER_MYPORT = $MASTER_MYPORT"
- echo "Using SLAVE_MYPORT = $SLAVE_MYPORT"
- echo "Using NDBCLUSTER_PORT = $NDBCLUSTER_PORT"
- echo "Using NDBCLUSTER_PORT_SLAVE = $NDBCLUSTER_PORT_SLAVE"
-fi
-
-NO_SLAVE=0
-USER_TEST=
-FAILED_CASES=
-
-EXTRA_MASTER_OPT=""
-EXTRA_MYSQL_TEST_OPT=""
-EXTRA_MYSQLCHECK_OPT=""
-EXTRA_MYSQLDUMP_OPT=""
-EXTRA_MYSQLSLAP_OPT=""
-EXTRA_MYSQLSHOW_OPT=""
-EXTRA_MYSQLBINLOG_OPT=""
-USE_RUNNING_SERVER=0
-USE_NDBCLUSTER=@USE_NDBCLUSTER@
-USE_NDBCLUSTER_SLAVE=@USE_NDBCLUSTER@
-USE_NDBCLUSTER_ALL=0
-USE_NDBCLUSTER_ONLY=0
-USE_RUNNING_NDBCLUSTER=""
-USE_RUNNING_NDBCLUSTER_SLAVE=""
-NDB_EXTRA_TEST=0
-NDB_VERBOSE=0
-NDBCLUSTER_EXTRA_OPTS=""
-USE_PURIFY=""
-PURIFY_LOGS=""
-DO_GCOV=""
-DO_GDB=""
-MANUAL_GDB=""
-DO_DDD=""
-DO_CLIENT_GDB=""
-SLEEP_TIME_AFTER_RESTART=1
-SLEEP_TIME_FOR_DELETE=10
-SLEEP_TIME_FOR_FIRST_MASTER=400 # Enough time to create innodb tables
-SLEEP_TIME_FOR_SECOND_MASTER=400
-SLEEP_TIME_FOR_FIRST_SLAVE=400
-SLEEP_TIME_FOR_SECOND_SLAVE=300
-CHARACTER_SET=latin1
-DBUSER=""
-START_WAIT_TIMEOUT=10
-STOP_WAIT_TIMEOUT=10
-MYSQL_TEST_SSL_OPTS=""
-USE_TIMER=""
-USE_EMBEDDED_SERVER=""
-TEST_MODE=""
-
-NDB_MGM_EXTRA_OPTS=
-NDB_MGMD_EXTRA_OPTS=
-NDBD_EXTRA_OPTS=
-MASTER_MYSQLDBINLOG=1
-SLAVE_MYSQLDBINLOG=1
-
-DO_STRESS=""
-STRESS_SUITE="main"
-STRESS_MODE="random"
-STRESS_THREADS=5
-STRESS_TEST_COUNT=""
-STRESS_LOOP_COUNT=""
-STRESS_TEST_DURATION=""
-STRESS_INIT_FILE=""
-STRESS_TEST_FILE=""
-STRESS_TEST=""
-
-$ECHO "Logging: $0 $*" # To ensure we see all arguments in the output, for the test analysis tool
-
-while test $# -gt 0; do
- case "$1" in
- --embedded-server)
- USE_EMBEDDED_SERVER=1
- USE_MANAGER=0 NO_SLAVE=1
- USE_RUNNING_SERVER=0
- USE_NDBCLUSTER=""
- USE_NDBCLUSTER_SLAVE=""
- TEST_MODE="$TEST_MODE embedded" ;;
- --purify)
- USE_PURIFY=1
- USE_MANAGER=0
- USE_RUNNING_SERVER=0
- TEST_MODE="$TEST_MODE purify" ;;
- --user=*) DBUSER=`$ECHO "$1" | $SED -e "s;--user=;;"` ;;
- --force) FORCE=1 ;;
- --timer) USE_TIMER=1 ;;
- --old-master) MASTER_40_ARGS="";;
- --master-binary=*)
- MASTER_MYSQLD=`$ECHO "$1" | $SED -e "s;--master-binary=;;"` ;;
- --slave-binary=*)
- SLAVE_MYSQLD=`$ECHO "$1" | $SED -e "s;--slave-binary=;;"` ;;
- --local) USE_RUNNING_SERVER=0 ;;
- --extern) USE_RUNNING_SERVER=1 ;;
- --with-ndbcluster)
- USE_NDBCLUSTER="--ndbcluster" ;;
- --with-ndbcluster-slave)
- USE_NDBCLUSTER_SLAVE="--ndbcluster" ;;
- --with-ndbcluster-all)
- USE_NDBCLUSTER="--ndbcluster"
- USE_NDBCLUSTER_SLAVE="--ndbcluster"
- USE_NDBCLUSTER_ALL=1 ;;
- --with-ndbcluster-only)
- USE_NDBCLUSTER="--ndbcluster"
- USE_NDBCLUSTER_SLAVE="--ndbcluster"
- USE_NDBCLUSTER_ONLY=1 ;;
- --ndb-connectstring=*)
- USE_NDBCLUSTER="--ndbcluster" ;
- USE_RUNNING_NDBCLUSTER=`$ECHO "$1" | $SED -e "s;--ndb-connectstring=;;"` ;;
- --ndb-connectstring-slave=*)
- USE_NDBCLUSTER_SLAVE="--ndbcluster" ;
- USE_RUNNING_NDBCLUSTER_SLAVE=`$ECHO "$1" | $SED -e "s;--ndb-connectstring-slave=;;"` ;;
- --ndb-extra-test)
- NDBCLUSTER_EXTRA_OPTS=" "
- NDB_EXTRA_TEST=1 ;
- ;;
- --ndb-verbose)
- NDB_VERBOSE=2 ;;
- --ndb_mgm-extra-opts=*)
- NDB_MGM_EXTRA_OPTS=`$ECHO "$1" | $SED -e "s;--ndb_mgm-extra-opts=;;"` ;;
- --ndb_mgmd-extra-opts=*)
- NDB_MGMD_EXTRA_OPTS=`$ECHO "$1" | $SED -e "s;--ndb_mgmd-extra-opts=;;"` ;;
- --ndbd-extra-opts=*)
- NDBD_EXTRA_OPTS=`$ECHO "$1" | $SED -e "s;--ndbd-extra-opts=;;"` ;;
- --tmpdir=*) MYSQL_TMP_DIR=`$ECHO "$1" | $SED -e "s;--tmpdir=;;"` ;;
- --local-master)
- MASTER_MYPORT=3306;
- EXTRA_MYSQL_TEST_OPT="$EXTRA_MYSQL_TEST_OPT --host=127.0.0.1 \
- --port=$MYSQL_MYPORT"
- LOCAL_MASTER=1 ;;
- --master_port=*) MASTER_MYPORT=`$ECHO "$1" | $SED -e "s;--master_port=;;"` ;;
- --slave_port=*) SLAVE_MYPORT=`$ECHO "$1" | $SED -e "s;--slave_port=;;"` ;;
- --ndbcluster_port=*) NDBCLUSTER_PORT=`$ECHO "$1" | $SED -e "s;--ndbcluster_port=;;"` ;;
- --ndbcluster-port=*) NDBCLUSTER_PORT=`$ECHO "$1" | $SED -e "s;--ndbcluster-port=;;"` ;;
- --ndbcluster-port-slave=*) NDBCLUSTER_PORT_SLAVE=`$ECHO "$1" | $SED -e "s;--ndbcluster-port-slave=;;"` ;;
- --with-openssl)
- EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT \
- --ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem \
- --ssl-cert=$MYSQL_TEST_DIR/std_data/server-cert.pem \
- --ssl-key=$MYSQL_TEST_DIR/std_data/server-key.pem"
- EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT \
- --ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem \
- --ssl-cert=$MYSQL_TEST_DIR/std_data/server-cert.pem \
- --ssl-key=$MYSQL_TEST_DIR/std_data/server-key.pem"
- MYSQL_TEST_SSL_OPTS="--ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem \
- --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem \
- --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem" ;;
- --start-and-exit)
- START_AND_EXIT=1
- ;;
- --socket=*) LOCAL_SOCKET=`$ECHO "$1" | $SED -e "s;--socket=;;"` ;;
- --skip-rpl) NO_SLAVE=1 ;;
- --skip-test=*) SKIP_TEST=`$ECHO "$1" | $SED -e "s;--skip-test=;;"`;;
- --do-test=*) DO_TEST=`$ECHO "$1" | $SED -e "s;--do-test=;;"`;;
- --start-from=* ) START_FROM=`$ECHO "$1" | $SED -e "s;--start-from=;;"` ;;
- --warnings | --log-warnings)
- EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --log-warnings"
- EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --log-warnings"
- ;;
- --wait-timeout=*)
- START_WAIT_TIMEOUT=`$ECHO "$1" | $SED -e "s;--wait-timeout=;;"`
- STOP_WAIT_TIMEOUT=$START_WAIT_TIMEOUT;;
- --record)
- RECORD=1;
- EXTRA_MYSQL_TEST_OPT="$EXTRA_MYSQL_TEST_OPT $1" ;;
- --small-bench)
- DO_SMALL_BENCH=1
- DO_BENCH=1
- NO_SLAVE=1
- ;;
- --bench)
- DO_BENCH=1
- NO_SLAVE=1
- ;;
- --stress)
- DO_STRESS=1
- NO_SLAVE=1
- SKIP_SLAVE=1
- ;;
- --stress-suite=*)
- STRESS_SUITE=`$ECHO "$1" | $SED -e "s;--stress-suite=;;"`
- ;;
- --stress-threads=*)
- STRESS_THREADS=`$ECHO "$1" | $SED -e "s;--stress-threads=;;"`
- ;;
- --stress-test-file=*)
- STRESS_TEST_FILE=`$ECHO "$1" | $SED -e "s;--stress-test-file=;;"`
- ;;
- --stress-init-file=*)
- STRESS_INIT_FILE=`$ECHO "$1" | $SED -e "s;--stress-init-file=;;"`
- ;;
- --stress-mode=*)
- STRESS_MODE=`$ECHO "$1" | $SED -e "s;--stress-mode=;;"`
- ;;
- --stress-loop-count=*)
- STRESS_LOOP_COUNT=`$ECHO "$1" | $SED -e "s;--stress-loop-count=;;"`
- ;;
- --stress-test-count=*)
- STRESS_TEST_COUNT=`$ECHO "$1" | $SED -e "s;--stress-test-count=;;"`
- ;;
- --stress-test-duration=*)
- STRESS_TEST_DURATION=`$ECHO "$1" | $SED -e "s;--stress-test-duration=;;"`
- ;;
- --big*) # Actually --big-test
- EXTRA_MYSQL_TEST_OPT="$EXTRA_MYSQL_TEST_OPT $1" ;;
- --compress)
- EXTRA_MYSQL_TEST_OPT="$EXTRA_MYSQL_TEST_OPT $1" ;;
- --sleep=*)
- EXTRA_MYSQL_TEST_OPT="$EXTRA_MYSQL_TEST_OPT $1"
- SLEEP_TIME_AFTER_RESTART=`$ECHO "$1" | $SED -e "s;--sleep=;;"`
- ;;
- --ps-protocol)
- TEST_MODE="$TEST_MODE ps-protocol" EXTRA_MYSQL_TEST_OPT="$EXTRA_MYSQL_TEST_OPT $1" ;;
- --user-test=*)
- USER_TEST=`$ECHO "$1" | $SED -e "s;--user-test=;;"`
- ;;
- --mysqld=*)
- TMP=`$ECHO "$1" | $SED -e "s;--mysqld=;;"`
- EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT $TMP"
- EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT $TMP"
- ;;
- --gcov )
- if [ x$BINARY_DIST = x1 ] ; then
- $ECHO "Cannot do coverage test without the source - please use source dist"
- exit 1
- fi
- DO_GCOV=1
- GCOV=`which gcov`
- ;;
- --gprof )
- DO_GPROF=1
- ;;
- --gdb )
- START_WAIT_TIMEOUT=300
- STOP_WAIT_TIMEOUT=300
- if [ x$BINARY_DIST = x1 ] ; then
- $ECHO "Note: you will get more meaningful output on a source distribution compiled with debugging option when running tests with --gdb option"
- fi
- DO_GDB=1
- EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --gdb"
- EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --gdb"
- # This needs to be checked properly
- # USE_MANAGER=1
- USE_RUNNING_SERVER=0
- ;;
- --client-gdb )
- if [ x$BINARY_DIST = x1 ] ; then
- $ECHO "Note: you will get more meaningful output on a source distribution compiled with debugging option when running tests with --client-gdb option"
- fi
- DO_CLIENT_GDB=1
- EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --gdb"
- EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --gdb"
- ;;
- --manual-gdb )
- DO_GDB=1
- MANUAL_GDB=1
- USE_RUNNING_SERVER=0
- EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --gdb"
- EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --gdb"
- ;;
- --ddd )
- if [ x$BINARY_DIST = x1 ] ; then
- $ECHO "Note: you will get more meaningful output on a source distribution compiled with debugging option when running tests with --ddd option"
- fi
- DO_DDD=1
- USE_RUNNING_SERVER=0
- EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --gdb"
- EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --gdb"
- ;;
- --valgrind | --valgrind-all)
- find_valgrind;
- VALGRIND=$FIND_VALGRIND
- EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --skip-safemalloc"
- EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --skip-safemalloc"
- SLEEP_TIME_AFTER_RESTART=10
- SLEEP_TIME_FOR_DELETE=60
- USE_RUNNING_SERVER=0
- if test "$1" = "--valgrind-all"
- then
- VALGRIND="$VALGRIND -v --show-reachable=yes"
- fi
- ;;
- --valgrind-options=*)
- TMP=`$ECHO "$1" | $SED -e "s;--valgrind-options=;;"`
- VALGRIND="$VALGRIND $TMP"
- ;;
- --skip-ndbcluster-slave | --skip-ndb-slave)
- USE_NDBCLUSTER_SLAVE=""
- EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --skip-ndbcluster"
- ;;
- --valgrind-mysqltest | --valgrind-mysqltest-all)
- find_valgrind;
- VALGRIND_MYSQLTEST=$FIND_VALGRIND
- if test "$1" = "--valgrind-mysqltest-all"
- then
- VALGRIND_MYSQLTEST="$VALGRIND_MYSQLTEST -v --show-reachable=yes"
- fi
- ;;
- --skip-ndbcluster | --skip-ndb)
- USE_NDBCLUSTER=""
- USE_NDBCLUSTER_SLAVE=""
- EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --skip-ndbcluster"
- EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --skip-ndbcluster"
- ;;
- --skip-master-binlog) MASTER_MYSQLDBINLOG=0 ;;
- --skip-slave-binlog) SLAVE_MYSQLDBINLOG=0 ;;
- --skip-*)
- EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT $1"
- EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT $1"
- ;;
- --strace-client )
- STRACE_CLIENT=1
- ;;
- --debug)
- EXTRA_MASTER_MYSQLD_TRACE=" \
- --debug=d:t:i:A,$MYSQL_TEST_DIR/var/log/master.trace"
- EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT \
- --debug=d:t:i:A,$MYSQL_TEST_DIR/var/log/slave.trace"
- EXTRA_MYSQL_TEST_OPT="$EXTRA_MYSQL_TEST_OPT \
- --debug=d:t:A,$MYSQL_TEST_DIR/var/log/mysqltest.trace"
- EXTRA_MYSQLCHECK_OPT="$EXTRA_MYSQLCHECK_OPT \
- --debug=d:t:A,$MYSQL_TEST_DIR/var/log/mysqlcheck.trace"
- EXTRA_MYSQLDUMP_OPT="$EXTRA_MYSQLDUMP_OPT \
- --debug=d:t:A,$MYSQL_TEST_DIR/var/log/mysqldump.trace"
- EXTRA_MYSQLSLAP_OPT="$EXTRA_MYSQLSLAP_OPT \
- --debug=d:t:A,$MYSQL_TEST_DIR/var/log/mysqlslap.trace"
- EXTRA_MYSQLSHOW_OPT="$EXTRA_MYSQLSHOW_OPT \
- --debug=d:t:A,$MYSQL_TEST_DIR/var/log/mysqlshow.trace"
- EXTRA_MYSQLBINLOG_OPT="$EXTRA_MYSQLBINLOG_OPT \
- --debug=d:t:A,$MYSQL_TEST_DIR/var/log/mysqlbinlog.trace"
- EXTRA_MYSQL_CLIENT_TEST_OPT="--debug=d:t:A,$MYSQL_TEST_DIR/var/log/mysql_client_test.trace"
- ;;
- --fast)
- FAST_START=1
- ;;
- --use-old-data)
- USE_OLD_DATA=1
- ;;
- --comment=*)
- TMP=`$ECHO "$1" | $SED -e "s;--comment=;;"`
- echo
- echo '############################################'
- echo "# $TMP"
- echo '############################################'
- ;;
- -- ) shift; break ;;
- --* ) $ECHO "Unrecognized option: $1"; exit 1 ;;
- * ) break ;;
- esac
- shift
-done
-
-if [ -z "$TEST_MODE" ] ; then
- TEST_MODE="default"
-else
- # Remove the leading space if any
- TEST_MODE=`echo $TEST_MODE | sed 's/^ *//'`
-fi
-
-#
-# Skip tests that doesn't work with shell version
-#
-SKIP_TEST="$SKIP_TEST bootstrap"
-
-#++
-# mysqld Environment Parameters
-#--
-
-MYRUN_DIR=$MYSQL_TEST_DIR/var/run
-
-MASTER_MYDDIR="$MYSQL_TEST_DIR/var/master-data"
-MASTER_MYSOCK="$MYSQL_TMP_DIR/master.sock"
-MASTER_MYSOCK1=$MYSQL_MYSOCK"1"
-MASTER_MYPID="$MYRUN_DIR/master.pid"
-MASTER_MYLOG="$MYSQL_TEST_DIR/var/log/master.log"
-MASTER_MYERR="$MYSQL_TEST_DIR/var/log/master.err"
-
-SLAVE_MYDDIR="$MYSQL_TEST_DIR/var/slave-data"
-SLAVE_MYSOCK="$MYSQL_TMP_DIR/slave.sock"
-SLAVE_MYPID="$MYRUN_DIR/slave.pid"
-SLAVE_MYLOG="$MYSQL_TEST_DIR/var/log/slave.log"
-SLAVE_MYERR="$MYSQL_TEST_DIR/var/log/slave.err"
-
-CURRENT_TEST="$MYSQL_TEST_DIR/var/log/current_test"
-SMALL_SERVER="--key_buffer_size=1M --sort_buffer=256K --max_heap_table_size=1M"
-
-export MASTER_MYHOST MASTER_MYPORT SLAVE_MYHOST SLAVE_MYPORT MYSQL_TCP_PORT MASTER_MYSOCK MASTER_MYSOCK1
-
-NDBCLUSTER_OPTS="--port=$NDBCLUSTER_PORT --data-dir=$MYSQL_TEST_DIR/var --ndb_mgm-extra-opts=$NDB_MGM_EXTRA_OPTS --ndb_mgmd-extra-opts=$NDB_MGMD_EXTRA_OPTS --ndbd-extra-opts=$NDBD_EXTRA_OPTS"
-NDBCLUSTER_OPTS_SLAVE="--port=$NDBCLUSTER_PORT_SLAVE --data-dir=$MYSQL_TEST_DIR/var"
-if [ -n "$USE_NDBCLUSTER_SLAVE" ] ; then
- USE_NDBCLUSTER_SLAVE="$USE_NDBCLUSTER_SLAVE --ndb-connectstring=localhost:$NDBCLUSTER_PORT_SLAVE --ndb-extra-logging"
-fi
-NDB_BACKUP_DIR=$MYSQL_TEST_DIR/var/ndbcluster-$NDBCLUSTER_PORT
-NDB_TOOLS_OUTPUT=$MYSQL_TEST_DIR/var/log/ndb_tools.log
-
-if [ x$SOURCE_DIST = x1 ] ; then
- MY_BASEDIR=$MYSQL_TEST_DIR
-else
- MY_BASEDIR=$BASEDIR
-fi
-
-# Create the directories
-
-# This should be fixed to be not be dependent on the contence of MYSQL_TMP_DIR
-# or MYRUN_DIR
-# (mkdir -p is not portable)
-[ -d $MYSQL_TEST_DIR/var ] || mkdir $MYSQL_TEST_DIR/var
-[ -d $MYSQL_TEST_DIR/var/tmp ] || mkdir $MYSQL_TEST_DIR/var/tmp
-[ -d $MYSQL_TEST_DIR/var/run ] || mkdir $MYSQL_TEST_DIR/var/run
-[ -d $MYSQL_TEST_DIR/var/log ] || mkdir $MYSQL_TEST_DIR/var/log
-
-# Use 'test', not '[' as the shell builtin might not have '-L
-if test ! -L "$MYSQL_TEST_DIR/var/std_data_ln" ; then
- ln -s $MYSQL_TEST_DIR/std_data/ $MYSQL_TEST_DIR/var/std_data_ln
-fi
-
-if test ${COLUMNS:-0} -lt 80 ; then COLUMNS=80 ; fi
-E=`$EXPR $COLUMNS - 8`
-DASH72=`$ECHO '-------------------------------------------------------'|$CUT -c 1-$E`
-
-# on source dist, we pick up freshly build executables
-# on binary, use what is installed
-if [ x$SOURCE_DIST = x1 ] ; then
- if [ "x$USE_EMBEDDED_SERVER" = "x1" ] ; then
- if [ -f "$BASEDIR/libmysqld/examples/mysqltest_embedded" ] ; then
- MYSQL_TEST="$BASEDIR/libmysqld/examples/mysqltest_embedded"
- else
- echo "Fatal error: Cannot find embedded server 'mysqltest_embedded'" 1>&2
- exit 1
- fi
- MYSQL_CLIENT_TEST="$BASEDIR/libmysqld/examples/mysql_client_test_embedded"
- else
- MYSQLD="$BASEDIR/sql/mysqld"
- if [ -n "$VALGRIND" ] ; then
- MYSQLD="$VALGRIND $MYSQLD"
- fi
- if [ -f "$BASEDIR/client/.libs/lt-mysqltest" ] ; then
- MYSQL_TEST="$BASEDIR/client/.libs/lt-mysqltest"
- elif [ -f "$BASEDIR/client/.libs/mysqltest" ] ; then
- MYSQL_TEST="$BASEDIR/client/.libs/mysqltest"
- else
- MYSQL_TEST="$BASEDIR/client/mysqltest"
- fi
- MYSQL_CLIENT_TEST="$BASEDIR/tests/mysql_client_test"
- fi
- if [ -f "$BASEDIR/client/.libs/mysqlcheck" ] ; then
- MYSQL_CHECK="$BASEDIR/client/.libs/mysqlcheck"
- else
- MYSQL_CHECK="$BASEDIR/client/mysqlcheck"
- fi
- if [ -f "$BASEDIR/client/.libs/mysqldump" ] ; then
- MYSQL_DUMP="$BASEDIR/client/.libs/mysqldump"
- else
- MYSQL_DUMP="$BASEDIR/client/mysqldump"
- fi
- if [ -f "$BASEDIR/client/.libs/mysqlslap" ] ; then
- MYSQL_SLAP="$BASEDIR/client/.libs/mysqlslap"
- else
- MYSQL_SLAP="$BASEDIR/client/mysqlslap"
- fi
- if [ -f "$BASEDIR/client/.libs/mysqlimport" ] ; then
- MYSQL_IMPORT="$BASEDIR/client/.libs/mysqlimport"
- else
- MYSQL_IMPORT="$BASEDIR/client/mysqlimport"
- fi
- if [ -f "$BASEDIR/client/.libs/mysqlshow" ] ; then
- MYSQL_SHOW="$BASEDIR/client/.libs/mysqlshow"
- else
- MYSQL_SHOW="$BASEDIR/client/mysqlshow"
- fi
- if [ -f "$BASEDIR/client/.libs/mysqlbinlog" ] ; then
- MYSQL_BINLOG="$BASEDIR/client/.libs/mysqlbinlog"
- else
- MYSQL_BINLOG="$BASEDIR/client/mysqlbinlog"
- fi
- if [ -n "$STRACE_CLIENT" ]; then
- MYSQL_TEST="strace -o $MYSQL_TEST_DIR/var/log/mysqltest.strace $MYSQL_TEST"
- fi
-
- CLIENT_BINDIR="$BASEDIR/client"
- MYSQLADMIN="$CLIENT_BINDIR/mysqladmin"
- WAIT_PID="$BASEDIR/extra/mysql_waitpid"
- MYSQL_MY_PRINT_DEFAULTS="$BASEDIR/extra/my_print_defaults"
- MYSQL="$CLIENT_BINDIR/mysql"
- LANGUAGE="$BASEDIR/sql/share/english/"
- CHARSETSDIR="$BASEDIR/sql/share/charsets"
- INSTALL_DB="./install_test_db"
- MYSQL_FIX_SYSTEM_TABLES="$BASEDIR/scripts/mysql_fix_privilege_tables"
- NDB_TOOLS_DIR="$BASEDIR/storage/ndb/tools"
- NDB_MGM="$BASEDIR/storage/ndb/src/mgmclient/ndb_mgm"
-
- if [ -n "$USE_PURIFY" ] ; then
- PSUP="$MYSQL_TEST_DIR/suppress.purify"
- PURIFYOPTIONS="-windows=no -log-file=%v.purifylog -append-logfile -add-suppression-files=$PSUP"
- if [ -f "${MYSQL_TEST}-purify" ] ; then
- MYSQL_TEST="${MYSQL_TEST}-purify"
- PLOG="$MYSQL_TEST.purifylog"
- if [ -f $PLOG ]; then
- mv $PLOG $PLOG.$$
- fi
- PURIFY_LOGS="$PLOG"
- fi
- if [ -f "${MYSQLD}-purify" ] ; then
- MYSQLD="${MYSQLD}-purify"
- PLOG="$MYSQLD.purifylog"
- if [ -f $PLOG ]; then
- mv $PLOG $PLOG.$$
- fi
- PURIFY_LOGS="$PURIFY_LOGS $PLOG"
- fi
- fi
-
-else
-
- # We have a binary installation. Note that this can be both from
- # unpacking a MySQL AB binary distribution (created using
- # "scripts/make_binary_distribution", and from a "make install".
- # Unfortunately the structure differs a bit, for a "make install"
- # currently all binaries are in "bin", for a MySQL AB packaging
- # some are in "tests".
-
- if test -x "$BASEDIR/libexec/mysqld"
- then
- MYSQLD="$VALGRIND $BASEDIR/libexec/mysqld"
- elif test -x "$BASEDIR/bin/mysqld"
- then
- MYSQLD="$VALGRIND $BASEDIR/bin/mysqld"
- elif test -x "$BASEDIR/sbin/mysqld"
- then
- MYSQLD="$VALGRIND $BASEDIR/sbin/mysqld"
- else
- $ECHO "Fatal error: Cannot find program mysqld in $BASEDIR/{libexec,bin,sbin}" 1>&2
- exit 1
- fi
- CLIENT_BINDIR="$BASEDIR/bin"
- if test -d "$BASEDIR/tests"
- then
- TESTS_BINDIR="$BASEDIR/tests"
- else
- TESTS_BINDIR="$BASEDIR/bin"
- fi
- MYSQL_TEST="$CLIENT_BINDIR/mysqltest"
- MYSQL_CHECK="$CLIENT_BINDIR/mysqlcheck"
- MYSQL_SLAP="$CLIENT_BINDIR/mysqlslap"
- MYSQL_SHOW="$CLIENT_BINDIR/mysqlshow"
- MYSQL_IMPORT="$CLIENT_BINDIR/mysqlimport"
- MYSQL_BINLOG="$CLIENT_BINDIR/mysqlbinlog"
- MYSQLADMIN="$CLIENT_BINDIR/mysqladmin"
- WAIT_PID="$CLIENT_BINDIR/mysql_waitpid"
- MYSQL_MY_PRINT_DEFAULTS="$CLIENT_BINDIR/my_print_defaults"
- MYSQL="$CLIENT_BINDIR/mysql"
- INSTALL_DB="./install_test_db --bin"
- MYSQL_FIX_SYSTEM_TABLES="$CLIENT_BINDIR/mysql_fix_privilege_tables"
- NDB_TOOLS_DIR="$CLIENT_BINDIR"
- NDB_MGM="$CLIENT_BINDIR/ndb_mgm"
- if test -d "$BASEDIR/share/mysql/english"
- then
- LANGUAGE="$BASEDIR/share/mysql/english/"
- CHARSETSDIR="$BASEDIR/share/mysql/charsets"
- else
- LANGUAGE="$BASEDIR/share/english/"
- CHARSETSDIR="$BASEDIR/share/charsets"
- fi
- if [ "x$USE_EMBEDDED_SERVER" = "x1" ] ; then
- if [ -f "$CLIENT_BINDIR/mysqltest_embedded" ] ; then
- MYSQL_TEST="$CLIENT_BINDIR/mysqltest_embedded"
- else
- echo "Fatal error: Cannot find embedded server 'mysqltest_embedded'" 1>&2
- exit 1
- fi
- if [ -d "$BASEDIR/tests/mysql_client_test_embedded" ] ; then
- MYSQL_CLIENT_TEST="$TESTS_BINDIR/mysql_client_test_embedded"
- else
- MYSQL_CLIENT_TEST="$CLIENT_BINDIR/mysql_client_test_embedded"
- fi
- else
- MYSQL_TEST="$CLIENT_BINDIR/mysqltest"
- MYSQL_CLIENT_TEST="$CLIENT_BINDIR/mysql_client_test"
- fi
- if [ -f "$BASEDIR/client/.libs/mysqldump" ] ; then
- MYSQL_DUMP="$BASEDIR/client/.libs/mysqldump"
- elif [ -f "$BASEDIR/client/mysqldump" ] ; then
- MYSQL_DUMP="$BASEDIR/client/mysqldump"
- else
- MYSQL_DUMP="$BASEDIR/bin/mysqldump"
- fi
-fi
-
-if [ -z "$MASTER_MYSQLD" ]
-then
-MASTER_MYSQLD=$MYSQLD
-fi
-
-if [ -z "$SLAVE_MYSQLD" ]
-then
-SLAVE_MYSQLD=$MYSQLD
-fi
-
-# If we should run all tests cases, we will use a local server for that
-
-if [ -z "$1" -a -z "$DO_STRESS" ]
-then
- USE_RUNNING_SERVER=0
-fi
-if [ $USE_RUNNING_SERVER -eq 1 ]
-then
- MASTER_MYSOCK=$LOCAL_SOCKET;
- DBUSER=${DBUSER:-test}
-else
- DBUSER=${DBUSER:-root} # We want to do FLUSH xxx commands
-fi
-
-if [ -w / ]
-then
- # We are running as root; We need to add the --root argument
- EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --user=root"
- EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --user=root"
-fi
-
-MYSQL_CLIENT_TEST="$MYSQL_CLIENT_TEST --no-defaults --testcase --user=root --socket=$MASTER_MYSOCK --port=$MYSQL_TCP_PORT --silent $EXTRA_MYSQL_CLIENT_TEST_OPT"
-# Need to pass additional arguments to MYSQL_CLIENT_TEST for embedded server
-# -A marks each argument for passing to the function which initializes the
-# embedded library
-if [ "x$USE_EMBEDDED_SERVER" = "x1" ]; then
- MYSQL_CLIENT_TEST="$MYSQL_CLIENT_TEST -A --language=$LANGUAGE -A --datadir=$SLAVE_MYDDIR -A --character-sets-dir=$CHARSETSDIR"
-fi
-# Save path and name of mysqldump
-MYSQL_DUMP_DIR="$MYSQL_DUMP"
-export MYSQL_DUMP_DIR
-MYSQL_CHECK="$MYSQL_CHECK --no-defaults --debug-info -uroot --socket=$MASTER_MYSOCK --password=$DBPASSWD $EXTRA_MYSQLCHECK_OPT"
-MYSQL_DUMP="$MYSQL_DUMP --no-defaults --debug-info -uroot --socket=$MASTER_MYSOCK --password=$DBPASSWD $EXTRA_MYSQLDUMP_OPT"
-MYSQL_SLAP="$MYSQL_SLAP -uroot --socket=$MASTER_MYSOCK --password=$DBPASSWD $EXTRA_MYSQLSLAP_OPT"
-MYSQL_DUMP_SLAVE="$MYSQL_DUMP_DIR --no-defaults -uroot --socket=$SLAVE_MYSOCK --password=$DBPASSWD $EXTRA_MYSQLDUMP_OPT"
-MYSQL_SHOW="$MYSQL_SHOW --no-defaults --debug-info -uroot --socket=$MASTER_MYSOCK --password=$DBPASSWD $EXTRA_MYSQLSHOW_OPT"
-MYSQL_BINLOG="$MYSQL_BINLOG --no-defaults --debug-info --local-load=$MYSQL_TMP_DIR --character-sets-dir=$CHARSETSDIR $EXTRA_MYSQLBINLOG_OPT"
-MYSQL_IMPORT="$MYSQL_IMPORT --no-defaults --debug-info -uroot --socket=$MASTER_MYSOCK --password=$DBPASSWD $EXTRA_MYSQLDUMP_OPT"
-MYSQL_FIX_SYSTEM_TABLES="$MYSQL_FIX_SYSTEM_TABLES --no-defaults --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK --user=root --password=$DBPASSWD --basedir=$BASEDIR --bindir=$CLIENT_BINDIR --verbose"
-MYSQL="$MYSQL --no-defaults --debug-info --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK --user=root --password=$DBPASSWD"
-export MYSQL MYSQL_CHECK MYSQL_DUMP MYSQL_DUMP_SLAVE MYSQL_SHOW MYSQL_BINLOG MYSQL_FIX_SYSTEM_TABLES MYSQL_IMPORT
-export CLIENT_BINDIR MYSQL_CLIENT_TEST CHARSETSDIR MYSQL_MY_PRINT_DEFAULTS
-export MYSQL_SLAP
-export NDB_TOOLS_DIR
-export NDB_MGM
-export NDB_BACKUP_DIR
-export NDB_TOOLS_OUTPUT
-export PURIFYOPTIONS
-NDB_STATUS_OK=1
-export NDB_STATUS_OK
-NDB_SLAVE_STATUS_OK=1
-export NDB_SLAVE_STATUS_OK
-export NDB_EXTRA_TEST NDBCLUSTER_PORT NDBCLUSTER_PORT_SLAVE
-
-MYSQL_TEST_ARGS="--no-defaults --socket=$MASTER_MYSOCK --database=$DB \
- --user=$DBUSER --password=$DBPASSWD --silent -v --skip-safemalloc \
- --tmpdir=$MYSQL_TMP_DIR --port=$MASTER_MYPORT $MYSQL_TEST_SSL_OPTS"
-if [ x$USE_TIMER = x1 ] ; then
- MYSQL_TEST_ARGS="$MYSQL_TEST_ARGS --timer-file=$MY_LOG_DIR/timer"
-fi
-MYSQL_TEST_BIN=$MYSQL_TEST
-MYSQL_TEST="$MYSQL_TEST $MYSQL_TEST_ARGS"
-
-# Export MYSQL_TEST variable for use from .test files
-export MYSQL_TEST
-
-GDB_CLIENT_INIT=$MYSQL_TMP_DIR/gdbinit.client
-GDB_MASTER_INIT=$MYSQL_TMP_DIR/gdbinit.master
-GDB_SLAVE_INIT=$MYSQL_TMP_DIR/gdbinit.slave
-GCOV_MSG=$MYSQL_TMP_DIR/mysqld-gcov.out
-GCOV_ERR=$MYSQL_TMP_DIR/mysqld-gcov.err
-GPROF_DIR=$MYSQL_TMP_DIR/gprof
-GPROF_MASTER=$GPROF_DIR/master.gprof
-GPROF_SLAVE=$GPROF_DIR/slave.gprof
-TIMEFILE="$MYSQL_TEST_DIR/var/log/mysqltest-time"
-MYSQLTEST_LOG="$MYSQL_TEST_DIR/var/log/mysqltest.log"
-if [ -n "$DO_CLIENT_GDB" -o -n "$DO_GDB" ] ; then
- XTERM=`which xterm`
-fi
-
-export MYSQL MYSQL_CHECK MYSQL_DUMP MYSQL_SHOW MYSQL_BINLOG MYSQL_FIX_SYSTEM_TABLES CLIENT_BINDIR MASTER_MYSOCK
-
-#++
-# Function Definitions
-#--
-
-prompt_user ()
-{
- $ECHO $1
- read unused
-}
-
-# We can't use diff -u or diff -a as these are not portable
-
-show_failed_diff ()
-{
- reject_file=r/$1.reject
- result_file=r/$1.result
- eval_file=r/$1.eval
-
- if [ -f $eval_file ]
- then
- result_file=$eval_file
- fi
-
- if [ -x "$DIFF" ] && [ -f $reject_file ]
- then
- echo "Below are the diffs between actual and expected results:"
- echo "-------------------------------------------------------"
- $DIFF -c $result_file $reject_file
- echo "-------------------------------------------------------"
- echo "Please follow the instructions outlined at"
- echo "http://forge.mysql.com/wiki/MySQL_Internals_Porting#Debugging_a_MySQL_Server"
- echo "to find the reason to this problem and how to report this."
- echo ""
- fi
-}
-
-do_gdb_test ()
-{
- mysql_test_args="$MYSQL_TEST_ARGS $1"
- $ECHO "set args $mysql_test_args < $2" > $GDB_CLIENT_INIT
- echo "Set breakpoints ( if needed) and type 'run' in gdb window"
- #this xterm should not be backgrounded
- $XTERM -title "Client" -e gdb -x $GDB_CLIENT_INIT $MYSQL_TEST_BIN
-}
-
-error () {
- $ECHO "Error: $1"
- exit 1
-}
-
-error_is () {
- $ECHO "Errors are (from $TIMEFILE) :"
- $CAT < $TIMEFILE
- $ECHO "(the last lines may be the most important ones)"
-}
-
-prefix_to_8() {
- $ECHO " $1" | $SED -e 's:.*\(........\)$:\1:'
-}
-
-pass_inc () {
- TOT_PASS=`$EXPR $TOT_PASS + 1`
-}
-
-fail_inc () {
- TOT_FAIL=`$EXPR $TOT_FAIL + 1`
-}
-
-skip_inc () {
- TOT_SKIP=`$EXPR $TOT_SKIP + 1`
-}
-
-total_inc () {
- TOT_TEST=`$EXPR $TOT_TEST + 1`
-}
-
-
-skip_test() {
- USERT=" ...."
- SYST=" ...."
- REALT=" ...."
- pname=`$ECHO "$1 "|$CUT -c 1-24`
- RES="$pname"
- skip_inc
- $ECHO "$RES$RES_SPACE [ skipped ]"
-}
-
-
-disable_test() {
- USERT=" ...."
- SYST=" ...."
- REALT=" ...."
- pname=`$ECHO "$1 "|$CUT -c 1-24`
- RES="$pname"
- skip_inc
- $ECHO "$RES$RES_SPACE [ disabled ] $2"
-}
-
-
-report_current_test () {
- tname=$1
- echo "CURRENT_TEST: $tname" >> $MASTER_MYERR
- eval "master1_running=\$MASTER1_RUNNING"
- if [ x$master1_running = x1 ] ; then
- echo "CURRENT_TEST: $tname" >> $MASTER_MYERR"1"
- fi
- if [ -n "$PURIFY_LOGS" ] ; then
- for log in $PURIFY_LOGS
- do
- echo "CURRENT_TEST: $tname" >> $log
- done
- fi
-}
-
-
-report_stats () {
- if [ $TOT_FAIL = 0 ]; then
- $ECHO "All $TOT_TEST tests were successful."
- else
- xten=`$EXPR $TOT_PASS \* 10000`
- raw=`$EXPR $xten / $TOT_TEST`
- raw=`$PRINTF %.4d $raw`
- whole=`$PRINTF %.2s $raw`
- xwhole=`$EXPR $whole \* 100`
- deci=`$EXPR $raw - $xwhole`
- $ECHO "Failed ${TOT_FAIL}/${TOT_TEST} tests, ${whole}.${deci}% were successful."
- $ECHO ""
- $ECHO "The log files in $MY_LOG_DIR may give you some hint"
- $ECHO "of what went wrong."
- $ECHO "If you want to report this error, please read first the documentation at"
- $ECHO "http://dev.mysql.com/doc/mysql/en/mysql-test-suite.html"
- fi
-
- if [ $USE_RUNNING_SERVER -eq 0 ]
- then
-
- # Report if there was any fatal warnings/errors in the log files
- #
- $RM -f $MY_LOG_DIR/warnings $MY_LOG_DIR/warnings.tmp
- # Remove some non fatal warnings from the log files
- $SED -e 's!Warning: Table:.* on delete!!g' -e 's!Warning: Setting lower_case_table_names=2!!g' -e 's!Warning: One can only use the --user.*root!!g' -e 's|InnoDB: Warning: we did not need to do crash recovery||g' \
- $MY_LOG_DIR/*.err \
- | $SED -e 's!Warning: Table:.* on rename!!g' \
- > $MY_LOG_DIR/warnings.tmp
-
- # Find errors
- for i in "^Warning:" "^Error:" "^==.* at 0x" "InnoDB: Warning" "missing DBUG_RETURN" "mysqld: Warning" "Attempting backtrace" "Assertion .* failed"
- do
- if $GREP "$i" $MY_LOG_DIR/warnings.tmp >> $MY_LOG_DIR/warnings
- then
- GOT_WARNINGS=1
- fi
- done
- $RM -f $MY_LOG_DIR/warnings.tmp
- if [ $GOT_WARNINGS = "1" ]
- then
- echo "WARNING: Got errors/warnings while running tests. Please examine"
- echo "$MY_LOG_DIR/warnings for details."
- fi
-
- fi # USE_RUNNING_SERVER
-
- # Check valgrind errors from mysqltest
- if [ ! -z "$VALGRIND_MYSQLTEST" ]
- then
- if $GREP "ERROR SUMMARY" $MYSQLTEST_LOG | $GREP -v "0 errors" > /dev/null
- then
- $ECHO "Valgrind detected errors!"
- $GREP "ERROR SUMMARY" $MYSQLTEST_LOG | $GREP -v "0 errors"
- $ECHO "See $MYSQLTEST_LOG"
- fi
- fi
-}
-
-mysql_install_db () {
- $ECHO "Removing Stale Files"
- if [ -z "$USE_OLD_DATA" ]; then
- $RM -rf $MASTER_MYDDIR $MASTER_MYDDIR"1"
- $ECHO "Installing Master Databases"
- $INSTALL_DB
- if [ $? != 0 ]; then
- error "Could not install master test DBs"
- exit 1
- fi
- fi
- if [ ! -z "$USE_NDBCLUSTER" ]
- then
- $ECHO "Installing Master Databases 1"
-# $INSTALL_DB -1
- $RM -rf var/master-data1
- mkdir var/master-data1
- cp -r var/master-data/* var/master-data1
- if [ $? != 0 ]; then
- error "Could not install master test DBs 1"
- exit 1
- fi
- fi
- $ECHO "Installing Slave Databases"
- $RM -rf $SLAVE_MYDDIR $MY_LOG_DIR/*
-# $INSTALL_DB -slave
- mkdir var/slave-data
- cp -r var/master-data/* var/slave-data
- if [ $? != 0 ]; then
- error "Could not install slave test DBs"
- exit 1
- fi
-
- for slave_num in 1 2 ;
- do
- $RM -rf var/slave$slave_num-data
- mkdir -p var/slave$slave_num-data/mysql
- mkdir -p var/slave$slave_num-data/test
- cp var/slave-data/mysql/* var/slave$slave_num-data/mysql
- done
- return 0
-}
-
-gprof_prepare ()
-{
- $RM -rf $GPROF_DIR
- mkdir -p $GPROF_DIR
-}
-
-gprof_collect ()
-{
- if [ -f $MASTER_MYDDIR/gmon.out ]; then
- gprof $MASTER_MYSQLD $MASTER_MYDDIR/gmon.out > $GPROF_MASTER
- echo "Master execution profile has been saved in $GPROF_MASTER"
- fi
- if [ -f $SLAVE_MYDDIR/gmon.out ]; then
- gprof $SLAVE_MYSQLD $SLAVE_MYDDIR/gmon.out > $GPROF_SLAVE
- echo "Slave execution profile has been saved in $GPROF_SLAVE"
- fi
-}
-
-gcov_prepare () {
- $FIND $BASEDIR -name \*.gcov \
- -or -name \*.da | $XARGS $RM
-}
-
-gcov_collect () {
- $ECHO "Collecting source coverage info..."
- [ -f $GCOV_MSG ] && $RM $GCOV_MSG
- [ -f $GCOV_ERR ] && $RM $GCOV_ERR
- for d in $MYSQLD_SRC_DIRS; do
- cd $BASEDIR/$d
- for f in *.h *.cc *.c; do
- $GCOV $f 2>>$GCOV_ERR >>$GCOV_MSG
- done
- cd $MYSQL_TEST_DIR
- done
-
- $ECHO "gcov info in $GCOV_MSG, errors in $GCOV_ERR"
-}
-
-abort_if_failed()
-{
- if [ ! $? = 0 ] ; then
- echo $1
- exit 1
- fi
-}
-
-launch_in_background()
-{
- shift
- echo $@ | /bin/sh >> $CUR_MYERR 2>&1 &
- sleep 2 #hack
- return
-}
-
-shutdown_mysqld()
-{
- pid=$1
- ident=$2
- # Shutdown time must be high as slave may be in reconnect
- $MYSQLADMIN --no-defaults -uroot --socket=$MYSQL_TMP_DIR/$ident.sock$3 --connect_timeout=5 --shutdown_timeout=70 shutdown >> $MYSQL_MANAGER_LOG 2>&1
- res=$?
- # Some systems require an extra connect
- $MYSQLADMIN --no-defaults -uroot --socket=$MYSQL_TMP_DIR/$ident.sock$3 --connect_timeout=1 ping >> $MYSQL_MANAGER_LOG 2>&1
- if test $res = 0
- then
- wait_for_pid $pid
- fi
- return $res
-}
-
-start_ndbcluster()
-{
- if [ ! -n "$USE_NDBCLUSTER" ] ;
- then
- USING_NDBCLUSTER=0
- USE_NDBCLUSTER_OPT=
- fi
-
- if [ x$USING_NDBCLUSTER = x1 -a -z "$USE_NDBCLUSTER_OPT" ]
- then
- rm -f $NDB_TOOLS_OUTPUT
- if [ -z "$USE_RUNNING_NDBCLUSTER" ]
- then
- if [ "$DO_BENCH" != 1 -a -z "$NDBCLUSTER_EXTRA_OPTS" ]
- then
- NDBCLUSTER_EXTRA_OPTS="--small"
- fi
- OPTS="$NDBCLUSTER_OPTS $NDBCLUSTER_EXTRA_OPTS --character-sets-dir=$CHARSETSDIR --verbose=$NDB_VERBOSE --initial --relative-config-data-dir --core"
- if [ "x$NDB_VERBOSE" != "x0" ] ; then
- echo "Starting master ndbcluster " $OPTS
- fi
- ./ndb/ndbcluster $OPTS || NDB_STATUS_OK=0
- if [ x$NDB_STATUS_OK != x1 ] ; then
- if [ x$FORCE != x1 ] ; then
- exit 1
- fi
- USING_NDBCLUSTER=0
- USE_NDBCLUSTER_OPT=
- return
- fi
-
- NDB_CONNECTSTRING="host=localhost:$NDBCLUSTER_PORT"
- else
- NDB_CONNECTSTRING="$USE_RUNNING_NDBCLUSTER"
- echo "Using ndbcluster at $NDB_CONNECTSTRING"
- fi
- USE_NDBCLUSTER_OPT="$USE_NDBCLUSTER --ndb-connectstring=\"$NDB_CONNECTSTRING\" --ndb-extra-logging"
- export NDB_CONNECTSTRING
- fi
-}
-
-rm_ndbcluster_tables()
-{
- $RM -f $1/mysql/apply_status*
- $RM -f $1/mysql/schema*
-}
-
-stop_ndbcluster()
-{
- if [ -n "$USE_NDBCLUSTER_OPT" ]
- then
- USE_NDBCLUSTER_OPT=
- if [ -z "$USE_RUNNING_NDBCLUSTER" ]
- then
- # Kill any running ndbcluster stuff
- $ECHO "Stopping master cluster"
- ./ndb/ndbcluster $NDBCLUSTER_OPTS --stop
- # remove ndb table the hard way as not to upset later tests
- rm_ndbcluster_tables $MASTER_MYDDIR
- rm_ndbcluster_tables $MASTER_MYDDIR"1"
- fi
- fi
-}
-
-# The embedded server needs the cleanup so we do some of the start work
-# but stop before actually running mysqld or anything.
-
-start_master()
-{
- eval "this_master_running=\$MASTER$1_RUNNING"
- if [ x$this_master_running = x1 ] || [ x$LOCAL_MASTER = x1 ] ; then
- return
- fi
- # Remove stale binary logs except for 2 tests which need them
- if [ "$tname" != "rpl_crash_binlog_ib_1b" ] && [ "$tname" != "rpl_crash_binlog_ib_2b" ] && [ "$tname" != "rpl_crash_binlog_ib_3b" ]
- then
- $RM -f $MYSQL_TEST_DIR/var/log/master-bin$1.*
- fi
-
- # Remove old master.info and relay-log.info files
- $RM -f $MYSQL_TEST_DIR/var/master-data$1/master.info $MYSQL_TEST_DIR/var/master-data$1/relay-log.info
-
- #run master initialization shell script if one exists
-
- if [ -f "$master_init_script" ] ;
- then
- /bin/sh $master_init_script
- fi
- cd $BASEDIR # for gcov
- if [ -n "$1" ] ; then
- id=`$EXPR $1 + 101`;
- this_master_myport=`$EXPR $MASTER_MYPORT + $1`
- NOT_FIRST_MASTER_EXTRA_OPTS="--skip-innodb"
- eval "MASTER_MYPORT$1=$this_master_myport"
- export MASTER_MYPORT$1
- else
- id=1;
- this_master_myport=$MASTER_MYPORT
- NOT_FIRST_MASTER_EXTRA_OPTS=""
- fi
- if [ -n "$EXTRA_MASTER_MYSQLD_TRACE" ]
- then
- CURR_MASTER_MYSQLD_TRACE="$EXTRA_MASTER_MYSQLD_TRACE$1"
- fi
- if [ x$MASTER_MYSQLDBINLOG = x1 ]
- then
- MASTER_MYSQLD_BINLOG_OPT="--log-bin=$MYSQL_TEST_DIR/var/log/master-bin$1"
- fi
- if [ -z "$DO_BENCH" -a -z "$DO_STRESS" ]
- then
- master_args="--no-defaults \
- --server-id=$id \
- --basedir=$MY_BASEDIR \
- --port=$this_master_myport \
- --port-open-timeout=380 \
- --local-infile \
- --exit-info=256 \
- --core \
- $USE_NDBCLUSTER_OPT \
- --datadir=$MASTER_MYDDIR$1 \
- --pid-file=$MASTER_MYPID$1 \
- --socket=$MASTER_MYSOCK$1 \
- --log=$MASTER_MYLOG$1 \
- --character-sets-dir=$CHARSETSDIR \
- --default-character-set=$CHARACTER_SET \
- --tmpdir=$MYSQL_TMP_DIR \
- --language=$LANGUAGE \
- --innodb_data_file_path=ibdata1:128M:autoextend \
- --open-files-limit=1024 \
- --log-bin-trust-function-creators \
- $MASTER_40_ARGS \
- $SMALL_SERVER \
- $MASTER_MYSQLD_BINLOG_OPT \
- $EXTRA_MASTER_MYSQLD_OPT $EXTRA_MASTER_OPT \
- $NOT_FIRST_MASTER_EXTRA_OPTS $CURR_MASTER_MYSQLD_TRACE"
- else
- master_args="--no-defaults \
- --server-id=$id --rpl-recovery-rank=1 \
- --basedir=$MY_BASEDIR --init-rpl-role=master \
- --port=$this_master_myport \
- --port-open-timeout=380 \
- --local-infile \
- --datadir=$MASTER_MYDDIR$1 \
- --pid-file=$MASTER_MYPID$1 \
- --socket=$MASTER_MYSOCK$1 \
- --character-sets-dir=$CHARSETSDIR \
- --default-character-set=$CHARACTER_SET \
- --core \
- $USE_NDBCLUSTER_OPT \
- --tmpdir=$MYSQL_TMP_DIR \
- --language=$LANGUAGE \
- --innodb_data_file_path=ibdata1:128M:autoextend \
- --log-bin-trust-function-creators \
- $MASTER_40_ARGS \
- $SMALL_SERVER \
- $MASTER_MYSQLD_BINLOG_OPT \
- $EXTRA_MASTER_MYSQLD_OPT $EXTRA_MASTER_OPT \
- $NOT_FIRST_MASTER_EXTRA_OPTS"
- fi
-
- CUR_MYERR=$MASTER_MYERR$1
- CUR_MYSOCK=$MASTER_MYSOCK$1
-
- # For embedded server we collect the server flags and return
- if [ "x$USE_EMBEDDED_SERVER" = "x1" ] ; then
- # Add a -A to each argument to pass it to embedded server
- EMBEDDED_SERVER_OPTS=""
- for opt in $master_args
- do
- EMBEDDED_SERVER_OPTS="$EMBEDDED_SERVER_OPTS -A $opt"
- done
- EXTRA_MYSQL_TEST_OPT="$EMBEDDED_SERVER_OPTS"
- return
- fi
-
- if [ x$DO_DDD = x1 ]
- then
- $ECHO "set args $master_args" > $GDB_MASTER_INIT$1
- launch_in_background master ddd -display $DISPLAY --debugger \
- "gdb -x $GDB_MASTER_INIT$1" $MASTER_MYSQLD
- elif [ x$DO_GDB = x1 ]
- then
- if [ x$MANUAL_GDB = x1 ]
- then
- $ECHO "set args $master_args" > $GDB_MASTER_INIT$1
- $ECHO "To start gdb for the master , type in another window:"
- $ECHO "cd $MYSQL_TEST_DIR ; gdb -x $GDB_MASTER_INIT$1 $MASTER_MYSQLD"
- wait_for_master=1500
- else
- ( $ECHO set args $master_args;
- if [ $USE_MANAGER = 0 ] ; then
- cat <<EOF
-b mysql_parse
-commands 1
-disa 1
-end
-r
-EOF
- fi ) > $GDB_MASTER_INIT$1
- launch_in_background master $XTERM -display $DISPLAY \
- -title "Master" -e gdb -x $GDB_MASTER_INIT$1 $MASTER_MYSQLD
- fi
- else
- launch_in_background master $MASTER_MYSQLD $master_args
- fi
- sleep_until_file_created $MASTER_MYPID$1 $wait_for_master
- wait_for_master=$SLEEP_TIME_FOR_SECOND_MASTER
- eval "MASTER$1_RUNNING=1"
-}
-
-start_slave()
-{
- [ x$SKIP_SLAVE = x1 ] && return
- eval "this_slave_running=\$SLAVE$1_RUNNING"
- [ x$this_slave_running = 1 ] && return
-
- # When testing fail-safe replication, we will have more than one slave
- # in this case, we start secondary slaves with an argument
- slave_ident="slave$1"
- if [ -n "$1" ] ;
- then
- slave_server_id=`$EXPR 2 + $1`
- slave_rpl_rank=$slave_server_id
- slave_port=`expr $SLAVE_MYPORT + $1`
- slave_log="$SLAVE_MYLOG.$1"
- slave_err="$SLAVE_MYERR.$1"
- slave_datadir="$SLAVE_MYDDIR/../$slave_ident-data/"
- slave_pid="$MYRUN_DIR/mysqld-$slave_ident.pid"
- slave_sock="$SLAVE_MYSOCK-$1"
- else
- slave_server_id=2
- slave_rpl_rank=2
- slave_port=$SLAVE_MYPORT
- slave_log=$SLAVE_MYLOG
- slave_err=$SLAVE_MYERR
- slave_datadir=$SLAVE_MYDDIR
- slave_pid=$SLAVE_MYPID
- slave_sock="$SLAVE_MYSOCK"
- fi
-
- #
- if [ x$USING_NDBCLUSTER = x1 -a -n "$USE_NDBCLUSTER_SLAVE" ] ; then
- if [ $slave_server_id -eq 2 ] ; then
- savedir=`pwd`
- cd $MYSQL_TEST_DIR
- if [ "$DO_BENCH" != 1 -a -z "$NDBCLUSTER_EXTRA_OPTS" ]
- then
- NDBCLUSTER_EXTRA_OPTS="--small"
- fi
-
- OPTS="$NDBCLUSTER_OPTS_SLAVE --initial $NDBCLUSTER_EXTRA_OPTS --ndbd-nodes=1 --verbose=$NDB_VERBOSE --relative-config-data-dir --core"
- if [ "x$NDB_VERBOSE" != "x0" ] ; then
- echo "Starting slave ndbcluster " $OPTS
- fi
- ./ndb/ndbcluster $OPTS \
- || NDB_SLAVE_STATUS_OK=0
- # > /dev/null 2>&1 || NDB_SLAVE_STATUS_OK=0
- cd $savedir
- if [ x$NDB_SLAVE_STATUS_OK != x1 ] ; then
- if [ x$FORCE != x1 ] ; then
- exit 1
- fi
- USE_NDBCLUSTER_SLAVE_OPT=
- USE_NDBCLUSTER_SLAVE=
- fi
- USE_NDBCLUSTER_SLAVE_OPT=$USE_NDBCLUSTER_SLAVE
- fi
- else
- USE_NDBCLUSTER_SLAVE_OPT=
- fi
-
- # Remove stale binary logs and old master.info files
- # except for too tests which need them
- if [ "$tname" != "rpl_crash_binlog_ib_1b" ] && [ "$tname" != "rpl_crash_binlog_ib_2b" ] && [ "$tname" != "rpl_crash_binlog_ib_3b" ]
- then
- $RM -f $MYSQL_TEST_DIR/var/log/$slave_ident-*bin.*
- $RM -f $slave_datadir/master.info $slave_datadir/relay-log.info
- fi
-
- #run slave initialization shell script if one exists
- if [ -f "$slave_init_script" ] ;
- then
- /bin/sh $slave_init_script
- fi
-
- if [ -z "$SLAVE_MASTER_INFO" ] ; then
- master_info="--master-user=root \
- --master-connect-retry=1 \
- --master-host=127.0.0.1 \
- --master-password="" \
- --master-port=$MASTER_MYPORT \
- --server-id=$slave_server_id --rpl-recovery-rank=$slave_rpl_rank"
- else
- master_info=$SLAVE_MASTER_INFO
- fi
-
- if [ x$SLAVE_MYSQLDBINLOG = x1 ]
- then
- SLAVE_MYSQLD_BINLOG_OPT="--log-bin=$MYSQL_TEST_DIR/var/log/$slave_ident-bin --log-slave-updates"
- fi
-
- $RM -f $slave_datadir/log.*
- slave_args="--no-defaults $master_info \
- --exit-info=256 \
- $SLAVE_MYSQLDBINLOG_OPT \
- --relay-log=$MYSQL_TEST_DIR/var/log/$slave_ident-relay-bin \
- --log=$slave_log \
- --basedir=$MY_BASEDIR \
- --datadir=$slave_datadir \
- --pid-file=$slave_pid \
- --port=$slave_port \
- --port-open-timeout=380 \
- --socket=$slave_sock \
- --character-sets-dir=$CHARSETSDIR \
- --default-character-set=$CHARACTER_SET \
- --core --init-rpl-role=slave \
- --tmpdir=$MYSQL_TMP_DIR \
- --language=$LANGUAGE \
- --skip-innodb --skip-ndbcluster --skip-slave-start \
- --slave-load-tmpdir=$SLAVE_LOAD_TMPDIR \
- --report-host=127.0.0.1 --report-user=root \
- --report-port=$slave_port \
- --master-retry-count=10 \
- -O slave_net_timeout=10 \
- --log-bin-trust-function-creators \
- $SMALL_SERVER \
- $SLAVE_MYSQLD_BINLOG_OPT \
- $EXTRA_SLAVE_MYSQLD_OPT $EXTRA_SLAVE_OPT \
- $USE_NDBCLUSTER_SLAVE_OPT"
- CUR_MYERR=$slave_err
- CUR_MYSOCK=$slave_sock
-
- if [ x$DO_DDD = x1 ]
- then
- $ECHO "set args $slave_args" > $GDB_SLAVE_INIT
- launch_in_background $slave_ident ddd -display $DISPLAY --debugger \
- "gdb -x $GDB_SLAVE_INIT" $SLAVE_MYSQLD
- elif [ x$DO_GDB = x1 ]
- then
- if [ x$MANUAL_GDB = x1 ]
- then
- $ECHO "set args $slave_args" > $GDB_SLAVE_INIT
- echo "To start gdb for the slave, type in another window:"
- echo "cd $MYSQL_TEST_DIR ; gdb -x $GDB_SLAVE_INIT $SLAVE_MYSQLD"
- wait_for_slave=1500
- else
- ( $ECHO set args $slave_args;
- if [ $USE_MANAGER = 0 ] ; then
- cat <<EOF
-b mysql_parse
-commands 1
-disa 1
-end
-r
-EOF
- fi ) > $GDB_SLAVE_INIT
- launch_in_background $slave_ident $XTERM -display $DISPLAY -title "Slave" -e \
- gdb -x $GDB_SLAVE_INIT $SLAVE_MYSQLD
- fi
- else
- launch_in_background $slave_ident $SLAVE_MYSQLD $slave_args
- fi
- eval "SLAVE$1_RUNNING=1"
- sleep_until_file_created $slave_pid $wait_for_slave
- wait_for_slave=$SLEEP_TIME_FOR_SECOND_SLAVE
-}
-
-mysql_start ()
-{
-# We should not start the daemon here as we don't know the arguments
-# for the test. Better to let the test start the daemon
-
-# $ECHO "Starting MySQL daemon"
-# start_master
-# start_slave
- cd $MYSQL_TEST_DIR
- return 1
-}
-
-stop_slave ()
-{
- eval "this_slave_running=\$SLAVE$1_RUNNING"
- slave_ident="slave$1"
- if [ -n "$1" ] ;
- then
- slave_pid="$MYRUN_DIR/mysqld-$slave_ident.pid"
- else
- slave_pid=$SLAVE_MYPID
- fi
- if [ x$this_slave_running = x1 ]
- then
- pid=`$CAT $slave_pid`
- shutdown_mysqld $pid $slave_ident
- if [ $? != 0 ] && [ -f $slave_pid ]
- then # try harder!
- $ECHO "slave not cooperating with mysqladmin, will try manual kill"
- kill $pid
- sleep_until_file_deleted $pid $slave_pid
- if [ -f $slave_pid ] ; then
- $ECHO "slave refused to die. Sending SIGKILL"
- kill -9 `$CAT $slave_pid`
- $RM -f $slave_pid
- else
- $ECHO "slave responded to SIGTERM "
- fi
- else
- sleep $SLEEP_TIME_AFTER_RESTART
- fi
- eval "SLAVE$1_RUNNING=0"
- if [ -n "$USE_NDBCLUSTER_SLAVE_OPT" ] ; then
- savedir=`pwd`
- cd $MYSQL_TEST_DIR
- $ECHO "Stopping slave cluster"
- ./ndb/ndbcluster $NDBCLUSTER_OPTS_SLAVE --stop
- rm_ndbcluster_tables $SLAVE_MYDDIR
- cd $savedir
- fi
- fi
-}
-
-stop_slave_threads ()
-{
- eval "this_slave_running=\$SLAVE$1_RUNNING"
- slave_ident="slave$1"
- if [ x$this_slave_running = x1 ]
- then
- $MYSQLADMIN --no-defaults -uroot --socket=$MYSQL_TMP_DIR/$slave_ident.sock stop-slave > /dev/null 2>&1
- fi
-}
-
-stop_master ()
-{
- eval "this_master_running=\$MASTER$1_RUNNING"
- if [ x$this_master_running = x1 ]
- then
- # For embedded server we don't stop anyting but mark that
- # MASTER_RUNNING=0 to get cleanup when calling start_master().
- if [ x$USE_EMBEDDED_SERVER != x1 ] ; then
- pid=`$CAT $MASTER_MYPID$1`
- shutdown_mysqld $pid master $1
- if [ $? != 0 ] && [ -f $MASTER_MYPID$1 ]
- then # try harder!
- $ECHO "master not cooperating with mysqladmin, will try manual kill"
- kill $pid
- sleep_until_file_deleted $pid $MASTER_MYPID$1
- if [ -f $MASTER_MYPID$1 ] ; then
- $ECHO "master refused to die. Sending SIGKILL"
- kill -9 `$CAT $MASTER_MYPID$1`
- $RM -f $MASTER_MYPID$1
- else
- $ECHO "master responded to SIGTERM "
- fi
- else
- sleep $SLEEP_TIME_AFTER_RESTART
- fi
- fi
- eval "MASTER$1_RUNNING=0"
- fi
-}
-
-mysql_stop ()
-{
- if [ "$MASTER_RUNNING" = 1 ]
- then
- $ECHO "Ending Tests"
- $ECHO "Shutting-down MySQL daemon"
- $ECHO ""
- stop_master
- stop_master 1
- $ECHO "Master shutdown finished"
- stop_slave
- stop_slave 1
- stop_slave 2
- $ECHO "Slave shutdown finished"
- stop_ndbcluster
- fi
- return 1
-}
-
-mysql_restart ()
-{
- mysql_stop
- mysql_start
- return 1
-}
-
-mysql_loadstd () {
-
- # cp $STD_DATA/*.frm $STD_DATA/*.MRG $MASTER_MYDDIR/test
- return 1
-}
-
-run_testcase ()
-{
- tf=$1
- tname=`$BASENAME $tf .test`
- master_opt_file=$TESTDIR/$tname-master.opt
- slave_opt_file=$TESTDIR/$tname-slave.opt
- master_init_script=$TESTDIR/$tname-master.sh
- slave_init_script=$TESTDIR/$tname-slave.sh
- slave_master_info_file=$TESTDIR/$tname.slave-mi
- tsrcdir=$TESTDIR/$tname-src
- result_file="r/$tname.result"
- echo $tname > $CURRENT_TEST
- SKIP_SLAVE=`$EXPR \( $tname : rpl \) = 0 \& \( $tname : federated \) = 0`
- NDBCLUSTER_TEST=`$EXPR \( $tname : '.*ndb.*' \) != 0`
- if [ "x$USE_NDBCLUSTER_ALL" = "x1" ] ; then
- NDBCLUSTER_TEST=1
- fi
- if [ "x$USE_NDBCLUSTER_ONLY" = "x1" -a "x$NDBCLUSTER_TEST" != "x1" ] ; then
- skip_test $tname
- return
- fi
- if [ "$USE_MANAGER" = 1 ] ; then
- many_slaves=`$EXPR \( \( $tname : rpl_failsafe \) != 0 \) \| \( \( $tname : rpl_chain_temp_table \) != 0 \)`
- fi
- if $EXPR "$tname" '<' "$START_FROM" > /dev/null ; then
- #skip_test $tname
- return
- fi
-
- if [ "$SKIP_TEST" ] ; then
- if $EXPR \( "$tname" : "$SKIP_TEST" \) > /dev/null ; then
- skip_test $tname
- return
- fi
- fi
-
- if [ "$DO_TEST" ] ; then
- if $EXPR \( "$tname" : "$DO_TEST" \) > /dev/null ; then
- : #empty command to keep some shells happy
- else
- #skip_test $tname
- return
- fi
- fi
-
- if [ x${NO_SLAVE}x$SKIP_SLAVE = x1x0 ] ; then
- skip_test $tname
- return
- fi
-
-# if [ -f "$TESTDIR/$tname.disabled" ]
-# then
-# comment=`$CAT $TESTDIR/$tname.disabled`;
-# disable_test $tname "$comment"
-# return
-# fi
- if [ -f "$TESTDIR/disabled.def" ] ; then
- comment=`$GREP "^$tname *: *" $TESTDIR/disabled.def`;
- if [ -n "$comment" ]
- then
- comment=`echo $comment | sed 's/^[^:]*: *//'`
- disable_test $tname "$comment"
- return
- fi
- fi
-
- if [ "x$USE_EMBEDDED_SERVER" != "x1" ] ; then
- # Stop all slave threads, so that we don't have useless reconnection
- # attempts and error messages in case the slave and master servers restart.
- stop_slave_threads
- stop_slave_threads 1
- stop_slave_threads 2
- fi
-
- # FIXME temporary solution, we will get a new C version of this
- # script soon anyway so it is not worth it spending the time
- if [ "x$USE_EMBEDDED_SERVER" = "x1" -a -z "$DO_TEST" ] ; then
- for t in \
- "init_connect" \
- "init_file"
- do
- if [ "$tname" = "$t" ] ; then
- skip_test $tname
- return
- fi
- done
- fi
-
- if [ $USE_RUNNING_SERVER -eq 0 ] ;
- then
- if [ -f $master_opt_file ] ;
- then
- EXTRA_MASTER_OPT=`$CAT $master_opt_file | $SED -e "s;\\$MYSQL_TEST_DIR;$MYSQL_TEST_DIR;"`
- case "$EXTRA_MASTER_OPT" in
- --timezone=*)
- TZ=`$ECHO "$EXTRA_MASTER_OPT" | $SED -e "s;--timezone=;;"`
- export TZ
- # Note that this must be set to space, not "" for test-reset to work
- EXTRA_MASTER_OPT=" "
- ;;
- --result-file=*)
- result_file=`$ECHO "$EXTRA_MASTER_OPT" | $SED -e "s;--result-file=;;"`
- result_file="r/$result_file.result"
- # Note that this must be set to space, not "" for test-reset to work
- EXTRA_MASTER_OPT=" "
- ;;
- --force-restart)
- # Note that this must be set to space, not "" for test-reset to work
- EXTRA_MASTER_OPT=" "
- ;;
- esac
- stop_master
- stop_master 1
-
- # only stop the cluster if this test will not use cluster
- if [ x$NDBCLUSTER_TEST != x1 ] ;
- then
- stop_ndbcluster
- fi
-
- report_current_test $tname
- USING_NDBCLUSTER=$NDBCLUSTER_TEST
- # start_ndbcluster knows if cluster is already started
- start_ndbcluster
- start_master
- if [ x$USING_NDBCLUSTER = x1 -a -z "$DO_BENCH" -a -z "$DO_STRESS" ] ; then
- echo "CURRENT_TEST: $tname" >> $MASTER_MYERR"1"
- start_master 1
- fi
- TZ=$MY_TZ; export TZ
- else
- # If we had extra master opts to the previous run
- # or there is no master running (FIXME strange.....)
- # or there is a master init script
- if [ ! -z "$EXTRA_MASTER_OPT" ] || [ x$MASTER_RUNNING != x1 ] || \
- [ -f $master_init_script ] || \
- [ -n "$USE_NDBCLUSTER" -a x$NDBCLUSTER_TEST != x$USING_NDBCLUSTER ]
- then
- EXTRA_MASTER_OPT=""
- stop_master
- stop_master 1
-
- # only stop the cluster if this test will not use cluster
- if [ x$NDBCLUSTER_TEST != x1 ] ;
- then
- stop_ndbcluster
- fi
-
- report_current_test $tname
- USING_NDBCLUSTER=$NDBCLUSTER_TEST
- # start_ndbcluster knows if cluster is already started
- start_ndbcluster
- start_master
- if [ x$USING_NDBCLUSTER = x1 -a -z "$DO_BENCH" -a -z "$DO_STRESS" ] ; then
- echo "CURRENT_TEST: $tname" >> $MASTER_MYERR"1"
- start_master 1
- fi
- else
- report_current_test $tname
- fi
- fi
-
- # We never start a slave if embedded server is used
- if [ "x$USE_EMBEDDED_SERVER" != "x1" ] ; then
- do_slave_restart=0
- if [ -f $slave_opt_file ] ;
- then
- EXTRA_SLAVE_OPT=`$CAT $slave_opt_file | $SED -e "s;\\$MYSQL_TEST_DIR;$MYSQL_TEST_DIR;"`
- do_slave_restart=1
- else
- if [ ! -z "$EXTRA_SLAVE_OPT" ] || [ x$SLAVE_RUNNING != x1 ] ;
- then
- EXTRA_SLAVE_OPT=""
- do_slave_restart=1
- fi
- fi
-
- if [ -f $slave_master_info_file ] ; then
- SLAVE_MASTER_INFO=`$CAT $slave_master_info_file`
- do_slave_restart=1
- else
- if [ ! -z "$SLAVE_MASTER_INFO" ] || [ x$SLAVE_RUNNING != x1 ] ;
- then
- SLAVE_MASTER_INFO=""
- do_slave_restart=1
- fi
- fi
-
- USING_NDBCLUSTER=$NDBCLUSTER_TEST
- if [ -n "$USE_NDBCLUSTER_SLAVE_OPT" ] ; then
- if [ x$USING_NDBCLUSTER != x1 ] ; then
- do_slave_restart=1
- fi
- else
- if [ x$USING_NDBCLUSTER = x1 ] ; then
- do_slave_restart=1
- fi
- fi
-
-
- if [ x$do_slave_restart = x1 ] ; then
- stop_slave
- echo "CURRENT_TEST: $tname" >> $SLAVE_MYERR
- start_slave
- else
- echo "CURRENT_TEST: $tname" >> $SLAVE_MYERR
- fi
- if [ x$many_slaves = x1 ]; then
- start_slave 1
- start_slave 2
- fi
- fi
- fi
-
- if [ "x$START_AND_EXIT" = "x1" ] ; then
- echo "Servers started, exiting"
- exit
- fi
-
- cd $MYSQL_TEST_DIR
-
- if [ -f $tf ] ; then
- $RM -f r/$tname.*reject
- mysql_test_args="-R $result_file $EXTRA_MYSQL_TEST_OPT"
- if [ -z "$DO_CLIENT_GDB" ] ; then
- `$VALGRIND_MYSQLTEST $MYSQL_TEST $mysql_test_args < $tf 2> $TIMEFILE`;
- else
- do_gdb_test "$mysql_test_args" "$tf"
- fi
-
- res=$?
-
- # Save the testcase log to mysqltest log file
- echo "CURRENT_TEST: $tname" >> $MYSQLTEST_LOG
- cat $TIMEFILE >> $MYSQLTEST_LOG
-
- pname=`$ECHO "$tname "|$CUT -c 1-24`
- RES="$pname"
-
- if [ x$many_slaves = x1 ] ; then
- stop_slave 1
- stop_slave 2
- fi
-
- if [ $res = 0 ]; then
- total_inc
- pass_inc
- TIMER=""
- if [ x$USE_TIMER = x1 -a -f "$MY_LOG_DIR/timer" ]; then
- TIMER=`cat $MY_LOG_DIR/timer`
- TIMER=`$PRINTF "%13s" $TIMER`
- fi
- $ECHO "$RES$RES_SPACE [ pass ] $TIMER"
- else
- # why the following ``if'' ? That is why res==1 is special ?
- if [ $res = 62 ]; then
- skip_inc
- $ECHO "$RES$RES_SPACE [ skipped ]"
- else
- if [ $res -ne 1 ]; then
- $ECHO "mysqltest returned unexpected code $res, it has probably crashed" >> $TIMEFILE
- fi
- total_inc
- fail_inc
- $ECHO "$RES$RES_SPACE [ fail ]"
- $ECHO
- error_is
- show_failed_diff $tname
- $ECHO
- if [ x$FORCE != x1 ] ; then
- $ECHO "Aborting: $tname failed in $TEST_MODE mode. To continue, re-run with '--force'."
- $ECHO
- if [ -z "$DO_GDB" ] && [ $USE_RUNNING_SERVER -eq 0 ] && \
- [ -z "$DO_DDD" ] && [ -z "$USE_EMBEDDED_SERVER" ]
- then
- mysql_stop
- fi
- exit 1
- fi
- FAILED_CASES="$FAILED_CASES $tname"
- if [ -z "$DO_GDB" ] && [ $USE_RUNNING_SERVER -eq 0 ] && \
- [ -z "$DO_DDD" ] && [ -z "$USE_EMBEDDED_SERVER" ]
- then
- mysql_restart
- fi
- fi
- fi
- fi
-}
-
-run_stress_test()
-{
-
- STRESS_BASEDIR="$MYSQL_TEST_DIR/var/stress"
-
- #Clean-up old stress test basedir
- if [ -d $STRESS_BASEDIR ] ; then
- $RM -rf $STRESS_BASEDIR
- fi
- #Create stress test basedir
- mkdir $STRESS_BASEDIR
-
- if [ "$STRESS_SUITE" != "main" -a "$STRESS_SUITE" != "default" ] ; then
- STRESS_SUITE_DIR="$MYSQL_TEST_DIR/suite/$STRESS_SUITE"
- else
- STRESS_SUITE_DIR="$MYSQL_TEST_DIR"
- fi
-
- if [ -d "$STRESS_SUITE_DIR" ] ; then
- STRESS_SUITE_T_DIR="$STRESS_SUITE_DIR/t"
- STRESS_SUITE_R_DIR="$STRESS_SUITE_DIR/r"
- #FIXME: check that dirs above are exist
- else
- echo "Directory $STRESS_SUITE_DIR with test suite doesn't exists. Abort stress testing"
- exit 1
- fi
-
- if [ -n "$STRESS_TEST" ] ; then
- STRESS_TEST_FILE="$STRESS_BASEDIR/stress_tests.txt"
- echo $STRESS_TEST > $STRESS_TEST_FILE
- elif [ -n "$STRESS_TEST_FILE" ] ; then
- STRESS_TEST_FILE="$STRESS_SUITE_DIR/$STRESS_TEST_FILE"
- if [ ! -f "$STRESS_TEST_FILE" ] ; then
- echo "Specified file $STRESS_TEST_FILE with list of tests does not exist"
- echo "Please ensure that file exists and has proper permissions"
- exit 1
- fi
- else
- STRESS_TEST_FILE="$STRESS_SUITE_DIR/stress_tests.txt"
- if [ ! -f "$STRESS_TEST_FILE" ] ; then
- echo "Default file $STRESS_TEST_FILE with list of tests does not exist."
- echo "Please use --stress-test-file option to specify custom one or you can"
- echo "just specify name of test for testing as last argument in command line"
- exit 1
- fi
- fi
-
- if [ -n "$STRESS_INIT_FILE" ] ; then
- STRESS_INIT_FILE="$STRESS_SUITE_DIR/$STRESS_INIT_FILE"
- if [ ! -f "$STRESS_INIT_FILE" ] ; then
- echo "Specified file $STRESS_INIT_FILE with list of tests doesn't exist."
- echo "Please ensure that file exists and has proper permissions"
- exit 1
- fi
- else
- STRESS_INIT_FILE="$STRESS_SUITE_DIR/stress_init.txt"
- #Check for default init file
- if [ ! -f "$STRESS_INIT_FILE" ] ; then
- STRESS_INIT_FILE=""
- fi
- fi
-
- if [ "$STRESS_MODE" != "random" -a "$STRESS_MODE" != "seq" ] ; then
- echo "You specified wrong mode '$STRESS_MODE' for stress test."
- echo "Correct values are 'random' or 'seq'"
- exit 1
- fi
-
- STRESS_TEST_ARGS="--server-socket=$MASTER_MYSOCK \
- --server-user=$DBUSER \
- --server-database=$DB \
- --stress-suite-basedir=$MYSQL_TEST_DIR \
- --suite=$STRESS_SUITE \
- --stress-tests-file=$STRESS_TEST_FILE \
- --stress-basedir=$STRESS_BASEDIR \
- --server-logs-dir=$STRESS_BASEDIR \
- --stress-mode=$STRESS_MODE \
- --mysqltest=$CLIENT_BINDIR/mysqltest \
- --threads=$STRESS_THREADS \
- --verbose \
- --cleanup \
- --log-error-details \
- --abort-on-error"
-
- if [ -n "$STRESS_INIT_FILE" ] ; then
- STRESS_TEST_ARGS="$STRESS_TEST_ARGS --stress-init-file=$STRESS_INIT_FILE"
- fi
-
- if [ -z "$STRESS_LOOP_COUNT" -a -z "$STRESS_TEST_COUNT" -a
- -z "$STRESS_TEST_DURATION" ] ; then
-
- #Limit stress testing with 20 loops in case when any limit parameter
- #was specified
- STRESS_TEST_COUNT=20
- fi
-
- if [ -n "$STRESS_LOOP_COUNT" ] ; then
- STRESS_TEST_ARGS="$STRESS_TEST_ARGS --loop-count=$STRESS_LOOP_COUNT"
- fi
-
- if [ -n "$STRESS_TEST_COUNT" ] ; then
- STRESS_TEST_ARGS="$STRESS_TEST_ARGS --test-count=$STRESS_TEST_COUNT"
- fi
-
- if [ -n "$STRESS_TEST_DURATION" ] ; then
- STRESS_TEST_ARGS="$STRESS_TEST_ARGS --test-duration=$STRESS_TEST_DURATION"
- fi
-
- echo "Stress test related variables:"
- echo "TESTS - $1"
- echo "STRESS - $DO_STRESS"
- echo "STRESS_SUITE - $STRESS_SUITE"
- echo "STRESS_TEST_FILE - $STRESS_TEST_FILE"
- echo "STRESS_INIT_FILE - $STRESS_INIT_FILE"
- echo "STRESS_THREADS - $STRESS_THREADS"
- echo "STRESS_MODE - $STRESS_MODE"
- echo "STRESS_TEST_COUNT - $STRESS_TEST_COUNT"
- echo "STRESS_LOOP_COUNT - $STRESS_LOOP_COUNT"
- echo "STRESS_TEST_DURATION - $STRESS_TEST_DURATION"
-
- #echo "$STRESS_TEST_ARGS";
- #Run stress test
- $MYSQL_TEST_DIR/mysql-stress-test.pl $STRESS_TEST_ARGS
-
-
-}
-
-######################################################################
-# Main script starts here
-######################################################################
-
-[ "$DO_GCOV" -a ! -x "$GCOV" ] && error "No gcov found"
-
-[ "$DO_GCOV" ] && gcov_prepare
-[ "$DO_GPROF" ] && gprof_prepare
-
-if [ $USE_RUNNING_SERVER -eq 0 ]
-then
- if [ -z "$FAST_START" ]
- then
- # Ensure that no old mysqld test servers are running
- $MYSQLADMIN --no-defaults --socket=$MASTER_MYSOCK -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1
- $MYSQLADMIN --no-defaults --socket=$MASTER_MYSOCK1 -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1
- $MYSQLADMIN --no-defaults --socket=$SLAVE_MYSOCK -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1
- $MYSQLADMIN --no-defaults --host=$hostname --port=$MASTER_MYPORT --protocol=tcp -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1
- $MYSQLADMIN --no-defaults --host=$hostname --protocol=tcp --port=`expr $MASTER_MYPORT + 1` -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1
- $MYSQLADMIN --no-defaults --host=$hostname --protocol=tcp --port=$SLAVE_MYPORT -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1
- $MYSQLADMIN --no-defaults --host=$hostname --protocol=tcp --port=`expr $SLAVE_MYPORT + 1` -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1
- sleep_until_file_deleted 0 $MASTER_MYPID
- sleep_until_file_deleted 0 $MASTER_MYPID"1"
- sleep_until_file_deleted 0 $SLAVE_MYPID
- else
- rm $MASTER_MYPID $MASTER_MYPID"1" $SLAVE_MYPID
- fi
-
- # just to force stopping anything from previous runs
- USE_NDBCLUSTER_OPT=$USE_NDBCLUSTER
- stop_ndbcluster
-
- # Remove files that can cause problems
- $RM -rf $MYSQL_TEST_DIR/var/ndbcluster
- $RM -rf $MYSQL_TEST_DIR/var/tmp/snapshot*
- $RM -rf $MYSQL_TEST_DIR/var/run/* $MYSQL_TEST_DIR/var/tmp/*
-
- # Remove old berkeley db log files that can confuse the server
- $RM -f $MASTER_MYDDIR/log.*
- $RM -f $MASTER_MYDDIR"1"/log.*
-
- # Remove old log and reject files
- $RM -f r/*.reject r/*.progress r/*.log r/*.warnings
-
- wait_for_master=$SLEEP_TIME_FOR_FIRST_MASTER
- wait_for_slave=$SLEEP_TIME_FOR_FIRST_SLAVE
- $ECHO "Installing Test Databases"
- mysql_install_db
-
- if [ -n "$1" -a `expr "X$*" : '.*ndb'` -eq 0 ]
- then
- USING_NDBCLUSTER=0
- USE_NDBCLUSTER_OPT=
- fi
-
- mysql_start
- $ECHO "Loading Standard Test Databases"
- mysql_loadstd
-fi
-
-$ECHO "Starting Tests"
-
-# Some test cases need USE_RUNNING_SERVER
-export USE_RUNNING_SERVER
-
-#
-# This can probably be deleted
-#
-if [ "$DO_BENCH" = 1 ]
-then
- start_master
-
- if [ "$DO_SMALL_BENCH" = 1 ]
- then
- EXTRA_BENCH_ARGS="--small-test --small-tables"
- fi
-
- if [ x$USING_NDBCLUSTER = x1 ]
- then
- EXTRA_BENCH_ARGS="--create-options=TYPE=ndb $EXTRA_BENCH_ARGS"
- fi
-
- BENCHDIR=$BASEDIR/sql-bench/
- savedir=`pwd`
- cd $BENCHDIR
- if [ -z "$1" ]
- then
- ./run-all-tests --socket=$MASTER_MYSOCK --user=root $EXTRA_BENCH_ARGS --log
- else
- if [ -x "./$1" ]
- then
- ./$1 --socket=$MASTER_MYSOCK --user=root $EXTRA_BENCH_ARGS
- else
- echo "benchmark $1 not found"
- fi
- fi
- cd $savedir
- mysql_stop
- exit
-fi
-
-#
-# Stress testing
-#
-if [ "$DO_STRESS" = 1 ]
-then
-
- if [ -n "$1" ] ; then
- STRESS_TEST="$1";
- fi
-
- if [ $USE_RUNNING_SERVER -eq 0 ] ; then
- start_master
- fi
-
- run_stress_test
-
- if [ $USE_RUNNING_SERVER -eq 0 ] ; then
- mysql_stop
- fi
-
- exit
-
-fi
-
-
-$ECHO
-if [ x$USE_TIMER = x1 ] ; then
-$ECHO "TEST RESULT TIME (ms)"
-else
-$ECHO "TEST RESULT"
-fi
-$ECHO $DASH72
-
-if [ -z "$1" ] ;
-then
- if [ x$RECORD = x1 ]; then
- $ECHO "Will not run in record mode without a specific test case."
- else
- for tf in $TESTDIR/*.$TESTSUFFIX
- do
- run_testcase $tf
- done
- $RM -f $TIMEFILE # Remove for full test
- fi
-else
- while [ ! -z "$1" ]; do
- tname=`$BASENAME $1 .test`
- tf=$TESTDIR/$tname.$TESTSUFFIX
- if [ -f $tf ] ; then
- run_testcase $tf
- else
- $ECHO "Test case $tf does not exist."
- fi
- shift
- done
-fi
-
-$ECHO $DASH72
-$ECHO
-
-if [ -z "$DO_GDB" ] && [ $USE_RUNNING_SERVER -eq 0 ] && [ -z "$DO_DDD" ]
-then
- mysql_stop
-fi
-report_stats
-$ECHO
-
-[ "$DO_GCOV" ] && gcov_collect # collect coverage information
-[ "$DO_GPROF" ] && gprof_collect # collect coverage information
-
-if [ $TOT_FAIL -ne 0 ]; then
- $ECHO "mysql-test-run in $TEST_MODE mode: *** Failing the test(s):$FAILED_CASES"
- $ECHO
- exit 1
-fi
-if [ $GOT_WARNINGS -ne 0 ]; then
- exit 1
-fi
-exit 0
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index c36fb3a3f40..1b12f1580dd 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -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
@@ -14,114 +14,71 @@
# Please keep the test framework tools identical in all versions!
#
##############################################################################
-#
-# Coding style directions for this perl script
-#
-# - To make this Perl script easy to alter even for those that not
-# code Perl that often, keeep the coding style as close as possible to
-# the C/C++ MySQL coding standard.
-#
-# - All lists of arguments to send to commands are Perl lists/arrays,
-# not strings we append args to. Within reason, most string
-# concatenation for arguments should be avoided.
-#
-# - Functions defined in the main program are not to be prefixed,
-# functions in "library files" are to be prefixed with "mtr_" (for
-# Mysql-Test-Run). There are some exceptions, code that fits best in
-# the main program, but are put into separate files to avoid
-# clutter, may be without prefix.
-#
-# - All stat/opendir/-f/ is to be kept in collect_test_cases(). It
-# will create a struct that the rest of the program can use to get
-# the information. This separates the "find information" from the
-# "do the work" and makes the program more easy to maintain.
-#
-# - The rule when it comes to the logic of this program is
-#
-# command_line_setup() - is to handle the logic between flags
-# collect_test_cases() - is to do its best to select what tests
-# to run, dig out options, if needs restart etc.
-# run_testcase() - is to run a single testcase, and follow the
-# logic set in both above. No, or rare file
-# system operations. If a test seems complex,
-# it should probably not be here.
-#
-# A nice way to trace the execution of this script while debugging
-# is to use the Devel::Trace package found at
-# "http://www.plover.com/~mjd/perl/Trace/" and run this script like
-# "perl -d:Trace mysql-test-run.pl"
-#
+use strict;
+use warnings;
-use lib "lib/";
+BEGIN {
+ # Check that mysql-test-run.pl is started from mysql-test/
+ unless ( -f "mysql-test-run.pl" )
+ {
+ print "**** ERROR **** ",
+ "You must start mysql-test-run from the mysql-test/ directory\n";
+ exit(1);
+ }
+ # Check that lib exist
+ unless ( -d "lib/" )
+ {
+ print "**** ERROR **** ",
+ "Could not find the lib/ directory \n";
+ exit(1);
+ }
+
+ # Include settings that control how the script behaves
+ require "lib/mtr_settings.pl";
+}
-$Devel::Trace::TRACE= 0; # Don't trace boring init stuff
-#require 5.6.1;
-use File::Path;
-use File::Basename;
-use File::Copy;
-use File::Temp qw /tempdir/;
+use lib "lib";
use Cwd;
use Getopt::Long;
-use IO::Socket;
-use IO::Socket::INET;
-use strict;
-use warnings;
-
-select(STDOUT);
-$| = 1; # Automatically flush STDOUT
+use My::File::Path; # Patched version of File::Path
+use File::Basename;
+use File::Copy;
+use File::Temp qw / tempdir /;
+use My::SafeProcess;
+use My::ConfigFactory;
+use mtr_cases;
-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 $glob_netware= ($^O eq "NetWare"); # NetWare
+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_im.pl";
require "lib/mtr_process.pl";
-require "lib/mtr_timer.pl";
require "lib/mtr_io.pl";
require "lib/mtr_gcov.pl";
-require "lib/mtr_gprof.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";
-$Devel::Trace::TRACE= 1;
+$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_scriptname= undef;
-our $glob_timers= undef;
-our $glob_use_embedded_server= 0;
-our @glob_test_mode;
-
-our $glob_basedir;
+our $glob_mysql_test_dir;
+our $basedir;
our $path_charsetsdir;
our $path_client_bindir;
-our $path_share;
our $path_language;
our $path_timefile;
-our $path_snapshot;
-our $path_mysqltest_log;
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
+our $default_vardir;
+our $opt_vardir; # Path to use for var/ dir
+my $path_vardir_trace; # unix formatted opt_vardir for trace files
+my $opt_tmpdir; # Path to use for tmp/ dir
+my $path_config_file; # The generated 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
@@ -129,46 +86,21 @@ our $opt_tmpdir; # A path but set directly on cmd line
# 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,binlog,rpl,rpl_ndb,ndb"; # Default suites to run
+our $opt_suites= DEFAULT_SUITES;
-our $opt_script_debug= 0; # Script debugging, enable with --script-debug
our $opt_verbose= 0; # Verbose output, enable with --verbose
-our $exe_master_mysqld;
+my $exe_mysqld;
our $exe_mysql;
our $exe_mysqladmin;
-our $exe_mysql_upgrade;
-our $exe_mysqlbinlog;
-our $exe_mysql_client_test;
-our $exe_bug25714;
-our $exe_mysqld;
-our $exe_mysqlcheck;
-our $exe_mysqldump;
-our $exe_mysqlslap;
-our $exe_mysqlimport;
-our $exe_mysqlshow;
-our $exe_mysql_fix_system_tables;
-our $file_mysql_fix_privilege_tables;
our $exe_mysqltest;
our $exe_ndbd;
-our $exe_ndb_mgmd;
-our $exe_slave_mysqld;
-our $exe_im;
-our $exe_my_print_defaults;
-our $exe_perror;
-our $lib_udf_example;
-our $lib_example_plugin;
+our $exe_ndb_mgmd= "";
our $exe_libtool;
-our $opt_bench= 0;
-our $opt_small_bench= 0;
our $opt_big_test= 0;
our @opt_combinations;
-our $opt_skip_combination;
our @opt_extra_mysqld_opt;
@@ -182,17 +114,16 @@ our $opt_cursor_protocol;
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);};
-our $opt_fast;
+our $opt_fast= 0;
our $opt_force;
our $opt_reorder= 0;
-our $opt_enable_disabled;
our $opt_mem= $ENV{'MTR_MEM'};
our $opt_gcov;
@@ -207,102 +138,63 @@ our $opt_client_ddd;
our $opt_manual_gdb;
our $opt_manual_ddd;
our $opt_manual_debug;
-our $opt_mtr_build_thread=0;
our $opt_debugger;
our $opt_client_debugger;
-our $opt_gprof;
-our $opt_gprof_dir;
-our $opt_gprof_master;
-our $opt_gprof_slave;
-
-our $master;
-our $slave;
-our $clusters;
-
-our $instance_manager;
+my $config; # The currently running config
+my $current_config_name; # The currently running config file template
-our $opt_master_myport;
-our $opt_slave_myport;
-our $im_port;
-our $im_mysqld1_port;
-our $im_mysqld2_port;
-our $opt_ndbcluster_port;
-our $opt_ndbconnectstring;
-our $opt_ndbcluster_port_slave;
-our $opt_ndbconnectstring_slave;
+my $opt_baseport;
+my $opt_mtr_build_thread= $ENV{'MTR_BUILD_THREAD'} || "auto";
-our $opt_record;
+my $opt_record;
my $opt_report_features;
-our $opt_check_testcases;
-our $opt_mark_progress;
+my $opt_check_testcases;
+my $opt_mark_progress;
-our $opt_skip_rpl;
-our $max_slave_num= 0;
-our $max_master_num= 1;
-our $use_innodb;
-our $opt_skip_test;
-our $opt_skip_im;
+my $opt_sleep;
-our $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
-our $opt_testcase_timeout;
-our $opt_suite_timeout;
-my $default_testcase_timeout= 15; # 15 min max
-my $default_suite_timeout= 180; # 3 hours max
+my $opt_start;
+my $opt_start_dirty;
-our $opt_start_and_exit;
-our $opt_start_dirty;
-our $opt_start_from;
-
-our $opt_strace_client;
+my $opt_strace_client;
our $opt_timer= 1;
our $opt_user;
-our $opt_valgrind= 0;
-our $opt_valgrind_mysqld= 0;
-our $opt_valgrind_mysqltest= 0;
-our $default_valgrind_options= "--show-reachable=yes";
-our $opt_valgrind_options;
-our $opt_valgrind_path;
-our $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;
+my $opt_valgrind= 0;
+my $opt_valgrind_mysqld= 0;
+my $opt_valgrind_mysqltest= 0;
+my @default_valgrind_args= ("--show-reachable=yes");
+my @valgrind_args;
+my $opt_valgrind_path;
+my $opt_callgrind;
+
+our $opt_warnings= 1;
our $opt_skip_ndbcluster= 0;
our $opt_skip_ndbcluster_slave= 0;
our $opt_with_ndbcluster= 0;
-our $opt_with_ndbcluster_only= 0;
our $glob_ndbcluster_supported= 0;
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;
-our @data_dir_lst;
-
-our $used_binlog_format;
-our $used_default_engine;
our $debug_compiled_binaries;
our %mysqld_variables;
@@ -312,63 +204,17 @@ 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.
-######################################################################
-#
-# Function declarations
-#
-######################################################################
-
-sub main ();
-sub initial_setup ();
-sub command_line_setup ();
-sub set_mtr_build_thread_ports($);
-sub datadir_list_setup ();
-sub executable_setup ();
-sub environment_setup ();
-sub kill_running_servers ();
-sub remove_stale_vardir ();
-sub setup_vardir ();
-sub check_ssl_support ($);
-sub check_running_as_root();
-sub check_ndbcluster_support ($);
-sub rm_ndbcluster_tables ($);
-sub ndbcluster_start_install ($);
-sub ndbcluster_start ($$);
-sub ndbcluster_wait_started ($$);
-sub mysqld_wait_started($);
-sub run_benchmarks ($);
-sub initialize_servers ();
-sub mysql_install_db ();
-sub install_db ($$);
-sub copy_install_db ($$);
-sub run_testcase ($);
-sub run_testcase_stop_servers ($$$);
-sub run_testcase_start_servers ($);
-sub run_testcase_check_skip_test($);
-sub report_failure_and_restart ($);
-sub do_before_start_master ($);
-sub do_before_start_slave ($);
-sub ndbd_start ($$$);
-sub ndb_mgmd_start ($);
-sub mysqld_start ($$$);
-sub mysqld_arguments ($$$$);
-sub stop_all_servers ();
-sub run_mysqltest ($);
-sub usage ($);
-
-
-######################################################################
-#
-# Main program
-#
-######################################################################
+select(STDOUT);
+$| = 1; # Automatically flush STDOUT
main();
-sub 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);
@@ -376,133 +222,50 @@ sub main () {
executable_setup();
environment_setup();
- signal_setup();
if ( $opt_gcov )
{
gcov_prepare();
}
- if ( $opt_gprof )
- {
- gprof_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
- my $tests= collect_test_cases($opt_suites);
-
- # Turn off NDB and other similar options if no tests use it
- my ($need_ndbcluster,$need_im);
- foreach my $test (@$tests)
- {
- next if $test->{skip};
-
- if (!$opt_extern)
- {
- $need_ndbcluster||= $test->{ndb_test};
- $need_im||= $test->{component_id} eq 'im';
-
- # Count max number of slaves used by a test case
- if ( $test->{slave_num} > $max_slave_num) {
- $max_slave_num= $test->{slave_num};
- mtr_error("Too many slaves") if $max_slave_num > 3;
- }
-
- # 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;
- }
+ # Figure out which tests we are going to run
+ mtr_report("Collecting tests...");
+ my $tests= collect_test_cases($opt_suites);
- # Check if slave cluster can be skipped
- if ($max_slave_num == 0)
- {
- $opt_skip_ndbcluster_slave= 1;
- }
-
- # Check if im can be skipped
- if ( ! $need_im )
- {
- $opt_skip_im= 1;
- }
+ initialize_servers();
- initialize_servers();
-
- if ( $opt_report_features ) {
- run_report_features();
- }
-
- run_tests($tests);
+ 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'} = [];
+ unshift(@$tests, $tinfo);
}
- mtr_exit(0);
-}
+ if ( using_extern() ) {
+ create_config_file_for_extern(%opts_extern);
+ }
-##############################################################################
-#
-# Default settings
-#
-##############################################################################
+ run_tests($tests);
-sub command_line_setup () {
+ exit(0);
+}
- # These are defaults for things that are set on the command line
+sub command_line_setup {
my $opt_comment;
-
- $opt_master_myport= 9306;
- $opt_slave_myport= 9308;
- $opt_ndbcluster_port= 9310;
- $opt_ndbcluster_port_slave= 9311;
- $im_port= 9312;
- $im_mysqld1_port= 9313;
- $im_mysqld2_port= 9314;
-
- # If so requested, we try to avail ourselves of a unique build thread number.
- if ( $ENV{'MTR_BUILD_THREAD'} ) {
- if ( lc($ENV{'MTR_BUILD_THREAD'}) eq 'auto' ) {
- print "Requesting build thread... ";
- $ENV{'MTR_BUILD_THREAD'} = mtr_require_unique_id_and_wait("/tmp/mysql-test-ports", 200, 299);
- print "got ".$ENV{'MTR_BUILD_THREAD'}."\n";
- }
- }
-
- if ( $ENV{'MTR_BUILD_THREAD'} )
- {
- set_mtr_build_thread_ports($ENV{'MTR_BUILD_THREAD'});
- }
+ 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
# directly before it executes them, like "make test-force-pl" in RPM builds.
- print "Logging: $0 ", join(" ", @ARGV), "\n";
+ mtr_report("Logging: $0 ", join(" ", @ARGV));
- # Read the command line
+ # Read the command line options
# Note: Keep list, and the order, in sync with usage at end of this file
-
Getopt::Long::Configure("pass_through");
GetOptions(
# Control what engine/variation to run
@@ -514,38 +277,33 @@ 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,
+ 'vs-config' => \$opt_vs_config,
+
+ # Config file to use as template for all tests
+ 'defaults-file=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,
+ 'with-ndbcluster-only' => \&collect_option,
'skip-ndbcluster|skip-ndb' => \$opt_skip_ndbcluster,
'skip-ndbcluster-slave|skip-ndb-slave'
=> \$opt_skip_ndbcluster_slave,
'ndb-extra-test' => \$opt_ndb_extra_test,
'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,
'suite|suites=s' => \$opt_suites,
- 'skip-rpl' => \$opt_skip_rpl,
- 'skip-im' => \$opt_skip_im,
- 'skip-test=s' => \$opt_skip_test,
+ 'skip-rpl' => \&collect_option,
+ 'skip-test=s' => \&collect_option,
+ 'do-test=s' => \&collect_option,
+ 'start-from=s' => \&collect_option,
'big-test' => \$opt_big_test,
- 'combination=s' => \@opt_combinations,
- 'skip-combination' => \$opt_skip_combination,
+ 'combination=s' => \@opt_combinations,
+ 'skip-combination' => \&collect_option,
# 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,
- 'im-port=i' => \$im_port, # Instance Manager port.
- 'im-mysqld1-port=i' => \$im_mysqld1_port, # Port of mysqld, controlled by IM
- 'im-mysqld2-port=i' => \$im_mysqld2_port, # Port of mysqld, controlled by IM
'mtr-build-thread=i' => \$opt_mtr_build_thread,
# Test case authoring
@@ -557,11 +315,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,
@@ -571,82 +328,59 @@ 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
'gcov' => \$opt_gcov,
- 'gprof' => \$opt_gprof,
'valgrind|valgrind-all' => \$opt_valgrind,
'valgrind-mysqltest' => \$opt_valgrind_mysqltest,
'valgrind-mysqld' => \$opt_valgrind_mysqld,
- 'valgrind-options=s' => \$opt_valgrind_options,
+ 'valgrind-options=s' => sub {
+ my ($opt, $value)= @_;
+ # Deprecated option unless it's what we know pushbuild uses
+ if ($value eq "--gen-suppressions=all --show-reachable=yes") {
+ push(@valgrind_args, $_) for (split(' ', $value));
+ return;
+ }
+ die("--valgrind-options=s is deprecated. Use ",
+ "--valgrind-option=s, to be specified several",
+ " times if necessary");
+ },
+ 'valgrind-option=s' => \@valgrind_args,
'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,
- 'script-debug' => \$opt_script_debug,
- 'verbose' => \$opt_verbose,
+ '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,
+ 'print-testcases' => \&collect_option,
+# TODO 'repeat'
+# TODO 'retry'
'timer!' => \$opt_timer,
'user=s' => \$opt_user,
'testcase-timeout=i' => \$opt_testcase_timeout,
'suite-timeout=i' => \$opt_suite_timeout,
- 'warnings|log-warnings' => \$opt_warnings,
+ 'shutdown-timeout=i' => \$opt_shutdown_timeout,
+ 'warnings!' => \$opt_warnings,
'help|h' => \$opt_usage,
) or usage("Can't read options");
usage("") if $opt_usage;
- $glob_scriptname= basename($0);
-
- if ($opt_mtr_build_thread != 0)
- {
- set_mtr_build_thread_ports($opt_mtr_build_thread)
- }
- elsif ($ENV{'MTR_BUILD_THREAD'})
- {
- $opt_mtr_build_thread= $ENV{'MTR_BUILD_THREAD'};
- }
-
- # We require that we are in the "mysql-test" directory
- # to run mysql-test-run
- if (! -f $glob_scriptname)
- {
- mtr_error("Can't find the location for the mysql-test-run script\n" .
- "Go to to the mysql-test directory and execute the script " .
- "as follows:\n./$glob_scriptname");
- }
-
if ( -d "../sql" )
{
$source_dist= 1;
@@ -654,69 +388,26 @@ 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"`;
chomp($glob_mysql_test_dir);
}
- $default_vardir= "$glob_mysql_test_dir/var";
# 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);
- }
-
- # 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;
-
- $glob_timers= mtr_init_timers();
-
- # --------------------------------------------------------------------------
- # Embedded server flag
- # --------------------------------------------------------------------------
- if ( $opt_embedded_server )
- {
- $glob_use_embedded_server= 1;
- # Add the location for libmysqld.dll to the path.
- if ( $glob_win32 )
- {
- 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;
- }
-
- push(@glob_test_mode, "embedded");
- $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 )
- {
- mtr_error("Can't use --extern with --embedded-server");
- }
+ $basedir= dirname($basedir);
}
#
@@ -725,51 +416,54 @@ sub command_line_setup () {
#
# 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
- $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");
-
- if (!$opt_extern)
+ # Look for SQL scripts directory
+ if ( mtr_file_exists("$path_share/mysql_system_tables.sql") ne "")
{
- $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");
-
- # Use the mysqld found above to find out what features are available
- collect_mysqld_features();
+ # The SQL scripts are in path_share
+ $path_sql_dir= $path_share;
}
else
{
- $mysqld_variables{'port'}= 3306;
- $mysqld_variables{'master-port'}= 3306;
+ $path_sql_dir= mtr_path_exists("$basedir/share",
+ "$basedir/scripts");
}
+ $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();
+
if ( $opt_comment )
{
- print "\n";
- print '#' x 78, "\n";
- print "# $opt_comment\n";
- print '#' x 78, "\n\n";
+ mtr_report();
+ mtr_print_thick_line('#');
+ mtr_report("# $opt_comment");
+ mtr_print_thick_line('#');
}
foreach my $arg ( @ARGV )
@@ -797,22 +491,13 @@ sub command_line_setup () {
# --------------------------------------------------------------------------
# Find out type of logging that are being used
# --------------------------------------------------------------------------
- if (!$opt_extern && $mysql_version_id >= 50100 )
+ foreach my $arg ( @opt_extra_mysqld_opt )
{
- foreach my $arg ( @opt_extra_mysqld_opt )
+ if ( $arg =~ /binlog[-_]format=(\S+)/ )
{
- if ( $arg =~ /binlog[-_]format=(\S+)/ )
- {
- $used_binlog_format= $1;
- }
- }
- if (defined $used_binlog_format)
- {
- mtr_report("Using binlog format '$used_binlog_format'");
- }
- else
- {
- mtr_report("Using dynamic switching of binlog format");
+ # Save this for collect phase
+ collect_option('binlog-format', $1);
+ mtr_report("Using binlog format '$1'");
}
}
@@ -820,21 +505,15 @@ sub command_line_setup () {
# --------------------------------------------------------------------------
# Find out default storage engine being used(if any)
# --------------------------------------------------------------------------
- if ( $opt_with_ndbcluster )
- {
- # --ndb or --with-ndbcluster turns on --default-storage-engine=ndbcluster
- push(@opt_extra_mysqld_opt, "--default-storage-engine=ndbcluster");
- }
-
foreach my $arg ( @opt_extra_mysqld_opt )
{
if ( $arg =~ /default-storage-engine=(\S+)/ )
{
- $used_default_engine= $1;
+ # Save this for collect phase
+ collect_option('default-storage-engine', $1);
+ mtr_report("Using default engine '$1'")
}
}
- mtr_report("Using default engine '$used_default_engine'")
- if defined $used_default_engine;
# --------------------------------------------------------------------------
# Check if we should speed up tests by trying to run on tmpfs
@@ -855,7 +534,6 @@ sub command_line_setup () {
{
if ( -d $fs )
{
- mtr_report("Using tmpfs in $fs");
$opt_mem= "$fs/var";
$opt_mem .= $opt_mtr_build_thread if $opt_mtr_build_thread;
last;
@@ -866,6 +544,7 @@ sub command_line_setup () {
# --------------------------------------------------------------------------
# Set the "var/" directory, as it is the base for everything else
# --------------------------------------------------------------------------
+ $default_vardir= "$glob_mysql_test_dir/var";
if ( ! $opt_vardir )
{
$opt_vardir= $default_vardir;
@@ -876,7 +555,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;
@@ -892,12 +571,15 @@ 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";
}
+ # Location of my.cnf that all clients use
+ $path_config_file= "$opt_vardir/my.cnf";
+
# --------------------------------------------------------------------------
# Set tmpdir
# --------------------------------------------------------------------------
@@ -905,22 +587,10 @@ sub command_line_setup () {
$opt_tmpdir =~ s,/+$,,; # Remove ending slash if any
# --------------------------------------------------------------------------
- # Check im suport
+ # fast option
# --------------------------------------------------------------------------
- if ($opt_extern)
- {
- mtr_report("Disable instance manager when running with extern mysqld");
- $opt_skip_im= 1;
- }
- elsif ( $mysql_version_id < 50000 )
- {
- # Instance manager is not supported until 5.0
- $opt_skip_im= 1;
- }
- elsif ( $glob_win32 )
- {
- mtr_report("Disable Instance manager - testing not supported on Windows");
- $opt_skip_im= 1;
+ if ($opt_fast){
+ $opt_shutdown_timeout= 0; # Kill processes instead of nice shutdown
}
# --------------------------------------------------------------------------
@@ -931,25 +601,36 @@ sub command_line_setup () {
mtr_error("Will not run in record mode without a specific test case");
}
- if ( $opt_record )
- {
- $opt_skip_combination = 1;
- }
-
# --------------------------------------------------------------------------
- # ps protcol flag
+ # Embedded server flag
# --------------------------------------------------------------------------
- if ( $opt_ps_protocol )
+ if ( $opt_embedded_server )
{
- push(@glob_test_mode, "ps-protocol");
- }
+ $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',''));
+ if ( $is_cygwin )
+ {
+ $lib_mysqld= `cygpath "$lib_mysqld"`;
+ chomp($lib_mysqld);
+ $separator= ":";
+ }
+ $ENV{'PATH'}= "$ENV{'PATH'}".$separator.$lib_mysqld;
+ }
+ $opt_skip_ndbcluster= 1; # Turn off use of NDB cluster
+ $opt_skip_ssl= 1; # Turn off use of SSL
- # --------------------------------------------------------------------------
- # Bench flags
- # --------------------------------------------------------------------------
- if ( $opt_small_bench )
- {
- $opt_bench= 1;
+ # Turn off use of bin log
+ push(@opt_extra_mysqld_opt, "--skip-log-bin");
+
+ if ( using_extern() )
+ {
+ mtr_error("Can't use --extern with --embedded-server");
+ }
}
# --------------------------------------------------------------------------
@@ -977,27 +658,27 @@ 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");
}
}
# --------------------------------------------------------------------------
- # Check if special exe was selected for master or slave
- # --------------------------------------------------------------------------
- $exe_master_mysqld= $exe_master_mysqld || $exe_mysqld;
- $exe_slave_mysqld= $exe_slave_mysqld || $exe_mysqld;
-
- # --------------------------------------------------------------------------
# Check valgrind arguments
# --------------------------------------------------------------------------
- if ( $opt_valgrind or $opt_valgrind_path or defined $opt_valgrind_options)
+ if ( $opt_valgrind or $opt_valgrind_path or @valgrind_args)
{
mtr_report("Turning on valgrind for all executables");
$opt_valgrind= 1;
$opt_valgrind_mysqld= 1;
$opt_valgrind_mysqltest= 1;
+
+ # Increase the timeouts when running with valgrind
+ $opt_testcase_timeout*= 10;
+ $opt_suite_timeout*= 6;
+ $opt_start_timeout*= 10;
+
}
elsif ( $opt_valgrind_mysqld )
{
@@ -1017,43 +698,23 @@ sub command_line_setup () {
$opt_valgrind_mysqld= 1;
# Set special valgrind options unless options passed on command line
- $opt_valgrind_options="--trace-children=yes"
- unless defined $opt_valgrind_options;
+ push(@valgrind_args, "--trace-children=yes")
+ unless @valgrind_args;
}
if ( $opt_valgrind )
{
# Set valgrind_options to default unless already defined
- $opt_valgrind_options=$default_valgrind_options
- unless defined $opt_valgrind_options;
-
- mtr_report("Running valgrind with options \"$opt_valgrind_options\"");
- }
+ push(@valgrind_args, @default_valgrind_args)
+ unless @valgrind_args;
- if ( ! $opt_testcase_timeout )
- {
- $opt_testcase_timeout= $default_testcase_timeout;
- $opt_testcase_timeout*= 10 if $opt_valgrind;
- $opt_testcase_timeout*= 10 if ($opt_debug and $glob_win32);
- }
-
- if ( ! $opt_suite_timeout )
- {
- $opt_suite_timeout= $default_suite_timeout;
- $opt_suite_timeout*= 6 if $opt_valgrind;
- $opt_suite_timeout*= 6 if ($opt_debug and $glob_win32);
+ mtr_report("Running valgrind with options \"",
+ join(" ", @valgrind_args), "\"");
}
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
@@ -1067,235 +728,18 @@ sub command_line_setup () {
# socket path names.
$sockdir = tempdir(CLEANUP => 0) if ( length($sockdir) >= 70 );
- $master->[0]=
- {
- pid => 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]=
- {
- pid => 0,
- 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]=
- {
- pid => 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]=
- {
- pid => 0,
- 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]=
- {
- pid => 0,
- 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 => [],
- };
-
- $instance_manager=
- {
- path_err => "$opt_vardir/log/im.err",
- path_log => "$opt_vardir/log/im.log",
- path_pid => "$opt_vardir/run/im.pid",
- path_angel_pid => "$opt_vardir/run/im.angel.pid",
- path_sock => "$sockdir/im.sock",
- port => $im_port,
- start_timeout => $master->[0]->{'start_timeout'},
- admin_login => 'im_admin',
- admin_password => 'im_admin_secret',
- admin_sha1 => '*598D51AD2DFF7792045D6DF3DDF9AA1AF737B295',
- password_file => "$opt_vardir/im.passwd",
- defaults_file => "$opt_vardir/im.cnf",
- };
-
- $instance_manager->{'instances'}->[0]=
- {
- server_id => 1,
- port => $im_mysqld1_port,
- path_datadir => "$opt_vardir/im_mysqld_1.data",
- path_sock => "$sockdir/mysqld_1.sock",
- path_pid => "$opt_vardir/run/mysqld_1.pid",
- start_timeout => 400, # enough time create innodb tables
- old_log_format => 1
- };
-
- $instance_manager->{'instances'}->[1]=
- {
- server_id => 2,
- port => $im_mysqld2_port,
- path_datadir => "$opt_vardir/im_mysqld_2.data",
- path_sock => "$sockdir/mysqld_2.sock",
- path_pid => "$opt_vardir/run/mysqld_2.pid",
- nonguarded => 1,
- start_timeout => 400, # enough time create innodb tables
- old_log_format => 1
- };
-
- 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
- pid => 0, # pid of ndb_mgmd
- installed_ok => 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
- pid => 0, # pid of ndb_mgmd
- installed_ok => 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]=
- {
- pid => 0,
- nodeid => $nodeid,
- path_pid => "$cluster->{'data_dir'}/ndb_${nodeid}.pid",
- path_fs => "$cluster->{'data_dir'}/ndb_${nodeid}_fs",
- };
- }
- }
-
- # --------------------------------------------------------------------------
- # extern
- # --------------------------------------------------------------------------
- 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;
- }
-
-
- # --------------------------------------------------------------------------
- # 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;
- }
- $ENV{'NDB_CONNECTSTRING'}= $clusters->[0]->{'connect_string'};
-
-
- 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;
- }
-
-
$path_timefile= "$opt_vardir/log/mysqltest-time";
- $path_mysqltest_log= "$opt_vardir/log/mysqltest.log";
$path_current_test_log= "$opt_vardir/log/current_test";
$path_ndb_testrun_log= "$opt_vardir/log/ndb_testrun.log";
- $path_snapshot= "$opt_tmpdir/snapshot_$opt_master_myport/";
+ # --------------------------------------------------------------------------
+ # Check mtr_build_thread and calculate baseport
+ # --------------------------------------------------------------------------
+ set_mtr_build_thread_ports($opt_mtr_build_thread);
- 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";
- }
- }
}
+
#
# To make it easier for different devs to work on the same host,
# an environment variable can be used to control all ports. A small
@@ -1311,70 +755,38 @@ sub command_line_setup () {
# http://www.ncftp.com/ncftpd/doc/misc/ephemeral_ports.html
# But a fairly safe range seems to be 5001 - 32767
#
-
sub set_mtr_build_thread_ports($) {
- my $mtr_build_thread= shift;
+ my $mtr_build_thread= shift || 0;
if ( lc($mtr_build_thread) eq 'auto' ) {
print "Requesting build thread... ";
- $ENV{'MTR_BUILD_THREAD'} = $mtr_build_thread = mtr_require_unique_id_and_wait("/tmp/mysql-test-ports", 200, 299);
+ $mtr_build_thread=
+ mtr_require_unique_id_and_wait("/tmp/mysql-test-ports", 200, 299);
print "got ".$mtr_build_thread."\n";
}
+ $opt_mtr_build_thread= $mtr_build_thread;
- # 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;
- $im_port= $opt_master_myport + 7;
- $im_mysqld1_port= $opt_master_myport + 8;
- $im_mysqld2_port= $opt_master_myport + 9;
-
- 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)");
- }
-}
-
-
-sub datadir_list_setup () {
-
- # Make a list of all data_dirs
- for (my $idx= 0; $idx < $max_master_num; $idx++)
- {
- push(@data_dir_lst, $master->[$idx]->{'path_myddir'});
+ "($opt_baseport - $opt_baseport + 9)");
}
- for (my $idx= 0; $idx < $max_slave_num; $idx++)
- {
- push(@data_dir_lst, $slave->[$idx]->{'path_myddir'});
- }
+ mtr_report("Using MR_BUILD_THREAD $opt_mtr_build_thread,",
+ "with reserved ports $opt_baseport..".($opt_baseport+9));
- unless ($opt_skip_im)
- {
- foreach my $instance (@{$instance_manager->{'instances'}})
- {
- push(@data_dir_lst, $instance->{'path_datadir'});
- }
- }
}
-##############################################################################
-#
-# Set paths to various executable programs
-#
-##############################################################################
-
-
-sub collect_mysqld_features () {
+sub collect_mysqld_features {
my $found_variable_list_start= 0;
my $tmpdir= tempdir(CLEANUP => 0); # Directory removed by this function
#
- # Execute "mysqld --help --verbose" to get a list
+ # Execute "mysqld --no-defaults --help --verbose" to get a
# list of all features and settings
#
# --no-defaults and --skip-grant-tables are to avoid loading
@@ -1444,59 +856,12 @@ sub collect_mysqld_features () {
}
-sub run_query($$) {
- my ($mysqld, $query)= @_;
-
- my $args;
- mtr_init_args(\$args);
-
- mtr_add_arg($args, "--no-defaults");
- mtr_add_arg($args, "--user=%s", $opt_user);
- mtr_add_arg($args, "--port=%d", $mysqld->{'port'});
- mtr_add_arg($args, "--socket=%s", $mysqld->{'path_sock'});
- mtr_add_arg($args, "--silent"); # Tab separated output
- mtr_add_arg($args, "-e '%s'", $query);
-
- my $cmd= "$exe_mysql " . join(' ', @$args);
- mtr_verbose("cmd: $cmd");
- return `$cmd`;
-}
-
-
-sub collect_mysqld_features_from_running_server ()
-{
- my $list= run_query($master->[0], "use mysql; SHOW VARIABLES");
-
- foreach my $line (split('\n', $list))
- {
- # Put variables into hash
- if ( $line =~ /^([\S]+)[ \t]+(.*?)\r?$/ )
- {
- print "$1=\"$2\"\n";
- $mysqld_variables{$1}= $2;
- }
- }
-}
-
-sub executable_setup_im () {
-
- # Look for instance manager binary - mysqlmanager
- $exe_im=
- mtr_exe_maybe_exists(
- "$glob_basedir/server-tools/instance-manager/mysqlmanager",
- "$glob_basedir/libexec/mysqlmanager",
- "$glob_basedir/bin/mysqlmanager",
- "$glob_basedir/sbin/mysqlmanager");
-
- return ($exe_im eq "");
-}
-
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",
@@ -1528,6 +893,7 @@ sub executable_setup_ndb () {
$exe_ndb_waiter eq "");
}
+
sub executable_setup () {
#
@@ -1545,104 +911,27 @@ sub executable_setup () {
}
}
- # Look for my_print_defaults
- $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");
-
- # Look for perror
- $exe_perror= mtr_exe_exists(vs_config_dirs('extra', 'perror'),
- "$glob_basedir/extra/perror",
- "$path_client_bindir/perror");
# Look for the client binaries
- $exe_mysqlcheck= mtr_exe_exists("$path_client_bindir/mysqlcheck");
- $exe_mysqldump= mtr_exe_exists("$path_client_bindir/mysqldump");
- $exe_mysqlimport= mtr_exe_exists("$path_client_bindir/mysqlimport");
- $exe_mysqlshow= mtr_exe_exists("$path_client_bindir/mysqlshow");
- $exe_mysqlbinlog= mtr_exe_exists("$path_client_bindir/mysqlbinlog");
$exe_mysqladmin= mtr_exe_exists("$path_client_bindir/mysqladmin");
$exe_mysql= mtr_exe_exists("$path_client_bindir/mysql");
- if (!$opt_extern)
- {
- # Look for SQL scripts directory
- if ( mtr_file_exists("$path_share/mysql_system_tables.sql") ne "")
- {
- # The SQL scripts are in path_share
- $path_sql_dir= $path_share;
- }
- else
- {
- $path_sql_dir= mtr_path_exists("$glob_basedir/share",
- "$glob_basedir/scripts");
- }
+ 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.");
- if ( $mysql_version_id >= 50100 )
- {
- $exe_mysqlslap= mtr_exe_exists("$path_client_bindir/mysqlslap");
- }
- if ( $mysql_version_id >= 50000 and !$glob_use_embedded_server )
- {
- $exe_mysql_upgrade= mtr_exe_exists("$path_client_bindir/mysql_upgrade")
- }
- else
- {
- $exe_mysql_upgrade= "";
+ foreach my $cluster ( clusters()) {
+ $cluster->{"executable_setup_failed"}= 1;
}
-
- if ( ! $glob_win32 )
- {
- # Look for mysql_fix_system_table script
- $exe_mysql_fix_system_tables=
- mtr_script_exists("$glob_basedir/scripts/mysql_fix_privilege_tables",
- "$path_client_bindir/mysql_fix_privilege_tables");
- }
-
- # Look for mysql_fix_privilege_tables.sql script
- $file_mysql_fix_privilege_tables=
- mtr_file_exists("$glob_basedir/scripts/mysql_fix_privilege_tables.sql",
- "$glob_basedir/share/mysql_fix_privilege_tables.sql");
-
- 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})
- {
- $cluster->{"executable_setup_failed"}= 1;
- }
- }
-
- if ( ! $opt_skip_im and executable_setup_im())
- {
- mtr_warning("Could not find all required instance manager binaries, " .
- "all im tests will fail, use --skip-im to " .
- "continue without instance manager");
- $instance_manager->{"executable_setup_failed"}= 1;
- }
-
- # Look for the udf_example library
- $lib_udf_example=
- mtr_file_exists(vs_config_dirs('sql', 'udf_example.dll'),
- "$glob_basedir/sql/.libs/udf_example.so",);
-
- # Look for the ha_example library
- $lib_example_plugin=
- mtr_file_exists(vs_config_dirs('storage/example', 'ha_example.dll'),
- "$glob_basedir/storage/example/.libs/ha_example.so",);
-
}
# 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
@@ -1650,119 +939,115 @@ sub executable_setup () {
$exe_mysqltest= mtr_exe_exists("$path_client_bindir/mysqltest");
}
- # Look for mysql_client_test executable which may _not_ exist in
- # some versions, test using it should be skipped
- if ( $glob_use_embedded_server )
- {
- $exe_mysql_client_test=
- mtr_exe_maybe_exists(
- vs_config_dirs('libmysqld/examples', 'mysql_client_test_embedded'),
- "$glob_basedir/libmysqld/examples/mysql_client_test_embedded");
- }
- else
- {
- $exe_mysql_client_test=
- mtr_exe_maybe_exists(vs_config_dirs('tests', 'mysql_client_test'),
- "$glob_basedir/tests/mysql_client_test",
- "$glob_basedir/bin/mysql_client_test");
- }
-
- # Look for bug25714 executable which may _not_ exist in
- # some versions, test using it should be skipped
- $exe_bug25714=
- mtr_exe_maybe_exists(vs_config_dirs('tests', 'bug25714'),
- "$glob_basedir/tests/bug25714");
}
-sub generate_cmdline_mysqldump ($) {
- my($mysqld) = @_;
- return
- mtr_native_path($exe_mysqldump) .
- " --no-defaults -uroot --debug-check " .
- "--port=$mysqld->{'port'} " .
- "--socket=$mysqld->{'path_sock'} --password=";
+
+sub client_debug_arg($$) {
+ my ($args, $client_name)= @_;
+
+ if ( $opt_debug ) {
+ mtr_add_arg($args,
+ "--debug=d:t:A,%s/log/%s.trace",
+ $path_vardir_trace, $client_name)
+ }
}
-##############################################################################
-#
-# Set environment to be used by childs of this process for
-# things that are constant duting the whole lifetime of mysql-test-run.pl
-#
-##############################################################################
+sub mysql_fix_arguments () {
-sub mysql_client_test_arguments()
-{
- my $exe= $exe_mysql_client_test;
+ return "" if ( $is_win32 );
+ my $exe=
+ mtr_script_exists("$basedir/scripts/mysql_fix_privilege_tables",
+ "$path_client_bindir/mysql_fix_privilege_tables");
my $args;
mtr_init_args(\$args);
- if ( $opt_valgrind_mysqltest )
- {
- valgrind_arguments($args, \$exe);
- }
+ mtr_add_arg($args, "--defaults-file=%s", $path_config_file);
- mtr_add_arg($args, "--no-defaults");
- mtr_add_arg($args, "--testcase");
- mtr_add_arg($args, "--user=root");
- mtr_add_arg($args, "--port=$master->[0]->{'port'}");
- mtr_add_arg($args, "--socket=$master->[0]->{'path_sock'}");
+ mtr_add_arg($args, "--basedir=", $basedir);
+ mtr_add_arg($args, "--bindir=", $path_client_bindir);
+ mtr_add_arg($args, "--verbose");
+ return mtr_args2str($exe, @$args);
+}
- if ( $opt_extern || $mysql_version_id >= 50000 )
- {
- mtr_add_arg($args, "--vardir=$opt_vardir")
- }
- if ( $opt_debug )
- {
- mtr_add_arg($args,
- "--debug=d:t:A,$path_vardir_trace/log/mysql_client_test.trace");
- }
+sub client_arguments ($) {
+ my $client_name= shift;
+ my $client_exe= mtr_exe_exists("$path_client_bindir/$client_name");
- if ( $glob_use_embedded_server )
- {
- mtr_add_arg($args,
- " -A --language=$path_language");
- mtr_add_arg($args,
- " -A --datadir=$slave->[0]->{'path_myddir'}");
- mtr_add_arg($args,
- " -A --character-sets-dir=$path_charsetsdir");
+ my $args;
+ mtr_init_args(\$args);
+ mtr_add_arg($args, "--defaults-file=%s", $path_config_file);
+ client_debug_arg($args, $client_name);
+ return mtr_args2str($client_exe, @$args);
+}
+
+
+sub mysqlslap_arguments () {
+ my $exe= mtr_exe_maybe_exists("$path_client_bindir/mysqlslap");
+ if ( $exe eq "" ) {
+ # mysqlap was not found
+
+ if (defined $mysql_version_id and $mysql_version_id >= 50100 ) {
+ mtr_error("Could not find the mysqlslap binary");
+ }
+ return ""; # Don't care about mysqlslap
}
- return join(" ", $exe, @$args);
+ my $args;
+ mtr_init_args(\$args);
+ mtr_add_arg($args, "--defaults-file=%s", $path_config_file);
+ client_debug_arg($args, "mysqlslap");
+ return mtr_args2str($exe, @$args);
}
-sub mysql_upgrade_arguments()
-{
- my $exe= $exe_mysql_upgrade;
+
+sub mysqldump_arguments ($) {
+ my($group_suffix) = @_;
+ my $exe= mtr_exe_exists("$path_client_bindir/mysqldump");
my $args;
mtr_init_args(\$args);
-# if ( $opt_valgrind_mysql_ugrade )
-# {
-# valgrind_arguments($args, \$exe);
-# }
+ mtr_add_arg($args, "--defaults-file=%s", $path_config_file);
+ mtr_add_arg($args, "--defaults-group-suffix=_%s", $group_suffix);
+ client_debug_arg($args, "mysqldump-$group_suffix");
+ return mtr_args2str($exe, @$args);
+}
- mtr_add_arg($args, "--no-defaults");
- mtr_add_arg($args, "--user=root");
- mtr_add_arg($args, "--port=$master->[0]->{'port'}");
- mtr_add_arg($args, "--socket=$master->[0]->{'path_sock'}");
- mtr_add_arg($args, "--datadir=$master->[0]->{'path_myddir'}");
- mtr_add_arg($args, "--basedir=$glob_basedir");
- if ( $opt_debug )
- {
- mtr_add_arg($args,
- "--debug=d:t:A,$path_vardir_trace/log/mysql_upgrade.trace");
+sub mysql_client_test_arguments(){
+ my $exe;
+ # mysql_client_test executable may _not_ exist
+ if ( $opt_embedded_server ) {
+ $exe= mtr_exe_maybe_exists(
+ vs_config_dirs('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'),
+ "$basedir/tests/mysql_client_test",
+ "$basedir/bin/mysql_client_test");
}
- return join(" ", $exe, @$args);
+ my $args;
+ mtr_init_args(\$args);
+ if ( $opt_valgrind_mysqltest ) {
+ valgrind_arguments($args, \$exe);
+ }
+ mtr_add_arg($args, "--defaults-file=%s", $path_config_file);
+ mtr_add_arg($args, "--testcase");
+ mtr_add_arg($args, "--vardir=$opt_vardir");
+ client_debug_arg($args,"mysql_client_test");
+
+ return mtr_args2str($exe, @$args);
}
-# Note that some env is setup in spawn/run, in "mtr_process.pl"
-sub environment_setup () {
+#
+# Set environment to be used by childs of this process for
+# things that are constant during the whole lifetime of mysql-test-run
+#
+sub environment_setup {
umask(022);
@@ -1774,21 +1059,52 @@ 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");
}
- # --------------------------------------------------------------------------
+ # --------------------------------------------------------------------------
# Add the path where libndbclient can be found
# --------------------------------------------------------------------------
if ( $glob_ndbcluster_supported )
{
- push(@ld_library_paths, "$glob_basedir/storage/ndb/src/.libs");
+ push(@ld_library_paths, "$basedir/storage/ndb/src/.libs");
+ }
+
+ # --------------------------------------------------------------------------
+ # Add the path where mysqld will find udf_example.so
+ # --------------------------------------------------------------------------
+ my $lib_udf_example=
+ mtr_file_exists(vs_config_dirs('sql', 'udf_example.dll'),
+ "$basedir/sql/.libs/udf_example.so",);
+
+ if ( $lib_udf_example )
+ {
+ push(@ld_library_paths, dirname($lib_udf_example));
+ }
+
+ $ENV{'UDF_EXAMPLE_LIB'}=
+ ($lib_udf_example ? basename($lib_udf_example) : "");
+ $ENV{'UDF_EXAMPLE_LIB_OPT'}=
+ ($lib_udf_example ? "--plugin_dir=" . dirname($lib_udf_example) : "");
+
+ # --------------------------------------------------------------------------
+ # Add the path where mysqld will find ha_example.so
+ # --------------------------------------------------------------------------
+ if ($mysql_version_id >= 50100) {
+ my $lib_example_plugin=
+ mtr_file_exists(vs_config_dirs('storage/example', 'ha_example.dll'),
+ "$basedir/storage/example/.libs/ha_example.so",);
+ $ENV{'EXAMPLE_PLUGIN'}=
+ ($lib_example_plugin ? basename($lib_example_plugin) : "");
+ $ENV{'EXAMPLE_PLUGIN_OPT'}=
+ ($lib_example_plugin ?
+ "--plugin_dir=" . dirname($lib_example_plugin) : "");
}
# --------------------------------------------------------------------------
@@ -1805,7 +1121,8 @@ sub environment_setup () {
my $deb_version;
if ( $opt_valgrind and -d $debug_libraries_path and
(! -e '/etc/debian_version' or
- ($deb_version= mtr_grab_file('/etc/debian_version')) !~ /^[0-9]+\.[0-9]$/ or
+ ($deb_version=
+ mtr_grab_file('/etc/debian_version')) !~ /^[0-9]+\.[0-9]$/ or
$deb_version > 3.1 ) )
{
push(@ld_library_paths, $debug_libraries_path);
@@ -1833,14 +1150,10 @@ sub environment_setup () {
split(':', $ENV{'LIBPATH'}) : ());
mtr_debug("LIBPATH: $ENV{'LIBPATH'}");
- # --------------------------------------------------------------------------
- # Also command lines in .opt files may contain env vars
- # --------------------------------------------------------------------------
-
$ENV{'CHARSETSDIR'}= $path_charsetsdir;
$ENV{'UMASK'}= "0660"; # The octal *string*
$ENV{'UMASK_DIR'}= "0770"; # The octal *string*
-
+
#
# MySQL tests can produce output in various character sets
# (especially, ctype_xxx.test). To avoid confusing Perl
@@ -1851,289 +1164,75 @@ sub environment_setup () {
#
$ENV{'LC_ALL'}= "C";
$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{'IM_PATH_SOCK'}= $instance_manager->{path_sock};
- $ENV{'IM_USERNAME'}= $instance_manager->{admin_login};
- $ENV{'IM_PASSWORD'}= $instance_manager->{admin_password};
- $ENV{MTR_BUILD_THREAD}= $opt_mtr_build_thread;
-
- $ENV{'EXE_MYSQL'}= $exe_mysql;
-
+ $ENV{'DEFAULT_MASTER_PORT'}= $mysqld_variables{'master-port'} || 3306;
# ----------------------------------------------------
# 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;
- }
-
- # ----------------------------------------------------
- # Setup env for IM
- # ----------------------------------------------------
- if ( ! $opt_skip_im )
- {
- $ENV{'IM_EXE'}= $exe_im;
- $ENV{'IM_PATH_PID'}= $instance_manager->{path_pid};
- $ENV{'IM_PATH_ANGEL_PID'}= $instance_manager->{path_angel_pid};
- $ENV{'IM_PORT'}= $instance_manager->{port};
- $ENV{'IM_DEFAULTS_PATH'}= $instance_manager->{defaults_file};
- $ENV{'IM_PASSWORD_PATH'}= $instance_manager->{password_file};
-
- $ENV{'IM_MYSQLD1_SOCK'}=
- $instance_manager->{instances}->[0]->{path_sock};
- $ENV{'IM_MYSQLD1_PORT'}=
- $instance_manager->{instances}->[0]->{port};
- $ENV{'IM_MYSQLD1_PATH_PID'}=
- $instance_manager->{instances}->[0]->{path_pid};
- $ENV{'IM_MYSQLD2_SOCK'}=
- $instance_manager->{instances}->[1]->{path_sock};
- $ENV{'IM_MYSQLD2_PORT'}=
- $instance_manager->{instances}->[1]->{port};
- $ENV{'IM_MYSQLD2_PATH_PID'}=
- $instance_manager->{instances}->[1]->{path_pid};
- }
+ $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{'NDB_EXAMPLES_BINARY'}= $exe_ndb_example;
+ $ENV{'NDB_EXAMPLES_OUTPUT'}= $path_ndb_testrun_log;
# ----------------------------------------------------
- # Setup env so childs can execute mysqlcheck
+ # mysql clients
# ----------------------------------------------------
- my $cmdline_mysqlcheck=
- mtr_native_path($exe_mysqlcheck) .
- " --no-defaults --debug-check -uroot " .
- "--port=$master->[0]->{'port'} " .
- "--socket=$master->[0]->{'path_sock'} --password=";
+ $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;
- if ( $opt_debug )
- {
- $cmdline_mysqlcheck .=
- " --debug=d:t:A,$path_vardir_trace/log/mysqlcheck.trace";
- }
- $ENV{'MYSQL_CHECK'}= $cmdline_mysqlcheck;
-
- # ----------------------------------------------------
- # Setup env to childs can execute myqldump
- # ----------------------------------------------------
- my $cmdline_mysqldump= generate_cmdline_mysqldump($master->[0]);
- my $cmdline_mysqldumpslave= generate_cmdline_mysqldump($slave->[0]);
-
- if ( $opt_debug )
- {
- $cmdline_mysqldump .=
- " --debug=d:t:A,$path_vardir_trace/log/mysqldump-master.trace";
- $cmdline_mysqldumpslave .=
- " --debug=d:t:A,$path_vardir_trace/log/mysqldump-slave.trace";
- }
- $ENV{'MYSQL_DUMP'}= $cmdline_mysqldump;
- $ENV{'MYSQL_DUMP_SLAVE'}= $cmdline_mysqldumpslave;
-
-
- # ----------------------------------------------------
- # Setup env so childs can execute mysqlslap
# ----------------------------------------------------
- if ( $exe_mysqlslap )
- {
- my $cmdline_mysqlslap=
- mtr_native_path($exe_mysqlslap) .
- " -uroot " .
- "--port=$master->[0]->{'port'} " .
- "--socket=$master->[0]->{'path_sock'} --password= ";
-
- if ( $opt_debug )
- {
- $cmdline_mysqlslap .=
- " --debug=d:t:A,$path_vardir_trace/log/mysqlslap.trace";
- }
- $ENV{'MYSQL_SLAP'}= $cmdline_mysqlslap;
- }
-
- # ----------------------------------------------------
- # Setup env so childs can execute mysqlimport
- # ----------------------------------------------------
- my $cmdline_mysqlimport=
- mtr_native_path($exe_mysqlimport) .
- " -uroot --debug-check " .
- "--port=$master->[0]->{'port'} " .
- "--socket=$master->[0]->{'path_sock'} --password=";
-
- if ( $opt_debug )
- {
- $cmdline_mysqlimport .=
- " --debug=d:t:A,$path_vardir_trace/log/mysqlimport.trace";
- }
- $ENV{'MYSQL_IMPORT'}= $cmdline_mysqlimport;
-
-
- # ----------------------------------------------------
- # Setup env so childs can execute mysqlshow
- # ----------------------------------------------------
- my $cmdline_mysqlshow=
- mtr_native_path($exe_mysqlshow) .
- " -uroot --debug-check " .
- "--port=$master->[0]->{'port'} " .
- "--socket=$master->[0]->{'path_sock'} --password=";
-
- if ( $opt_debug )
- {
- $cmdline_mysqlshow .=
- " --debug=d:t:A,$path_vardir_trace/log/mysqlshow.trace";
- }
- $ENV{'MYSQL_SHOW'}= $cmdline_mysqlshow;
-
- # ----------------------------------------------------
- # Setup env so childs can execute mysqlbinlog
- # ----------------------------------------------------
- my $cmdline_mysqlbinlog=
- mtr_native_path($exe_mysqlbinlog) .
- " --no-defaults --disable-force-if-open --debug-check";
- if ( !$opt_extern && $mysql_version_id >= 50000 )
- {
- $cmdline_mysqlbinlog .=" --character-sets-dir=$path_charsetsdir";
- }
-
- if ( $opt_debug )
- {
- $cmdline_mysqlbinlog .=
- " --debug=d:t:A,$path_vardir_trace/log/mysqlbinlog.trace";
- }
- $ENV{'MYSQL_BINLOG'}= $cmdline_mysqlbinlog;
-
- # ----------------------------------------------------
- # Setup env so childs can execute mysql
- # ----------------------------------------------------
- my $cmdline_mysql=
- mtr_native_path($exe_mysql) .
- " --no-defaults --debug-check --host=localhost --user=root --password= " .
- "--port=$master->[0]->{'port'} " .
- "--socket=$master->[0]->{'path_sock'} ".
- "--character-sets-dir=$path_charsetsdir";
-
- $ENV{'MYSQL'}= $cmdline_mysql;
-
- # ----------------------------------------------------
- # Setup env so childs can execute bug25714
- # ----------------------------------------------------
- $ENV{'MYSQL_BUG25714'}= $exe_bug25714;
-
- # ----------------------------------------------------
- # Setup env so childs can execute mysql_client_test
- # ----------------------------------------------------
- $ENV{'MYSQL_CLIENT_TEST'}= mysql_client_test_arguments();
-
- # ----------------------------------------------------
- # Setup env so childs can execute mysql_upgrade
+ # bug25714 executable may _not_ exist in
+ # some versions, test using it should be skipped
# ----------------------------------------------------
- if ( !$opt_extern && $mysql_version_id >= 50000 )
- {
- $ENV{'MYSQL_UPGRADE'}= mysql_upgrade_arguments();
- }
+ my $exe_bug25714=
+ mtr_exe_maybe_exists(vs_config_dirs('tests', 'bug25714'),
+ "$basedir/tests/bug25714");
+ $ENV{'MYSQL_BUG25714'}= mtr_native_path($exe_bug25714);
# ----------------------------------------------------
- # Setup env so childs can execute mysql_fix_system_tables
+ # mysql_fix_privilege_tables.sql
# ----------------------------------------------------
- if ( !$opt_extern && ! $glob_win32 )
- {
- my $cmdline_mysql_fix_system_tables=
- "$exe_mysql_fix_system_tables --no-defaults --host=localhost " .
- "--user=root --password= " .
- "--basedir=$glob_basedir --bindir=$path_client_bindir --verbose " .
- "--port=$master->[0]->{'port'} " .
- "--socket=$master->[0]->{'path_sock'}";
- $ENV{'MYSQL_FIX_SYSTEM_TABLES'}= $cmdline_mysql_fix_system_tables;
-
- }
+ my $file_mysql_fix_privilege_tables=
+ 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;
# ----------------------------------------------------
- # Setup env so childs can execute my_print_defaults
+ # my_print_defaults
# ----------------------------------------------------
+ my $exe_my_print_defaults=
+ mtr_exe_exists(vs_config_dirs('extra', 'my_print_defaults'),
+ "$path_client_bindir/my_print_defaults",
+ "$basedir/extra/my_print_defaults");
$ENV{'MYSQL_MY_PRINT_DEFAULTS'}= mtr_native_path($exe_my_print_defaults);
# ----------------------------------------------------
- # Setup env so childs can execute mysqladmin
- # ----------------------------------------------------
- $ENV{'MYSQLADMIN'}= mtr_native_path($exe_mysqladmin);
-
- # ----------------------------------------------------
- # Setup env so childs can execute perror
+ # perror
# ----------------------------------------------------
+ my $exe_perror= mtr_exe_exists(vs_config_dirs('extra', 'perror'),
+ "$basedir/extra/perror",
+ "$path_client_bindir/perror");
$ENV{'MY_PERROR'}= mtr_native_path($exe_perror);
- # ----------------------------------------------------
- # Add the path where mysqld will find udf_example.so
- # ----------------------------------------------------
- $ENV{'UDF_EXAMPLE_LIB'}=
- ($lib_udf_example ? basename($lib_udf_example) : "");
- $ENV{'UDF_EXAMPLE_LIB_OPT'}=
- ($lib_udf_example ? "--plugin_dir=" . dirname($lib_udf_example) : "");
-
- # ----------------------------------------------------
- # Add the path where mysqld will find ha_example.so
- # ----------------------------------------------------
- $ENV{'EXAMPLE_PLUGIN'}=
- ($lib_example_plugin ? basename($lib_example_plugin) : "");
- $ENV{'EXAMPLE_PLUGIN_OPT'}=
- ($lib_example_plugin ? "--plugin_dir=" . dirname($lib_example_plugin) : "");
-
- # ----------------------------------------------------
- # We are nice and report a bit about our settings
- # ----------------------------------------------------
- if (!$opt_extern)
- {
- print "Using MTR_BUILD_THREAD = $ENV{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";
- }
- }
- if ( ! $opt_skip_im )
- {
- print "Using IM_PORT = $ENV{IM_PORT}\n";
- print "Using IM_MYSQLD1_PORT = $ENV{IM_MYSQLD1_PORT}\n";
- print "Using IM_MYSQLD2_PORT = $ENV{IM_MYSQLD2_PORT}\n";
- }
- }
-
# Create an environment variable to make it possible
# to detect that valgrind is being used from test cases
$ENV{'VALGRIND_TEST'}= $opt_valgrind;
@@ -2141,52 +1240,6 @@ sub environment_setup () {
}
-##############################################################################
-#
-# If we get a ^C, we try to clean up before termination
-#
-##############################################################################
-# FIXME check restrictions what to do in a signal handler
-
-sub signal_setup () {
- $SIG{INT}= \&handle_int_signal;
-}
-
-
-sub handle_int_signal () {
- $SIG{INT}= 'DEFAULT'; # If we get a ^C again, we die...
- mtr_warning("got INT signal, cleaning up.....");
- stop_all_servers();
- mtr_error("We die from ^C signal from user");
-}
-
-
-##############################################################################
-#
-# Handle left overs from previous runs
-#
-##############################################################################
-
-sub kill_running_servers () {
-
- if ( $opt_fast or $glob_use_embedded_server )
- {
- # FIXME is embedded server really using PID files?!
- unlink($master->[0]->{'path_pid'});
- unlink($master->[1]->{'path_pid'});
- unlink($slave->[0]->{'path_pid'});
- unlink($slave->[1]->{'path_pid'});
- unlink($slave->[2]->{'path_pid'});
- }
- else
- {
- # Ensure that no old mysqld test servers are running
- # This is different from terminating processes we have
- # started from this run of the script, this is terminating
- # leftovers from previous runs.
- mtr_kill_leftovers();
- }
-}
#
# Remove var and any directories in var/ created by previous
@@ -2194,11 +1247,11 @@ sub kill_running_servers () {
#
sub remove_stale_vardir () {
- mtr_report("Removing Stale Files");
+ mtr_report("Removing old var directory...");
# 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 )
@@ -2214,7 +1267,7 @@ sub remove_stale_vardir () {
{
# Remove the directory which the link points at
mtr_verbose("Removing " . readlink($opt_vardir));
- mtr_rmtree(readlink($opt_vardir));
+ rmtree(readlink($opt_vardir));
# Remove the "var" symlink
mtr_verbose("unlink($opt_vardir)");
@@ -2223,7 +1276,7 @@ sub remove_stale_vardir () {
elsif ( $opt_mem )
{
# Just remove the "var" symlink
- mtr_report("WARNING: Removing '$opt_vardir' symlink it's wrong");
+ mtr_report(" - WARNING: Removing '$opt_vardir' symlink it's wrong");
mtr_verbose("unlink($opt_vardir)");
unlink($opt_vardir);
@@ -2233,7 +1286,7 @@ sub remove_stale_vardir () {
# Some users creates a soft link in mysql-test/var to another area
# - allow it, but remove all files in it
- mtr_report("WARNING: Using the 'mysql-test/var' symlink");
+ mtr_report(" - WARNING: Using the 'mysql-test/var' symlink");
# Make sure the directory where it points exist
mtr_error("The destination for symlink $opt_vardir does not exist")
@@ -2242,7 +1295,7 @@ sub remove_stale_vardir () {
foreach my $bin ( glob("$opt_vardir/*") )
{
mtr_verbose("Removing bin $bin");
- mtr_rmtree($bin);
+ rmtree($bin);
}
}
}
@@ -2250,7 +1303,7 @@ sub remove_stale_vardir () {
{
# Remove the entire "var" dir
mtr_verbose("Removing $opt_vardir/");
- mtr_rmtree("$opt_vardir/");
+ rmtree("$opt_vardir/");
}
if ( $opt_mem )
@@ -2259,7 +1312,7 @@ sub remove_stale_vardir () {
# remove the $opt_mem dir to assure the symlink
# won't point at an old directory
mtr_verbose("Removing $opt_mem");
- mtr_rmtree($opt_mem);
+ rmtree($opt_mem);
}
}
@@ -2272,19 +1325,21 @@ sub remove_stale_vardir () {
# Remove the var/ dir in mysql-test dir if any
# this could be an old symlink that shouldn't be there
mtr_verbose("Removing $default_vardir");
- mtr_rmtree($default_vardir);
+ rmtree($default_vardir);
# Remove the "var" dir
mtr_verbose("Removing $opt_vardir/");
- mtr_rmtree("$opt_vardir/");
+ rmtree("$opt_vardir/");
}
}
+
+
#
# Create var and the directories needed in var
#
sub setup_vardir() {
- mtr_report("Creating Directories");
+ mtr_report("Creating var directory...");
if ( $opt_vardir eq $default_vardir )
{
@@ -2305,7 +1360,7 @@ sub setup_vardir() {
mtr_verbose("Creating $opt_mem");
mkpath($opt_mem);
- mtr_report("Symlinking 'var' to '$opt_mem'");
+ mtr_report(" - symlinking 'var' to '$opt_mem'");
symlink($opt_mem, $opt_vardir);
}
}
@@ -2328,30 +1383,9 @@ sub setup_vardir() {
mkpath("$opt_vardir/tmp");
mkpath($opt_tmpdir) if $opt_tmpdir ne "$opt_vardir/tmp";
- # Create new data dirs
- foreach my $data_dir (@data_dir_lst)
- {
- mkpath("$data_dir/mysql");
- mkpath("$data_dir/test");
- }
-
- # 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
- mkpath("$opt_vardir/std_data_ln");
- opendir(DIR, "$glob_mysql_test_dir/std_data")
- or mtr_error("Can't find the std_data directory: $!");
- for(readdir(DIR)) {
- next if -d "$glob_mysql_test_dir/std_data/$_";
- copy("$glob_mysql_test_dir/std_data/$_", "$opt_vardir/std_data_ln/$_");
- }
- closedir(DIR);
- }
+ # 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"))
@@ -2361,9 +1395,11 @@ sub setup_vardir() {
}
+#
+# Check if running as root
+# i.e a file can be read regardless what mode we set it to
+#
sub check_running_as_root () {
- # Check if running as root
- # i.e a file can be read regardless what mode we set it to
my $test_file= "$opt_vardir/test_running_as_root.txt";
mtr_tofile($test_file, "MySQL");
chmod(oct("0000"), $test_file);
@@ -2391,19 +1427,15 @@ sub check_running_as_root () {
chmod(oct("0755"), $test_file);
unlink($test_file);
-
}
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;
@@ -2416,12 +1448,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;
}
@@ -2431,7 +1463,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 )
@@ -2440,11 +1472,11 @@ sub check_debug_support ($) {
}
return;
}
- mtr_report("Binaries are debug compiled");
+ mtr_report(" - binaries are debug compiled");
$debug_compiled_binaries= 1;
}
-##############################################################################
+
#
# Helper function to handle configuration-based subdirectories which Visual
# Studio uses for storing binaries. If opt_vs_config is set, this returns
@@ -2453,51 +1485,45 @@ sub check_debug_support ($) {
#
# $exe can be undefined, if the directory itself will be used
#
-###############################################################################
-
sub vs_config_dirs ($$) {
my ($path_part, $exe) = @_;
$exe = "" if not defined $exe;
+ # Don't look in these dirs when not on windows
+ 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");
}
-##############################################################################
-#
-# Start the ndb cluster
-#
-##############################################################################
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 )
{
@@ -2510,97 +1536,15 @@ sub check_ndbcluster_support ($) {
}
-sub ndbcluster_start_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;
-
-
- # Start cluster with "--initial"
-
- ndbcluster_start($cluster, "--initial");
-
- 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)
@@ -2611,29 +1555,45 @@ sub ndbcluster_wait_started($$){
# Start the ndb_waiter which will connect to the ndb_mgmd
# and poll it for state of the ndbd's, will return when
# all nodes in the cluster is started
- my $res= mtr_run($exe_ndb_waiter, $args,
- "", $path_waiter_log, $path_waiter_log, "");
- mtr_verbose("ndbcluster_wait_started, returns: $res") if $res;
- return $res;
-}
+ my $res= My::SafeProcess->run
+ (
+ name => "ndb_waiter ".$cluster->name(),
+ path => $exe_ndb_waiter,
+ args => \$args,
+ output => $path_waitlog,
+ error => $path_waitlog,
+ append => 1,
+ );
+ # 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;
+ }
+ }
-sub mysqld_wait_started($){
- my $mysqld= shift;
+ # 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 (sleep_until_file_created($mysqld->{'path_pid'},
- $mysqld->{'start_timeout'},
- $mysqld->{'pid'}) == 0)
+ if ($res)
{
- # Failed to wait for pid file
+ mtr_verbose("ndbcluster_wait_started failed");
return 1;
}
-
- # Get the "real pid" of the process, it will be used for killing
- # the process in ActiveState's perl on windows
- $mysqld->{'real_pid'}= mtr_get_pid_from_file($mysqld->{'path_pid'});
-
return 0;
}
@@ -2642,267 +1602,290 @@ sub ndb_mgmd_wait_started($) {
my ($cluster)= @_;
my $retries= 100;
- while (ndbcluster_wait_started($cluster, "--no-contact") and
- $retries)
+ while ($retries)
{
- # Millisceond sleep emulated with select
- select(undef, undef, undef, (0.1));
+ 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;
+ }
+ mtr_milli_sleep(100);
$retries--;
}
- return $retries == 0;
-
+ return 1;
}
-sub ndb_mgmd_start ($) {
- my $cluster= shift;
- my $args; # Arg vector
- my $pid= -1;
+sub ndb_mgmd_start ($$) {
+ my ($cluster, $ndb_mgmd)= @_;
+
+ mtr_verbose("ndb_mgmd_start");
+ my $dir= $ndb_mgmd->value("DataDir");
+ mkpath($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= "$dir/ndb_mgmd.log";
- my $path_ndb_mgmd_log= "$cluster->{'data_dir'}/\l$cluster->{'name'}_ndb_mgmd.log";
- $pid= mtr_spawn($exe_ndb_mgmd, $args, "",
- $path_ndb_mgmd_log,
- $path_ndb_mgmd_log,
- "",
- { append_log_file => 1 });
+ $ndb_mgmd->{'proc'}= My::SafeProcess->new
+ (
+ name => $ndb_mgmd->after('cluster_config.'),
+ path => $exe_ndb_mgmd,
+ args => \$args,
+ output => $path_ndb_mgmd_log,
+ error => $path_ndb_mgmd_log,
+ append => 1,
+ verbose => $opt_verbose,
+ );
+ 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;
}
- # Remember pid of ndb_mgmd
- $cluster->{'pid'}= $pid;
-
- mtr_verbose("ndb_mgmd_start, pid: $pid");
-
- return $pid;
+ return 0;
}
-sub ndbd_start ($$$) {
- my $cluster= shift;
- my $idx= shift;
- my $extra_args= shift;
+sub ndbd_start {
+ my ($cluster, $ndbd)= @_;
- my $args; # Arg vector
- my $pid= -1;
+ mtr_verbose("ndbd_start");
+ my $dir= $ndbd->value("DataDir");
+ mkpath($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'}");
- if ( $mysql_version_id >= 50000)
- {
- 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";
- $pid= mtr_spawn($exe_ndbd, $args, "",
- $path_ndbd_log,
- $path_ndbd_log,
- "",
- { append_log_file => 1 });
+# > 5.0 { 'character-sets-dir' => \&fix_charset_dir },
- # Add pid to list of pids for this cluster
- $cluster->{'ndbds'}->[$idx]->{'pid'}= $pid;
- # Rememeber options used when starting
- $cluster->{'ndbds'}->[$idx]->{'start_extra_args'}= $extra_args;
- $cluster->{'ndbds'}->[$idx]->{'idx'}= $idx;
+ my $path_ndbd_log= "$dir/ndbd.log";
+ my $proc= My::SafeProcess->new
+ (
+ name => $ndbd->after('cluster_config.'),
+ path => $exe_ndbd,
+ args => \$args,
+ output => $path_ndbd_log,
+ error => $path_ndbd_log,
+ append => 1,
+ verbose => $opt_verbose,
+ );
+ mtr_verbose("Started $proc");
- mtr_verbose("ndbd_start, pid: $pid");
+ $ndbd->{proc}= $proc;
- return $pid;
+ 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 ( $cluster->{'pid'} )
+ 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
+# Run the collected tests
#
-##############################################################################
-
-sub run_benchmarks ($) {
- my $benchmark= shift;
+my $suite_timeout_proc;
+sub run_tests {
+ my ($tests)= @_;
- my $args;
+ mtr_report();
+ mtr_print_thick_line();
+ mtr_print_header();
- if ( ! $glob_use_embedded_server )
+ $suite_timeout_proc= My::SafeProcess->timer($opt_suite_timeout* 60);
+ foreach my $tinfo ( @$tests )
{
- mysqld_start($master->[0],[],[]);
- if ( ! $master->[0]->{'pid'} )
+ if (run_testcase_check_skip_test($tinfo))
{
- mtr_error("Can't start the mysqld server");
+ next;
}
+
+ run_testcase($tinfo);
}
+ # Kill the test suite timer
+ $suite_timeout_proc->kill();
- mtr_init_args(\$args);
+ mtr_print_line();
- mtr_add_arg($args, "--socket=%s", $master->[0]->{'path_sock'});
- mtr_add_arg($args, "--user=%s", $opt_user);
+ stop_all_servers();
- if ( $opt_small_bench )
+ if ( $opt_gcov )
{
- mtr_add_arg($args, "--small-test");
- mtr_add_arg($args, "--small-tables");
+ gcov_collect(); # collect coverage information
}
- if ( $opt_with_ndbcluster )
- {
- mtr_add_arg($args, "--create-options=TYPE=ndb");
- }
+ mtr_report_stats($tests);
- chdir($glob_mysql_bench_dir)
- or mtr_error("Couldn't chdir to '$glob_mysql_bench_dir': $!");
+}
- if ( ! $benchmark )
- {
- mtr_add_arg($args, "--log");
- mtr_run("$glob_mysql_bench_dir/run-all-tests", $args, "", "", "", "");
- # FIXME check result code?!
- }
- elsif ( -x $benchmark )
- {
- mtr_run("$glob_mysql_bench_dir/$benchmark", $args, "", "", "", "");
- # FIXME check result code?!
- }
- else
- {
- mtr_error("Benchmark $benchmark not found");
- }
- chdir($glob_mysql_test_dir); # Go back
+sub create_config_file_for_extern {
+ my %opts=
+ (
+ socket => '/tmp/mysqld.sock',
+ port => 3306,
+ user => 'test',
+ password => '',
+ @_
+ );
- if ( ! $glob_use_embedded_server )
- {
- stop_masters();
+ 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
-##############################################################################
-#
-# Run the tests
-#
-##############################################################################
+# binlog reads from [client] and [mysqlbinlog]
+[mysqlbinlog]
+character-sets-dir= $path_charsetsdir
-sub run_tests () {
- my ($tests)= @_;
+# mysql_fix_privilege_tables.sh don't read from [client]
+[mysql_fix_privilege_tables]
+socket = $opts{'socket'}
+port = $opts{'port'}
+user = $opts{'user'}
+password = $opts{'password'}
- mtr_print_thick_line();
- mtr_timer_start($glob_timers,"suite", 60 * $opt_suite_timeout);
+EOF
+;
- mtr_report_tests_not_skipped_though_disabled($tests);
+ $F= undef; # Close file
+}
- mtr_print_header();
- foreach my $tinfo ( @$tests )
+#
+# Kill processes left from previous runs, normally
+# there should be none so make sure to warn
+# if there is one
+#
+sub kill_leftovers ($) {
+ my $rundir= shift;
+ return unless ( -d $rundir );
+
+ mtr_report("Checking leftover processes...");
+
+ # Scan the "run" directory for process id's to kill
+ opendir(RUNDIR, $rundir)
+ or mtr_error("kill_leftovers, can't open dir \"$rundir\": $!");
+ while ( my $elem= readdir(RUNDIR) )
{
- if (run_testcase_check_skip_test($tinfo))
+ # Only read pid from files that end with .pid
+ if ( $elem =~ /.*[.]pid$/ )
{
- next;
- }
-
- mtr_timer_start($glob_timers,"testcase", 60 * $opt_testcase_timeout);
- run_testcase($tinfo);
- mtr_timer_stop($glob_timers,"testcase");
- }
+ my $pidfile= "$rundir/$elem";
+ next unless -f $pidfile;
+ my $pid= mtr_fromfile($pidfile);
+ unlink($pidfile);
+ unless ($pid=~ /^(\d+)/){
+ # The pid was not a valid number
+ mtr_warning("Got invalid pid '$pid' from '$elem'");
+ next;
+ }
+ mtr_report(" - found old pid $pid in '$elem', killing it...");
- mtr_print_line();
+ my $ret= kill(9, $pid);
+ if ($ret == 0) {
+ mtr_report(" process did not exist!");
+ next;
+ }
- if ( ! $glob_debugger and
- ! $opt_extern and
- ! $glob_use_embedded_server )
- {
- stop_all_servers();
+ my $check_counter= 100;
+ while ($ret > 0 and $check_counter--) {
+ mtr_milli_sleep(100);
+ $ret= kill(0, $pid);
+ }
+ mtr_report($check_counter ? " ok!" : " failed!");
+ }
+ else
+ {
+ mtr_warning("Found non pid file '$elem' in '$rundir'")
+ if -f "$rundir/$elem";
+ }
}
+ closedir(RUNDIR);
+}
- if ( $opt_gcov )
- {
- gcov_collect(); # collect coverage information
+#
+# Check that all the ports that are going to
+# be used are free
+#
+sub check_ports_free
+{
+ my @ports_to_check;
+ for ($opt_baseport..$opt_baseport+9){
+ push(@ports_to_check, $_);
}
- if ( $opt_gprof )
- {
- gprof_collect(); # collect coverage information
+ 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
+ }
}
- mtr_report_stats($tests);
-
- mtr_timer_stop($glob_timers,"suite");
+ return 0; # All ports free
}
-##############################################################################
-#
-# Initiate the test databases
-#
-##############################################################################
-
-sub initialize_servers () {
-
- datadir_list_setup();
+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
if ( ! -d $opt_vardir )
{
- mtr_report("Creating '$opt_vardir'");
setup_vardir();
}
else
@@ -2912,7 +1895,14 @@ sub initialize_servers () {
}
else
{
- kill_running_servers();
+ # Kill leftovers from previous run
+ # using any pidfiles found in var/run
+ kill_leftovers("$opt_vardir/run");
+
+ if (check_ports_free()){
+ # Some port was not free(which one has already been printed)
+ mtr_error("Some port(s) was not free")
+ }
if ( ! $opt_start_dirty )
{
@@ -2920,126 +1910,39 @@ sub initialize_servers () {
setup_vardir();
mysql_install_db();
- if ( $opt_force )
- {
- # Save a snapshot of the freshly installed db
- # to make it possible to restore to a known point in time
- save_installed_db();
- }
}
}
check_running_as_root();
mtr_log_init("$opt_vardir/log/mysql-test-run.log");
-
-}
-
-sub mysql_install_db () {
-
- install_db('master', $master->[0]->{'path_myddir'});
-
- if ($max_master_num > 1)
- {
- copy_install_db('master', $master->[1]->{'path_myddir'});
- }
-
- # Install the number of slave databses needed
- for (my $idx= 0; $idx < $max_slave_num; $idx++)
- {
- copy_install_db("slave".($idx+1), $slave->[$idx]->{'path_myddir'});
- }
-
- if ( ! $opt_skip_im )
- {
- im_prepare_env($instance_manager);
- }
-
- my $cluster_started_ok= 1; # Assume it can be started
-
- my $cluster= $clusters->[0]; # Master cluster
- if ($opt_skip_ndbcluster ||
- $cluster->{'use_running'} ||
- $cluster->{executable_setup_failed})
- {
- # Don't install master cluster
- }
- elsif (ndbcluster_start_install($cluster))
- {
- mtr_warning("Failed to start install of $cluster->{name}");
- $cluster_started_ok= 0;
- }
-
- $cluster= $clusters->[1]; # Slave cluster
- if ($max_slave_num == 0 ||
- $opt_skip_ndbcluster_slave ||
- $cluster->{'use_running'} ||
- $cluster->{executable_setup_failed})
- {
- # Don't install slave cluster
- }
- elsif (ndbcluster_start_install($cluster))
- {
- mtr_warning("Failed to start install of $cluster->{name}");
- $cluster_started_ok= 0;
- }
-
- foreach $cluster (@{$clusters})
- {
-
- next if !$cluster->{'pid'};
-
- $cluster->{'installed_ok'}= 1; # Assume install suceeds
-
- if (ndbcluster_wait_started($cluster, ""))
- {
- # failed to install, disable usage and flag that its no ok
- mtr_report("ndbcluster_install of $cluster->{'name'} failed");
- $cluster->{"installed_ok"}= 0;
-
- $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;
}
-sub copy_install_db ($$) {
- my $type= shift;
- my $data_dir= shift;
-
- mtr_report("Installing \u$type Database");
+#
+# Copy the reference database into selected datadir
+#
+sub copy_install_db ($) {
+ my $path_data_dir= shift;
- # Just copy the installed db from first master
- mtr_copy_dir($master->[0]->{'path_myddir'}, $data_dir);
+ # Don't install over another db
+ mtr_error("There is already an installed db in '$path_data_dir'")
+ if -d $path_data_dir;
+ # copy the installed db into place
+ copytree("$opt_vardir/install.db", $path_data_dir);
}
-sub install_db ($$) {
- my $type= shift;
- my $data_dir= shift;
-
- mtr_report("Installing \u$type Database");
+sub mysql_install_db {
+ my $data_dir= "$opt_vardir/install.db";
+ mtr_report("Installing system database...");
my $args;
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");
@@ -3048,15 +1951,12 @@ sub install_db ($$) {
if ( $opt_debug )
{
- mtr_add_arg($args, "--debug=d:t:i:A,%s/log/bootstrap_%s.trace",
- $path_vardir_trace, $type);
+ mtr_add_arg($args, "--debug=d:t:i:A,%s/log/bootstrap.trace",
+ $path_vardir_trace);
}
- if ( ! $glob_netware )
- {
- mtr_add_arg($args, "--language=%s", $path_language);
- mtr_add_arg($args, "--character-sets-dir=%s", $path_charsetsdir);
- }
+ mtr_add_arg($args, "--language=%s", $path_language);
+ mtr_add_arg($args, "--character-sets-dir=%s", $path_charsetsdir);
# If DISABLE_GRANT_OPTIONS is defined when the server is compiled (e.g.,
# configure --disable-grant-options), mysqld will not recognize the
@@ -3109,11 +2009,20 @@ sub install_db ($$) {
mtr_tofile($path_bootstrap_log,
"$exe_mysqld_bootstrap " . join(" ", @$args) . "\n");
-
- if ( mtr_run($exe_mysqld_bootstrap, $args, $bootstrap_sql_file,
- $path_bootstrap_log, $path_bootstrap_log,
- "", { append_log_file => 1 }) != 0 )
-
+ # Create directories mysql and test
+ mkpath("$data_dir/mysql");
+ mkpath("$data_dir/test");
+
+ if ( My::SafeProcess->run
+ (
+ name => "bootstrap",
+ path => $exe_mysqld_bootstrap,
+ args => \$args,
+ input => $bootstrap_sql_file,
+ output => $path_bootstrap_log,
+ error => $path_bootstrap_log,
+ append => 1,
+ ) != 0)
{
mtr_error("Error executing mysqld --bootstrap\n" .
"Could not install system database from $bootstrap_sql_file\n" .
@@ -3122,125 +2031,6 @@ sub install_db ($$) {
}
-sub im_prepare_env($) {
- my $instance_manager = shift;
-
- im_create_passwd_file($instance_manager);
- im_prepare_data_dir($instance_manager);
-}
-
-
-sub im_create_passwd_file($) {
- my $instance_manager = shift;
-
- my $pwd_file_path = $instance_manager->{'password_file'};
-
- mtr_report("Creating IM password file ($pwd_file_path)");
-
- open(OUT, ">", $pwd_file_path)
- or mtr_error("Can't write to $pwd_file_path: $!");
-
- print OUT $instance_manager->{'admin_login'}, ":",
- $instance_manager->{'admin_sha1'}, "\n";
-
- close(OUT);
-}
-
-
-sub im_create_defaults_file($) {
- my $instance_manager = shift;
-
- my $defaults_file = $instance_manager->{'defaults_file'};
-
- open(OUT, ">", $defaults_file)
- or mtr_error("Can't write to $defaults_file: $!");
-
- print OUT <<EOF
-[mysql]
-
-[manager]
-pid-file = $instance_manager->{path_pid}
-angel-pid-file = $instance_manager->{path_angel_pid}
-socket = $instance_manager->{path_sock}
-port = $instance_manager->{port}
-password-file = $instance_manager->{password_file}
-default-mysqld-path = $exe_mysqld
-
-EOF
-;
-
- foreach my $instance (@{$instance_manager->{'instances'}})
- {
- my $server_id = $instance->{'server_id'};
-
- print OUT <<EOF
-[mysqld$server_id]
-socket = $instance->{path_sock}
-pid-file = $instance->{path_pid}
-port = $instance->{port}
-datadir = $instance->{path_datadir}
-log = $instance->{path_datadir}/mysqld$server_id.log
-log-error = $instance->{path_datadir}/mysqld$server_id.err.log
-log-slow-queries = $instance->{path_datadir}/mysqld$server_id.slow.log
-language = $path_language
-character-sets-dir = $path_charsetsdir
-basedir = $path_my_basedir
-server_id = $server_id
-shutdown-delay = 10
-skip-stack-trace
-loose-skip-innodb
-loose-skip-ndbcluster
-EOF
-;
- if ( $mysql_version_id < 50100 )
- {
- print OUT "skip-bdb\n";
- }
- print OUT "nonguarded\n" if $instance->{'nonguarded'};
- if ( $mysql_version_id >= 50100 )
- {
- print OUT "log-output=FILE\n" if $instance->{'old_log_format'};
- }
- print OUT "\n";
- }
-
- close(OUT);
-}
-
-
-sub im_prepare_data_dir($) {
- my $instance_manager = shift;
-
- foreach my $instance (@{$instance_manager->{'instances'}})
- {
- copy_install_db(
- 'im_mysqld_' . $instance->{'server_id'},
- $instance->{'path_datadir'});
- }
-}
-
-
-
-#
-# Restore snapshot of the installed slave databases
-# if the snapshot exists
-#
-sub restore_slave_databases ($) {
- my ($num_slaves)= @_;
-
- if ( -d $path_snapshot)
- {
- for (my $idx= 0; $idx < $num_slaves; $idx++)
- {
- my $data_dir= $slave->[$idx]->{'path_myddir'};
- my $name= basename($data_dir);
- mtr_rmtree($data_dir);
- mtr_copy_dir("$path_snapshot/$name", $data_dir);
- }
- }
-}
-
-
sub run_testcase_check_skip_test($)
{
my ($tinfo)= @_;
@@ -3254,69 +2044,61 @@ sub run_testcase_check_skip_test($)
if ( $tinfo->{'skip'} )
{
- mtr_report_test_name($tinfo);
mtr_report_test_skipped($tinfo);
return 1;
}
if ($tinfo->{'ndb_test'})
{
- foreach my $cluster (@{$clusters})
+ foreach my $cluster ( clusters() )
{
- # Slave cluster is skipped and thus not
- # installed, no need to perform checks
- 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'} )
{
- mtr_report_test_name($tinfo);
$tinfo->{comment}=
"Failed to find cluster binaries";
mtr_report_test_failed($tinfo);
return 1;
}
-
- # If test needs this cluster, check it was installed ok
- if ( !$cluster->{'installed_ok'} )
- {
- mtr_report_test_name($tinfo);
- $tinfo->{comment}=
- "Cluster $cluster->{'name'} was not installed ok";
- mtr_report_test_failed($tinfo);
- return 1;
- }
-
}
}
- if ( $tinfo->{'component_id'} eq 'im' )
+ return 0;
+}
+
+sub dynamic_binlog_format_switch {
+ my ($tinfo)= @_;
+ # Dynamically switch binlog format started MySQL servers
+ foreach my $mysqld ( mysqlds() )
{
- # If test needs im, check binaries was found ok
- if ( $instance_manager->{'executable_setup_failed'} )
+ # Skip servers that are restarted between each test
+ next if $mysqld->option('#!force-restart');
+
+ my $sql= "include/set_binlog_format_".$tinfo->{binlog_format_switch}.".sql";
+ 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->after('mysqld'));
+ mtr_verbose("Dynamically switching binlog format to:",
+ $tinfo->{binlog_format_switch});
+ my $res= My::SafeProcess->run
+ (
+ name => "switch binlog format ".$mysqld->name(),
+ path => $exe_mysql,
+ args => \$args,
+ input => $sql,
+ );
+
+ if ($res != 0)
{
- mtr_report_test_name($tinfo);
- $tinfo->{comment}=
- "Failed to find MySQL manager binaries";
- mtr_report_test_failed($tinfo);
- return 1;
+ mtr_error("Failed to switch binlog format");
}
}
-
- return 0;
}
-
sub do_before_run_mysqltest($)
{
my $tinfo= shift;
- my $args;
# Remove old files produced by mysqltest
my $base_file= mtr_match_extension($tinfo->{'result_file'},
@@ -3326,80 +2108,43 @@ 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 (defined $tinfo->{binlog_format} and $mysql_version_id > 50100 )
- {
- # Dynamically switch binlog format of
- # master, slave is always restarted
- foreach my $server ( @$master )
- {
- next unless ($server->{'pid'});
-
- mtr_init_args(\$args);
- mtr_add_arg($args, "--no-defaults");
- mtr_add_arg($args, "--user=root");
- mtr_add_arg($args, "--port=$server->{'port'}");
- mtr_add_arg($args, "--socket=$server->{'path_sock'}");
-
- my $sql= "include/set_binlog_format_".$tinfo->{binlog_format}.".sql";
- mtr_verbose("Setting binlog format:", $tinfo->{binlog_format});
- if (mtr_run($exe_mysql, $args, $sql, "", "", "") != 0)
- {
- mtr_error("Failed to switch binlog format");
- }
- }
- }
+ 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";
}
}
-sub do_after_run_mysqltest($)
-{
- my $tinfo= shift;
- # Save info from this testcase run to mysqltest.log
- mtr_appendfile_to_file($path_current_test_log, $path_mysqltest_log)
- if -f $path_current_test_log;
- mtr_appendfile_to_file($path_timefile, $path_mysqltest_log)
- if -f $path_timefile;
-}
-
-
-sub run_testcase_mark_logs($$)
+sub run_check_testcase_all($$)
{
- my ($tinfo, $log_msg)= @_;
-
- # Write a marker to all log files
-
- # The file indicating current test name
- mtr_tonewfile($path_current_test_log, $log_msg);
+ my ($tinfo, $mode)= @_;
- # each mysqld's .err file
- foreach my $mysqld (@{$master}, @{$slave})
+ foreach my $mysqld ( mysqlds() )
{
- mtr_tofile($mysqld->{path_myerr}, $log_msg);
- }
-
- if ( $tinfo->{'component_id'} eq 'im')
- {
- mtr_tofile($instance_manager->{path_err}, $log_msg);
- mtr_tofile($instance_manager->{path_log}, $log_msg);
+ if ( defined $mysqld->{'proc'} )
+ {
+ if (run_check_testcase($tinfo, $mode, $mysqld))
+ {
+ # Check failed, mark the test case with that info
+ $tinfo->{'check_testcase_failed'}= 1;
+ }
+ }
}
+}
- # 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);
}
+
sub find_testcase_skipped_reason($)
{
my ($tinfo)= @_;
@@ -3430,145 +2175,279 @@ sub find_testcase_skipped_reason($)
}
-##############################################################################
-#
-# Run a single test case
-#
-##############################################################################
+# Return timezone value of tinfo or default value
+sub timezone {
+ my ($tinfo)= @_;
+ return $tinfo->{timezone} || "GMT-3";
+}
-# When we get here, we have already filtered out test cases that doesn't
-# apply to the current setup, for example if we use a running server, test
-# cases that restart the server are dropped. So this function should mostly
-# be about doing things, not a lot of logic.
-# We don't start and kill the servers for each testcase. But some
-# testcases needs a restart, because they specify options to start
-# mysqld with. After that testcase, we need to restart again, to set
-# back the normal options.
+# 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= timezone($tinfo);
+ $ENV{'TZ'}= $timezone;
+ mtr_verbose("Setting timezone: $timezone");
- $ENV{'TZ'}= $tinfo->{'timezone'};
- mtr_verbose("Setting timezone: $tinfo->{'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 )
- {
- mtr_report_test_name($tinfo);
- $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 );
}
- run_testcase_stop_servers($tinfo, $master_restart, $slave_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= ();
+
+ mtr_verbose("Generating my.cnf from '$tinfo->{template_path}'");
+
+ # 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 => '',
+ }
+ );
- # Write to all log files to indicate start of testcase
- run_testcase_mark_logs($tinfo, "CURRENT_TEST: $tinfo->{name}\n");
+ # Write the new my.cnf
+ $config->save($path_config_file);
- my $died= mtr_record_dead_children();
- if ($died or $master_restart or $slave_restart)
- {
- if (run_testcase_start_servers($tinfo))
+ # 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))
{
- mtr_report_test_name($tinfo);
report_failure_and_restart($tinfo);
return 1;
}
}
- elsif ($glob_use_embedded_server)
- {
- run_master_init_script($tinfo);
- }
- # ----------------------------------------------------------------------
- # 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_timer_stop_all($glob_timers);
- mtr_report("\nServers started, exiting");
+ mtr_report("\nServers started, sleeping");
+ sleep(1) while (1);
exit(0);
}
+ my $test_timeout_proc= My::SafeProcess->timer($opt_testcase_timeout * 60);
+
+ do_before_run_mysqltest($tinfo);
+
+ if (defined $tinfo->{binlog_format_switch} )
{
- do_before_run_mysqltest($tinfo);
+ dynamic_binlog_format_switch($tinfo)
+ }
- my $res= run_mysqltest($tinfo);
- mtr_report_test_name($tinfo);
+ if ( $opt_check_testcases )
+ {
+ run_check_testcase_all($tinfo, "before")
+ }
- do_after_run_mysqltest($tinfo);
+ my $test= start_mysqltest($tinfo);
- if ( $res == 0 )
+ while (1)
+ {
+ my $proc= My::SafeProcess->wait_any();
+ unless ( defined $proc )
{
- mtr_report_test_passed($tinfo);
+ mtr_error("wait_any failed");
}
- elsif ( $res == 62 )
+ mtr_verbose("Got $proc");
+
+ # ----------------------------------------------------
+ # Stop the test case timer
+ # ----------------------------------------------------
+ $test_timeout_proc->kill();
+
+ # ----------------------------------------------------
+ # Was it the test program that exited
+ # ----------------------------------------------------
+ if ($proc eq $test)
{
- # Testcase itself tell us to skip this one
+ my $res= $test->exit_status();
+
+ if ( $res == 0 )
+ {
+ mtr_report_test_passed($tinfo, $opt_timer);
+
+ if ( $opt_check_testcases )
+ {
+ run_check_testcase_all($tinfo, "after");
+ }
+ }
+ elsif ( $res == 62 )
+ {
+ # Testcase itself tell us to skip this one
+ $tinfo->{skip_detected_by_test}= 1;
+ # Try to get reason from mysqltest.log
+ find_testcase_skipped_reason($tinfo);
+ mtr_report_test_skipped($tinfo);
+ }
+ elsif ( $res == 65 )
+ {
+ # Testprogram killed by signal
+ $tinfo->{comment}=
+ "testprogram crashed(returned code $res)";
+ report_failure_and_restart($tinfo);
+ }
+ elsif ( $res == 1 )
+ {
+ # Test case failure reported by mysqltest
+ report_failure_and_restart($tinfo);
+ }
+ else
+ {
+ # mysqltest failed, probably crashed
+ $tinfo->{comment}=
+ "mysqltest failed with unexpected return code $res";
+ report_failure_and_restart($tinfo);
+ }
+
+ # Save info from this testcase run to mysqltest.log
+ my $path_mysqltest_log= "$opt_vardir/log/mysqltest.log";
+ mtr_appendfile_to_file($path_current_test_log, $path_mysqltest_log)
+ if -f $path_current_test_log;
+ mtr_appendfile_to_file($path_timefile, $path_mysqltest_log)
+ if -f $path_timefile;
+
+ # 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;
- # Try to get reason from mysqltest.log
- find_testcase_skipped_reason($tinfo);
- mtr_report_test_skipped($tinfo);
}
- elsif ( $res == 63 )
+
+ # ----------------------------------------------------
+ # Check if it was an expected crash
+ # ----------------------------------------------------
+ if ( check_expected_crash_and_restart($proc) )
{
- $tinfo->{'timeout'}= 1; # Mark as timeout
- report_failure_and_restart($tinfo);
+ next;
}
- elsif ( $res == 1 )
+
+ # ----------------------------------------------------
+ # It's not mysqltest that has exited, kill it
+ # ----------------------------------------------------
+ $test->kill();
+
+ # ----------------------------------------------------
+ # Check if it was a server that died
+ # ----------------------------------------------------
+ if ( grep($proc eq $_, started(all_servers())) )
{
- # Test case failure reported by mysqltest
+ # Server failed, probably crashed
+ $tinfo->{comment}=
+ "Server failed during test run";
+
report_failure_and_restart($tinfo);
+ return;
}
- else
+
+ # ----------------------------------------------------
+ # Check if testcase timer expired
+ # ----------------------------------------------------
+ if ( $proc eq $test_timeout_proc )
{
- # mysqltest failed, probably crashed
- $tinfo->{comment}=
- "mysqltest returned unexpected code $res, it has probably crashed";
+ mtr_report("Test case timeout!");
+ $tinfo->{'timeout'}= 1; # Mark as timeout
report_failure_and_restart($tinfo);
+ return;
}
- }
- # Remove the file that mysqltest writes info to
- unlink($path_timefile);
+ # ----------------------------------------------------
+ # Check if test suite timer expired
+ # ----------------------------------------------------
+ if ( $proc eq $suite_timeout_proc )
+ {
+ mtr_report("Test suite timeout! Terminating...");
+ exit(1);
+ }
- # ----------------------------------------------------------------------
- # Stop Instance Manager if we are processing an IM-test case.
- # ----------------------------------------------------------------------
- if ( $tinfo->{'component_id'} eq 'im' and
- !mtr_im_stop($instance_manager, $tinfo->{'name'}))
- {
- mtr_error("Failed to stop Instance Manager.")
+ mtr_error("Unhandled process $proc exited");
}
}
#
-# Save a snapshot of the installed test db(s)
-# I.e take a snapshot of the var/ dir
+# Loop through our list of processes and look for and entry
+# with the provided pid, if found check for the file indicating
+# expected crash and restart it.
#
-sub save_installed_db () {
+sub check_expected_crash_and_restart {
+ my ($proc)= @_;
- mtr_report("Saving snapshot of installed databases");
- mtr_rmtree($path_snapshot);
-
- foreach my $data_dir (@data_dir_lst)
+ foreach my $mysqld ( mysqlds() )
{
- my $name= basename($data_dir);
- mtr_copy_dir("$data_dir", "$path_snapshot/$name");
+ next unless ( $mysqld->{proc} eq $proc );
+
+ # Check if crash expected by looking at the .expect file
+ # in var/tmp
+ my $expect_file= "$opt_vardir/tmp/".$mysqld->name().".expect";
+ if ( -f $expect_file )
+ {
+ mtr_verbose("Crash was expected, file $expect_file exists");
+ # Start server with same settings as last time
+ mysqld_start($mysqld, $mysqld->{'started_opts'});
+ unlink($expect_file);
+ }
+
+ return 1;
}
+
+ # Not an expected crash
+ return 0;
}
@@ -3576,7 +2455,7 @@ sub save_installed_db () {
# Save any interesting files in the data_dir
# before the data dir is removed.
#
-sub save_files_before_restore($$) {
+sub save_files_after_test_failure($$) {
my $test_name= shift;
my $data_dir= shift;
my $save_name= "$opt_vardir/log/$test_name";
@@ -3586,213 +2465,121 @@ sub save_files_before_restore($$) {
{
last if $opt_max_save_core > 0 && $num_saved_cores >= $opt_max_save_core;
my $core_name= basename($core_file);
- mtr_report("Saving $core_name");
- mkdir($save_name) if ! -d $save_name;
+ mtr_report(" - saving '$core_name'");
+ mkpath($save_name) if ! -d $save_name;
rename("$core_file", "$save_name/$core_name");
++$num_saved_cores;
}
}
-#
-# Restore snapshot of the installed test db(s)
-# if the snapshot exists
-#
-sub restore_installed_db ($) {
+sub after_test_failure ($) {
my $test_name= shift;
- if ( -d $path_snapshot)
- {
- mtr_report("Restoring snapshot of databases");
+ mtr_report("Cleaning datadirs...");
- foreach my $data_dir (@data_dir_lst)
- {
- my $name= basename($data_dir);
- save_files_before_restore($test_name, $data_dir);
- mtr_rmtree("$data_dir");
- mtr_copy_dir("$path_snapshot/$name", "$data_dir");
- }
+ foreach my $mysqld ( mysqlds() )
+ {
+ my $data_dir= $mysqld->value('datadir');
+ my $name= basename($data_dir);
+ save_files_after_test_failure($test_name, $data_dir);
+ mtr_debug("Removing '$data_dir'");
+ rmtree($data_dir);
+ }
- # Remove the ndb_*_fs dirs for all ndbd nodes
- # forcing a clean start of ndb
- foreach my $cluster (@{$clusters})
+ # Remove the ndb_*_fs dirs for all ndbd nodes
+ # forcing a clean start of ndb next time
+ foreach my $cluster ( clusters() )
+ {
+ foreach my $ndbd ( ndbds($cluster) )
{
- foreach my $ndbd (@{$cluster->{'ndbds'}})
- {
- mtr_rmtree("$ndbd->{'path_fs'}" );
+ my $datadir= $ndbd->value('DataDir');
+ foreach my $fs_dir ( glob("$datadir/ndb_*_fs") ) {
+ if (-d $fs_dir) {
+ rmtree($fs_dir);
+ mtr_debug("Removing '$fs_dir'");
+ }
}
}
}
- else
- {
- # No snapshot existed
- mtr_error("No snapshot existed");
- }
}
+
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 )
{
# Stop all servers that are known to be running
stop_all_servers();
- # Restore the snapshot of the installed test db
- restore_installed_db($tinfo->{'name'});
- mtr_report("Resuming Tests\n");
+ after_test_failure($tinfo->{'name'});
+ mtr_report("Resuming tests...\n");
return;
}
-
- my $test_mode= join(" ", @::glob_test_mode) || "default";
- mtr_report("Aborting: $tinfo->{'name'} failed in $test_mode mode. ");
- mtr_report("To continue, re-run with '--force'.");
- if ( ! $glob_debugger and
- ! $opt_extern and
- ! $glob_use_embedded_server )
- {
- stop_all_servers();
- }
- mtr_exit(1);
-
+ mtr_error("Test '$tinfo->{'name'}' failed.",
+ "To continue, re-run with '--force'");
}
-sub run_master_init_script ($) {
- my ($tinfo)= @_;
- my $init_script= $tinfo->{'master_sh'};
-
- # Run master initialization shell script if one exists
- if ( $init_script )
- {
- my $ret= mtr_run("/bin/sh", [$init_script], "", "", "", "");
- if ( $ret != 0 )
- {
- # FIXME rewrite those scripts to return 0 if successful
- # mtr_warning("$init_script exited with code $ret");
- }
- }
-}
-
-
-##############################################################################
-#
-# Start and stop servers
-#
-##############################################################################
-
-
-sub do_before_start_master ($) {
- my ($tinfo)= @_;
-
- my $tname= $tinfo->{'name'};
-
- # FIXME what about second master.....
+sub run_sh_script {
+ my ($script)= @_;
- # Don't delete anything if starting dirty
- return if ($opt_start_dirty);
+ return 0 unless defined $script;
- 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");
-
- run_master_init_script($tinfo);
+ mtr_verbose("Running '$script'");
+ my $ret= system("/bin/sh $script") >> 8;
+ return $ret;
}
-sub do_before_start_slave ($) {
- my ($tinfo)= @_;
-
- my $tname= $tinfo->{'name'};
- my $init_script= $tinfo->{'master_sh'};
+sub mysqld_stop {
+ my $mysqld= shift or die "usage: mysqld_stop(<mysqld>)";
- # Don't delete anything if starting dirty
- return if ($opt_start_dirty);
+ my $args;
+ mtr_init_args(\$args);
- foreach my $bin ( glob("$opt_vardir/log/slave*-bin*") )
- {
- unlink($bin);
- }
+ 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->value('port'));
+ mtr_add_arg($args, "--host=%s", $mysqld->value('#host'));
+ mtr_add_arg($args, "--connect_timeout=20");
+ mtr_add_arg($args, "--protocol=tcp");
- unlink("$slave->[0]->{'path_myddir'}/master.info");
- unlink("$slave->[0]->{'path_myddir'}/relay-log.info");
+ mtr_add_arg($args, "shutdown");
- # Run slave initialization shell script if one exists
- if ( $init_script )
- {
- my $ret= mtr_run("/bin/sh", [$init_script], "", "", "", "");
- if ( $ret != 0 )
- {
- # FIXME rewrite those scripts to return 0 if successful
- # mtr_warning("$init_script exited with code $ret");
- }
- }
+ My::SafeProcess->run
+ (
+ name => "mysqladmin shutdown ".$mysqld->name(),
+ path => $exe_mysqladmin,
+ args => \$args,
+ error => "/dev/null",
- foreach my $bin ( glob("$slave->[0]->{'path_myddir'}/log.*") )
- {
- unlink($bin);
- }
+ );
}
-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);
-
- 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);
+ mtr_add_arg($args, "%s--defaults-file=%s", $prefix, $path_config_file);
+ mtr_add_arg($args, "--defaults-group-suffix=%s", $mysqld->after('mysqld'));
# 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);
}
@@ -3807,172 +2594,22 @@ 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--loose-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 ( $cluster->{'pid'} || # 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
- {
- 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=120", $prefix);
-
- if ( @$slave_master_info )
- {
- foreach my $arg ( @$slave_master_info )
- {
- mtr_add_arg($args, "%s%s", $prefix, $arg);
- }
- }
- else
- {
- if ($mysql_version_id < 50200)
- {
- 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 ( $cluster->{'pid'} || # Slave cluster is started
- $cluster->{'use_running'} ) # Using running slave 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);
- }
-
- } # end slave
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);
- }
-
- if ( $opt_warnings )
- {
- mtr_add_arg($args, "%s--log-warnings", $prefix);
- }
-
- # 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);
@@ -4000,55 +2637,25 @@ 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);
+ if ( $is_win32 ){
+ mtr_add_arg($args, "%s--log-error=%s", $prefix, $mysqld->{"path_myerr"});
}
return $args;
}
-##############################################################################
-#
-# Start mysqld and return the PID
-#
-##############################################################################
-
-sub mysqld_start ($$$) {
+sub mysqld_start ($$) {
my $mysqld= shift;
my $extra_opt= shift;
- my $slave_master_info= shift;
- my $args; # Arg vector
- my $exe;
- my $pid= -1;
+ 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;
- }
- elsif ( $type eq 'slave' )
- {
- $exe= $exe_slave_mysqld;
- }
- else
- {
- mtr_error("Unknown 'type' \"$type\" passed to mysqld_start");
- }
+ if $opt_embedded_server;
+ my $args;
mtr_init_args(\$args);
if ( $opt_valgrind_mysqld )
@@ -4056,23 +2663,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" .
@@ -4087,550 +2694,386 @@ sub mysqld_start ($$$) {
$wait_for_pid_file= 0;
}
- # Remove the pidfile
- unlink($mysqld->{'path_pid'});
+ # Remove the old pidfile if any
+ unlink($mysqld->value('pid-file'));
- if ( defined $exe )
+ my $output= $mysqld->value('log-error');
+ if ( $opt_valgrind and $opt_debug )
{
- $pid= mtr_spawn($exe, $args, "",
- $mysqld->{'path_myerr'},
- $mysqld->{'path_myerr'},
- "",
- { append_log_file => 1 });
+ # 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 ( $wait_for_pid_file && !sleep_until_file_created($mysqld->{'path_pid'},
- $mysqld->{'start_timeout'},
- $pid))
+ if ( defined $exe )
{
-
- mtr_error("Failed to start mysqld $mysqld->{'type'}");
+ $mysqld->{'proc'}= My::SafeProcess->new
+ (
+ name => $mysqld->name(),
+ path => $exe,
+ args => \$args,
+ output => $output,
+ error => $output,
+ append => 1,
+ verbose => $opt_verbose,
+ host => undef,
+ shutdown => sub { mysqld_stop($mysqld) },
+ );
+ mtr_verbose("Started $mysqld->{proc}");
}
-
- # Remember pid of the started process
- $mysqld->{'pid'}= $pid;
+ if ( $wait_for_pid_file &&
+ !sleep_until_file_created($mysqld->value('pid-file'),
+ $opt_start_timeout,
+ $mysqld->{'proc'}))
+ {
+ 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;
- mtr_verbose("mysqld pid: $pid");
- return $pid;
+ return;
}
sub stop_all_servers () {
- mtr_report("Stopping All Servers");
-
- if ( ! $opt_skip_im )
- {
- mtr_report("Shutting-down Instance Manager");
- unless (mtr_im_stop($instance_manager, "stop_all_servers"))
- {
- mtr_error("Failed to stop Instance Manager.")
- }
- }
-
- my %admin_pids; # hash of admin processes that requests shutdown
- my @kill_pids; # list of processes to shutdown/kill
- my $pid;
+ mtr_report("Stopping all servers...");
- # Start shutdown of all started masters
- foreach my $mysqld (@{$slave}, @{$master})
- {
- if ( $mysqld->{'pid'} )
- {
- $pid= mtr_mysqladmin_start($mysqld, "shutdown", 70);
- $admin_pids{$pid}= 1;
-
- push(@kill_pids,{
- pid => $mysqld->{'pid'},
- real_pid => $mysqld->{'real_pid'},
- pidfile => $mysqld->{'path_pid'},
- sockfile => $mysqld->{'path_sock'},
- port => $mysqld->{'port'},
- errfile => $mysqld->{'path_myerr'},
- });
-
- $mysqld->{'pid'}= 0; # Assume we are done with it
- }
- }
+ # Kill all started servers
+ My::SafeProcess::shutdown(0, # shutdown timeout 0 => kill
+ started(all_servers()));
- # Start shutdown of clusters
- foreach my $cluster (@{$clusters})
- {
- if ( $cluster->{'pid'} )
- {
- $pid= mtr_ndbmgm_start($cluster, "shutdown");
- $admin_pids{$pid}= 1;
-
- push(@kill_pids,{
- pid => $cluster->{'pid'},
- pidfile => $cluster->{'path_pid'}
- });
-
- $cluster->{'pid'}= 0; # Assume we are done with it
+ # Mark servers as stopped
+ map($_->{proc}= undef, all_servers());
- foreach my $ndbd (@{$cluster->{'ndbds'}})
- {
- if ( $ndbd->{'pid'} )
- {
- push(@kill_pids,{
- pid => $ndbd->{'pid'},
- pidfile => $ndbd->{'path_pid'},
- });
- $ndbd->{'pid'}= 0;
- }
- }
- }
- }
-
- # Wait blocking until all shutdown processes has completed
- mtr_wait_blocking(\%admin_pids);
-
- # Make sure that process has shutdown else try to kill them
- mtr_check_stop_servers(\@kill_pids);
-
- 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 )
- {
- mtr_verbose("Never start or restart for embedded server");
- return $do_restart;
- }
- elsif ( $tinfo->{'master_sh'} )
+ if ( using_extern() )
{
- $do_restart= 1; # Always restart if script to run
- mtr_verbose("Restart master: Always restart if script to run");
+ mtr_verbose("No restart: using extern");
+ return 0;
}
- if ( $tinfo->{'force_restart'} )
+
+ if ( $opt_embedded_server )
{
- $do_restart= 1; # Always restart if --force-restart in -opt file
- mtr_verbose("Restart master: Restart forced with --force-restart");
+ mtr_verbose("No start or restart for embedded server");
+ return 0;
}
- elsif ( ! $opt_skip_ndbcluster and
- !$tinfo->{'ndb_test'} and
- $clusters->[0]->{'pid'} != 0 )
- {
- $do_restart= 1; # Restart without cluster
- mtr_verbose("Restart master: Test does not need cluster");
+
+ if ( $server->option('#!force-restart') ) {
+ mtr_verbose("Restart: forced in configuration");
+ return 1;
}
- elsif ( ! $opt_skip_ndbcluster and
- $tinfo->{'ndb_test'} and
- $clusters->[0]->{'pid'} == 0 )
- {
- $do_restart= 1; # Restart with cluster
- mtr_verbose("Restart master: Test need cluster");
+
+ if ( $tinfo->{'force_restart'} ) {
+ mtr_verbose("Restart: forced in .opt file");
+ return 1;
}
- elsif( $tinfo->{'component_id'} eq 'im' )
+
+ if ( $tinfo->{template_path} ne $current_config_name)
{
- $do_restart= 1;
- mtr_verbose("Restart master: Always restart for im tests");
+ mtr_verbose("Restart: using different config file");
+ return 1;
}
- elsif ( $master->[0]->{'running_master_options'} and
- $master->[0]->{'running_master_options'}->{'timezone'} ne
- $tinfo->{'timezone'})
+
+ if ( $tinfo->{'master_sh'} || $tinfo->{'slave_sh'} )
{
- $do_restart= 1;
- mtr_verbose("Restart master: Different timezone");
+ mtr_verbose("Restart: script to run");
+ 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 ( ! started($server) )
{
- # Chech that diff is binlog format only
- my $diff_opts= mtr_diff_opts($master->[0]->{'start_opts'},$tinfo->{'master_opt'});
- if (scalar(@$diff_opts) eq 2)
- {
- $do_restart= 1 unless ($diff_opts->[0] =~/^--binlog-format=/ and $diff_opts->[1] =~/^--binlog-format=/);
- }
- else
- {
- $do_restart= 1;
- mtr_verbose("Restart master: running with different options '" .
- join(" ", @{$tinfo->{'master_opt'}}) . "' != '" .
- join(" ", @{$master->[0]->{'start_opts'}}) . "'" );
- }
+ mtr_verbose("Restart: not started");
+ return 1;
}
- elsif( ! $master->[0]->{'pid'} )
+
+ my $started_tinfo= $server->{'started_tinfo'};
+ if ( defined $started_tinfo )
{
- if ( $opt_extern )
- {
- $do_restart= 0;
- mtr_verbose("No restart: using extern master");
- }
- else
+
+ # Check if timezone of test that server was started
+ # with differs from timezone of next test
+ if ( timezone($started_tinfo) ne timezone($tinfo) )
{
- $do_restart= 1;
- mtr_verbose("Restart master: master is not started");
+ mtr_verbose("Restart: Different timezone");
+ 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 )
- {
- mtr_verbose("Never start or restart for embedded server");
- return $do_slave_restart;
- }
- elsif ( $max_slave_num == 0)
- {
- mtr_verbose("Skip slave restart: No testcase use slaves");
- }
- else
+ # 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) )
{
-
- # Check if any slave is currently started
- my $any_slave_started= 0;
- foreach my $mysqld (@{$slave})
+ # Check if diff is binlog format only
+ my @diff_opts= mtr_diff_opts($started_opts, $extra_opt);
+ if (@diff_opts == 2 and
+ $diff_opts[0] =~/^--binlog-format=/ and
+ $diff_opts[1] =~/^--binlog-format=/)
{
- if ( $mysqld->{'pid'} )
- {
- $any_slave_started= 1;
- last;
- }
- }
+ mtr_verbose("Using dynamic switch of binlog format from ",
+ $diff_opts[0],"to", $diff_opts[1]);
- if ($any_slave_started)
- {
- mtr_verbose("Restart slave: Slave is started, always restart");
- $do_slave_restart= 1;
+ die "Binlog format to switch to is not set"
+ unless defined $tinfo->{binlog_format_switch};
}
- elsif ( $tinfo->{'slave_num'} )
+ else
{
- mtr_verbose("Restart slave: Test need slave");
- $do_slave_restart= 1;
+
+ 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;
}
-# ----------------------------------------------------------------------
-# If not using a running servers we may need to stop and restart.
-# We restart in the case we have initiation scripts, server options
-# etc to run. But we also restart again after the test first restart
-# and test is run, to get back to normal server settings.
-#
-# To make the code a bit more clean, we actually only stop servers
-# here, and mark this to be done. Then a generic "start" part will
-# start up the needed servers again.
-# ----------------------------------------------------------------------
-
-sub run_testcase_stop_servers($$$) {
- my ($tinfo, $do_restart, $do_slave_restart)= @_;
- my $pid;
- my %admin_pids; # hash of admin processes that requests shutdown
- my @kill_pids; # list of processes to shutdown/kill
-
- # Remember if we restarted for this test case (count restarts)
- $tinfo->{'restarted'}= $do_restart;
-
- if ( $do_restart )
- {
- delete $master->[0]->{'running_master_options'}; # Forget history
- # Start shutdown of all started masters
- foreach my $mysqld (@{$master})
- {
- if ( $mysqld->{'pid'} )
- {
- $pid= mtr_mysqladmin_start($mysqld, "shutdown", 20);
+sub servers_need_restart($) {
+ my ($tinfo)= @_;
+ return grep { server_need_restart($tinfo, $_); } all_servers();
+}
- $admin_pids{$pid}= 1;
- push(@kill_pids,{
- pid => $mysqld->{'pid'},
- real_pid => $mysqld->{'real_pid'},
- pidfile => $mysqld->{'path_pid'},
- sockfile => $mysqld->{'path_sock'},
- port => $mysqld->{'port'},
- errfile => $mysqld->{'path_myerr'},
- });
- $mysqld->{'pid'}= 0; # Assume we are done with it
- }
- }
+#
+# 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() ); }
- # Start shutdown of master cluster
- my $cluster= $clusters->[0];
- if ( $cluster->{'pid'} )
- {
- $pid= mtr_ndbmgm_start($cluster, "shutdown");
- $admin_pids{$pid}= 1;
- push(@kill_pids,{
- pid => $cluster->{'pid'},
- pidfile => $cluster->{'path_pid'}
- });
+#
+# Filter a list of servers and return only those that are part
+# of the specified cluster
+#
+sub in_cluster {
+ my ($cluster)= shift;
+ # Return only processes for a specific cluster
+ return grep { $_->suffix() eq $cluster->suffix() } @_;
+}
- $cluster->{'pid'}= 0; # Assume we are done with it
- foreach my $ndbd (@{$cluster->{'ndbds'}})
- {
- push(@kill_pids,{
- pid => $ndbd->{'pid'},
- pidfile => $ndbd->{'path_pid'},
- });
- $ndbd->{'pid'}= 0; # Assume we are done with it
- }
- }
- }
- if ( $do_restart || $do_slave_restart )
- {
+#
+# Filter a list of servers and return the SafeProcess
+# for only those that are started or stopped
+#
+sub started { return grep(defined $_, map($_->{proc}, @_)); }
+sub stopped { return grep(!defined $_, map($_->{proc}, @_)); }
- delete $slave->[0]->{'running_slave_options'}; # Forget history
- # Start shutdown of all started slaves
- foreach my $mysqld (@{$slave})
- {
- if ( $mysqld->{'pid'} )
- {
- $pid= mtr_mysqladmin_start($mysqld, "shutdown", 20);
+sub get_extra_opt {
+ my ($mysqld, $tinfo)= @_;
- $admin_pids{$pid}= 1;
+ return
+ $mysqld->option("#!use-slave-opt") ?
+ $tinfo->{slave_opt} : $tinfo->{master_opt};
+}
- push(@kill_pids,{
- pid => $mysqld->{'pid'},
- real_pid => $mysqld->{'real_pid'},
- pidfile => $mysqld->{'path_pid'},
- sockfile => $mysqld->{'path_sock'},
- port => $mysqld->{'port'},
- errfile => $mysqld->{'path_myerr'},
- });
+sub stop_servers($$) {
+ my ($tinfo, @servers)= @_;
- $mysqld->{'pid'}= 0; # Assume we are done with it
- }
- }
-
- # Start shutdown of slave cluster
- my $cluster= $clusters->[1];
- if ( $cluster->{'pid'} )
- {
- $pid= mtr_ndbmgm_start($cluster, "shutdown");
+ # Remember if we restarted for this test case (count restarts)
+ $tinfo->{'restarted'}= 1;
- $admin_pids{$pid}= 1;
+ if ( join('|', @servers) eq join('|', all_servers()) )
+ {
+ # All servers are going down, use some kind of order to
+ # avoid too many warnings in the log files
- push(@kill_pids,{
- pid => $cluster->{'pid'},
- pidfile => $cluster->{'path_pid'}
- });
+ mtr_verbose("All servers are going down");
- $cluster->{'pid'}= 0; # Assume we are done with it
+ # mysqld processes
+ My::SafeProcess::shutdown( $opt_shutdown_timeout, started(mysqlds()) );
- foreach my $ndbd (@{$cluster->{'ndbds'}} )
- {
- push(@kill_pids,{
- pid => $ndbd->{'pid'},
- pidfile => $ndbd->{'path_pid'},
- });
- $ndbd->{'pid'}= 0; # Assume we are done with it
- }
- }
+ # cluster processes
+ My::SafeProcess::shutdown( $opt_shutdown_timeout,
+ started(ndbds(), ndb_mgmds()) );
+ }
+ else
+ {
+ # Stop only some servers
+ My::SafeProcess::shutdown( $opt_shutdown_timeout,
+ started(@servers) );
}
- # ----------------------------------------------------------------------
- # Shutdown has now been started and lists for the shutdown processes
- # and the processes to be killed has been created
- # ----------------------------------------------------------------------
-
- # Wait blocking until all shutdown processes has completed
- mtr_wait_blocking(\%admin_pids);
-
-
- # Make sure that process has shutdown else try to kill them
- mtr_check_stop_servers(\@kill_pids);
-
- foreach my $mysqld (@{$master}, @{$slave})
+ foreach my $server (@servers)
{
- if ( ! $mysqld->{'pid'} )
+ # Remove datadir
+ if ( $server->option('#!remove-datadir') )
{
- # Remove ndbcluster tables if server is stopped
- rm_ndbcluster_tables($mysqld->{'path_myddir'});
+ my $datadir= $server->value('datadir');
+ mtr_debug("Removing '$datadir'");
+ rmtree($datadir);
}
+
+ # 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 start_servers($) {
+ my ($tinfo)= @_;
-sub run_testcase_start_servers($) {
- my $tinfo= shift;
- my $tname= $tinfo->{'name'};
+ # Start clusters
+ foreach my $cluster ( clusters() )
+ {
+ ndbcluster_start($cluster);
+ }
- if ( $tinfo->{'component_id'} eq 'mysqld' )
+ # Start mysqlds
+ foreach my $mysqld ( mysqlds() )
{
- if ( ! $opt_skip_ndbcluster and
- !$clusters->[0]->{'pid'} and
- $tinfo->{'ndb_test'} )
+ if ( $mysqld->{proc} )
{
- # Test need cluster, cluster is not started, start it
- ndbcluster_start($clusters->[0], "");
+ # Already started
+
+ # Write start of testcase to log file
+ mark_log($mysqld->value('log-error'), $tinfo);
+
+ next;
}
- if ( !$master->[0]->{'pid'} )
+ my $datadir= $mysqld->value('datadir');
+
+ # Don't delete anything if starting dirty
+ if (!$opt_start_dirty)
{
- # Master mysqld is not started
- do_before_start_master($tinfo);
+ # Remove old datadir before starting process
+ if ($mysqld->option('#!fresh-datadir') and -d $datadir) {
+ mtr_debug("Removing old datadir: '$datadir'");
+ rmdir($datadir);
+ }
- mysqld_start($master->[0],$tinfo->{'master_opt'},[]);
+ my @options= ('log-bin', 'relay-log');
- }
+ foreach my $option_name ( @options ) {
+ next unless $mysqld->option($option_name);
- if ( $clusters->[0]->{'pid'} || $clusters->[0]->{'use_running'}
- and ! $master->[1]->{'pid'} and
- $tinfo->{'master_num'} > 1 )
- {
- # Test needs cluster, start an extra mysqld connected to cluster
+ my $value= $mysqld->value($option_name);
- if ( $mysql_version_id >= 50100 )
- {
- # 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]->{'pid'}))
+ foreach my $file ( glob("$datadir/$value*") )
{
-
- $tinfo->{'comment'}= "Failed to create 'mysql/ndb_apply_status' table";
- return 1;
+ #print "removing: $file\n";
+ mtr_debug("Removing '$file'");
+ unlink($file);
}
}
- mysqld_start($master->[1],$tinfo->{'master_opt'},[]);
+
+ # Remove old master.info and relay-log.info files
+ # from the servers datadir
+ unlink("$datadir/master.info");
+ unlink("$datadir/relay-log.info");
}
- # Save this test case information, so next can examine it
- $master->[0]->{'running_master_options'}= $tinfo;
- }
- elsif ( ! $opt_skip_im and $tinfo->{'component_id'} eq 'im' )
- {
- # We have to create defaults file every time, in order to ensure that it
- # will be the same for each test. The problem is that test can change the
- # file (by SET/UNSET commands), so w/o recreating the file, execution of
- # one test can affect the other.
+ # Copy datadir from installed system db
+ copy_install_db($datadir) unless -d $datadir;
- im_create_defaults_file($instance_manager);
+ # Write start of testcase to log file
+ mark_log($mysqld->value('log-error'), $tinfo);
- if ( ! mtr_im_start($instance_manager, $tinfo->{im_opts}) )
+ # Run <tname>-master.sh
+ if ($mysqld->option('#!run-master-sh') and
+ run_sh_script($tinfo->{master_sh}) )
{
- $tinfo->{'comment'}= "Failed to start Instance Manager. ";
+ $tinfo->{'comment'}= "Failed to execute '$tinfo->{master_sh}'";
return 1;
}
- }
-
- # ----------------------------------------------------------------------
- # Start slaves - if needed
- # ----------------------------------------------------------------------
- if ( $tinfo->{'slave_num'} )
- {
- restore_slave_databases($tinfo->{'slave_num'});
- do_before_start_slave($tinfo);
-
- if ( ! $opt_skip_ndbcluster_slave and
- !$clusters->[1]->{'pid'} and
- $tinfo->{'ndb_test'} )
+ # Run <tname>-slave.sh
+ if ($mysqld->option('#!run-slave-sh') and
+ run_sh_script($tinfo->{slave_sh}))
{
- # Test need slave cluster, cluster is not started, start it
- ndbcluster_start($clusters->[1], "");
+ $tinfo->{'comment'}= "Failed to execute '$tinfo->{slave_sh}'";
+ return 1;
}
- for ( my $idx= 0; $idx < $tinfo->{'slave_num'}; $idx++ )
- {
- if ( ! $slave->[$idx]->{'pid'} )
- {
- mysqld_start($slave->[$idx],$tinfo->{'slave_opt'},
- $tinfo->{'slave_mi'});
-
- }
- }
+ 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 !$cluster->{'pid'};
-
if (ndbcluster_wait_started($cluster, ""))
{
# failed to start
- $tinfo->{'comment'}= "Start of $cluster->{'name'} cluster failed";
+ $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 !$mysqld->{'pid'};
-
- if (mysqld_wait_started($mysqld))
- {
- # failed to start
- $tinfo->{'comment'}=
- "Failed to start $mysqld->{'type'} mysqld $mysqld->{'idx'}";
+ if (sleep_until_file_created($mysqld->value('pid-file'),
+ $opt_start_timeout,
+ $mysqld->{'proc'}) == 0) {
+ $tinfo->{comment}=
+ "Failed to start ".$mysqld->name();
return 1;
}
}
return 0;
}
+
#
# 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
# 0 OK
# 1 Check failed
#
-sub run_check_testcase ($$) {
-
+sub run_check_testcase ($$$) {
+ my $tinfo= shift;
my $mode= shift;
my $mysqld= shift;
- my $name= "check-" . $mysqld->{'type'} . $mysqld->{'idx'};
+ my $name= "check-".$mysqld->name();
+ my $tname= $tinfo->{name};
my $args;
mtr_init_args(\$args);
@@ -4641,84 +3084,59 @@ 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=");
- mtr_add_arg($args, "-R");
- mtr_add_arg($args, "$opt_vardir/tmp/$name.result");
+ mtr_add_arg($args, "--result-file=%s", "$opt_vardir/tmp/$name.result");
+ mtr_add_arg($args, "--test-file=%s", "include/check-testcase.test");
if ( $mode eq "before" )
{
mtr_add_arg($args, "--record");
}
+ my $errfile= "$opt_vardir/tmp/$name.err";
+ my $res= My::SafeProcess->run
+ (
+ name => $name,
+ path => $exe_mysqltest,
+ error => $errfile,
+ args => \$args,
+ );
- my $res = mtr_run_test($exe_mysqltest,$args,
- "include/check-testcase.test", "", "", "");
-
- if ( $res == 1 and $mode eq "after")
+ if ( $mode eq "after" and $res == 1 )
{
- mtr_run("diff",["-u",
- "$opt_vardir/tmp/$name.result",
- "$opt_vardir/tmp/$name.reject"],
- "", "", "", "");
+ 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 )
{
- mtr_error("Could not execute 'check-testcase' $mode testcase");
+ mtr_report("\nCould not execute 'check-testcase' $mode testcase '$tname':");
+ mtr_printfile("$opt_vardir/tmp/$name.err");
+ mtr_report();
}
return $res;
}
-##############################################################################
-#
-# Report the features that were compiled in
-#
-##############################################################################
-
-sub run_report_features () {
- my $args;
- if ( ! $glob_use_embedded_server )
- {
- mysqld_start($master->[0],[],[]);
- if ( ! $master->[0]->{'pid'} )
- {
- mtr_error("Can't start the mysqld server");
- }
- mysqld_wait_started($master->[0]);
- }
-
- my $tinfo = {};
- $tinfo->{'name'} = 'report features';
- $tinfo->{'result_file'} = undef;
- $tinfo->{'component_id'} = 'mysqld';
- $tinfo->{'path'} = 'include/report-features.test';
- $tinfo->{'timezone'}= "GMT-3";
- $tinfo->{'slave_num'} = 0;
- $tinfo->{'master_opt'} = [];
- $tinfo->{'slave_opt'} = [];
- $tinfo->{'slave_mi'} = [];
- $tinfo->{'comment'} = 'report server features';
- run_mysqltest($tinfo);
-
- if ( ! $glob_use_embedded_server )
- {
- stop_all_servers();
- }
+sub run_mysqltest ($) {
+ my $proc= start_mysqltest(@_);
+ $proc->wait();
}
-sub run_mysqltest ($) {
+sub start_mysqltest ($) {
my ($tinfo)= @_;
my $exe= $exe_mysqltest;
my $args;
mtr_init_args(\$args);
- mtr_add_arg($args, "--no-defaults");
+ mtr_add_arg($args, "--defaults-file=%s", $path_config_file);
mtr_add_arg($args, "--silent");
mtr_add_arg($args, "--skip-safemalloc");
mtr_add_arg($args, "--tmpdir=%s", $opt_tmpdir);
@@ -4729,21 +3147,7 @@ sub run_mysqltest ($) {
mtr_add_arg($args, "--mark-progress")
if $opt_mark_progress;
- if ($tinfo->{'component_id'} eq 'im')
- {
- mtr_add_arg($args, "--socket=%s", $instance_manager->{'path_sock'});
- mtr_add_arg($args, "--port=%d", $instance_manager->{'port'});
- mtr_add_arg($args, "--user=%s", $instance_manager->{'admin_login'});
- mtr_add_arg($args, "--password=%s", $instance_manager->{'admin_password'});
- }
- else # component_id == mysqld
- {
- mtr_add_arg($args, "--socket=%s", $master->[0]->{'path_sock'});
- mtr_add_arg($args, "--port=%d", $master->[0]->{'port'});
- mtr_add_arg($args, "--database=test");
- mtr_add_arg($args, "--user=%s", $opt_user);
- mtr_add_arg($args, "--password=");
- }
+ mtr_add_arg($args, "--database=test");
if ( $opt_ps_protocol )
{
@@ -4767,7 +3171,7 @@ sub run_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");
@@ -4788,21 +3192,7 @@ sub run_mysqltest ($) {
mtr_add_arg($args, "--sleep=%d", $opt_sleep);
}
- if ( $opt_debug )
- {
- mtr_add_arg($args, "--debug=d:t:A,%s/log/mysqltest.trace",
- $path_vardir_trace);
- }
-
- if ( $opt_ssl_supported )
- {
- mtr_add_arg($args, "--ssl-ca=%s/std_data/cacert.pem",
- $glob_mysql_test_dir);
- mtr_add_arg($args, "--ssl-cert=%s/std_data/client-cert.pem",
- $glob_mysql_test_dir);
- mtr_add_arg($args, "--ssl-key=%s/std_data/client-key.pem",
- $glob_mysql_test_dir);
- }
+ client_debug_arg($args, "mysqltest");
if ( $opt_ssl )
{
@@ -4815,15 +3205,6 @@ sub run_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'}=
@@ -4832,7 +3213,6 @@ sub run_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.
@@ -4869,38 +3249,19 @@ sub run_mysqltest ($) {
elsif ( $opt_client_debugger )
{
debugger_arguments(\$args, \$exe, "client");
- }
-
- if ( $opt_check_testcases )
- {
- foreach my $mysqld (@{$master}, @{$slave})
- {
- if ($mysqld->{'pid'})
- {
- run_check_testcase("before", $mysqld);
- }
- }
- }
+ }
- my $res = mtr_run_test($exe,$args,"","",$path_timefile,"");
-
- if ( $opt_check_testcases )
- {
- foreach my $mysqld (@{$master}, @{$slave})
- {
- if ($mysqld->{'pid'})
- {
- if (run_check_testcase("after", $mysqld))
- {
- # Check failed, mark the test case with that info
- $tinfo->{'check_testcase_failed'}= 1;
- }
- }
- }
- }
-
- return $res;
+ my $proc= My::SafeProcess->new
+ (
+ name => "mysqltest",
+ path => $exe,
+ args => \$args,
+ error => $path_timefile,
+ verbose => $opt_verbose,
+ );
+ mtr_verbose("Started $proc");
+ return $proc;
}
@@ -5102,7 +3463,7 @@ sub valgrind_arguments {
}
# Add valgrind options, can be overriden by user
- mtr_add_arg($args, '%s', $opt_valgrind_options);
+ mtr_add_arg($args, '%s', $_) for (@valgrind_args);
mtr_add_arg($args, $$exe);
@@ -5118,12 +3479,9 @@ sub valgrind_arguments {
}
-##############################################################################
#
-# Usage
+# Usage
#
-##############################################################################
-
sub usage ($) {
my $message= shift;
@@ -5147,12 +3505,15 @@ Options to control what engine/variation to run
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)
@@ -5186,21 +3547,16 @@ Options to control what test suites or cases to run
list of suite names.
The default is: "$opt_suites"
skip-rpl Skip the replication test cases.
- skip-im Don't start IM, and skip the IM test cases
big-test Set the environment variable BIG_TEST, which can be
checked from test cases.
- combination="ARG1 .. ARG2" Specify a set of "mysqld" arguments for one
- combination.
- skip-combination Skip any combination options and combinations files
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.
+ 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
@@ -5214,9 +3570,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
@@ -5235,24 +3594,24 @@ 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
- gprof FIXME
valgrind Run the "mysqltest" and "mysqld" executables using
- valgrind with options($default_valgrind_options)
+ valgrind with default options
valgrind-all Synonym for --valgrind
valgrind-mysqltest Run the "mysqltest" and "mysql_client_test" executable
with valgrind
valgrind-mysqld Run the "mysqld" executable with valgrind
- valgrind-options=ARGS Options to give valgrind, replaces default options
+ valgrind-options=ARGS Deprecated, use --valgrind-option
+ valgrind-option=ARGS Option to give valgrind, replaces default option(s),
+ can be specified more then once
valgrind-path=[EXE] Path to the valgrind executable
callgrind Instruct valgrind to use callgrind
@@ -5260,27 +3619,29 @@ Misc options
comment=STR Write STR to the output
notimer Don't show test case execution time
- script-debug Debug this script itself
- verbose More verbose output
- start-and-exit Only initialize and start the servers, using the
- startup settings for the specified test case (if any)
+ verbose More verbose output(use multiple times for even more)
+ 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
- testcase-timeout=MINUTES Max test case run time (default $default_testcase_timeout)
- suite-timeout=MINUTES Max test suite run time (default $default_suite_timeout)
- warnings | log-warnings Pass --log-warnings to mysqld
+ testcase-timeout=MINUTES Max test case run time (default $opt_testcase_timeout)
+ suite-timeout=MINUTES Max test suite run time (default $opt_suite_timeout)
+ shutdown-timeout=SECONDS Max number of seconds to wait for server shutdown
+ before killing servers (default $opt_shutdown_timeout)
+ warnings Scan the log files for warnings. Use --nowarnings
+ to turn off.
sleep=SECONDS Passed to mysqltest, will be used as fixed sleep time
-Deprecated options
- with-openssl Deprecated option for ssl
-
-
HERE
- mtr_exit(1);
+ exit(1);
}
+
diff --git a/mysql-test/ndb/Makefile.am b/mysql-test/ndb/Makefile.am
deleted file mode 100644
index 4ddf61cf5cc..00000000000
--- a/mysql-test/ndb/Makefile.am
+++ /dev/null
@@ -1,23 +0,0 @@
-
-benchdir_root= $(prefix)
-testdir = $(benchdir_root)/mysql-test/ndb
-
-EXTRA_DIST = ndbcluster.sh
-CLEANFILES = ndbcluster
-dist_test_DATA = ndb_config_2_node.ini ndb_config_1_node.ini
-test_SCRIPTS = ndbcluster
-
-SUFFIXES = .sh
-
-.sh:
- @RM@ -f $@ $@-t
- @SED@ \
- -e 's!@''ndb_port''@!$(ndb_port)!g' \
- -e 's!@''ndbbindir''@!$(ndbbindir)!g' \
- -e 's!@''ndbtoolsdir''@!$(ndbtoolsdir)!g' \
- $< > $@-t
- @CHMOD@ +x $@-t
- @MV@ $@-t $@
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%
diff --git a/mysql-test/ndb/basic.result b/mysql-test/ndb/basic.result
deleted file mode 100644
index 9d2b18881b9..00000000000
--- a/mysql-test/ndb/basic.result
+++ /dev/null
@@ -1,69 +0,0 @@
--- NDB Cluster -- Management Client --
----------------------------------------------------------------------------
- NDB Cluster -- Management Client -- Help
----------------------------------------------------------------------------
-HELP Print help text
-HELP SHOW Help for SHOW command
-HELP DEBUG Help for debug compiled version
-SHOW Print information about cluster
-START BACKUP [NOWAIT | WAIT STARTED | WAIT COMPLETED]
- Start backup (default WAIT COMPLETED)
-ABORT BACKUP <backup id> Abort backup
-SHUTDOWN Shutdown all processes in cluster
-CLUSTERLOG ON [<severity>] ... Enable Cluster logging
-CLUSTERLOG OFF [<severity>] ... Disable Cluster logging
-CLUSTERLOG TOGGLE [<severity>] ... Toggle severity filter on/off
-CLUSTERLOG INFO Print cluster log information
-<id> START Start DB node (started with -n)
-<id> RESTART [-n] [-i] Restart DB node
-<id> STOP Stop DB node
-ENTER SINGLE USER MODE <api-node> Enter single user mode
-EXIT SINGLE USER MODE Exit single user mode
-<id> STATUS Print status
-<id> CLUSTERLOG {<category>=<level>}+ Set log level for cluster log
-PURGE STALE SESSIONS Reset reserved nodeid's in the mgmt server
-CONNECT [<connectstring>] Connect to management server (reconnect if already connected)
-QUIT Quit management client
-
-<severity> = ALERT | CRITICAL | ERROR | WARNING | INFO | DEBUG
-<category> = STARTUP | SHUTDOWN | STATISTICS | CHECKPOINT | NODERESTART | CONNECTION | INFO | ERROR | CONGESTION | DEBUG | BACKUP
-<level> = 0 - 15
-<id> = ALL | Any database node id
-
-Connected to Management Server at: localhost:1186
-Node 1: started (Version 5.0.3)
-Node 2: started (Version 5.0.3)
-
-Node 1: started (Version 5.0.3)
-
-Node 2: started (Version 5.0.3)
-
-Executing CLUSTERLOG on node 1 OK!
-Executing CLUSTERLOG on node 2 OK!
-
-Executing CLUSTERLOG on node 1 OK!
-Executing CLUSTERLOG on node 2 OK!
-
-Executing CLUSTERLOG on node 1 OK!
-Executing CLUSTERLOG on node 2 OK!
-
-Executing CLUSTERLOG on node 1 OK!
-Executing CLUSTERLOG on node 2 OK!
-
-Executing CLUSTERLOG on node 1 OK!
-Executing CLUSTERLOG on node 2 OK!
-
-Executing CLUSTERLOG on node 1 OK!
-Executing CLUSTERLOG on node 2 OK!
-
-Executing CLUSTERLOG on node 1 OK!
-Executing CLUSTERLOG on node 2 OK!
-
-Executing CLUSTERLOG on node 1 OK!
-Executing CLUSTERLOG on node 2 OK!
-
-Cluster logging is disabled
-Cluster logging is enabled.
-Cluster logging is disabled
-ALL disabled
-ALL enabled
diff --git a/mysql-test/ndb/basic.test b/mysql-test/ndb/basic.test
deleted file mode 100644
index 945bda94ff6..00000000000
--- a/mysql-test/ndb/basic.test
+++ /dev/null
@@ -1,17 +0,0 @@
-help
-all status
-1 status
-2 status
-all clusterlog connection=8
-all clusterlog startup=7
-all clusterlog checkpoint=7
-all clusterlog noderestart=15
-all clusterlog statistics=7
-all clusterlog error=7
-all clusterlog info=7
-all clusterlog backup=15
-clusterlog off
-clusterlog toggle
-clusterlog off
-clusterlog off all
-clusterlog on all
diff --git a/mysql-test/ndb/basic_log.result b/mysql-test/ndb/basic_log.result
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/mysql-test/ndb/basic_log.result
+++ /dev/null
diff --git a/mysql-test/ndb/ndb_config_1_node.ini b/mysql-test/ndb/ndb_config_1_node.ini
deleted file mode 100644
index 4e0be7796dc..00000000000
--- a/mysql-test/ndb/ndb_config_1_node.ini
+++ /dev/null
@@ -1,47 +0,0 @@
-[ndbd default]
-NoOfReplicas= 1
-MaxNoOfConcurrentTransactions= 64
-MaxNoOfConcurrentOperations= CHOOSE_MaxNoOfConcurrentOperations
-DataMemory= CHOOSE_DataMemory
-IndexMemory= CHOOSE_IndexMemory
-Diskless= CHOOSE_Diskless
-TimeBetweenWatchDogCheck= 30000
-DataDir= CHOOSE_FILESYSTEM
-MaxNoOfOrderedIndexes= CHOOSE_MaxNoOfOrderedIndexes
-MaxNoOfAttributes= CHOOSE_MaxNoOfAttributes
-TimeBetweenGlobalCheckpoints= 500
-NoOfFragmentLogFiles= 8
-FragmentLogFileSize= 6M
-DiskPageBufferMemory= CHOOSE_DiskPageBufferMemory
-
-#
-# Increase timeouts to cater for slow test-machines
-# (possibly running several tests in parallell)
-#
-HeartbeatIntervalDbDb= 30000
-HeartbeatIntervalDbApi= 30000
-#TransactionDeadlockDetectionTimeout= 7500
-
-[ndbd]
-HostName= CHOOSE_HOSTNAME_1 # hostname is a valid network adress
-
-[ndb_mgmd]
-HostName= CHOOSE_HOSTNAME_1 # hostname is a valid network adress
-DataDir= CHOOSE_FILESYSTEM #
-PortNumber= CHOOSE_PORT_MGM
-
-[mysqld]
-
-[mysqld]
-
-[mysqld]
-
-[mysqld]
-
-[mysqld]
-
-[mysqld]
-
-[mysqld]
-
-[mysqld]
diff --git a/mysql-test/ndb/ndb_config_2_node.ini b/mysql-test/ndb/ndb_config_2_node.ini
deleted file mode 100644
index 57e4d049ad6..00000000000
--- a/mysql-test/ndb/ndb_config_2_node.ini
+++ /dev/null
@@ -1,55 +0,0 @@
-[ndbd default]
-NoOfReplicas= 2
-MaxNoOfConcurrentTransactions= 64
-MaxNoOfConcurrentOperations= CHOOSE_MaxNoOfConcurrentOperations
-DataMemory= CHOOSE_DataMemory
-IndexMemory= CHOOSE_IndexMemory
-Diskless= CHOOSE_Diskless
-TimeBetweenWatchDogCheck= 30000
-DataDir= CHOOSE_FILESYSTEM
-MaxNoOfOrderedIndexes= CHOOSE_MaxNoOfOrderedIndexes
-MaxNoOfAttributes= CHOOSE_MaxNoOfAttributes
-TimeBetweenGlobalCheckpoints= 500
-NoOfFragmentLogFiles= 4
-FragmentLogFileSize=12M
-DiskPageBufferMemory= CHOOSE_DiskPageBufferMemory
-# O_DIRECT has issues on 2.4 whach have not been handled, Bug #29612
-#ODirect= 1
-# the following parametes just function as a small regression
-# test that the parameter exists
-InitialNoOfOpenFiles= 27
-
-#
-# Increase timeouts to cater for slow test-machines
-# (possibly running several tests in parallell)
-#
-HeartbeatIntervalDbDb= 30000
-HeartbeatIntervalDbApi= 30000
-#TransactionDeadlockDetectionTimeout= 7500
-
-[ndbd]
-HostName= CHOOSE_HOSTNAME_1 # hostname is a valid network adress
-
-[ndbd]
-HostName= CHOOSE_HOSTNAME_2 # hostname is a valid network adress
-
-[ndb_mgmd]
-HostName= CHOOSE_HOSTNAME_1 # hostname is a valid network adress
-DataDir= CHOOSE_FILESYSTEM #
-PortNumber= CHOOSE_PORT_MGM
-
-[mysqld]
-
-[mysqld]
-
-[mysqld]
-
-[mysqld]
-
-[mysqld]
-
-[mysqld]
-
-[mysqld]
-
-[mysqld]
diff --git a/mysql-test/ndb/ndb_config_4_node.ini b/mysql-test/ndb/ndb_config_4_node.ini
deleted file mode 100644
index d7c66cf177a..00000000000
--- a/mysql-test/ndb/ndb_config_4_node.ini
+++ /dev/null
@@ -1,55 +0,0 @@
-[ndbd default]
-NoOfReplicas= 2
-MaxNoOfConcurrentTransactions= 64
-MaxNoOfConcurrentOperations= CHOOSE_MaxNoOfConcurrentOperations
-DataMemory= CHOOSE_DataMemory
-IndexMemory= CHOOSE_IndexMemory
-Diskless= CHOOSE_Diskless
-TimeBetweenWatchDogCheck= 30000
-DataDir= CHOOSE_FILESYSTEM
-MaxNoOfOrderedIndexes= CHOOSE_MaxNoOfOrderedIndexes
-MaxNoOfAttributes= CHOOSE_MaxNoOfAttributes
-TimeBetweenGlobalCheckpoints= 500
-NoOfFragmentLogFiles= 3
-DiskPageBufferMemory= CHOOSE_DiskPageBufferMemory
-
-#
-# Increase timeouts to cater for slow test-machines
-# (possibly running several tests in parallell)
-#
-HeartbeatIntervalDbDb= 30000
-HeartbeatIntervalDbApi= 30000
-#TransactionDeadlockDetectionTimeout= 7500
-
-[ndbd]
-HostName= CHOOSE_HOSTNAME_1 # hostname is a valid network adress
-
-[ndbd]
-HostName= CHOOSE_HOSTNAME_2 # hostname is a valid network adress
-
-[ndbd]
-HostName= CHOOSE_HOSTNAME_3 # hostname is a valid network adress
-
-[ndbd]
-HostName= CHOOSE_HOSTNAME_4 # hostname is a valid network adress
-
-[ndb_mgmd]
-HostName= CHOOSE_HOSTNAME_1 # hostname is a valid network adress
-DataDir= CHOOSE_FILESYSTEM #
-PortNumber= CHOOSE_PORT_MGM
-
-[mysqld]
-
-[mysqld]
-
-[mysqld]
-
-[mysqld]
-
-[mysqld]
-
-[mysqld]
-
-[mysqld]
-
-[mysqld]
diff --git a/mysql-test/ndb/ndbcluster.sh b/mysql-test/ndb/ndbcluster.sh
deleted file mode 100644
index 2d550294c84..00000000000
--- a/mysql-test/ndb/ndbcluster.sh
+++ /dev/null
@@ -1,414 +0,0 @@
-#!/bin/sh
-# Copyright (C) 2004 MySQL AB
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-# This scripts starts the table handler ndbcluster
-
-# configurable parameters, make sure to change in mysqlcluterd as well
-port=@ndb_port@
-fsdir=`pwd`
-# end configurable parameters
-
-#BASEDIR is always one above mysql-test directory
-CWD=`pwd`
-cd ..
-BASEDIR=`pwd`
-cd $CWD
-
-# Are we using a source or a binary distribution?
-if [ -d ../sql ] ; then
- SOURCE_DIST=1
- ndbtop=$BASEDIR/storage/ndb
- exec_ndb=$ndbtop/src/kernel/ndbd
- exec_mgmtsrvr=$ndbtop/src/mgmsrv/ndb_mgmd
- exec_waiter=$ndbtop/tools/ndb_waiter
- exec_test=$ndbtop/tools/ndb_test_platform
- exec_test_ndberror=$ndbtop/src/ndbapi/ndberror_check
- exec_mgmtclient=$ndbtop/src/mgmclient/ndb_mgm
-else
- BINARY_DIST=1
- if test -x "$BASEDIR/libexec/ndbd"
- then
- exec_ndb=$BASEDIR/libexec/ndbd
- exec_mgmtsrvr=$BASEDIR/libexec/ndb_mgmd
- else
- exec_ndb=$BASEDIR/bin/ndbd
- exec_mgmtsrvr=$BASEDIR/bin/ndb_mgmd
- fi
- exec_waiter=$BASEDIR/bin/ndb_waiter
- exec_test=$BASEDIR/bin/ndb_test_platform
- exec_test_ndberror=
- exec_mgmtclient=$BASEDIR/bin/ndb_mgm
-fi
-
-if $exec_test ; then :; else
- echo "ndb not correctly compiled to support this platform"
- exit 1
-fi
-
-if [ $exec_test_ndberror ] ; then
-if $exec_test_ndberror ; then :; else
- echo "please fix in ndberror.c"
- exit 1
-fi
-fi
-
-pidfile=ndbcluster.pid
-cfgfile=Ndb.cfg
-test_ndb=
-stop_ndb=
-initial_ndb=
-status_ndb=
-ndb_diskless=0
-ndbd_nodes=2
-relative_config_data_dir=
-opt_core=
-
-ndb_no_ord=512
-ndb_no_attr=2048
-ndb_con_op=105000
-ndb_dmem=80M
-ndb_imem=24M
-ndb_pbmem=32M
-
-VERBOSE=100
-NDB_MGM_EXTRA_OPTS=
-NDB_MGMD_EXTRA_OPTS=
-NDBD_EXTRA_OPTS=
-CHARSETSDIR=
-
-while test $# -gt 0; do
- case "$1" in
- --test)
- test_ndb=1
- ;;
- --stop)
- stop_ndb=1
- ;;
- --initial)
- flags_ndb="$flags_ndb --initial"
- initial_ndb=1
- ;;
- --debug*)
- flags_ndb="$flags_ndb $1"
- ;;
- --ndbd-nodes=*)
- ndbd_nodes=`echo "$1" | sed -e "s;--ndbd-nodes=;;"`
- ;;
- --status)
- status_ndb=1
- ;;
- --small)
- ndb_no_ord=32
- ndb_con_op=5000
- ndb_dmem=20M
- ndb_imem=1M
- ndb_pbmem=4M
- ;;
- --diskless)
- ndb_diskless=1
- ;;
- --data-dir=*)
- fsdir=`echo "$1" | sed -e "s;--data-dir=;;"`
- ;;
- --relative-config-data-dir)
- relative_config_data_dir=1
- ;;
- --port=*)
- port=`echo "$1" | sed -e "s;--port=;;"`
- ;;
- --port-base=*)
- $ECHO "--port-base option depricated. Ignored."
- ;;
- --ndb_mgm-extra-opts=*)
- NDB_MGM_EXTRA_OPTS=`echo "$1" | sed -e "s;--ndb_mgm-extra-opts=;;"`
- ;;
- --ndb_mgmd-extra-opts=*)
- NDB_MGMD_EXTRA_OPTS=`echo "$1" | sed -e "s;--ndb_mgmd-extra-opts=;;"`
- ;;
- --ndbd-extra-opts=*)
- NDBD_EXTRA_OPTS=`echo "$1" | sed -e "s;--ndbd-extra-opts=;;"`
- ;;
- --character-sets-dir=*)
- CHARSETSDIR=`echo "$1" | sed -e "s;--character-sets-dir=;;"`
- ;;
- --core)
- opt_core="--core"
- ;;
- --verbose=*)
- VERBOSE=`echo "$1" | sed -e "s;--verbose=;;"`
- ;;
- -- ) shift; break ;;
- --* ) $ECHO "Unrecognized option: $1"; exit 1 ;;
- * ) break ;;
- esac
- shift
-done
-
-fs_ndb="$fsdir/ndbcluster-$port"
-config_ini=ndb/ndb_config_${ndbd_nodes}_node.ini
-
-NDB_HOME=
-if [ ! -d "$fsdir" ]; then
- echo "$fsdir missing"
- exit 1
-fi
-if [ ! -x "$exec_ndb" ]; then
- echo "$exec_ndb missing"
- exit 1
-fi
-if [ ! -x "$exec_mgmtsrvr" ]; then
- echo "$exec_mgmtsrvr missing"
- exit 1
-fi
-if [ ! -x "$exec_waiter" ]; then
- echo "$exec_waiter missing"
- exit 1
-fi
-if [ ! -f "$config_ini" ]; then
- echo "$config_ini missing, unsupported number of nodes"
- exit 1
-fi
-
-exec_mgmtclient="$exec_mgmtclient --no-defaults $opt_core $NDB_MGM_EXTRA_OPTS"
-exec_mgmtsrvr="$exec_mgmtsrvr --no-defaults $opt_core $NDB_MGMD_EXTRA_OPTS"
-exec_ndb="$exec_ndb --no-defaults $opt_core $NDBD_EXTRA_OPTS --character-sets-dir=$CHARSETSDIR"
-exec_waiter="$exec_waiter --no-defaults $opt_core"
-
-ndb_host="localhost"
-ndb_mgmd_port=$port
-NDB_CONNECTSTRING="host=$ndb_host:$ndb_mgmd_port"
-export NDB_CONNECTSTRING
-
-sleep_until_file_created () {
- file=$1
- loop=$2
- org_time=$2
- message=$3
- while (test $loop -gt 0)
- do
- if [ -r $file ]
- then
- return 0
- fi
- sleep 1
- loop=`expr $loop - 1`
- done
- if [ $message ]
- then
- echo $message
- fi
- echo "ERROR: $file was not created in $org_time seconds; Aborting"
- return 1;
-}
-
-start_default_ndbcluster() {
-
-# do some checks
-
-if [ "$initial_ndb" ] ; then
- [ -d "$fs_ndb" ] || mkdir "$fs_ndb"
-fi
-if [ -d "$fs_ndb" ]; then :; else
- echo "$fs_ndb filesystem directory does not exist"
- exit 1
-fi
-
-# Start management server as deamon
-
-# Edit file system path and ports in config file
-if [ $relative_config_data_dir ] ; then
- config_fs_ndb="."
-else
- config_fs_ndb=$fs_ndb
-fi
-if [ $initial_ndb ] ; then
- rm -rf $fs_ndb/ndb_* 2>&1 | cat > /dev/null
- sed \
- -e s,"CHOOSE_MaxNoOfAttributes","$ndb_no_attr",g \
- -e s,"CHOOSE_MaxNoOfOrderedIndexes","$ndb_no_ord",g \
- -e s,"CHOOSE_MaxNoOfConcurrentOperations","$ndb_con_op",g \
- -e s,"CHOOSE_DataMemory","$ndb_dmem",g \
- -e s,"CHOOSE_IndexMemory","$ndb_imem",g \
- -e s,"CHOOSE_Diskless","$ndb_diskless",g \
- -e s,"CHOOSE_HOSTNAME_".*,"$ndb_host",g \
- -e s,"CHOOSE_FILESYSTEM","$config_fs_ndb",g \
- -e s,"CHOOSE_PORT_MGM","$ndb_mgmd_port",g \
- -e s,"CHOOSE_DiskPageBufferMemory","$ndb_pbmem",g \
- < "$config_ini" \
- > "$fs_ndb/config.ini"
-fi
-
-rm -f "$cfgfile" 2>&1 | cat > /dev/null
-rm -f "$fs_ndb/$cfgfile" 2>&1 | cat > /dev/null
-
-if ( cd "$fs_ndb" ; $exec_mgmtsrvr -f config.ini ) ; then :; else
- echo "Unable to start $exec_mgmtsrvr from `pwd`"
- exit 1
-fi
-if sleep_until_file_created $fs_ndb/ndb_`expr $ndbd_nodes + 1`.pid 120
-then :; else
- exit 1
-fi
-cat `find "$fs_ndb" -name 'ndb_*.pid'` > "$fs_ndb/$pidfile"
-
-# Start database node
-
-id=1
-while [ $id -le $ndbd_nodes ]
-do
- if [ `expr $VERBOSE \> 1` = 1 ] ; then
- echo "Starting ndbd $id($ndbd_nodes)"
- fi
- ( cd "$fs_ndb" ; $exec_ndb $flags_ndb & )
- if sleep_until_file_created $fs_ndb/ndb_${id}.pid 120
- then :; else
- stop_default_ndbcluster
- exit 1
- fi
- cat `find "$fs_ndb" -name 'ndb_*.pid'` > "$fs_ndb/$pidfile"
- id=`expr $id + 1`
-done
-
-# test if Ndb Cluster starts properly
-
-if [ `expr $VERBOSE \> 1` = 1 ] ; then
- echo "Waiting for NDB data nodes to start..."
-fi
-if ( $exec_waiter ) | grep "NDBT_ProgramExit: 0 - OK" > /dev/null 2>&1 ; then :; else
- if [ `expr $VERBOSE \> 0` = 1 ] ; then
- echo "Ndbcluster startup failed"
- fi
- stop_default_ndbcluster
- exit 1
-fi
-if [ `expr $VERBOSE \> 1` = 1 ] ; then
- echo "Ok"
-fi
-
-cat `find "$fs_ndb" -name 'ndb_*.pid'` > $fs_ndb/$pidfile
-
-if [ `expr $VERBOSE \> 2` = 1 ] ; then
- status_ndbcluster
-fi
-}
-
-status_ndbcluster() {
- # Start management client
- $exec_mgmtclient -e show
-}
-
-stop_default_ndbcluster() {
-
-# Start management client
-
-exec_mgmtclient="$exec_mgmtclient --try-reconnect=1"
-
-$exec_mgmtclient -e shutdown 2>&1 | cat > /dev/null
-
-if [ -f "$fs_ndb/$pidfile" ] ; then
- kill_pids=`cat "$fs_ndb/$pidfile"`
- attempt=0
- while [ $attempt -lt 10 ] ; do
- new_kill_pid=""
- kill_pids2=""
- for p in $kill_pids ; do
- kill -0 $p 2> /dev/null
- if [ $? -eq 0 ] ; then
- new_kill_pid="$p $new_kill_pid"
- kill_pids2="-$p $kill_pids2"
- fi
- done
- kill_pids=$new_kill_pid
- if [ -z "$kill_pids" ] ; then
- break
- fi
- sleep 1
- attempt=`expr $attempt + 1`
- done
- if [ "$kill_pids2" != "" ] ; then
- echo "Failed to shutdown ndbcluster, executing kill "$kill_pids2
- kill -9 -- $kill_pids2 2> /dev/null
- /bin/kill -9 -- $kill_pids2 2> /dev/null
- /usr/bin/kill -9 -- $kill_pids2 2> /dev/null
- kill -9 $kill_pids2 2> /dev/null
- /bin/kill -9 $kill_pids2 2> /dev/null
- /usr/bin/kill -9 $kill_pids2 2> /dev/null
- fi
- rm "$fs_ndb/$pidfile"
-fi
-}
-
-initialize_ndb_test ()
-{
- fs_result=$fs_ndb/r
- rm -rf $fs_result
- mkdir $fs_result
- echo ------------------
- echo starting ndb tests
- echo ------------------
-}
-
-do_ndb_test ()
-{
- test_name=$1
-
- clusterlog=$fs_ndb/ndb_3_cluster.log
-
- test_log_result=$fs_result/${test_name}_log.result
- test_log_reject=$fs_result/${test_name}_log.reject
- test_result=$fs_result/${test_name}.result
- test_reject=$fs_result/${test_name}.reject
-
- clean_log='s/.*\[MgmSrvr\]//'
-
- cat $clusterlog ndb/${test_name}_log.result | sed -e $clean_log > $test_log_result
-
- cp ndb/${test_name}.result $test_result
-
- cat ndb/${test_name}.test | $exec_mgmtclient > $test_reject
- cat $clusterlog | sed -e $clean_log > $test_log_reject
-
- t="pass"
- diff -C 5 $test_result $test_reject || t="fail"
- printf "ndb_mgm output %20s [%s]\n" $test_name $t
- t="pass"
- diff -C 5 $test_log_result $test_log_reject || t="fail"
- printf "clusterlog output %20s [%s]\n" $test_name $t
-}
-
-if [ $status_ndb ] ; then
- status_ndbcluster
- exit 0
-fi
-
-if [ $stop_ndb ] ; then
- stop_default_ndbcluster
-else
- start_default_ndbcluster
-fi
-
-if [ $test_ndb ] ; then
- initialize_ndb_test
- all_tests=`ls ndb/*.test | sed "s#ndb/##" | sed "s#.test##"`
- for a in $all_tests ; do
- do_ndb_test $a
- done
- echo ------------------
- echo shutting down cluster
- stop_default_ndbcluster
-fi
-
-exit 0
diff --git a/mysql-test/ndb/restart.result b/mysql-test/ndb/restart.result
deleted file mode 100644
index efa1399b5d9..00000000000
--- a/mysql-test/ndb/restart.result
+++ /dev/null
@@ -1,16 +0,0 @@
--- NDB Cluster -- Management Client --
-Connected to Management Server at: localhost:1186
-ALL disabled
-Cluster logging is enabled.
-ALERT enabled
-Executing CLUSTERLOG on node 1 OK!
-Executing CLUSTERLOG on node 2 OK!
-
-Node 1 is being restarted.
-
-Executing CLUSTERLOG on node 1 OK!
-Executing CLUSTERLOG on node 2 OK!
-
-Node 1 is being restarted.
-
-ALL enabled
diff --git a/mysql-test/ndb/restart.test b/mysql-test/ndb/restart.test
deleted file mode 100644
index 4b4584dd739..00000000000
--- a/mysql-test/ndb/restart.test
+++ /dev/null
@@ -1,12 +0,0 @@
-clusterlog off all
-clusterlog on
-clusterlog on alert
-all clusterlog connection=0
-sleep 1
-1 restart
-sleep 5
-all clusterlog connection=8
-sleep 1
-1 restart
-sleep 10
-clusterlog on all
diff --git a/mysql-test/ndb/restart_log.result b/mysql-test/ndb/restart_log.result
deleted file mode 100644
index 2b25fc7b5b6..00000000000
--- a/mysql-test/ndb/restart_log.result
+++ /dev/null
@@ -1,20 +0,0 @@
- ALERT -- Node 2: Network partitioning - arbitration required
- ALERT -- Node 2: Arbitration won - positive reply from node 3
- ALERT -- Node 2: Node 1 has failed. The Node state at failure was 0
- ALERT -- Node 2: Node failure of 1 DBLQH completed
- ALERT -- Node 2: Node failure of 1 DBDICT completed
- ALERT -- Node 2: Node failure of 1 DBDIH completed
- ALERT -- Node 2: Node failure of 1 DBTC completed
- ALERT -- Node 2: Node 2 completed failure of Node 1
- ALERT -- Node 2: All nodes completed failure of Node 1
- ALERT -- Node 3: Node 1 Disconnected
- ALERT -- Node 2: Node 1 Disconnected
- ALERT -- Node 2: Network partitioning - arbitration required
- ALERT -- Node 2: Arbitration won - positive reply from node 3
- ALERT -- Node 2: Node 1 has failed. The Node state at failure was 0
- ALERT -- Node 2: Node failure of 1 DBLQH completed
- ALERT -- Node 2: Node failure of 1 DBDICT completed
- ALERT -- Node 2: Node failure of 1 DBDIH completed
- ALERT -- Node 2: Node failure of 1 DBTC completed
- ALERT -- Node 2: Node 2 completed failure of Node 1
- ALERT -- Node 2: All nodes completed failure of Node 1
diff --git a/mysql-test/r/backup.result b/mysql-test/r/backup.result
index 4de599f3af7..b657c620805 100644
--- a/mysql-test/r/backup.result
+++ b/mysql-test/r/backup.result
@@ -1,24 +1,24 @@
set SQL_LOG_BIN=0;
drop table if exists t1, t2, t3, t4;
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 Warning The syntax 'BACKUP TABLE' is deprecated and will be removed in MySQL 5.2. Please use MySQL Administrator (mysqldump, mysql) instead
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 Warning The syntax 'BACKUP TABLE' is deprecated and will be removed in MySQL 5.2. Please use MySQL Administrator (mysqldump, mysql) instead
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 Warning The syntax 'BACKUP TABLE' is deprecated and will be removed in MySQL 5.2. Please use MySQL Administrator (mysqldump, mysql) instead
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 Warning The syntax 'RESTORE TABLE' is deprecated and will be removed in MySQL 5.2. Please use MySQL Administrator (mysqldump, mysql) instead
test.t4 restore status OK
@@ -27,18 +27,18 @@ 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 Warning The syntax 'BACKUP TABLE' is deprecated and will be removed in MySQL 5.2. Please use MySQL Administrator (mysqldump, mysql) instead
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:
Warning 1287 The syntax 'RESTORE TABLE' is deprecated and will be removed in MySQL 5.2. Please use MySQL Administrator (mysqldump, mysql) instead
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 Warning The syntax 'RESTORE TABLE' is deprecated and will be removed in MySQL 5.2. Please use MySQL Administrator (mysqldump, mysql) instead
test.t1 restore status OK
@@ -51,13 +51,13 @@ 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';
Table Op Msg_type Msg_text
test.t2 backup Warning The syntax 'BACKUP TABLE' is deprecated and will be removed in MySQL 5.2. Please use MySQL Administrator (mysqldump, mysql) instead
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 Warning The syntax 'RESTORE TABLE' is deprecated and will be removed in MySQL 5.2. Please use MySQL Administrator (mysqldump, mysql) instead
test.t1 restore status OK
@@ -79,13 +79,13 @@ 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 Warning The syntax 'RESTORE TABLE' is deprecated and will be removed in MySQL 5.2. Please use MySQL Administrator (mysqldump, mysql) instead
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 Warning The syntax 'BACKUP TABLE' is deprecated and will be removed in MySQL 5.2. Please use MySQL Administrator (mysqldump, mysql) instead
@@ -94,12 +94,12 @@ drop table t5;
DROP TABLE IF EXISTS `t+1`;
CREATE TABLE `t+1` (c1 INT);
INSERT INTO `t+1` VALUES (1), (2), (3);
-BACKUP TABLE `t+1` TO '../tmp';
+BACKUP TABLE `t+1` TO '../../tmp';
Table Op Msg_type Msg_text
test.t+1 backup Warning The syntax 'BACKUP TABLE' is deprecated and will be removed in MySQL 5.2. Please use MySQL Administrator (mysqldump, mysql) instead
test.t+1 backup status OK
DROP TABLE `t+1`;
-RESTORE TABLE `t+1` FROM '../tmp';
+RESTORE TABLE `t+1` FROM '../../tmp';
Table Op Msg_type Msg_text
test.t+1 restore Warning The syntax 'RESTORE TABLE' is deprecated and will be removed in MySQL 5.2. Please use MySQL Administrator (mysqldump, mysql) instead
test.t+1 restore status OK
diff --git a/mysql-test/r/ctype_big5.result b/mysql-test/r/ctype_big5.result
index b190273cc64..c948aa646f6 100644
--- a/mysql-test/r/ctype_big5.result
+++ b/mysql-test/r/ctype_big5.result
@@ -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('MYSQLD_DATADIR/test/t1.txt'));;
+hex(load_file('MYSQLD_DATADIR/test/t1.txt'))
5CEE5C300A
load data infile 't1.txt' into table t1;
select hex(a) from t1;
diff --git a/mysql-test/r/gis.result b/mysql-test/r/gis.result
index 61394409947..3793aacaed4 100644
--- a/mysql-test/r/gis.result
+++ b/mysql-test/r/gis.result
@@ -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 set to default value; NULL supplied to NOT NULL column 'b' at row 1
alter table t1 enable keys;
drop table t1;
diff --git a/mysql-test/r/have_bug25714.require b/mysql-test/r/have_bug25714.require
deleted file mode 100644
index 5acc378dcf7..00000000000
--- a/mysql-test/r/have_bug25714.require
+++ /dev/null
@@ -1,2 +0,0 @@
-have_bug25714_exe
-1
diff --git a/mysql-test/r/loaddata.result b/mysql-test/r/loaddata.result
index 98e221b0dea..a18cef792c5 100644
--- a/mysql-test/r/loaddata.result
+++ b/mysql-test/r/loaddata.result
@@ -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 'd' at row 1
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 t2 ON t1.id=t2.id WHERE c1 != c2;
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,7 +170,7 @@ select @a, @b;
@a @b
NULL 15
truncate table t1;
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t1 set c=b;
+load data infile '../../std_data/rpl_loaddata.dat' into table t1 set c=b;
Warnings:
Warning 1261 Row 1 doesn't contain data for all columns
Warning 1261 Row 2 doesn't contain data for all columns
@@ -179,25 +179,25 @@ a b c
NULL 10 10
NULL 15 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 --git a/mysql-test/r/loaddata_autocom_innodb.result b/mysql-test/r/loaddata_autocom_innodb.result
index 11a07cdb783..c1e6b7f2fba 100644
--- a/mysql-test/r/loaddata_autocom_innodb.result
+++ b/mysql-test/r/loaddata_autocom_innodb.result
@@ -2,7 +2,7 @@ SET SESSION STORAGE_ENGINE = InnoDB;
drop table if exists t1;
create table t1 (id int unsigned not null auto_increment primary key, a text, b text);
start transaction;
-load data infile '../std_data_ln/loaddata2.dat' into table t1 fields terminated by ',' enclosed by '''' (a, b);
+load data infile 'LOAD_FILE' into table t1 fields terminated by ',' enclosed by '''' (a, b);
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 '''' (a, b);
+load data infile 'LOAD_FILE' into table t1 fields terminated by ',' enclosed by '''' (a, b);
Warnings:
Warning 1261 Row 3 doesn't contain data for all columns
rollback;
diff --git a/mysql-test/r/mysqlbinlog.result b/mysql-test/r/mysqlbinlog.result
index cb8760279eb..7f500c88c26 100644
--- a/mysql-test/r/mysqlbinlog.result
+++ b/mysql-test/r/mysqlbinlog.result
@@ -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;
@@ -257,17 +257,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 --git a/mysql-test/r/mysqlbinlog_base64.result b/mysql-test/r/mysqlbinlog_base64.result
index b62023e0ccf..436b165cfa3 100644
--- a/mysql-test/r/mysqlbinlog_base64.result
+++ b/mysql-test/r/mysqlbinlog_base64.result
@@ -5,7 +5,7 @@ insert into t1 values (3);
update t1 set a=a+2 where a=2;
update t1 set a=a+2 where a=3;
create table t2 (word varchar(20));
-load data infile '../std_data_ln/words.dat' into table t2;
+load data infile '../../std_data/words.dat' into table t2;
flush logs;
drop table t1;
drop table t2;
@@ -89,7 +89,7 @@ aberration
flush logs;
drop table t2;
create table t2 (word varchar(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 select * from t2;
insert into t2 select * from t2;
insert into t2 select * from t2;
diff --git a/mysql-test/r/outfile.result b/mysql-test/r/outfile.result
index 8503df545d2..bbd8088834f 100644
--- a/mysql-test/r/outfile.result
+++ b/mysql-test/r/outfile.result
Binary files differ
diff --git a/mysql-test/r/partition_error.result b/mysql-test/r/partition_error.result
index 46532cb32ab..9bee70e9fb5 100644
--- a/mysql-test/r/partition_error.result
+++ b/mysql-test/r/partition_error.result
@@ -74,8 +74,8 @@ partitions 3
partition x2 tablespace ts2,
partition x3 tablespace ts3);
ERROR HY000: Field in list of fields for partition function not found in table
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
-load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par')
+select load_file('$MYSQLD_DATADIR/test/t1.par');
+load_file('$MYSQLD_DATADIR/test/t1.par')
NULL
CREATE TABLE t1 (
a int not null,
@@ -151,8 +151,8 @@ partitions 2
(partition x1 values less than (4),
partition x2 values less than (5));
ERROR HY000: Only RANGE PARTITIONING can use VALUES LESS THAN in partition definition
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
-load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par')
+select load_file('$MYSQLD_DATADIR/test/t1.par');
+load_file('$MYSQLD_DATADIR/test/t1.par')
NULL
CREATE TABLE t1 (
a int not null,
@@ -164,8 +164,8 @@ partitions 2
(partition x1 values in (4),
partition x2 values in (5));
ERROR HY000: Only LIST PARTITIONING can use VALUES IN in partition definition
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
-load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par')
+select load_file('$MYSQLD_DATADIR/test/t1.par');
+load_file('$MYSQLD_DATADIR/test/t1.par')
NULL
CREATE TABLE t1 (
a int not null,
@@ -177,8 +177,8 @@ partitions 2
(partition x1 values in (4,6),
partition x2 values in (5,7));
ERROR HY000: Only LIST PARTITIONING can use VALUES IN in partition definition
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
-load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par')
+select load_file('$MYSQLD_DATADIR/test/t1.par');
+load_file('$MYSQLD_DATADIR/test/t1.par')
NULL
CREATE TABLE t1 (
a int not null,
@@ -188,8 +188,8 @@ primary key (a,b))
partition by key (a)
subpartition by key (b);
ERROR HY000: It is only possible to mix RANGE/LIST partitioning with HASH/KEY partitioning for subpartitioning
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
-load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par')
+select load_file('$MYSQLD_DATADIR/test/t1.par');
+load_file('$MYSQLD_DATADIR/test/t1.par')
NULL
CREATE TABLE t1 (
a int not null,
@@ -199,8 +199,8 @@ primary key (a,b))
partition by key (a)
subpartition by key (a, b);
ERROR HY000: It is only possible to mix RANGE/LIST partitioning with HASH/KEY partitioning for subpartitioning
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
-load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par')
+select load_file('$MYSQLD_DATADIR/test/t1.par');
+load_file('$MYSQLD_DATADIR/test/t1.par')
NULL
CREATE TABLE t1 (
a int not null,
@@ -210,8 +210,8 @@ primary key (a,b))
partition by key (a)
subpartition by hash (a+b);
ERROR HY000: It is only possible to mix RANGE/LIST partitioning with HASH/KEY partitioning for subpartitioning
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
-load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par')
+select load_file('$MYSQLD_DATADIR/test/t1.par');
+load_file('$MYSQLD_DATADIR/test/t1.par')
NULL
CREATE TABLE t1 (
a int not null,
@@ -221,8 +221,8 @@ primary key (a,b))
partition by key (a)
subpartition by key (b);
ERROR HY000: It is only possible to mix RANGE/LIST partitioning with HASH/KEY partitioning for subpartitioning
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
-load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par')
+select load_file('$MYSQLD_DATADIR/test/t1.par');
+load_file('$MYSQLD_DATADIR/test/t1.par')
NULL
CREATE TABLE t1 (
a int not null,
@@ -232,8 +232,8 @@ primary key (a,b))
partition by key (a)
subpartition by key (a, b);
ERROR HY000: It is only possible to mix RANGE/LIST partitioning with HASH/KEY partitioning for subpartitioning
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
-load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par')
+select load_file('$MYSQLD_DATADIR/test/t1.par');
+load_file('$MYSQLD_DATADIR/test/t1.par')
NULL
CREATE TABLE t1 (
a int not null,
@@ -243,8 +243,8 @@ primary key (a,b))
partition by key (a)
subpartition by hash (a+b);
ERROR HY000: It is only possible to mix RANGE/LIST partitioning with HASH/KEY partitioning for subpartitioning
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
-load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par')
+select load_file('$MYSQLD_DATADIR/test/t1.par');
+load_file('$MYSQLD_DATADIR/test/t1.par')
NULL
CREATE TABLE t1 (
a int not null,
@@ -264,8 +264,8 @@ subpartition by hash (sin(a+b))
(partition x1 (subpartition x11, subpartition x12),
partition x2 (subpartition x21, subpartition x22));
ERROR HY000: It is only possible to mix RANGE/LIST partitioning with HASH/KEY partitioning for subpartitioning
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
-load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par')
+select load_file('$MYSQLD_DATADIR/test/t1.par');
+load_file('$MYSQLD_DATADIR/test/t1.par')
NULL
CREATE TABLE t1 (
a int not null,
@@ -289,8 +289,8 @@ subpartition by key (a,d)
(partition x1 values less than (1) (subpartition x11, subpartition x12),
partition x2 values less than (2) (subpartition x21, subpartition x22));
ERROR HY000: Field in list of fields for partition function not found in table
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
-load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par')
+select load_file('$MYSQLD_DATADIR/test/t1.par');
+load_file('$MYSQLD_DATADIR/test/t1.par')
NULL
CREATE TABLE t1 (
a int not null,
@@ -317,8 +317,8 @@ c int not null,
primary key(a,b))
partition by range (a);
ERROR HY000: For RANGE partitions each partition must be defined
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
-load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par')
+select load_file('$MYSQLD_DATADIR/test/t1.par');
+load_file('$MYSQLD_DATADIR/test/t1.par')
NULL
CREATE TABLE t1 (
a int not null,
diff --git a/mysql-test/r/partition_not_windows.result b/mysql-test/r/partition_not_windows.result
index 31ea300e8ed..be2c896dca3 100644
--- a/mysql-test/r/partition_not_windows.result
+++ b/mysql-test/r/partition_not_windows.result
@@ -1,13 +1,13 @@
create table t1 (a int) engine myisam
partition by range (a)
subpartition by hash (a)
-(partition p0 VALUES LESS THAN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/tmpdata' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/tmpinx'
+(partition p0 VALUES LESS THAN (1) DATA DIRECTORY = 'MYSQLD_DATADIR/tmpdata' INDEX DIRECTORY = 'MYSQLD_DATADIR/tmpinx'
(SUBPARTITION subpart00, SUBPARTITION subpart01));
Checking if file exists before alter
ALTER TABLE t1 REORGANIZE PARTITION p0 INTO
-(partition p1 VALUES LESS THAN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/tmpdata' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/tmpinx'
+(partition p1 VALUES LESS THAN (1) DATA DIRECTORY = 'MYSQLD_DATADIR/tmpdata' INDEX DIRECTORY = 'MYSQLD_DATADIR/tmpinx'
(SUBPARTITION subpart10, SUBPARTITION subpart11),
-partition p2 VALUES LESS THAN (2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/tmpdata' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/tmpinx'
+partition p2 VALUES LESS THAN (2) DATA DIRECTORY = 'MYSQLD_DATADIR/tmpdata' INDEX DIRECTORY = 'MYSQLD_DATADIR/tmpinx'
(SUBPARTITION subpart20, SUBPARTITION subpart21));
Checking if file exists after alter
drop table t1;
diff --git a/mysql-test/r/partition_symlink.result b/mysql-test/r/partition_symlink.result
index 20e841d2e0e..68f7a8a0c96 100644
--- a/mysql-test/r/partition_symlink.result
+++ b/mysql-test/r/partition_symlink.result
@@ -13,11 +13,11 @@ USE test;
CREATE TABLE t1 (a INT)
PARTITION BY LIST (a) (
PARTITION p0 VALUES IN (0)
-DATA DIRECTORY 'MYSQLTEST_VARDIR/master-data/mysqltest2'
- INDEX DIRECTORY 'MYSQLTEST_VARDIR/master-data/mysqltest2',
+DATA DIRECTORY 'MYSQLD_DATADIR/mysqltest2'
+ INDEX DIRECTORY 'MYSQLD_DATADIR/mysqltest2',
PARTITION p1 VALUES IN (1)
-DATA DIRECTORY 'MYSQLTEST_VARDIR/master-data/test'
- INDEX DIRECTORY 'MYSQLTEST_VARDIR/master-data/test',
+DATA DIRECTORY 'MYSQLD_DATADIR/test'
+ INDEX DIRECTORY 'MYSQLD_DATADIR/test',
PARTITION p2 VALUES IN (2)
);
# without the patch for bug#32091 this would create
@@ -49,32 +49,32 @@ USE mysqltest2;
CREATE TABLE t1 (a INT)
PARTITION BY LIST (a) (
PARTITION p0 VALUES IN (0)
-DATA DIRECTORY 'MYSQLTEST_VARDIR/master-data/mysqltest2'
- INDEX DIRECTORY 'MYSQLTEST_VARDIR/master-data/mysqltest2',
+DATA DIRECTORY 'MYSQLD_DATADIR/mysqltest2'
+ INDEX DIRECTORY 'MYSQLD_DATADIR/mysqltest2',
PARTITION p1 VALUES IN (1)
-DATA DIRECTORY 'MYSQLTEST_VARDIR/master-data/test'
- INDEX DIRECTORY 'MYSQLTEST_VARDIR/master-data/test'
+DATA DIRECTORY 'MYSQLD_DATADIR/test'
+ INDEX DIRECTORY 'MYSQLD_DATADIR/test'
);
# user mysqltest_1:
USE test;
CREATE TABLE t1 (a INT)
PARTITION BY LIST (a) (
PARTITION p0 VALUES IN (0)
-DATA DIRECTORY 'MYSQLTEST_VARDIR/master-data/mysqltest2'
- INDEX DIRECTORY 'MYSQLTEST_VARDIR/master-data/mysqltest2',
+DATA DIRECTORY 'MYSQLD_DATADIR/mysqltest2'
+ INDEX DIRECTORY 'MYSQLD_DATADIR/mysqltest2',
PARTITION p1 VALUES IN (1)
-DATA DIRECTORY 'MYSQLTEST_VARDIR/master-data/test'
- INDEX DIRECTORY 'MYSQLTEST_VARDIR/master-data/test'
+DATA DIRECTORY 'MYSQLD_DATADIR/test'
+ INDEX DIRECTORY 'MYSQLD_DATADIR/test'
);
Got one of the listed errors
CREATE TABLE t1 (a INT)
PARTITION BY LIST (a) (
PARTITION p0 VALUES IN (0)
-DATA DIRECTORY 'MYSQLTEST_VARDIR/master-data/test'
- INDEX DIRECTORY 'MYSQLTEST_VARDIR/master-data/test',
+DATA DIRECTORY 'MYSQLD_DATADIR/test'
+ INDEX DIRECTORY 'MYSQLD_DATADIR/test',
PARTITION p1 VALUES IN (1)
-DATA DIRECTORY 'MYSQLTEST_VARDIR/master-data/mysqltest2'
- INDEX DIRECTORY 'MYSQLTEST_VARDIR/master-data/mysqltest2'
+DATA DIRECTORY 'MYSQLD_DATADIR/mysqltest2'
+ INDEX DIRECTORY 'MYSQLD_DATADIR/mysqltest2'
);
Got one of the listed errors
# user root (cleanup):
diff --git a/mysql-test/r/query_cache.result b/mysql-test/r/query_cache.result
index 1a728354c7b..473d120839c 100644
--- a/mysql-test/r/query_cache.result
+++ b/mysql-test/r/query_cache.result
@@ -669,7 +669,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 --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result
index 68aa278585f..357bd28f23d 100644
--- a/mysql-test/r/sp.result
+++ b/mysql-test/r/sp.result
@@ -544,7 +544,7 @@ drop procedure if exists into_outfile|
create procedure into_outfile(x char(16), y int)
begin
insert into test.t1 values (x, y);
-select * into outfile "../tmp/spout" from test.t1;
+select * into outfile "MYSQLTEST_VARDIR/tmp/spout" from test.t1;
insert into test.t1 values (concat(x, "2"), y+2);
end|
call into_outfile("ofile", 1)|
@@ -554,7 +554,7 @@ drop procedure if exists into_dumpfile|
create procedure into_dumpfile(x char(16), y int)
begin
insert into test.t1 values (x, y);
-select * into dumpfile "../tmp/spdump" from test.t1 limit 1;
+select * into dumpfile "MYSQLTEST_VARDIR/tmp/spdump" from test.t1 limit 1;
insert into test.t1 values (concat(x, "2"), y+2);
end|
call into_dumpfile("dfile", 1)|
@@ -4401,9 +4401,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 --git a/mysql-test/r/symlink.result b/mysql-test/r/symlink.result
index 4eece9d5b5a..6ac5242bcf0 100644
--- a/mysql-test/r/symlink.result
+++ b/mysql-test/r/symlink.result
@@ -100,10 +100,10 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
CREATE TABLE t1(a INT)
-DATA DIRECTORY='TEST_DIR/master-data/mysql'
-INDEX DIRECTORY='TEST_DIR/master-data/mysql';
+DATA DIRECTORY='MYSQLD_DATADIR/mysql'
+INDEX DIRECTORY='MYSQLD_DATADIR/mysql';
RENAME TABLE t1 TO user;
-ERROR HY000: Can't create/write to file 'TEST_DIR/master-data/mysql/user.MYI' (Errcode: 17)
+ERROR HY000: Can't create/write to file 'MYSQLD_DATADIR/mysql/user.MYI' (Errcode: 17)
DROP TABLE t1;
show create table t1;
Table Create Table
diff --git a/mysql-test/r/system_mysql_db.result b/mysql-test/r/system_mysql_db.result
index d1aff0fa657..2af9fdd53c3 100644
--- a/mysql-test/r/system_mysql_db.result
+++ b/mysql-test/r/system_mysql_db.result
@@ -1,4 +1,3 @@
-drop table if exists t1,t1aa,t2aa;
show tables;
Tables_in_db
columns_priv
diff --git a/mysql-test/r/trigger.result b/mysql-test/r/trigger.result
index 47ffc90e3cd..db5ebb73702 100644
--- a/mysql-test/r/trigger.result
+++ b/mysql-test/r/trigger.result
@@ -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 function f1;
drop function f2;
drop table t1, t2;
diff --git a/mysql-test/r/type_blob.result b/mysql-test/r/type_blob.result
index 869efb535e6..3409a9a143c 100644
--- a/mysql-test/r/type_blob.result
+++ b/mysql-test/r/type_blob.result
@@ -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 filtered Extra
1 SIMPLE NULL 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 --git a/mysql-test/r/view.result b/mysql-test/r/view.result
index 60c3ff68e67..fafbccb7b12 100644
--- a/mysql-test/r/view.result
+++ b/mysql-test/r/view.result
@@ -1314,7 +1314,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
@@ -1325,7 +1325,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'
@@ -1345,14 +1345,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 --git a/mysql-test/r/warnings.result b/mysql-test/r/warnings.result
index 2929328a9b1..2ff1b181e9b 100644
--- a/mysql-test/r/warnings.result
+++ b/mysql-test/r/warnings.result
@@ -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 set to default value; NULL supplied to NOT NULL column 'b' at row 2
Warning 1265 Data truncated for column 'd' at row 3
diff --git a/mysql-test/resolve-stack b/mysql-test/resolve-stack
deleted file mode 100755
index cdbe362c752..00000000000
--- a/mysql-test/resolve-stack
+++ /dev/null
@@ -1,8 +0,0 @@
-#! /bin/sh
-# A shortcut for resolving stacks when debugging when
-# we cannot duplicate the crash in a debugger and have to
-# resort to using stack traces
-
-nm --numeric-sort ../sql/mysqld > var/tmp/mysqld.sym
-echo "Please type or paste the numeric stack trace,Ctrl-C to quit:"
-../extra/resolve_stack_dump -s var/tmp/mysqld.sym
diff --git a/mysql-test/std_data/ndb_config_config.ini b/mysql-test/std_data/ndb_config_config.ini
new file mode 100644
index 00000000000..c325952d322
--- /dev/null
+++ b/mysql-test/std_data/ndb_config_config.ini
@@ -0,0 +1,55 @@
+[ndbd default]
+NoOfReplicas= 2
+MaxNoOfConcurrentTransactions= 64
+MaxNoOfConcurrentOperations= 10000
+DataMemory= 20M
+IndexMemory= 1M
+Diskless= 0
+TimeBetweenWatchDogCheck= 30000
+DataDir= /data/msvensson/mysql/mysql-5.1-new-maint/mysql-test/var/ndbcluster-10095
+MaxNoOfOrderedIndexes= 32
+MaxNoOfAttributes= 2048
+TimeBetweenGlobalCheckpoints= 500
+NoOfFragmentLogFiles= 4
+FragmentLogFileSize=12M
+DiskPageBufferMemory= 4M
+# O_DIRECT has issues on 2.4 whach have not been handled, Bug #29612
+#ODirect= 1
+# the following parametes just function as a small regression
+# test that the parameter exists
+InitialNoOfOpenFiles= 27
+
+#
+# Increase timeouts to cater for slow test-machines
+# (possibly running several tests in parallell)
+#
+HeartbeatIntervalDbDb= 30000
+HeartbeatIntervalDbApi= 30000
+#TransactionDeadlockDetectionTimeout= 7500
+
+[ndbd]
+HostName= localhost
+
+[ndbd]
+HostName= localhost
+
+[ndb_mgmd]
+HostName= localhost
+DataDir= /data/msvensson/mysql/mysql-5.1-new-maint/mysql-test/var/ndbcluster-10095 #
+PortNumber= 10095
+
+[mysqld]
+
+[mysqld]
+
+[mysqld]
+
+[mysqld]
+
+[mysqld]
+
+[mysqld]
+
+[mysqld]
+
+[mysqld]
diff --git a/mysql-test/suite/binlog/r/binlog_killed_simulate.result b/mysql-test/suite/binlog/r/binlog_killed_simulate.result
index f6a5ddade51..a6f8f75dc15 100644
--- a/mysql-test/suite/binlog/r/binlog_killed_simulate.result
+++ b/mysql-test/suite/binlog/r/binlog_killed_simulate.result
@@ -14,12 +14,12 @@ select 1 /* must return 1 as query completed before got killed*/;
1
create table t2 (a int, b int) ENGINE=MyISAM;
reset master;
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t2 /* will be "killed" in the middle */;
+load data infile '../../std_data/rpl_loaddata.dat' into table t2 /* will be "killed" in the middle */;
ERROR 70100: Query execution was interrupted
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Begin_load_query # # ;file_id=1;block_len=12
-master-bin.000001 # Execute_load_query # # use `test`; load data infile '../std_data_ln/rpl_loaddata.dat' into table t2 /* will be "killed" in the middle */ ;file_id=1
+master-bin.000001 # Execute_load_query # # use `test`; load data infile '../../std_data/rpl_loaddata.dat' into table t2 /* will be "killed" in the middle */ ;file_id=1
select
(@a:=load_file("MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog"))
is not null;
diff --git a/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result b/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result
index f69d5717a1f..9b15a832dca 100644
--- a/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result
+++ b/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result
@@ -628,7 +628,7 @@ delete from t1;
create table t4 (a int default 0, b int primary key) engine=innodb;
insert into t4 values (0, 17);
reset master;
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t4 (a, @b) set b= @b + bug27417(2);
+load data infile '../../std_data/rpl_loaddata.dat' into table t4 (a, @b) set b= @b + bug27417(2);
ERROR 23000: Duplicate entry '17' for key 'PRIMARY'
select * from t4;
a b
@@ -641,7 +641,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Intvar # # INSERT_ID=10
master-bin.000001 # Begin_load_query # # ;file_id=1;block_len=12
master-bin.000001 # Intvar # # INSERT_ID=10
-master-bin.000001 # Execute_load_query # # use `test`; load data infile '../std_data_ln/rpl_loaddata.dat' into table t4 (a, @b) set b= @b + bug27417(2) ;file_id=1
+master-bin.000001 # Execute_load_query # # use `test`; load data infile '../../std_data/rpl_loaddata.dat' into table t4 (a, @b) set b= @b + bug27417(2) ;file_id=1
master-bin.000001 # Query # # use `test`; ROLLBACK
drop trigger trg_del_t2;
drop table t1,t2,t3,t4,t5;
diff --git a/mysql-test/suite/binlog/r/binlog_stm_blackhole.result b/mysql-test/suite/binlog/r/binlog_stm_blackhole.result
index a1c83ffc73d..295272eb45e 100644
--- a/mysql-test/suite/binlog/r/binlog_stm_blackhole.result
+++ b/mysql-test/suite/binlog/r/binlog_stm_blackhole.result
@@ -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;
@@ -115,7 +115,7 @@ master-bin.000001 # Query # # use `test`; insert ignore into t1 values(1)
master-bin.000001 # Query # # use `test`; replace into t1 values(100)
master-bin.000001 # Query # # use `test`; create table t2 (a varchar(200)) engine=blackhole
master-bin.000001 # Begin_load_query # # ;file_id=1;block_len=581
-master-bin.000001 # Execute_load_query # # use `test`; load data infile '../std_data_ln/words.dat' into table t2 ;file_id=1
+master-bin.000001 # Execute_load_query # # use `test`; load data infile '../../std_data/words.dat' into table t2 ;file_id=1
master-bin.000001 # Query # # use `test`; alter table t1 add b int
master-bin.000001 # Query # # use `test`; alter table t1 drop b
master-bin.000001 # Query # # use `test`; create table t3 like t1
diff --git a/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result b/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result
index c15478bc826..268767163c3 100644
--- a/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result
+++ b/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result
@@ -602,7 +602,7 @@ delete from t1;
create table t4 (a int default 0, b int primary key) engine=innodb;
insert into t4 values (0, 17);
reset master;
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t4 (a, @b) set b= @b + bug27417(2);
+load data infile '../../std_data/rpl_loaddata.dat' into table t4 (a, @b) set b= @b + bug27417(2);
ERROR 23000: Duplicate entry '17' for key 'PRIMARY'
select * from t4;
a b
@@ -615,7 +615,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Intvar # # INSERT_ID=10
master-bin.000001 # Begin_load_query # # ;file_id=1;block_len=12
master-bin.000001 # Intvar # # INSERT_ID=10
-master-bin.000001 # Execute_load_query # # use `test`; load data infile '../std_data_ln/rpl_loaddata.dat' into table t4 (a, @b) set b= @b + bug27417(2) ;file_id=1
+master-bin.000001 # Execute_load_query # # use `test`; load data infile '../../std_data/rpl_loaddata.dat' into table t4 (a, @b) set b= @b + bug27417(2) ;file_id=1
master-bin.000001 # Query # # use `test`; ROLLBACK
drop trigger trg_del_t2;
drop table t1,t2,t3,t4,t5;
diff --git a/mysql-test/suite/binlog/t/binlog_killed.test b/mysql-test/suite/binlog/t/binlog_killed.test
index e5f7288b17c..2ba8afe7148 100644
--- a/mysql-test/suite/binlog/t/binlog_killed.test
+++ b/mysql-test/suite/binlog/t/binlog_killed.test
@@ -39,7 +39,8 @@ connection con2;
reap;
let $rows= `select count(*) from t2 /* must be 2 or 0 */`;
---exec $MYSQL_BINLOG --start-position=134 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog
+let $MYSQLD_DATADIR= `select @@datadir`;
+--exec $MYSQL_BINLOG --start-position=134 $MYSQLD_DATADIR/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"))
@@ -250,7 +251,7 @@ source include/show_binlog_events.inc;
# a proof the query is binlogged with an error
---exec $MYSQL_BINLOG --start-position=106 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog
+--exec $MYSQL_BINLOG --start-position=106 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval select
(@a:=load_file("$MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog"))
@@ -296,7 +297,7 @@ source include/show_binlog_events.inc;
# a proof the query is binlogged with an error
---exec $MYSQL_BINLOG --start-position=106 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog
+--exec $MYSQL_BINLOG --start-position=106 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval select
(@a:=load_file("$MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog"))
diff --git a/mysql-test/suite/binlog/t/binlog_killed_simulate.test b/mysql-test/suite/binlog/t/binlog_killed_simulate.test
index 2121a90dc8c..955457c143f 100644
--- a/mysql-test/suite/binlog/t/binlog_killed_simulate.test
+++ b/mysql-test/suite/binlog/t/binlog_killed_simulate.test
@@ -23,7 +23,8 @@ update t1 set a=2 /* will be "killed" after work has been done */;
#todo: introduce a suite private macro that provides numeric values
# for some constants like the offset of the first real event
# that is different between severs versions.
---exec $MYSQL_BINLOG --start-position=106 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog
+let $MYSQLD_DATADIR= `select @@datadir`;
+--exec $MYSQL_BINLOG --start-position=106 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval select
(@a:=load_file("$MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog"))
@@ -44,14 +45,14 @@ system rm $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog;
create table t2 (a int, b int) ENGINE=MyISAM;
reset master;
--error ER_QUERY_INTERRUPTED
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t2 /* will be "killed" in the middle */;
+load data infile '../../std_data/rpl_loaddata.dat' into table t2 /* will be "killed" in the middle */;
# a proof the query is binlogged with an error
source include/show_binlog_events.inc;
---exec $MYSQL_BINLOG --start-position=98 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog
+--exec $MYSQL_BINLOG --start-position=98 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval select
(@a:=load_file("$MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog"))
diff --git a/mysql-test/suite/binlog/t/binlog_row_mix_innodb_myisam.test b/mysql-test/suite/binlog/t/binlog_row_mix_innodb_myisam.test
index 3148cc50fd0..7700f20cc83 100644
--- a/mysql-test/suite/binlog/t/binlog_row_mix_innodb_myisam.test
+++ b/mysql-test/suite/binlog/t/binlog_row_mix_innodb_myisam.test
@@ -20,7 +20,8 @@
# ER_SERVER_SHUTDOWN (i.e. disconnection just rolls back transaction
# and does not make slave to stop)
flush logs;
---exec $MYSQL_BINLOG --start-position=524 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output
+let $MYSQLD_DATADIR= `select @@datadir`;
+--exec $MYSQL_BINLOG --start-position=524 $MYSQLD_DATADIR/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 --git a/mysql-test/suite/binlog/t/binlog_stm_mix_innodb_myisam.test b/mysql-test/suite/binlog/t/binlog_stm_mix_innodb_myisam.test
index e7149e03b87..f6d7daf5179 100644
--- a/mysql-test/suite/binlog/t/binlog_stm_mix_innodb_myisam.test
+++ b/mysql-test/suite/binlog/t/binlog_stm_mix_innodb_myisam.test
@@ -12,7 +12,8 @@
# ER_SERVER_SHUTDOWN (i.e. disconnection just rolls back transaction
# and does not make slave to stop)
flush logs;
---exec $MYSQL_BINLOG --start-position=555 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output
+let $MYSQLD_DATADIR= `select @@datadir`;
+--exec $MYSQL_BINLOG --start-position=555 $MYSQLD_DATADIR/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 --git a/mysql-test/suite/federated/disabled.def b/mysql-test/suite/federated/disabled.def
new file mode 100644
index 00000000000..9a9149ec80a
--- /dev/null
+++ b/mysql-test/suite/federated/disabled.def
@@ -0,0 +1,12 @@
+##############################################################################
+#
+# List the test cases that are to be disabled temporarily.
+#
+# Separate the test case name and the comment with ':'.
+#
+# <testcasename> : BUG#<xxxx> <comment>
+#
+# Do not use any TAB characters for whitespace.
+#
+##############################################################################
+federated_transactions : Bug#29523 Transactions do not work
diff --git a/mysql-test/suite/federated/federated.inc b/mysql-test/suite/federated/federated.inc
new file mode 100644
index 00000000000..548a37249de
--- /dev/null
+++ b/mysql-test/suite/federated/federated.inc
@@ -0,0 +1,16 @@
+--source have_federated_db.inc
+
+connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,);
+connect (slave,127.0.0.1,root,,test,$SLAVE_MYPORT,);
+
+connection master;
+--disable_warnings
+DROP DATABASE IF EXISTS federated;
+--enable_warnings
+CREATE DATABASE federated;
+
+connection slave;
+--disable_warnings
+DROP DATABASE IF EXISTS federated;
+--enable_warnings
+CREATE DATABASE federated;
diff --git a/mysql-test/r/federated.result b/mysql-test/suite/federated/federated.result
index 8f1fe20ea3b..d408a3e9a37 100644
--- a/mysql-test/r/federated.result
+++ b/mysql-test/suite/federated/federated.result
@@ -1,10 +1,3 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-stop slave;
DROP DATABASE IF EXISTS federated;
CREATE DATABASE federated;
DROP DATABASE IF EXISTS federated;
@@ -1667,7 +1660,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 order by a;
a b c
3 4 12
diff --git a/mysql-test/t/federated.test b/mysql-test/suite/federated/federated.test
index 90f1fa36bb4..08a4613b4e8 100644
--- a/mysql-test/t/federated.test
+++ b/mysql-test/suite/federated/federated.test
@@ -1,6 +1,4 @@
-# should work with embedded server after mysqltest is fixed
---source include/not_embedded.inc
---source include/federated.inc
+--source federated.inc
connection slave;
DROP TABLE IF EXISTS federated.t1;
@@ -1461,7 +1459,7 @@ insert into federated.t1 (a, b) select * from federated.t2;
select * from federated.t1 order by a;
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 order by a;
drop tables federated.t1, federated.t2;
@@ -1766,4 +1764,4 @@ DROP TABLE federated.t1;
--echo End of 5.1 tests
-source include/federated_cleanup.inc;
+source federated_cleanup.inc;
diff --git a/mysql-test/r/federated_archive.result b/mysql-test/suite/federated/federated_archive.result
index 3fd7cb2acd4..c7e3ee205f3 100644
--- a/mysql-test/r/federated_archive.result
+++ b/mysql-test/suite/federated/federated_archive.result
@@ -1,10 +1,3 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-stop slave;
DROP DATABASE IF EXISTS federated;
CREATE DATABASE federated;
DROP DATABASE IF EXISTS federated;
diff --git a/mysql-test/t/federated_archive.test b/mysql-test/suite/federated/federated_archive.test
index f8df5f1c51a..1bde23889be 100644
--- a/mysql-test/t/federated_archive.test
+++ b/mysql-test/suite/federated/federated_archive.test
@@ -1,7 +1,5 @@
-# should work with embedded server after mysqltest is fixed
--- source include/not_embedded.inc
source include/have_archive.inc;
-source include/federated.inc;
+source federated.inc;
connection slave;
@@ -56,5 +54,5 @@ connection slave;
DROP TABLE federated.archive_table;
-source include/federated_cleanup.inc;
+source federated_cleanup.inc;
diff --git a/mysql-test/r/federated_bug_13118.result b/mysql-test/suite/federated/federated_bug_13118.result
index cc14dae87d9..a9023d8e9bc 100644
--- a/mysql-test/r/federated_bug_13118.result
+++ b/mysql-test/suite/federated/federated_bug_13118.result
@@ -1,10 +1,3 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-stop slave;
DROP DATABASE IF EXISTS federated;
CREATE DATABASE federated;
DROP DATABASE IF EXISTS federated;
diff --git a/mysql-test/t/federated_bug_13118.test b/mysql-test/suite/federated/federated_bug_13118.test
index e429a660489..fad6be75dac 100644
--- a/mysql-test/t/federated_bug_13118.test
+++ b/mysql-test/suite/federated/federated_bug_13118.test
@@ -1,7 +1,4 @@
-# should work with embedded server after mysqltest is fixed
--- source include/not_embedded.inc
-source include/federated.inc;
-
+source federated.inc;
connection slave;
--disable_warnings
@@ -40,5 +37,5 @@ connection slave;
DROP TABLE federated.bug_13118_table;
-source include/federated_cleanup.inc;
+source federated_cleanup.inc;
diff --git a/mysql-test/r/federated_bug_25714.result b/mysql-test/suite/federated/federated_bug_25714.result
index 12554f7af3a..20caaa55742 100644
--- a/mysql-test/r/federated_bug_25714.result
+++ b/mysql-test/suite/federated/federated_bug_25714.result
@@ -1,10 +1,3 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-stop slave;
DROP DATABASE IF EXISTS federated;
CREATE DATABASE federated;
DROP DATABASE IF EXISTS federated;
diff --git a/mysql-test/t/federated_bug_25714.test b/mysql-test/suite/federated/federated_bug_25714.test
index 9c185181511..3e1c3f4058e 100644
--- a/mysql-test/t/federated_bug_25714.test
+++ b/mysql-test/suite/federated/federated_bug_25714.test
@@ -1,6 +1,10 @@
---source include/have_bug25714.inc
-source include/federated.inc;
+source federated.inc;
+ # Check that path to the specific test program has been setup
+if (`select LENGTH("$MYSQL_BUG25714") = 0`)
+{
+ skip Need bug25714 test program;
+}
connection slave;
--disable_warnings
@@ -43,5 +47,5 @@ connection slave;
DROP TABLE federated.t1;
-source include/federated_cleanup.inc;
+source federated_cleanup.inc;
diff --git a/mysql-test/include/federated_cleanup.inc b/mysql-test/suite/federated/federated_cleanup.inc
index 06fd7f6737a..06fd7f6737a 100644
--- a/mysql-test/include/federated_cleanup.inc
+++ b/mysql-test/suite/federated/federated_cleanup.inc
diff --git a/mysql-test/t/federated_innodb-slave.opt b/mysql-test/suite/federated/federated_innodb-slave.opt
index 627becdbfb5..627becdbfb5 100644
--- a/mysql-test/t/federated_innodb-slave.opt
+++ b/mysql-test/suite/federated/federated_innodb-slave.opt
diff --git a/mysql-test/r/federated_innodb.result b/mysql-test/suite/federated/federated_innodb.result
index 70ba3acb279..786997afa8d 100644
--- a/mysql-test/r/federated_innodb.result
+++ b/mysql-test/suite/federated/federated_innodb.result
@@ -1,10 +1,3 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-stop slave;
DROP DATABASE IF EXISTS federated;
CREATE DATABASE federated;
DROP DATABASE IF EXISTS federated;
diff --git a/mysql-test/t/federated_innodb.test b/mysql-test/suite/federated/federated_innodb.test
index 772e37a2929..6f1ad941f82 100644
--- a/mysql-test/t/federated_innodb.test
+++ b/mysql-test/suite/federated/federated_innodb.test
@@ -1,4 +1,4 @@
-source include/federated.inc;
+source federated.inc;
source include/have_innodb.inc;
#
@@ -31,4 +31,4 @@ connection slave;
drop table federated.t1;
-source include/federated_cleanup.inc;
+source federated_cleanup.inc;
diff --git a/mysql-test/r/federated_server.result b/mysql-test/suite/federated/federated_server.result
index 32717b4f0e3..b5f25d3345b 100644
--- a/mysql-test/r/federated_server.result
+++ b/mysql-test/suite/federated/federated_server.result
@@ -1,10 +1,3 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-stop slave;
DROP DATABASE IF EXISTS federated;
CREATE DATABASE federated;
DROP DATABASE IF EXISTS federated;
diff --git a/mysql-test/t/federated_server.test b/mysql-test/suite/federated/federated_server.test
index 444285ac045..4b8d51a60f4 100644
--- a/mysql-test/t/federated_server.test
+++ b/mysql-test/suite/federated/federated_server.test
@@ -1,9 +1,6 @@
# WL #3031 This test tests the new servers table as well as
# if federated can utilise the servers table
-# should work with embedded server after mysqltest is fixed
--- source include/not_embedded.inc
--- source include/federated.inc
--- source include/big_test.inc
+-- source federated.inc
connection slave;
create database first_db;
@@ -334,4 +331,4 @@ drop procedure p1;
drop server if exists s;
-source include/federated_cleanup.inc;
+source federated_cleanup.inc;
diff --git a/mysql-test/t/federated_transactions-slave.opt b/mysql-test/suite/federated/federated_transactions-slave.opt
index 48457b17309..48457b17309 100644
--- a/mysql-test/t/federated_transactions-slave.opt
+++ b/mysql-test/suite/federated/federated_transactions-slave.opt
diff --git a/mysql-test/r/federated_transactions.result b/mysql-test/suite/federated/federated_transactions.result
index 40644e3535e..40644e3535e 100644
--- a/mysql-test/r/federated_transactions.result
+++ b/mysql-test/suite/federated/federated_transactions.result
diff --git a/mysql-test/t/federated_transactions.test b/mysql-test/suite/federated/federated_transactions.test
index 2fc737730bf..cd08d310273 100644
--- a/mysql-test/t/federated_transactions.test
+++ b/mysql-test/suite/federated/federated_transactions.test
@@ -1,7 +1,5 @@
-# should work with embedded server after mysqltest is fixed
--- source include/not_embedded.inc
source include/have_innodb.inc;
-source include/federated.inc;
+source federated.inc;
connection slave;
DROP TABLE IF EXISTS federated.t1;
@@ -37,4 +35,4 @@ INSERT INTO federated.t1 (id, name) VALUES (6, 'fig');
SELECT * FROM federated.t1;
DELETE FROM federated.t1;
-source include/federated_cleanup.inc;
+source federated_cleanup.inc;
diff --git a/mysql-test/suite/federated/have_federated_db.inc b/mysql-test/suite/federated/have_federated_db.inc
new file mode 100644
index 00000000000..69cb20c46f0
--- /dev/null
+++ b/mysql-test/suite/federated/have_federated_db.inc
@@ -0,0 +1,4 @@
+if (`select (support = 'YES' or support = 'DEFAULT')=0 from information_schema.engines where engine = 'federated'`)
+{
+ skip Need federated engine;
+}
diff --git a/mysql-test/suite/federated/my.cnf b/mysql-test/suite/federated/my.cnf
new file mode 100644
index 00000000000..3e84845b945
--- /dev/null
+++ b/mysql-test/suite/federated/my.cnf
@@ -0,0 +1,12 @@
+# Use default setting for mysqld processes
+!include include/default_mysqld.cnf
+
+[mysqld.1]
+log-bin= master-bin
+
+[mysqld.2]
+
+
+[ENV]
+MASTER_MYPORT= @mysqld.1.port
+SLAVE_MYPORT= @mysqld.2.port
diff --git a/mysql-test/suite/ndb/my.cnf b/mysql-test/suite/ndb/my.cnf
new file mode 100644
index 00000000000..60769272ada
--- /dev/null
+++ b/mysql-test/suite/ndb/my.cnf
@@ -0,0 +1,20 @@
+!include include/default_mysqld.cnf
+!include include/default_ndbd.cnf
+
+[cluster_config.1]
+NoOfReplicas= 2
+ndbd=,
+ndb_mgmd=
+mysqld=,
+
+[mysqld]
+# Make all mysqlds use cluster
+ndbcluster
+
+[ENV]
+NDB_CONNECTSTRING= @mysql_cluster.1.ndb_connectstring
+MASTER_MYPORT= @mysqld.1.1.port
+MASTER_MYPORT1= @mysqld.2.1.port
+
+NDB_BACKUP_DIR= @cluster_config.ndbd.1.1.BackupDataDir
+
diff --git a/mysql-test/suite/ndb/r/loaddata_autocom_ndb.result b/mysql-test/suite/ndb/r/loaddata_autocom_ndb.result
index f98e6a76981..b4d0b0b81a7 100644
--- a/mysql-test/suite/ndb/r/loaddata_autocom_ndb.result
+++ b/mysql-test/suite/ndb/r/loaddata_autocom_ndb.result
@@ -2,7 +2,7 @@ SET SESSION STORAGE_ENGINE = ndbcluster;
drop table if exists t1;
create table t1 (id int unsigned not null auto_increment primary key, a text, b text);
start transaction;
-load data infile '../std_data_ln/loaddata2.dat' into table t1 fields terminated by ',' enclosed by '''' (a, b);
+load data infile 'LOAD_FILE' into table t1 fields terminated by ',' enclosed by '''' (a, b);
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 '''' (a, b);
+load data infile 'LOAD_FILE' into table t1 fields terminated by ',' enclosed by '''' (a, b);
Warnings:
Warning 1261 Row 3 doesn't contain data for all columns
rollback;
diff --git a/mysql-test/suite/ndb/r/ndb_config.result b/mysql-test/suite/ndb/r/ndb_config.result
index 9495af29df6..e12741212d6 100644
--- a/mysql-test/suite/ndb/r/ndb_config.result
+++ b/mysql-test/suite/ndb/r/ndb_config.result
@@ -1,4 +1,4 @@
-ndbd,1,localhost ndbd,2,localhost ndb_mgmd,3,localhost mysqld,4, mysqld,5, mysqld,6, mysqld,7, mysqld,8, mysqld,9, mysqld,10, mysqld,11,
+ndbd,1,localhost ndbd,2,localhost ndb_mgmd,3,localhost mysqld,4,localhost mysqld,5,localhost mysqld,6,localhost
1,localhost,20971520,1048576 2,localhost,20971520,1048576
1 localhost 20971520 1048576
2 localhost 20971520 1048576
diff --git a/mysql-test/suite/ndb/r/ndb_dd_backuprestore.result b/mysql-test/suite/ndb/r/ndb_dd_backuprestore.result
index c82fe560121..7c9601c819f 100644
--- a/mysql-test/suite/ndb/r/ndb_dd_backuprestore.result
+++ b/mysql-test/suite/ndb/r/ndb_dd_backuprestore.result
@@ -27,12 +27,8 @@ pk1 c2 c3 hex(c4)
3 Sweden 498 1
4 Sweden 497 1
5 Sweden 496 1
-CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
-DELETE FROM test.backup_info;
-LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
-SELECT @the_backup_id:=backup_id FROM test.backup_info;
-@the_backup_id:=backup_id
-<the_backup_id>
+CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
+LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
DROP TABLE test.backup_info;
DROP TABLE test.t1;
ALTER TABLESPACE table_space1
@@ -95,12 +91,8 @@ LENGTH(data)
SELECT LENGTH(data) FROM test.t4 WHERE c1 = 2;
LENGTH(data)
16384
-CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
-DELETE FROM test.backup_info;
-LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
-SELECT @the_backup_id:=backup_id FROM test.backup_info;
-@the_backup_id:=backup_id
-<the_backup_id>
+CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
+LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
DROP TABLE test.backup_info;
DROP TABLE test.t1;
DROP TABLE test.t2;
@@ -308,12 +300,8 @@ pk1 c2 c3 hex(c4)
248 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 4 1
247 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 6 1
246 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 8 1
-CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
-DELETE FROM test.backup_info;
-LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
-SELECT @the_backup_id:=backup_id FROM test.backup_info;
-@the_backup_id:=backup_id
-<the_backup_id>
+CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
+LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
DROP TABLE test.backup_info;
DROP TABLE test.t1;
DROP TABLE test.t2;
diff --git a/mysql-test/suite/ndb/r/ndb_load.result b/mysql-test/suite/ndb/r/ndb_load.result
index 416a350066b..f990b12e735 100644
--- a/mysql-test/suite/ndb/r/ndb_load.result
+++ b/mysql-test/suite/ndb/r/ndb_load.result
@@ -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 '../../../std_data/words.dat' 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 '../../../std_data/words.dat' INTO TABLE t1 ;
SELECT * FROM t1 ORDER BY word;
word
Aarhus
diff --git a/mysql-test/suite/ndb/r/ndb_loaddatalocal.result b/mysql-test/suite/ndb/r/ndb_loaddatalocal.result
index 1d15c608f03..71d1b143089 100644
--- a/mysql-test/suite/ndb/r/ndb_loaddatalocal.result
+++ b/mysql-test/suite/ndb/r/ndb_loaddatalocal.result
@@ -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 'MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile' 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 'MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile' 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 'MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile' 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 'MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile' 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 'MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile' 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 'MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile' 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 'MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile' 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 'MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile' into table t1;
select * from t1 order by a;
a
1
diff --git a/mysql-test/suite/ndb/r/ndb_replace.result b/mysql-test/suite/ndb/r/ndb_replace.result
index 23844ce3bff..ba78017ef7b 100644
--- a/mysql-test/suite/ndb/r/ndb_replace.result
+++ b/mysql-test/suite/ndb/r/ndb_replace.result
@@ -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 '../../../std_data/loaddata5.dat' 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 '../../../std_data/loaddata5.dat' 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 --git a/mysql-test/suite/ndb/r/ndb_restore.result b/mysql-test/suite/ndb/r/ndb_restore.result
index aba6997d218..71d2c4d24e4 100644
--- a/mysql-test/suite/ndb/r/ndb_restore.result
+++ b/mysql-test/suite/ndb/r/ndb_restore.result
@@ -131,12 +131,8 @@ create table t9 engine=myisam as select * from t9_c;
create table t10 engine=myisam as select * from t10_c;
ForceVarPart: 0
ForceVarPart: 1
-CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
-DELETE FROM test.backup_info;
-LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
-SELECT @the_backup_id:=backup_id FROM test.backup_info;
-@the_backup_id:=backup_id
-<the_backup_id>
+CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
+LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
DROP TABLE test.backup_info;
drop table t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c,t10_c;
ForceVarPart: 0
@@ -270,12 +266,8 @@ Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length I
X X X X X X X X X X 10001 X X X X X X X
ALTER TABLE t7_c
PARTITION BY LINEAR KEY (`dardtestard`);
-CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
-DELETE FROM test.backup_info;
-LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
-SELECT @the_backup_id:=backup_id FROM test.backup_info;
-@the_backup_id:=backup_id
-<the_backup_id>
+CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
+LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
DROP TABLE test.backup_info;
drop table t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c,t10_c;
select count(*) from t1;
@@ -478,13 +470,9 @@ select * from t9_c) a;
count(*)
3
drop table t1_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c,t10_c;
-CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
-DELETE FROM test.backup_info;
-LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
-SELECT @the_backup_id:=backup_id FROM test.backup_info;
-@the_backup_id:=backup_id
-<the_backup_id>
+CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
+LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
DROP TABLE test.backup_info;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
-drop table if exists t2_c;
+drop table t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
+drop table t2_c;
520093696,<the_backup_id>
diff --git a/mysql-test/suite/ndb/r/ndb_restore_partition.result b/mysql-test/suite/ndb/r/ndb_restore_partition.result
index 7dc4057e615..58a35437a2e 100644
--- a/mysql-test/suite/ndb/r/ndb_restore_partition.result
+++ b/mysql-test/suite/ndb/r/ndb_restore_partition.result
@@ -125,12 +125,8 @@ create table t6 engine=myisam as select * from t6_c;
create table t7 engine=myisam as select * from t7_c;
create table t8 engine=myisam as select * from t8_c;
create table t9 engine=myisam as select * from t9_c;
-CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
-DELETE FROM test.backup_info;
-LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
-SELECT @the_backup_id:=backup_id FROM test.backup_info;
-@the_backup_id:=backup_id
-<the_backup_id>
+CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
+LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
DROP TABLE test.backup_info;
drop table t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c;
select count(*) from t1;
@@ -248,12 +244,8 @@ PARTITION BY LINEAR HASH (`relatta`)
PARTITIONS 4;
ALTER TABLE t7_c
PARTITION BY LINEAR KEY (`dardtestard`);
-CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
-DELETE FROM test.backup_info;
-LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
-SELECT @the_backup_id:=backup_id FROM test.backup_info;
-@the_backup_id:=backup_id
-<the_backup_id>
+CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
+LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
DROP TABLE test.backup_info;
drop table t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c;
select count(*) from t1;
@@ -456,12 +448,8 @@ select * from t9_c) a;
count(*)
3
drop table t1_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c;
-CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
-DELETE FROM test.backup_info;
-LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
-SELECT @the_backup_id:=backup_id FROM test.backup_info;
-@the_backup_id:=backup_id
-<the_backup_id>
+CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
+LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
DROP TABLE test.backup_info;
Create table test/def/t2_c failed: Translate frm error
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
diff --git a/mysql-test/suite/ndb/r/ndb_restore_print.result b/mysql-test/suite/ndb/r/ndb_restore_print.result
index e05f8e43d1a..7ff15652b3f 100644
--- a/mysql-test/suite/ndb/r/ndb_restore_print.result
+++ b/mysql-test/suite/ndb/r/ndb_restore_print.result
@@ -227,12 +227,8 @@ hex(h3) NULL
hex(i1) NULL
hex(i2) NULL
hex(i3) NULL
-CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
-DELETE FROM test.backup_info;
-LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
-SELECT @the_backup_id:=backup_id FROM test.backup_info;
-@the_backup_id:=backup_id
-<the_backup_id>
+CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
+LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
DROP TABLE test.backup_info;
1;0x1;0x17;0x789A;0x789ABCDE;0xFEDC0001;127;255;32767;65535;2147483647;4294967295;9223372036854775807;18446744073709551615;1;12345678901234567890123456789012;123456789;1;12345678901234567890123456789012;123456789;0x12;0x123456789ABCDEF0;0x012345;0x12;0x123456789ABCDEF0;0x00123450
2;0x0;0x0;0x0;0x0;0x0;-128;0;-32768;0;-2147483648;0;-9223372036854775808;0;;;;;;;0x0;0x0;0x0;0x0;0x0;0x0
@@ -261,12 +257,8 @@ create table t4 (pk int key, a int) engine ndb;
insert into t2 values (1,11),(2,12),(3,13),(4,14),(5,15);
insert into t3 values (1,21),(2,22),(3,23),(4,24),(5,25);
insert into t4 values (1,31),(2,32),(3,33),(4,34),(5,35);
-CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
-DELETE FROM test.backup_info;
-LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
-SELECT @the_backup_id:=backup_id FROM test.backup_info;
-@the_backup_id:=backup_id
-<the_backup_id>
+CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
+LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
DROP TABLE test.backup_info;
'1' '1' '12345678901234567890123456789012' '123456789' '1' '12345678901234567890123456789012' '123456789' '0x20' '0x123456789ABCDEF020' '0x012345000020' '0x1200000020' '0x123456789ABCDEF000000020' '0x00123450000020'
@@ -305,12 +297,8 @@ create table t1
insert into t1 values(1, 8388607, 16777215);
insert into t1 values(2, -8388608, 0);
insert into t1 values(3, -1, 1);
-CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
-DELETE FROM test.backup_info;
-LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
-SELECT @the_backup_id:=backup_id FROM test.backup_info;
-@the_backup_id:=backup_id
-<the_backup_id>
+CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
+LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
DROP TABLE test.backup_info;
1;8388607;16777215
2;-8388608;0
diff --git a/mysql-test/suite/ndb/r/ndb_trigger.result b/mysql-test/suite/ndb/r/ndb_trigger.result
index d074ad01c22..cc3e27df852 100644
--- a/mysql-test/suite/ndb/r/ndb_trigger.result
+++ b/mysql-test/suite/ndb/r/ndb_trigger.result
@@ -120,7 +120,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 --git a/mysql-test/suite/ndb/t/ndb_alter_table.test b/mysql-test/suite/ndb/t/ndb_alter_table.test
index 082fe726927..6dc3088137d 100644
--- a/mysql-test/suite/ndb/t/ndb_alter_table.test
+++ b/mysql-test/suite/ndb/t/ndb_alter_table.test
@@ -362,7 +362,8 @@ CREATE TABLE t1 (
CREATE TEMPORARY TABLE ndb_show_tables (id INT, type VARCHAR(20), state VARCHAR(20), logging VARCHAR(20), _database VARCHAR(255), _schema VARCHAR(20), name VARCHAR(255));
--disable_warnings
---exec $NDB_TOOLS_DIR/ndb_show_tables --p > $MYSQLTEST_VARDIR/master-data/test/tmp.dat
+let $MYSQLD_DATADIR= `select @@datadir`;
+--exec $NDB_TOOLS_DIR/ndb_show_tables --p > $MYSQLD_DATADIR/test/tmp.dat
LOAD DATA INFILE 'tmp.dat' INTO TABLE ndb_show_tables;
--enable_warnings
@@ -372,7 +373,7 @@ truncate ndb_show_tables;
alter table t1 change tiny new_tiny tinyint(4) DEFAULT '0' NOT NULL;
--disable_warnings
---exec $NDB_TOOLS_DIR/ndb_show_tables --p > $MYSQLTEST_VARDIR/master-data/test/tmp.dat
+--exec $NDB_TOOLS_DIR/ndb_show_tables --p > $MYSQLD_DATADIR/test/tmp.dat
LOAD DATA INFILE 'tmp.dat' INTO TABLE ndb_show_tables;
--enable_warnings
@@ -386,9 +387,9 @@ alter table t1 add index i2(new_tiny);
drop index i1 on t1;
--disable_warnings
---exec $NDB_TOOLS_DIR/ndb_show_tables --p > $MYSQLTEST_VARDIR/master-data/test/tmp.dat
+--exec $NDB_TOOLS_DIR/ndb_show_tables --p > $MYSQLD_DATADIR/test/tmp.dat
LOAD DATA INFILE 'tmp.dat' INTO TABLE ndb_show_tables;
---exec rm $MYSQLTEST_VARDIR/master-data/test/tmp.dat || true
+--exec rm $MYSQLD_DATADIR/test/tmp.dat || true
--enable_warnings
select 'no_copy' from ndb_show_tables where id = @t1_id and name like '%t1%';
diff --git a/mysql-test/suite/ndb/t/ndb_config.test b/mysql-test/suite/ndb/t/ndb_config.test
index f63c0087c1e..08d1226953c 100644
--- a/mysql-test/suite/ndb/t/ndb_config.test
+++ b/mysql-test/suite/ndb/t/ndb_config.test
@@ -6,7 +6,7 @@
--exec $NDB_TOOLS_DIR/ndb_config --no-defaults --query=nodeid,host,DataMemory,IndexMemory --type=ndbd 2> /dev/null
--exec $NDB_TOOLS_DIR/ndb_config --no-defaults -r \\\n -f " " --query=nodeid,host,DataMemory,IndexMemory --type=ndbd 2> /dev/null
--exec $NDB_TOOLS_DIR/ndb_config --no-defaults --query=nodeid --type=ndbd --host=localhost 2> /dev/null
---exec $NDB_TOOLS_DIR/ndb_config --no-defaults --query=type,nodeid,host --config-file=$NDB_BACKUP_DIR/config.ini 2> /dev/null
+--exec $NDB_TOOLS_DIR/ndb_config --no-defaults --query=type,nodeid,host --config-file=$MYSQL_TEST_DIR/std_data/ndb_config_config.ini 2> /dev/null
# End of 4.1 tests
@@ -18,6 +18,6 @@
--exec $NDB_TOOLS_DIR/ndb_config --defaults-group-suffix=.cluster2 --defaults-file=$MYSQL_TEST_DIR/std_data/ndb_config_mycnf2.cnf --ndb-shm --connections --query=type,nodeid1,nodeid2,group,nodeidserver --mycnf 2> /dev/null
---exec $NDB_TOOLS_DIR/ndb_config --no-defaults --query=nodeid --host=localhost --config-file=$NDB_BACKUP_DIR/config.ini 2> /dev/null
---exec $NDB_TOOLS_DIR/ndb_config --no-defaults --query=nodeid --host=1.2.3.4 --config-file=$NDB_BACKUP_DIR/config.ini 2> /dev/null
---exec $NDB_TOOLS_DIR/ndb_config --no-defaults --query=nodeid --host=127.0.0.1 --config-file=$NDB_BACKUP_DIR/config.ini 2> /dev/null
+--exec $NDB_TOOLS_DIR/ndb_config --no-defaults --query=nodeid --host=localhost --config-file=$MYSQL_TEST_DIR/std_data/ndb_config_config.ini 2> /dev/null
+--exec $NDB_TOOLS_DIR/ndb_config --no-defaults --query=nodeid --host=1.2.3.4 --config-file=$MYSQL_TEST_DIR/std_data/ndb_config_config.ini 2> /dev/null
+--exec $NDB_TOOLS_DIR/ndb_config --no-defaults --query=nodeid --host=127.0.0.1 --config-file=$MYSQL_TEST_DIR/std_data/ndb_config_config.ini 2> /dev/null
diff --git a/mysql-test/suite/ndb/t/ndb_load.test b/mysql-test/suite/ndb/t/ndb_load.test
index af2df70b74e..aa48b3dfdcf 100644
--- a/mysql-test/suite/ndb/t/ndb_load.test
+++ b/mysql-test/suite/ndb/t/ndb_load.test
@@ -12,12 +12,12 @@ DROP TABLE IF EXISTS t1;
# should give duplicate key
CREATE TABLE t1 (word CHAR(20) NOT NULL PRIMARY KEY) ENGINE=NDB;
--error 1022
-LOAD DATA INFILE '../std_data_ln/words.dat' INTO TABLE t1 ;
+LOAD DATA INFILE '../../../std_data/words.dat' 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 ;
+LOAD DATA INFILE '../../../std_data/words.dat' INTO TABLE t1 ;
SELECT * FROM t1 ORDER BY word;
DROP TABLE t1;
diff --git a/mysql-test/suite/ndb/t/ndb_loaddatalocal.test b/mysql-test/suite/ndb/t/ndb_loaddatalocal.test
index 3eae3891f43..257a26087b7 100644
--- a/mysql-test/suite/ndb/t/ndb_loaddatalocal.test
+++ b/mysql-test/suite/ndb/t/ndb_loaddatalocal.test
@@ -15,55 +15,56 @@ while ($1)
dec $1;
}
set SQL_LOG_BIN=1;
+let $MYSQLD_DATADIR= `select @@datadir`;
enable_query_log;
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-eval select * into outfile '$MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' from t1;
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+eval select * into outfile '$MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile' 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 $MYSQLD_DATADIR MYSQLD_DATADIR
+eval load data local infile '$MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile' into table t1;
select count(*) from t1;
---remove_file $MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile
+--remove_file $MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile
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 $MYSQLD_DATADIR MYSQLD_DATADIR
+eval select * into outfile '$MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile' 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;
---remove_file $MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+eval load data local infile '$MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile' into table t1;
+--remove_file $MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile
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 $MYSQLD_DATADIR MYSQLD_DATADIR
+eval select * into outfile '$MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile' 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;
---remove_file $MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+eval load data local infile '$MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile' into table t1;
+--remove_file $MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile
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 $MYSQLD_DATADIR MYSQLD_DATADIR
+eval select * into outfile '$MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile' 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;
---remove_file $MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+eval load data local infile '$MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile' into table t1;
+--remove_file $MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile
select * from t1 order by a;
drop table t1;
diff --git a/mysql-test/suite/ndb/t/ndb_replace.test b/mysql-test/suite/ndb/t/ndb_replace.test
index aa2072b98dd..432cf7f2dcd 100644
--- a/mysql-test/suite/ndb/t/ndb_replace.test
+++ b/mysql-test/suite/ndb/t/ndb_replace.test
@@ -85,12 +85,12 @@ 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);
+load data infile '../../../std_data/loaddata5.dat' 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);
+load data infile '../../../std_data/loaddata5.dat' 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 --git a/mysql-test/suite/ndb/t/ndb_restore.test b/mysql-test/suite/ndb/t/ndb_restore.test
index 18efa66ebe0..75af879faa8 100644
--- a/mysql-test/suite/ndb/t/ndb_restore.test
+++ b/mysql-test/suite/ndb/t/ndb_restore.test
@@ -394,10 +394,8 @@ drop table t1_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c,t10_c;
# Cleanup
#
---disable_warnings
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
-drop table if exists t2_c;
---enable_warnings
+drop table t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
+drop table t2_c;
#
# Test BUG#10287
diff --git a/mysql-test/suite/ndb/t/ndb_single_user.test b/mysql-test/suite/ndb/t/ndb_single_user.test
index 07925b25917..76a4307f226 100644
--- a/mysql-test/suite/ndb/t/ndb_single_user.test
+++ b/mysql-test/suite/ndb/t/ndb_single_user.test
@@ -15,8 +15,8 @@ drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
--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
# and test that some operations give correct errors
@@ -124,7 +124,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
#
@@ -139,8 +139,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;
@@ -160,7 +160,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 --git a/mysql-test/suite/ndb/t/ndb_trigger.test b/mysql-test/suite/ndb/t/ndb_trigger.test
index 2e944174fd0..9f01157fc93 100644
--- a/mysql-test/suite/ndb/t/ndb_trigger.test
+++ b/mysql-test/suite/ndb/t/ndb_trigger.test
@@ -98,7 +98,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;
update t4 set b = 10 where a = 1;
diff --git a/mysql-test/suite/ndb/t/ndbapi.test b/mysql-test/suite/ndb/t/ndbapi.test
index 3424513f8af..398a2cbfbfa 100644
--- a/mysql-test/suite/ndb/t/ndbapi.test
+++ b/mysql-test/suite/ndb/t/ndbapi.test
@@ -7,28 +7,28 @@ drop database if exists mysqltest;
--enable_warnings
--exec echo Running ndbapi_simple
---exec $NDB_EXAMPLES_DIR/ndbapi_simple/ndbapi_simple $MASTER_MYSOCK "localhost:$NDBCLUSTER_PORT" >> $NDB_EXAMPLES_OUTPUT
+--exec $NDB_EXAMPLES_DIR/ndbapi_simple/ndbapi_simple $MASTER_MYSOCK "$NDB_CONNECTSTRING" >> $NDB_EXAMPLES_OUTPUT
--exec echo Running ndbapi_simple_index
---exec $NDB_EXAMPLES_DIR/ndbapi_simple_index/ndbapi_simple_index $MASTER_MYSOCK "localhost:$NDBCLUSTER_PORT" >> $NDB_EXAMPLES_OUTPUT
+--exec $NDB_EXAMPLES_DIR/ndbapi_simple_index/ndbapi_simple_index $MASTER_MYSOCK "$NDB_CONNECTSTRING" >> $NDB_EXAMPLES_OUTPUT
--exec echo Running ndbapi_scan
---exec $NDB_EXAMPLES_DIR/ndbapi_scan/ndbapi_scan $MASTER_MYSOCK "localhost:$NDBCLUSTER_PORT" >> $NDB_EXAMPLES_OUTPUT
+--exec $NDB_EXAMPLES_DIR/ndbapi_scan/ndbapi_scan $MASTER_MYSOCK "$NDB_CONNECTSTRING" >> $NDB_EXAMPLES_OUTPUT
--exec echo Running ndbapi_retries
---exec $NDB_EXAMPLES_DIR/ndbapi_retries/ndbapi_retries $MASTER_MYSOCK "localhost:$NDBCLUSTER_PORT" >> $NDB_EXAMPLES_OUTPUT
+--exec $NDB_EXAMPLES_DIR/ndbapi_retries/ndbapi_retries $MASTER_MYSOCK "$NDB_CONNECTSTRING" >> $NDB_EXAMPLES_OUTPUT
--exec echo Running ndbapi_async
---exec $NDB_EXAMPLES_DIR/ndbapi_async/ndbapi_async $MASTER_MYSOCK "localhost:$NDBCLUSTER_PORT" >> $NDB_EXAMPLES_OUTPUT
+--exec $NDB_EXAMPLES_DIR/ndbapi_async/ndbapi_async $MASTER_MYSOCK "$NDB_CONNECTSTRING" >> $NDB_EXAMPLES_OUTPUT
--exec echo Running ndbapi_async1
---exec $NDB_EXAMPLES_DIR/ndbapi_async1/ndbapi_async1 $MASTER_MYSOCK "localhost:$NDBCLUSTER_PORT" >> $NDB_EXAMPLES_OUTPUT
+--exec $NDB_EXAMPLES_DIR/ndbapi_async1/ndbapi_async1 $MASTER_MYSOCK "$NDB_CONNECTSTRING" >> $NDB_EXAMPLES_OUTPUT
use TEST_DB;
create table t0(c0 int, c1 int, c2 char(4), c3 char(4), c4 text,
primary key(c0, c2)) engine ndb charset latin1;
#--exec echo Running ndbapi_event
-#--exec $NDB_EXAMPLES_DIR/ndbapi_event/ndbapi_event "localhost:$NDBCLUSTER_PORT" 1 >> $NDB_EXAMPLES_OUTPUT
+#--exec $NDB_EXAMPLES_DIR/ndbapi_event/ndbapi_event "$NDB_CONNECTSTRING" 1 >> $NDB_EXAMPLES_OUTPUT
insert into t0 values (1, 2, 'a', 'b', null);
insert into t0 values (3, 4, 'c', 'd', null);
update t0 set c3 = 'e' where c0 = 1 and c2 = 'a'; -- use pk
@@ -41,4 +41,4 @@ delete from t0;
drop table t0;
--exec echo Running mgmapi_logevent
---exec $NDB_EXAMPLES_DIR/mgmapi_logevent/mgmapi_logevent "localhost:$NDBCLUSTER_PORT" 1 >> $NDB_EXAMPLES_OUTPUT
+--exec $NDB_EXAMPLES_DIR/mgmapi_logevent/mgmapi_logevent "$NDB_CONNECTSTRING" 1 >> $NDB_EXAMPLES_OUTPUT
diff --git a/mysql-test/suite/rpl/include/rpl_mixed_dml.inc b/mysql-test/suite/rpl/include/rpl_mixed_dml.inc
index 70db5b6cf83..b76d45c0eb0 100644
--- a/mysql-test/suite/rpl/include/rpl_mixed_dml.inc
+++ b/mysql-test/suite/rpl/include/rpl_mixed_dml.inc
@@ -51,8 +51,8 @@ DELETE FROM t2 WHERE a = 2;
--echo
--echo ******************** LOAD DATA INFILE ********************
---exec cp ./suite/rpl/data/rpl_mixed.dat $MYSQLTEST_VARDIR/tmp/
-LOAD DATA INFILE '../tmp/rpl_mixed.dat' INTO TABLE t1 FIELDS TERMINATED BY '|' ;
+--copy_file suite/rpl/data/rpl_mixed.dat $MYSQLTEST_VARDIR/tmp/rpl_mixed.dat
+LOAD DATA INFILE '../../tmp/rpl_mixed.dat' INTO TABLE t1 FIELDS TERMINATED BY '|' ;
--remove_file $MYSQLTEST_VARDIR/tmp/rpl_mixed.dat
SELECT * FROM t1 ORDER BY a;
--source suite/rpl/include/rpl_mixed_check_select.inc
@@ -344,4 +344,4 @@ sync_slave_with_master;
# will be created. You will need to go to the mysql-test dir and diff
# the files your self to see what is not matching
---exec diff $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_slave.sql
+--diff_files $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_slave.sql
diff --git a/mysql-test/suite/rpl/my.cnf b/mysql-test/suite/rpl/my.cnf
new file mode 100644
index 00000000000..c57cc775ec3
--- /dev/null
+++ b/mysql-test/suite/rpl/my.cnf
@@ -0,0 +1,14 @@
+# 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]
+# Hardcode the host to 127.0.0.1 until running on more
+# than one host and it need to be masked
+# master-host= @mysqld.1.#host
+master-host= 127.0.0.1
+master-port= @mysqld.1.port
+master-password= @mysqld.1.#password
+master-user= @mysqld.1.#user
+master-connect-retry= 1
+
diff --git a/mysql-test/suite/rpl/r/rpl_LD_INFILE.result b/mysql-test/suite/rpl/r/rpl_LD_INFILE.result
index 70013f95d85..b092dd9e088 100644
--- a/mysql-test/suite/rpl/r/rpl_LD_INFILE.result
+++ b/mysql-test/suite/rpl/r/rpl_LD_INFILE.result
@@ -6,10 +6,10 @@ drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
DROP TABLE IF EXISTS test.t1;
CREATE TABLE test.t1 (a VARCHAR(255), PRIMARY KEY(a));
-LOAD DATA INFILE '../std_data_ln/words2.dat' INTO TABLE test.t1;
+LOAD DATA INFILE '../../std_data/words2.dat' INTO TABLE test.t1;
DELETE FROM test.t1 WHERE a = 'abashed';
DELETE FROM test.t1;
-LOAD DATA INFILE '../std_data_ln/words2.dat' INTO TABLE test.t1;
+LOAD DATA INFILE '../../std_data/words2.dat' INTO TABLE test.t1;
SELECT * FROM test.t1 ORDER BY a DESC;
a
aberration
diff --git a/mysql-test/suite/rpl/r/rpl_flushlog_loop.result b/mysql-test/suite/rpl/r/rpl_flushlog_loop.result
index ca06a5a328c..62a50dcc406 100644
--- a/mysql-test/suite/rpl/r/rpl_flushlog_loop.result
+++ b/mysql-test/suite/rpl/r/rpl_flushlog_loop.result
@@ -6,7 +6,7 @@ drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
show variables like 'relay_log%';
Variable_name Value
-relay_log MYSQLTEST_VARDIR/master-data/relay-log
+relay_log MYSQLD_DATADIR/relay-log
relay_log_index
relay_log_info_file relay-log.info
relay_log_purge ON
diff --git a/mysql-test/suite/rpl/r/rpl_innodb.result b/mysql-test/suite/rpl/r/rpl_innodb.result
index 658f92f4d75..fb906dd6197 100644
--- a/mysql-test/suite/rpl/r/rpl_innodb.result
+++ b/mysql-test/suite/rpl/r/rpl_innodb.result
@@ -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 --git a/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result b/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result
index 0e11d132cc4..1f952dcd7c5 100644
--- a/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result
+++ b/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result
@@ -103,7 +103,7 @@ DELETE FROM t1;
DELETE FROM t2;
******************** LOAD DATA INFILE ********************
-LOAD DATA INFILE '../tmp/rpl_mixed.dat' INTO TABLE t1 FIELDS TERMINATED BY '|' ;
+LOAD DATA INFILE '../../tmp/rpl_mixed.dat' INTO TABLE t1 FIELDS TERMINATED BY '|' ;
SELECT * FROM t1 ORDER BY a;
a b
10 line A
@@ -868,7 +868,7 @@ master-bin.000001 # Xid 1 # #
master-bin.000001 # Query 1 # use `test_rpl`; DELETE FROM t2
master-bin.000001 # Xid 1 # #
master-bin.000001 # Begin_load_query 1 # ;file_id=#;block_len=#
-master-bin.000001 # Execute_load_query 1 # use `test_rpl`; LOAD DATA INFILE '../tmp/rpl_mixed.dat' INTO TABLE t1 FIELDS TERMINATED BY '|' ;file_id=#
+master-bin.000001 # Execute_load_query 1 # use `test_rpl`; LOAD DATA INFILE '../../tmp/rpl_mixed.dat' INTO TABLE t1 FIELDS TERMINATED BY '|' ;file_id=#
master-bin.000001 # Xid 1 # #
master-bin.000001 # Query 1 # use `test_rpl`; DELETE FROM t1
master-bin.000001 # Xid 1 # #
diff --git a/mysql-test/suite/rpl/r/rpl_load_table_from_master.result b/mysql-test/suite/rpl/r/rpl_load_table_from_master.result
index c24f857d829..9d9a1d7d6cb 100644
--- a/mysql-test/suite/rpl/r/rpl_load_table_from_master.result
+++ b/mysql-test/suite/rpl/r/rpl_load_table_from_master.result
@@ -29,9 +29,9 @@ drop table t1;
drop table t1;
set SQL_LOG_BIN=0;
create table t1 (word char(20) not null, index(word))ENGINE=MyISAM;
-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)ENGINE=MyISAM;
-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)ENGINE=MyISAM;
load table t1 from master;
load table t2 from master;
diff --git a/mysql-test/suite/rpl/r/rpl_loaddata.result b/mysql-test/suite/rpl/r/rpl_loaddata.result
index b9bd2a22fd0..4f95a08a74a 100644
--- a/mysql-test/suite/rpl/r/rpl_loaddata.result
+++ b/mysql-test/suite/rpl/r/rpl_loaddata.result
@@ -9,12 +9,12 @@ select last_insert_id();
last_insert_id()
0
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;
select last_insert_id();
last_insert_id()
1
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,13 +28,13 @@ day id category name
2003-03-22 2416 a bbbbb
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
-slave-bin.000001 1280
+slave-bin.000001 1286
drop table t1;
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;
@@ -43,7 +43,7 @@ Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File
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';
@@ -55,7 +55,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;
@@ -64,7 +64,7 @@ Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File
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 'day'
@@ -79,7 +79,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 'day'
@@ -87,6 +87,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 'PRIMARY'
DROP TABLE IF EXISTS t1;
diff --git a/mysql-test/suite/rpl/r/rpl_loaddata_charset.result b/mysql-test/suite/rpl/r/rpl_loaddata_charset.result
index 929d06e74cf..7ba67150cb9 100644
--- a/mysql-test/suite/rpl/r/rpl_loaddata_charset.result
+++ b/mysql-test/suite/rpl/r/rpl_loaddata_charset.result
@@ -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 --git a/mysql-test/suite/rpl/r/rpl_loaddata_fatal.result b/mysql-test/suite/rpl/r/rpl_loaddata_fatal.result
index a4d67754bd6..27fb8623e85 100644
--- a/mysql-test/suite/rpl/r/rpl_loaddata_fatal.result
+++ b/mysql-test/suite/rpl/r/rpl_loaddata_fatal.result
@@ -45,7 +45,7 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
-LOAD DATA INFILE '../std_data_ln/rpl_loaddata.dat' INTO TABLE t1;
+LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE t1;
SHOW SLAVE STATUS;
Slave_IO_State #
Master_Host 127.0.0.1
diff --git a/mysql-test/suite/rpl/r/rpl_loaddata_m.result b/mysql-test/suite/rpl/r/rpl_loaddata_m.result
index 9dbae6d38c4..1d263a41e1b 100644
--- a/mysql-test/suite/rpl/r/rpl_loaddata_m.result
+++ b/mysql-test/suite/rpl/r/rpl_loaddata_m.result
@@ -7,14 +7,14 @@ start slave;
drop database if exists mysqltest;
USE test;
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 test.t1;
COUNT(*)
2
CREATE DATABASE mysqltest;
USE mysqltest;
CREATE TABLE t1(a INT, b INT, UNIQUE(b));
-LOAD DATA INFILE '../std_data_ln/rpl_loaddata.dat' INTO TABLE mysqltest.t1;
+LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE mysqltest.t1;
SELECT COUNT(*) FROM mysqltest.t1;
COUNT(*)
2
diff --git a/mysql-test/suite/rpl/r/rpl_loaddata_s.result b/mysql-test/suite/rpl/r/rpl_loaddata_s.result
index 4fc33eee20d..779a3af9631 100644
--- a/mysql-test/suite/rpl/r/rpl_loaddata_s.result
+++ b/mysql-test/suite/rpl/r/rpl_loaddata_s.result
@@ -6,7 +6,7 @@ drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
reset master;
create table test.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 test.t1;
count(*)
2
diff --git a/mysql-test/suite/rpl/r/rpl_loaddata_simple.result b/mysql-test/suite/rpl/r/rpl_loaddata_simple.result
index 196093211b6..5e3923616ed 100644
--- a/mysql-test/suite/rpl/r/rpl_loaddata_simple.result
+++ b/mysql-test/suite/rpl/r/rpl_loaddata_simple.result
@@ -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;
SELECT * FROM t1 ORDER BY word;
word
Aarhus
diff --git a/mysql-test/suite/rpl/r/rpl_loaddatalocal.result b/mysql-test/suite/rpl/r/rpl_loaddatalocal.result
index bb1b0610aa8..96de55e9dcf 100644
--- a/mysql-test/suite/rpl/r/rpl_loaddatalocal.result
+++ b/mysql-test/suite/rpl/r/rpl_loaddatalocal.result
@@ -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 'MYSQLD_DATADIR/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 'MYSQLD_DATADIR/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 'MYSQLD_DATADIR/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 'MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' into table t1;
SELECT * FROM t1 ORDER BY a;
a
1
diff --git a/mysql-test/suite/rpl/r/rpl_loadfile.result b/mysql-test/suite/rpl/r/rpl_loadfile.result
index 7487693a9f7..7a5a7bc50c9 100644
--- a/mysql-test/suite/rpl/r/rpl_loadfile.result
+++ b/mysql-test/suite/rpl/r/rpl_loadfile.result
@@ -8,11 +8,11 @@ DROP PROCEDURE IF EXISTS test.p1;
DROP TABLE IF EXISTS test.t1;
CREATE TABLE test.t1 (a INT, blob_column LONGBLOB, PRIMARY KEY(a));
INSERT INTO test.t1 VALUES(1,'test');
-UPDATE test.t1 SET blob_column=LOAD_FILE('../std_data_ln/words2.dat') WHERE a=1;
+UPDATE test.t1 SET blob_column=LOAD_FILE('../../std_data/words2.dat') WHERE a=1;
create procedure test.p1()
begin
INSERT INTO test.t1 VALUES(2,'test');
-UPDATE test.t1 SET blob_column=LOAD_FILE('../std_data_ln/words2.dat') WHERE a=2;
+UPDATE test.t1 SET blob_column=LOAD_FILE('../../std_data/words2.dat') WHERE a=2;
end|
CALL test.p1();
SELECT * FROM test.t1 ORDER BY blob_column;
diff --git a/mysql-test/suite/rpl/r/rpl_misc_functions.result b/mysql-test/suite/rpl/r/rpl_misc_functions.result
index a8e5520ca8f..8025387b43e 100644
--- a/mysql-test/suite/rpl/r/rpl_misc_functions.result
+++ b/mysql-test/suite/rpl/r/rpl_misc_functions.result
@@ -15,7 +15,7 @@ insert into t1 values(3, 0, 0, 0, password('does_this_work?'));
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 'MYSQLD_DATADIR/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;
@@ -41,9 +41,9 @@ CALL test_replication_sp2();
INSERT INTO t1 (col_a) VALUES (test_replication_sf());
INSERT INTO t1 (col_a) VALUES (test_replication_sf());
INSERT INTO t1 (col_a) VALUES (test_replication_sf());
-select * from t1 into outfile "../tmp/t1_slave.txt";
+select * from t1 into outfile "../../tmp/t1_slave.txt";
create temporary table t1_slave select * from t1 where 1=0;
-load data infile '../tmp/t1_slave.txt' into table t1_slave;
+load data infile '../../tmp/t1_slave.txt' into table t1_slave;
select count(*) into @aux from t1 join t1_slave using (id)
where ABS(t1.col_a - t1_slave.col_a) < 0.0000001 ;
SELECT @aux;
diff --git a/mysql-test/suite/rpl/r/rpl_replicate_do.result b/mysql-test/suite/rpl/r/rpl_replicate_do.result
index d854a2d0f8d..33088ee2ec8 100644
--- a/mysql-test/suite/rpl/r/rpl_replicate_do.result
+++ b/mysql-test/suite/rpl/r/rpl_replicate_do.result
@@ -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 --git a/mysql-test/suite/rpl/r/rpl_rewrt_db.result b/mysql-test/suite/rpl/r/rpl_rewrt_db.result
index 1b843bffdca..76dd574191f 100644
--- a/mysql-test/suite/rpl/r/rpl_rewrt_db.result
+++ b/mysql-test/suite/rpl/r/rpl_rewrt_db.result
@@ -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 'd' at row 1
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 --git a/mysql-test/suite/rpl/r/rpl_row_001.result b/mysql-test/suite/rpl/r/rpl_row_001.result
index fad60af664f..b07a99644fc 100644
--- a/mysql-test/suite/rpl/r/rpl_row_001.result
+++ b/mysql-test/suite/rpl/r/rpl_row_001.result
@@ -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 ORDER BY word LIMIT 10;
word
diff --git a/mysql-test/suite/rpl/r/rpl_row_loaddata_m.result b/mysql-test/suite/rpl/r/rpl_row_loaddata_m.result
index 149efddaf8d..198e55c71d0 100644
--- a/mysql-test/suite/rpl/r/rpl_row_loaddata_m.result
+++ b/mysql-test/suite/rpl/r/rpl_row_loaddata_m.result
@@ -9,7 +9,7 @@ stop slave;
create database mysqltest;
use mysqltest;
create table t1(a int, b int, unique(b));
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t1;
+load data infile '../../std_data/rpl_loaddata.dat' into table t1;
show binlog events from 102;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # #
diff --git a/mysql-test/suite/rpl/r/rpl_row_log.result b/mysql-test/suite/rpl/r/rpl_row_log.result
index 33a6c3b9781..c5e9cebcf23 100644
--- a/mysql-test/suite/rpl/r/rpl_row_log.result
+++ b/mysql-test/suite/rpl/r/rpl_row_log.result
@@ -12,7 +12,7 @@ create table t1(n int not null auto_increment primary key)ENGINE=MyISAM;
insert into t1 values (NULL);
drop table t1;
create table t1 (word char(20) not null)ENGINE=MyISAM;
-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
diff --git a/mysql-test/suite/rpl/r/rpl_row_log_innodb.result b/mysql-test/suite/rpl/r/rpl_row_log_innodb.result
index 9ed35f34dc5..6ea0532fe25 100644
--- a/mysql-test/suite/rpl/r/rpl_row_log_innodb.result
+++ b/mysql-test/suite/rpl/r/rpl_row_log_innodb.result
@@ -12,7 +12,7 @@ create table t1(n int not null auto_increment primary key)ENGINE=InnoDB;
insert into t1 values (NULL);
drop table t1;
create table t1 (word char(20) not null)ENGINE=InnoDB;
-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
diff --git a/mysql-test/suite/rpl/r/rpl_row_stop_middle_update.result b/mysql-test/suite/rpl/r/rpl_row_stop_middle_update.result
index 0fd4ff86893..584a3af4543 100644
--- a/mysql-test/suite/rpl/r/rpl_row_stop_middle_update.result
+++ b/mysql-test/suite/rpl/r/rpl_row_stop_middle_update.result
@@ -5,7 +5,7 @@ reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
create table t1 (words varchar(20)) engine=myisam;
-load data infile '../std_data_ln/words.dat' into table t1 (words);
+load data infile '../../std_data/words.dat' into table t1 (words);
select count(*) from t1;
count(*)
70
diff --git a/mysql-test/suite/rpl/r/rpl_stm_000001.result b/mysql-test/suite/rpl/r/rpl_stm_000001.result
index 3b4cd05f640..24e454eb876 100644
--- a/mysql-test/suite/rpl/r/rpl_stm_000001.result
+++ b/mysql-test/suite/rpl/r/rpl_stm_000001.result
@@ -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 --git a/mysql-test/suite/rpl/r/rpl_stm_log.result b/mysql-test/suite/rpl/r/rpl_stm_log.result
index 02f3dc9044a..3bbb60feca7 100644
--- a/mysql-test/suite/rpl/r/rpl_stm_log.result
+++ b/mysql-test/suite/rpl/r/rpl_stm_log.result
@@ -12,7 +12,7 @@ create table t1(n int not null auto_increment primary key)ENGINE=MyISAM;
insert into t1 values (NULL);
drop table t1;
create table t1 (word char(20) not null)ENGINE=MyISAM;
-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
@@ -25,7 +25,7 @@ master-bin.000001 # Query 1 # use `test`; insert into t1 values (NULL)
master-bin.000001 # Query 1 # use `test`; drop table t1
master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
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 t1 ignore 1 lines ;file_id=1
+master-bin.000001 # Execute_load_query 1 # use `test`; load data infile '../../std_data/words.dat' into table t1 ignore 1 lines ;file_id=1
show binlog events from 106 limit 1;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
@@ -197,7 +197,7 @@ master-bin.000001 # Query # # use `test`; insert into t1 values (NULL)
master-bin.000001 # Query # # use `test`; drop table t1
master-bin.000001 # Query # # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
master-bin.000001 # Begin_load_query # # ;file_id=1;block_len=581
-master-bin.000001 # Execute_load_query # # use `test`; load data infile '../std_data_ln/words.dat' into table t1 ignore 1 lines ;file_id=1
+master-bin.000001 # Execute_load_query # # use `test`; load data infile '../../std_data/words.dat' into table t1 ignore 1 lines ;file_id=1
master-bin.000001 # Rotate # # master-bin.000002;pos=4
show binlog events in 'master-bin.000002';
Log_name Pos Event_type Server_id End_log_pos Info
@@ -212,7 +212,7 @@ master-bin.000002 392
start slave;
show binary logs;
Log_name File_size
-slave-bin.000001 1447
+slave-bin.000001 1450
slave-bin.000002 293
show binlog events in 'slave-bin.000001' from 4;
Log_name Pos Event_type Server_id End_log_pos Info
@@ -223,7 +223,7 @@ slave-bin.000001 # Query 1 # use `test`; insert into t1 values (NULL)
slave-bin.000001 # Query 1 # use `test`; drop table t1
slave-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
slave-bin.000001 # Begin_load_query 1 # ;file_id=1;block_len=581
-slave-bin.000001 # Execute_load_query 1 # use `test`; load data INFILE '../tmp/SQL_LOAD-2-1-1.data' INTO table t1 ignore 1 lines ;file_id=1
+slave-bin.000001 # Execute_load_query 1 # use `test`; load data INFILE '../../tmp/SQL_LOAD-2-1-1.data' INTO table t1 ignore 1 lines ;file_id=1
slave-bin.000001 # Query 1 # use `test`; create table t3 (a int)ENGINE=MyISAM
slave-bin.000001 # Rotate 2 # slave-bin.000002;pos=4
show binlog events in 'slave-bin.000002' from 4;
diff --git a/mysql-test/suite/rpl/r/rpl_timezone.result b/mysql-test/suite/rpl/r/rpl_timezone.result
index cd71dbe628e..927756dd530 100644
--- a/mysql-test/suite/rpl/r/rpl_timezone.result
+++ b/mysql-test/suite/rpl/r/rpl_timezone.result
@@ -42,7 +42,7 @@ t n
2004-06-11 09:39:02 6
delete from t1;
set time_zone='UTC';
-load data infile '../std_data_ln/rpl_timezone2.dat' into table t1;
+load data infile '../../std_data/rpl_timezone2.dat' into table t1;
Warnings:
Warning 1265 Data truncated for column 't' at row 1
Warning 1261 Row 1 doesn't contain data for all columns
diff --git a/mysql-test/suite/rpl/rpl_1slave_base.cnf b/mysql-test/suite/rpl/rpl_1slave_base.cnf
new file mode 100644
index 00000000000..83b391f07c4
--- /dev/null
+++ b/mysql-test/suite/rpl/rpl_1slave_base.cnf
@@ -0,0 +1,56 @@
+# Use default setting for mysqld processes
+!include include/default_mysqld.cnf
+
+[mysqld.1]
+
+# Run the master.sh script before starting this process
+#!run-master-sh
+
+log-bin= master-bin
+
+[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
+# and 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
+
+
+rpl-recovery-rank= @mysqld.2.server-id
+
+
+[ENV]
+MASTER_MYPORT= @mysqld.1.port
+MASTER_MYSOCK= @mysqld.1.socket
+
+SLAVE_MYPORT= @mysqld.2.port
+SLAVE_MYSOCK= @mysqld.2.socket
+
diff --git a/mysql-test/suite/rpl/t/disabled.def b/mysql-test/suite/rpl/t/disabled.def
index b57c77b6ef5..ed3d4b6e01d 100644
--- a/mysql-test/suite/rpl/t/disabled.def
+++ b/mysql-test/suite/rpl/t/disabled.def
@@ -10,6 +10,6 @@
#
##############################################################################
-rpl_ddl : BUG#26418 2007-03-01 mleich Slave out of sync after CREATE/DROP TEMPORARY TABLE + ROLLBACK on master
-rpl_stm_extraColmaster_ndb : WL#3915 : Statement-based replication not supported in ndb. Enable test when supported.
-rpl_innodb_bug28430 : Bug #32247 2007-11-27 mats Test reports wrong value of "AUTO_INCREMENT" (on a partitioned InnoDB table)
+rpl_ddl : BUG#26418 Slave out of sync after CREATE/DROP TEMPORARY TABLE + ROLLBACK on master
+rpl_stm_extraColmaster_ndb : WL#3915 Statement-based replication not supported in ndb. Enable test when supported.
+rpl_innodb_bug28430 : Bug #32247 Test reports wrong value of "AUTO_INCREMENT" (on a partitioned InnoDB table)
diff --git a/mysql-test/suite/rpl/t/rpl000017-slave.sh b/mysql-test/suite/rpl/t/rpl000017-slave.sh
index 17188aba0db..1d95798260a 100755
--- a/mysql-test/suite/rpl/t/rpl000017-slave.sh
+++ b/mysql-test/suite/rpl/t/rpl000017-slave.sh
@@ -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/data/relay-log.info
+cat > $MYSQLTEST_VARDIR/mysqld.2/data/master.info <<EOF
master-bin.000001
4
127.0.0.1
diff --git a/mysql-test/suite/rpl/t/rpl_000015-master.opt b/mysql-test/suite/rpl/t/rpl_000015-master.opt
new file mode 100644
index 00000000000..59a8261ba69
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_000015-master.opt
@@ -0,0 +1,2 @@
+--config-file-template=../rpl_1slave_base.cnf
+
diff --git a/mysql-test/suite/rpl/t/rpl_000015.slave-mi b/mysql-test/suite/rpl/t/rpl_000015-slave.opt
index 28bc753dd56..28bc753dd56 100644
--- a/mysql-test/suite/rpl/t/rpl_000015.slave-mi
+++ b/mysql-test/suite/rpl/t/rpl_000015-slave.opt
diff --git a/mysql-test/suite/rpl/t/rpl_LD_INFILE.test b/mysql-test/suite/rpl/t/rpl_LD_INFILE.test
index bace5d4c1f5..ae647ed6648 100644
--- a/mysql-test/suite/rpl/t/rpl_LD_INFILE.test
+++ b/mysql-test/suite/rpl/t/rpl_LD_INFILE.test
@@ -16,10 +16,10 @@ DROP TABLE IF EXISTS test.t1;
# Section 1 test
CREATE TABLE test.t1 (a VARCHAR(255), PRIMARY KEY(a));
-LOAD DATA INFILE '../std_data_ln/words2.dat' INTO TABLE test.t1;
+LOAD DATA INFILE '../../std_data/words2.dat' INTO TABLE test.t1;
DELETE FROM test.t1 WHERE a = 'abashed';
DELETE FROM test.t1;
-LOAD DATA INFILE '../std_data_ln/words2.dat' INTO TABLE test.t1;
+LOAD DATA INFILE '../../std_data/words2.dat' INTO TABLE test.t1;
SELECT * FROM test.t1 ORDER BY a DESC;
diff --git a/mysql-test/suite/rpl/t/rpl_drop_db.test b/mysql-test/suite/rpl/t/rpl_drop_db.test
index 7f4a7843c4a..6aab1aec188 100644
--- a/mysql-test/suite/rpl/t/rpl_drop_db.test
+++ b/mysql-test/suite/rpl/t/rpl_drop_db.test
@@ -53,7 +53,8 @@ drop database mysqltest1;
connection master;
# Remove the "extra" file created above
---remove_file $MYSQLTEST_VARDIR/master-data/mysqltest1/f1.txt
+let $MYSQLD_DATADIR= `select @@datadir`;
+--remove_file $MYSQLD_DATADIR/mysqltest1/f1.txt
drop database mysqltest1;
use test;
diff --git a/mysql-test/suite/rpl/t/rpl_flushlog_loop-master.opt b/mysql-test/suite/rpl/t/rpl_flushlog_loop-master.opt
index a4d1d403dc9..95bca94fd3a 100644
--- a/mysql-test/suite/rpl/t/rpl_flushlog_loop-master.opt
+++ b/mysql-test/suite/rpl/t/rpl_flushlog_loop-master.opt
@@ -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 --git a/mysql-test/suite/rpl/t/rpl_flushlog_loop-slave.opt b/mysql-test/suite/rpl/t/rpl_flushlog_loop-slave.opt
index 95839c831c9..e2aa63225a3 100644
--- a/mysql-test/suite/rpl/t/rpl_flushlog_loop-slave.opt
+++ b/mysql-test/suite/rpl/t/rpl_flushlog_loop-slave.opt
@@ -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/data/relay-log
diff --git a/mysql-test/suite/rpl/t/rpl_flushlog_loop.test b/mysql-test/suite/rpl/t/rpl_flushlog_loop.test
index 750b49f19a9..9bfd921bc1f 100644
--- a/mysql-test/suite/rpl/t/rpl_flushlog_loop.test
+++ b/mysql-test/suite/rpl/t/rpl_flushlog_loop.test
@@ -2,7 +2,8 @@
# in case of bi-directional replication
-- source include/master-slave.inc
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+let $MYSQLD_DATADIR= `select @@datadir`;
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR/
show variables like 'relay_log%';
connection slave;
diff --git a/mysql-test/suite/rpl/t/rpl_innodb.test b/mysql-test/suite/rpl/t/rpl_innodb.test
index 30d40e19614..012ecbeb2ea 100644
--- a/mysql-test/suite/rpl/t/rpl_innodb.test
+++ b/mysql-test/suite/rpl/t/rpl_innodb.test
@@ -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 --git a/mysql-test/suite/rpl/t/rpl_innodb_bug30919.test b/mysql-test/suite/rpl/t/rpl_innodb_bug30919.test
index 56b2c7bc03d..17d2261e13a 100644
--- a/mysql-test/suite/rpl/t/rpl_innodb_bug30919.test
+++ b/mysql-test/suite/rpl/t/rpl_innodb_bug30919.test
@@ -1,5 +1,6 @@
--source include/have_innodb.inc
--source include/have_partition.inc
+--source include/have_log_bin.inc
--vertical_results
let $engine_type= 'innodb';
diff --git a/mysql-test/suite/rpl/t/rpl_load_from_master.test b/mysql-test/suite/rpl/t/rpl_load_from_master.test
index 9bab7d5696e..e7708ff222f 100644
--- a/mysql-test/suite/rpl/t/rpl_load_from_master.test
+++ b/mysql-test/suite/rpl/t/rpl_load_from_master.test
@@ -144,10 +144,11 @@ 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/;
+let $MYSQLD_SLAVE_DATADIR= `select @@datadir`;
+# system chmod 500 $MYSQLD_SLAVE_DATADIR/mysqltest/;
# --error 6
# load data from master; # should fail (errno 13)
-# system chmod 700 $MYSQLTEST_VARDIR/slave-data/mysqltest/;
+# system chmod 700 $MYSQLD_SLAVE_DATADIR/mysqltest/;
# select * from mysqltest.t1; # should contain the row (10, ...)
diff --git a/mysql-test/suite/rpl/t/rpl_load_table_from_master.test b/mysql-test/suite/rpl/t/rpl_load_table_from_master.test
index b9cec3858a9..aad113878d3 100644
--- a/mysql-test/suite/rpl/t/rpl_load_table_from_master.test
+++ b/mysql-test/suite/rpl/t/rpl_load_table_from_master.test
@@ -71,9 +71,9 @@ sync_with_master;
connection master;
set SQL_LOG_BIN=0;
create table t1 (word char(20) not null, index(word))ENGINE=MyISAM;
-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)ENGINE=MyISAM;
-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)ENGINE=MyISAM;
connection slave;
load table t1 from master;
diff --git a/mysql-test/suite/rpl/t/rpl_loaddata_charset.test b/mysql-test/suite/rpl/t/rpl_loaddata_charset.test
index 7f2389cb9f6..c191d29d5a3 100644
--- a/mysql-test/suite/rpl/t/rpl_loaddata_charset.test
+++ b/mysql-test/suite/rpl/t/rpl_loaddata_charset.test
@@ -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 --git a/mysql-test/suite/rpl/t/rpl_loaddata_fatal.test b/mysql-test/suite/rpl/t/rpl_loaddata_fatal.test
index dceee7a65af..b7d9995c834 100644
--- a/mysql-test/suite/rpl/t/rpl_loaddata_fatal.test
+++ b/mysql-test/suite/rpl/t/rpl_loaddata_fatal.test
@@ -13,7 +13,7 @@ source include/show_slave_status.inc;
# Now we feed it a load data infile, which should make it stop with a
# fatal error.
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;
connection slave;
wait_for_slave_to_stop;
diff --git a/mysql-test/suite/rpl/t/rpl_loaddata_m.test b/mysql-test/suite/rpl/t/rpl_loaddata_m.test
index 537d4c163ef..42c3ad99f33 100644
--- a/mysql-test/suite/rpl/t/rpl_loaddata_m.test
+++ b/mysql-test/suite/rpl/t/rpl_loaddata_m.test
@@ -17,14 +17,14 @@ connection master;
# 'test' database should be ignored by the slave
USE test;
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 test.t1;
# 'mysqltest' database should NOT be ignored by the slave
CREATE DATABASE mysqltest;
USE mysqltest;
CREATE TABLE t1(a INT, b INT, UNIQUE(b));
-LOAD DATA INFILE '../std_data_ln/rpl_loaddata.dat' INTO TABLE mysqltest.t1;
+LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE mysqltest.t1;
SELECT COUNT(*) FROM mysqltest.t1;
# Now lets check the slave to see what we have :-)
diff --git a/mysql-test/suite/rpl/t/rpl_loaddata_s.test b/mysql-test/suite/rpl/t/rpl_loaddata_s.test
index f397d741310..2dd2218eb5c 100644
--- a/mysql-test/suite/rpl/t/rpl_loaddata_s.test
+++ b/mysql-test/suite/rpl/t/rpl_loaddata_s.test
@@ -12,7 +12,7 @@ reset master;
connection master;
# 'test' is the current database
create table test.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 --git a/mysql-test/suite/rpl/t/rpl_loaddata_simple.test b/mysql-test/suite/rpl/t/rpl_loaddata_simple.test
index 9e908cac677..439c2b48ca5 100644
--- a/mysql-test/suite/rpl/t/rpl_loaddata_simple.test
+++ b/mysql-test/suite/rpl/t/rpl_loaddata_simple.test
@@ -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;
SELECT * FROM t1 ORDER BY word;
sync_slave_with_master;
diff --git a/mysql-test/suite/rpl/t/rpl_loaddatalocal.test b/mysql-test/suite/rpl/t/rpl_loaddatalocal.test
index b10603e7195..0de402f301a 100644
--- a/mysql-test/suite/rpl/t/rpl_loaddatalocal.test
+++ b/mysql-test/suite/rpl/t/rpl_loaddatalocal.test
@@ -19,13 +19,14 @@ 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;
+let $MYSQLD_DATADIR= `select @@datadir`;
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+eval select * into outfile '$MYSQLD_DATADIR/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;
---remove_file $MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+eval load data local infile '$MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' into table t1;
+--remove_file $MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile
save_master_pos;
connection slave;
sync_with_master;
@@ -46,13 +47,13 @@ sync_with_master;
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;
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+eval select * into outfile '$MYSQLD_DATADIR/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;
---remove_file $MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+eval load data local infile '$MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' into table t1;
+--remove_file $MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile
SELECT * FROM t1 ORDER BY a;
save_master_pos;
connection slave;
diff --git a/mysql-test/suite/rpl/t/rpl_loadfile.test b/mysql-test/suite/rpl/t/rpl_loadfile.test
index 532db77c248..5aa4da41fe5 100644
--- a/mysql-test/suite/rpl/t/rpl_loadfile.test
+++ b/mysql-test/suite/rpl/t/rpl_loadfile.test
@@ -24,12 +24,12 @@ DROP TABLE IF EXISTS test.t1;
CREATE TABLE test.t1 (a INT, blob_column LONGBLOB, PRIMARY KEY(a));
INSERT INTO test.t1 VALUES(1,'test');
-UPDATE test.t1 SET blob_column=LOAD_FILE('../std_data_ln/words2.dat') WHERE a=1;
+UPDATE test.t1 SET blob_column=LOAD_FILE('../../std_data/words2.dat') WHERE a=1;
delimiter |;
create procedure test.p1()
begin
INSERT INTO test.t1 VALUES(2,'test');
- UPDATE test.t1 SET blob_column=LOAD_FILE('../std_data_ln/words2.dat') WHERE a=2;
+ UPDATE test.t1 SET blob_column=LOAD_FILE('../../std_data/words2.dat') WHERE a=2;
end|
delimiter ;|
diff --git a/mysql-test/suite/rpl/t/rpl_misc_functions.test b/mysql-test/suite/rpl/t/rpl_misc_functions.test
index 4a47e9645f9..873c54b679b 100644
--- a/mysql-test/suite/rpl/t/rpl_misc_functions.test
+++ b/mysql-test/suite/rpl/t/rpl_misc_functions.test
@@ -21,11 +21,12 @@ insert into t1 values(3, 0, 0, 0, password('does_this_work?'));
# "altogether now"
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;
+let $MYSQLD_DATADIR= `select @@datadir`;
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;
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+eval load data local infile '$MYSQLD_DATADIR/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);
@@ -81,12 +82,12 @@ INSERT INTO t1 (col_a) VALUES (test_replication_sf());
--sync_slave_with_master
# Dump table on slave
-select * from t1 into outfile "../tmp/t1_slave.txt";
+select * from t1 into outfile "../../tmp/t1_slave.txt";
# Load data from slave into temp table on master
connection master;
create temporary table t1_slave select * from t1 where 1=0;
-load data infile '../tmp/t1_slave.txt' into table t1_slave;
+load data infile '../../tmp/t1_slave.txt' into table t1_slave;
--remove_file $MYSQLTEST_VARDIR/tmp/t1_slave.txt
# Compare master and slave temp table, use subtraction
@@ -109,7 +110,7 @@ DROP TABLE t1, t1_slave;
DROP PROCEDURE test_replication_sp1;
DROP PROCEDURE test_replication_sp2;
DROP FUNCTION test_replication_sf;
---remove_file $MYSQLTEST_VARDIR/master-data/test/rpl_misc_functions.outfile
+--remove_file $MYSQLD_DATADIR/test/rpl_misc_functions.outfile
--sync_slave_with_master
diff --git a/mysql-test/suite/rpl/t/rpl_replicate_do.test b/mysql-test/suite/rpl/t/rpl_replicate_do.test
index 90f00764691..fea168ee9f1 100644
--- a/mysql-test/suite/rpl/t/rpl_replicate_do.test
+++ b/mysql-test/suite/rpl/t/rpl_replicate_do.test
@@ -11,7 +11,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 --git a/mysql-test/suite/rpl/t/rpl_rewrt_db.test b/mysql-test/suite/rpl/t/rpl_rewrt_db.test
index 52f04e073dd..4dfe2edaf35 100644
--- a/mysql-test/suite/rpl/t/rpl_rewrt_db.test
+++ b/mysql-test/suite/rpl/t/rpl_rewrt_db.test
@@ -34,8 +34,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;
@@ -43,7 +43,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;
@@ -52,7 +52,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;
@@ -61,7 +61,7 @@ select concat('|',a,'|'), concat('|',b,'|') from rewrite.t1;
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;
@@ -69,7 +69,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 --git a/mysql-test/suite/rpl/t/rpl_rotate_logs-master.opt b/mysql-test/suite/rpl/t/rpl_rotate_logs-master.opt
index ad2c6a647b5..550212a5297 100644
--- a/mysql-test/suite/rpl/t/rpl_rotate_logs-master.opt
+++ b/mysql-test/suite/rpl/t/rpl_rotate_logs-master.opt
@@ -1 +1,3 @@
-O max_binlog_size=4096
+--config-file-template=../rpl_1slave_base.cnf
+
diff --git a/mysql-test/suite/rpl/t/rpl_rotate_logs.slave-mi b/mysql-test/suite/rpl/t/rpl_rotate_logs-slave.opt
index 80190bf6d29..80190bf6d29 100644
--- a/mysql-test/suite/rpl/t/rpl_rotate_logs.slave-mi
+++ b/mysql-test/suite/rpl/t/rpl_rotate_logs-slave.opt
diff --git a/mysql-test/suite/rpl/t/rpl_rotate_logs.test b/mysql-test/suite/rpl/t/rpl_rotate_logs.test
index 998bce33e8f..e07de5fe38f 100644
--- a/mysql-test/suite/rpl/t/rpl_rotate_logs.test
+++ b/mysql-test/suite/rpl/t/rpl_rotate_logs.test
@@ -23,9 +23,10 @@ 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;
+let $MYSQLD_SLAVE_DATADIR= `select @@datadir`;
+write_file $MYSQLD_SLAVE_DATADIR/master.info;
EOF
-chmod 0000 $MYSQLTEST_VARDIR/slave-data/master.info;
+chmod 0000 $MYSQLD_SLAVE_DATADIR/master.info;
connection slave;
--disable_warnings
drop table if exists t1, t2, t3, t4;
@@ -36,7 +37,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 $MYSQLD_SLAVE_DATADIR/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 --git a/mysql-test/suite/rpl/t/rpl_row_charset_innodb.test b/mysql-test/suite/rpl/t/rpl_row_charset_innodb.test
index 1465500d0eb..94be8f76e4b 100644
--- a/mysql-test/suite/rpl/t/rpl_row_charset_innodb.test
+++ b/mysql-test/suite/rpl/t/rpl_row_charset_innodb.test
@@ -5,5 +5,6 @@
-- source include/not_ndb_default.inc
-- source include/have_binlog_format_row.inc
-- source include/master-slave.inc
+--source include/have_innodb.inc
let $engine_type=innodb;
-- source extra/rpl_tests/rpl_row_charset.test
diff --git a/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test b/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test
index be76ac9f3f6..cf2bfe31475 100644
--- a/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test
+++ b/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test
@@ -37,11 +37,11 @@ CREATE TABLE t3(c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB, c3 TIMESTAMP, c4 TEXT,
--disable_query_log
INSERT INTO t1 VALUES ("abirvalg");
-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;
# d1 length 3000
set @d1 = 'dd1';
@@ -96,10 +96,10 @@ select "--- Test 1 Dump binlog to file --" as "";
#
# Prepare local temporary file to recreate what we have currently.
+let $MYSQLD_DATADIR= `select @@datadir;`;
+--exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/master.sql
---exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/master.sql
-
---exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000002 >> $MYSQLTEST_VARDIR/tmp/master.sql
+--exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000002 >> $MYSQLTEST_VARDIR/tmp/master.sql
# Now that we have our file, lets get rid of the current database.
# Cleanup the master and the slave and try to recreate.
@@ -160,7 +160,7 @@ connection master;
# We should be gold by the time, so I will get rid of our file.
---exec rm $MYSQLTEST_VARDIR/tmp/master.sql
+remove_file $MYSQLTEST_VARDIR/tmp/master.sql;
# this test for position option
@@ -168,8 +168,9 @@ connection master;
--disable_query_log
select "--- Test 2 position test --" as "";
--enable_query_log
+let $MYSQLD_DATADIR= `select @@datadir;`;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --position=416 $MYSQLTEST_VARDIR/log/master-bin.000001
+--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --position=416 $MYSQLD_DATADIR/master-bin.000001
# These are tests for remote binlog.
# They should return the same as previous test.
@@ -258,14 +259,15 @@ select "--- Test 5 LOAD DATA --" as "";
--disable_query_log
select "--- Test 6 reading stdin --" as "";
--enable_query_log
+let $MYSQLD_DATADIR= `select @@datadir;`;
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
---exec $MYSQL_BINLOG --short-form - < $MYSQLTEST_VARDIR/log/master-bin.000001
+--exec $MYSQL_BINLOG --short-form - < $MYSQLD_DATADIR/master-bin.000001
--disable_query_log
select "--- Test 7 reading stdin w/position --" as "";
--enable_query_log
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
---exec $MYSQL_BINLOG --short-form --position=416 - < $MYSQLTEST_VARDIR/log/master-bin.000001
+--exec $MYSQL_BINLOG --short-form --position=416 - < $MYSQLD_DATADIR/master-bin.000001
# Bug#16217 (mysql client did not know how not switch its internal charset)
--disable_query_log
@@ -294,9 +296,10 @@ create table t4 (f text character set utf8);
create table t5 (f text character set cp932);
--exec $MYSQL --default-character-set=utf8 test -e "insert into t4 values(_utf8'ソ')"
--exec $MYSQL --default-character-set=cp932 test -e "insert into t5 values(_cp932'ƒ\');"
+let $MYSQLD_DATADIR= `select @@datadir;`;
flush logs;
rename table t4 to t04, t5 to t05;
---exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000001 | $MYSQL --default-character-set=utf8
+--exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 | $MYSQL --default-character-set=utf8
# original and recovered data must be equal
select HEX(f) from t04;
select HEX(f) from t4;
@@ -332,10 +335,12 @@ INSERT INTO t1 VALUES(1,1);
SELECT * FROM t1;
+let $MYSQLD_DATADIR= `select @@datadir;`;
+
FLUSH LOGS;
--exec $MYSQL_BINLOG --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 > $MYSQLTEST_VARDIR/tmp/remote.sql
---exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/local.sql
+--exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/local.sql
--diff_files $MYSQLTEST_VARDIR/tmp/local.sql $MYSQLTEST_VARDIR/tmp/remote.sql
diff --git a/mysql-test/suite/rpl/t/rpl_row_stop_middle_update.test b/mysql-test/suite/rpl/t/rpl_row_stop_middle_update.test
index 29b3008e822..82c4b1a9936 100644
--- a/mysql-test/suite/rpl/t/rpl_row_stop_middle_update.test
+++ b/mysql-test/suite/rpl/t/rpl_row_stop_middle_update.test
@@ -9,7 +9,7 @@
connection master;
create table t1 (words varchar(20)) engine=myisam;
-load data infile '../std_data_ln/words.dat' into table t1 (words);
+load data infile '../../std_data/words.dat' into table t1 (words);
select count(*) from t1;
save_master_pos;
diff --git a/mysql-test/suite/rpl/t/rpl_timezone.test b/mysql-test/suite/rpl/t/rpl_timezone.test
index dac21000a62..d65242f2a22 100644
--- a/mysql-test/suite/rpl/t/rpl_timezone.test
+++ b/mysql-test/suite/rpl/t/rpl_timezone.test
@@ -67,7 +67,7 @@ connection master;
connection master;
delete from t1;
set time_zone='UTC';
-load data infile '../std_data_ln/rpl_timezone2.dat' into table t1;
+load data infile '../../std_data/rpl_timezone2.dat' into table t1;
SELECT * FROM t1 ORDER BY n;
sync_slave_with_master;
set time_zone='UTC';
diff --git a/mysql-test/suite/rpl/t/rpl_trigger.test b/mysql-test/suite/rpl/t/rpl_trigger.test
index 4a496ea4923..9538333dcf2 100644
--- a/mysql-test/suite/rpl/t/rpl_trigger.test
+++ b/mysql-test/suite/rpl/t/rpl_trigger.test
@@ -296,8 +296,10 @@ STOP SLAVE;
# Replace master's binlog.
connection master;
+let $MYSQLD_DATADIR= `select @@datadir`;
FLUSH LOGS;
-exec cp $MYSQL_TEST_DIR/std_data/bug16266.000001 $MYSQLTEST_VARDIR/log/master-bin.000001;
+remove_file $MYSQLD_DATADIR/master-bin.000001;
+copy_file $MYSQL_TEST_DIR/std_data/bug16266.000001 $MYSQLD_DATADIR/master-bin.000001;
# Make the slave to replay the new binlog.
diff --git a/mysql-test/suite/rpl_ndb/my.cnf b/mysql-test/suite/rpl_ndb/my.cnf
new file mode 100644
index 00000000000..b37b163afee
--- /dev/null
+++ b/mysql-test/suite/rpl_ndb/my.cnf
@@ -0,0 +1,75 @@
+!include include/default_mysqld.cnf
+!include include/default_ndbd.cnf
+
+[cluster_config.1]
+NoOfReplicas= 2
+ndbd=,
+ndb_mgmd=
+mysqld=,
+
+[cluster_config.slave]
+NoOfReplicas= 1
+ndbd=
+ndb_mgmd=
+mysqld=
+
+[mysqld]
+# Make all mysqlds use cluster
+ndbcluster
+# Turn on bin logging
+log-bin= master-bin
+
+[mysqld.1.1]
+
+[mysqld.1.1]
+
+[mysqld.1.slave]
+
+# Append <testname>-slave.opt file to the list of argument used when
+# starting the mysqld
+#!use-slave-opt
+
+# Connect mysqld in the second cluster as save to first mysqld
+# Hardcode the host to 127.0.0.1 until running on more
+# than one host and it probably need to be masked anyway
+# master-host= @mysqld.1.#host
+master-host= 127.0.0.1
+master-port= @mysqld.1.1.port
+master-password= @mysqld.1.1.#password
+master-user= @mysqld.1.1.#user
+master-connect-retry= 1
+
+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
+# and shows up in SHOW SLAVE STATUS;
+report-host= 127.0.0.1
+report-port= @mysqld.1.slave.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
+
+rpl-recovery-rank= @mysqld.1.slave.server-id
+
+
+[ENV]
+NDB_CONNECTSTRING= @mysql_cluster.1.ndb_connectstring
+MASTER_MYPORT= @mysqld.1.1.port
+MASTER_MYPORT1= @mysqld.2.1.port
+
+NDB_CONNECTSTRING_SLAVE= @mysql_cluster.slave.ndb_connectstring
+SLAVE_MYPORT= @mysqld.1.slave.port
+SLAVE_MYSOCK= @mysqld.1.slave.socket
+
+NDB_BACKUP_DIR= @cluster_config.ndbd.1.1.BackupDataDir
diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_dd_advance.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_dd_advance.result
index 7f26313894c..37188aeb1ca 100644
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_dd_advance.result
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_dd_advance.result
@@ -265,13 +265,9 @@ COUNT(*)
SELECT COUNT(*) FROM history;
COUNT(*)
200
-CREATE TEMPORARY TABLE IF NOT EXISTS mysql.backup_info (id INT, backup_id INT) ENGINE = HEAP;
-DELETE FROM mysql.backup_info;
-LOAD DATA INFILE '../tmp.dat' INTO TABLE mysql.backup_info FIELDS TERMINATED BY ',';
-SELECT @the_backup_id:=backup_id FROM mysql.backup_info;
-@the_backup_id:=backup_id
-<the_backup_id>
-DROP TABLE IF EXISTS mysql.backup_info;
+CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
+LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
+DROP TABLE test.backup_info;
************ Restore the slave ************************
CREATE DATABASE tpcb;
***** Check a few slave restore values ***************
diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_innodb_trans.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_innodb_trans.result
index 148e6247b03..7c3f331958f 100644
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_innodb_trans.result
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_innodb_trans.result
@@ -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 --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result
index 326506b0396..438bdf91c09 100644
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result
@@ -12,7 +12,7 @@ create table t1(n int not null auto_increment primary key)ENGINE=NDB;
insert into t1 values (NULL);
drop table t1;
create table t1 (word char(20) not null)ENGINE=NDB;
-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
diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_multi.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_multi.result
index 760114f3639..2e267bf77c1 100644
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_multi.result
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_multi.result
@@ -26,10 +26,10 @@ stop slave;
SELECT @the_pos:=Position,@the_file:=SUBSTRING_INDEX(FILE, '/', -1)
FROM mysql.ndb_binlog_index WHERE epoch = <the_epoch> ;
@the_pos:=Position @the_file:=SUBSTRING_INDEX(FILE, '/', -1)
-106 master-bin1.000001
+106 master-bin.000001
CHANGE MASTER TO
master_port=<MASTER_PORT1>,
-master_log_file = 'master-bin1.000001',
+master_log_file = 'master-bin.000001',
master_log_pos = 106 ;
start slave;
INSERT INTO t1 VALUES ("row2","will go away",2),("row3","will change",3),("row4","D",4);
diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_row_001.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_row_001.result
index 56bb31e329d..21fc33c577f 100644
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_row_001.result
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_row_001.result
@@ -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 ORDER BY word LIMIT 10;
word
diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_sync.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_sync.result
index f2a1ba410b9..c788893e055 100644
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_sync.result
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_sync.result
@@ -25,12 +25,8 @@ hex(c2) hex(c3) c1
0 1 BCDEF
1 0 CD
0 0 DEFGHIJKL
-CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
-DELETE FROM test.backup_info;
-LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
-SELECT @the_backup_id:=backup_id FROM test.backup_info;
-@the_backup_id:=backup_id
-<the_backup_id>
+CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
+LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
DROP TABLE test.backup_info;
UPDATE t1 SET c2=0 WHERE c3="row2";
SELECT hex(c1),hex(c2),c3 FROM t1 ORDER BY c3;
diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_bank.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_bank.test
index ce951f01212..b90e6fff8bc 100644
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_bank.test
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_bank.test
@@ -73,7 +73,7 @@ CREATE TABLE ACCOUNT_TYPE ( ACCOUNT_TYPE_ID INT UNSIGNED NOT NULL,
#
# create "BANK" application
#
---exec NDB_CONNECTSTRING=localhost:$NDBCLUSTER_PORT ../storage/ndb/test/ndbapi/bank/bankCreator >> $NDB_TOOLS_OUTPUT
+--exec NDB_CONNECTSTRING=$NDB_CONNECTSTRING ../storage/ndb/test/ndbapi/bank/bankCreator >> $NDB_TOOLS_OUTPUT
#
# start main loop
@@ -88,9 +88,9 @@ while ($2)
#
# start "BANK" application
#
---exec NDB_CONNECTSTRING=localhost:$NDBCLUSTER_PORT ../storage/ndb/test/ndbapi/bank/bankTimer -w 5 >> $NDB_TOOLS_OUTPUT &
---exec NDB_CONNECTSTRING=localhost:$NDBCLUSTER_PORT ../storage/ndb/test/ndbapi/bank/bankMakeGL >> $NDB_TOOLS_OUTPUT &
---exec NDB_CONNECTSTRING=localhost:$NDBCLUSTER_PORT ../storage/ndb/test/ndbapi/bank/bankTransactionMaker >> $NDB_TOOLS_OUTPUT &
+--exec NDB_CONNECTSTRING=$NDB_CONNECTSTRING ../storage/ndb/test/ndbapi/bank/bankTimer -w 5 >> $NDB_TOOLS_OUTPUT &
+--exec NDB_CONNECTSTRING=$NDB_CONNECTSTRING ../storage/ndb/test/ndbapi/bank/bankMakeGL >> $NDB_TOOLS_OUTPUT &
+--exec NDB_CONNECTSTRING=$NDB_CONNECTSTRING ../storage/ndb/test/ndbapi/bank/bankTransactionMaker >> $NDB_TOOLS_OUTPUT &
#
# let the "BANK" run for a while
@@ -114,10 +114,10 @@ CREATE DATABASE BANK;
# start by taking a backup on master
--connection master
RESET MASTER;
---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 TABLE IF NOT EXISTS mysql.backup_info (id INT, backup_id INT) ENGINE = HEAP;
DELETE FROM mysql.backup_info;
LOAD DATA INFILE '../tmp.dat' INTO TABLE mysql.backup_info FIELDS TERMINATED BY ',';
@@ -128,8 +128,8 @@ let the_backup_id=`select @the_backup_id`;
# restore on slave, first check that nothing is there
--connection slave
---exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT_SLAVE" -p 8 -b $the_backup_id -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
---exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT_SLAVE" -p 8 -b $the_backup_id -n 2 -r -e --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
+--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING_SLAVE" -p 8 -b $the_backup_id -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
+--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING_SLAVE" -p 8 -b $the_backup_id -n 2 -r -e --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
#
# now setup replication to continue from last epoch
@@ -150,7 +150,7 @@ while ($1)
--replace_column 1 <Slave_IO_State> 7 <Read_Master_Log_Pos> 8 <Relay_Log_File> 9 <Relay_Log_Pos> 16 <Replicate_Ignore_Table> 22 <Exec_Master_Log_Pos> 23 <Relay_Log_Space> 33 <Seconds_Behind_Master> 34 <Last_IO_Errno> 35 <Last_IO_Error>
SHOW SLAVE STATUS;
STOP SLAVE;
- --exec NDB_CONNECTSTRING=localhost:$NDBCLUSTER_PORT_SLAVE ../storage/ndb/test/ndbapi/bank/bankValidateAllGLs >> $NDB_TOOLS_OUTPUT
+ --exec NDB_CONNECTSTRING=$NDB_CONNECTSTRING_SLAVE ../storage/ndb/test/ndbapi/bank/bankValidateAllGLs >> $NDB_TOOLS_OUTPUT
START SLAVE;
--dec $1
}
diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_dd_advance.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_dd_advance.test
index a7e00262f5c..e08b1b6f701 100644
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_dd_advance.test
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_dd_advance.test
@@ -9,8 +9,6 @@
--source include/have_binlog_format_mixed_or_row.inc
--source include/ndb_default_cluster.inc
--source include/not_embedded.inc
-#--source include/big_test.inc
-#--source include/have_ndb_extra.inc
--source include/ndb_master-slave.inc
#### Test start cleanup section #####
@@ -289,25 +287,7 @@ while ($j)
SELECT COUNT(*) FROM history;
-#RESET MASTER;
---exec $NDB_MGM --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -e "start backup" >> $NDB_TOOLS_OUTPUT
-
---exec $NDB_TOOLS_DIR/ndb_select_all --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -d sys --delimiter=',' SYSTAB_0 | grep 520093696 > $MYSQLTEST_VARDIR/tmp.dat
-
-CREATE TEMPORARY TABLE IF NOT EXISTS mysql.backup_info (id INT, backup_id INT) ENGINE = HEAP;
-
-DELETE FROM mysql.backup_info;
-
-LOAD DATA INFILE '../tmp.dat' INTO TABLE mysql.backup_info FIELDS TERMINATED BY ',';
---exec rm $MYSQLTEST_VARDIR/tmp.dat || true
---replace_column 1 <the_backup_id>
-
-SELECT @the_backup_id:=backup_id FROM mysql.backup_info;
-
-let the_backup_id=`select @the_backup_id`;
-
-DROP TABLE IF EXISTS mysql.backup_info;
-#RESET MASTER;
+--source include/ndb_backup.inc
--echo ************ Restore the slave ************************
connection slave;
@@ -424,7 +404,7 @@ diff_files $MYSQLTEST_VARDIR/tmp/RPL_DD_ADV_M.sql $MYSQLTEST_VARDIR/tmp/RPL_DD_A
## Note: Ths files should only get removed, if the above diff succeeds.
---exec rm $MYSQLTEST_VARDIR/tmp/RPL_DD_ADV_M.sql
---exec rm $MYSQLTEST_VARDIR/tmp/RPL_DD_ADV_S.sql
+remove_file $MYSQLTEST_VARDIR/tmp/RPL_DD_ADV_M.sql;
+remove_file $MYSQLTEST_VARDIR/tmp/RPL_DD_ADV_S.sql;
# End 5.1 test case
diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_innodb_trans.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_innodb_trans.test
index 2f2414ba578..fcc2928c5e2 100644
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_innodb_trans.test
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_innodb_trans.test
@@ -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 --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_load.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_load.test
index a695eee3221..75fe2688b4a 100644
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_load.test
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_load.test
@@ -62,5 +62,5 @@ CREATE TABLE SERVER
#
# start "load" application
#
---exec NDB_CONNECTSTRING=localhost:$NDBCLUSTER_PORT ../storage/ndb/test/ndbapi/DbCreate >> $NDB_TOOLS_OUTPUT
---exec NDB_CONNECTSTRING=localhost:$NDBCLUSTER_PORT ../storage/ndb/test/ndbapi/DbAsyncGenerator >> $NDB_TOOLS_OUTPUT
+--exec NDB_CONNECTSTRING=$NDB_CONNECTSTRING ../storage/ndb/test/ndbapi/DbCreate >> $NDB_TOOLS_OUTPUT
+--exec NDB_CONNECTSTRING=$NDB_CONNECTSTRING ../storage/ndb/test/ndbapi/DbAsyncGenerator >> $NDB_TOOLS_OUTPUT
diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_sync.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_sync.test
index 116f0879ca0..88572c3e9a2 100644
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_sync.test
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_sync.test
@@ -39,8 +39,8 @@ SELECT hex(c1),hex(c2),c3 FROM t1 ORDER BY c3;
# we should have no tables
SHOW TABLES;
---exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT_SLAVE" -b $the_backup_id -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
---exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT_SLAVE" -b $the_backup_id -n 2 -r -e --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
+--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING_SLAVE" -b $the_backup_id -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
+--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING_SLAVE" -b $the_backup_id -n 2 -r -e --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
#
# BUG#11960
@@ -50,8 +50,8 @@ SHOW TABLES;
DROP DATABASE ndbsynctest;
CREATE DATABASE ndbsynctest;
USE ndbsynctest;
---exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT_SLAVE" -b $the_backup_id -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
---exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT_SLAVE" -b $the_backup_id -n 2 -r -e --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
+--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING_SLAVE" -b $the_backup_id -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
+--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING_SLAVE" -b $the_backup_id -n 2 -r -e --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
# continue test
SHOW TABLES;
diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndbapi_multi.test b/mysql-test/suite/rpl_ndb/t/rpl_ndbapi_multi.test
index 5067722bb79..543393b980d 100644
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndbapi_multi.test
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndbapi_multi.test
@@ -4,8 +4,8 @@
-- source include/ndb_master-slave.inc
--exec echo Running ndbapi_simple_dual
---exec $NDB_EXAMPLES_DIR/ndbapi_simple_dual/ndbapi_simple_dual $MASTER_MYSOCK "localhost:$NDBCLUSTER_PORT" $SLAVE_MYSOCK "localhost:$NDBCLUSTER_PORT_SLAVE" >> $NDB_EXAMPLES_OUTPUT
+--exec $NDB_EXAMPLES_DIR/ndbapi_simple_dual/ndbapi_simple_dual $MASTER_MYSOCK "$NDB_CONNECTSTRING" $SLAVE_MYSOCK "$NDB_CONNECTSTRING_SLAVE" >> $NDB_EXAMPLES_OUTPUT
--exec echo Running mgmapi_logevent
---exec $NDB_EXAMPLES_DIR/mgmapi_logevent/mgmapi_logevent "localhost:$NDBCLUSTER_PORT" "localhost:$NDBCLUSTER_PORT_SLAVE" 1 >> $NDB_EXAMPLES_OUTPUT
+--exec $NDB_EXAMPLES_DIR/mgmapi_logevent/mgmapi_logevent "$NDB_CONNECTSTRING" "$NDB_CONNECTSTRING_SLAVE" 1 >> $NDB_EXAMPLES_OUTPUT
diff --git a/mysql-test/t/backup.test b/mysql-test/t/backup.test
index cdbf7b69615..61e80ec682e 100644
--- a/mysql-test/t/backup.test
+++ b/mysql-test/t/backup.test
@@ -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, t4;
--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;
@@ -80,11 +80,11 @@ DROP TABLE IF EXISTS `t+1`;
--enable_warnings
CREATE TABLE `t+1` (c1 INT);
INSERT INTO `t+1` VALUES (1), (2), (3);
-BACKUP TABLE `t+1` TO '../tmp';
+BACKUP TABLE `t+1` TO '../../tmp';
DROP TABLE `t+1`;
#
# Same for restore.
-RESTORE TABLE `t+1` FROM '../tmp';
+RESTORE TABLE `t+1` FROM '../../tmp';
SELECT * FROM `t+1`;
DROP TABLE `t+1`;
diff --git a/mysql-test/t/bootstrap.test b/mysql-test/t/bootstrap.test
index 203ba9b2914..db89269b35d 100644
--- a/mysql-test/t/bootstrap.test
+++ b/mysql-test/t/bootstrap.test
@@ -6,6 +6,10 @@ drop table if exists t1;
--enable_warnings
+# Add the datadir to the bootstrap command
+let $MYSQLD_DATADIR= `select @@datadir`;
+let $MYSQLD_BOOTSTRAP_CMD= $MYSQLD_BOOTSTRAP_CMD --datadir=$MYSQLD_DATADIR;
+
#
# Check that --bootstrap reads from stdin
#
diff --git a/mysql-test/t/crash_commit_before.test b/mysql-test/t/crash_commit_before.test
index 4e212d81e66..e3dba58d4df 100644
--- a/mysql-test/t/crash_commit_before.test
+++ b/mysql-test/t/crash_commit_before.test
@@ -15,7 +15,7 @@ insert into t1 values(9);
SET SESSION debug="d,crash_commit_before";
# Write file to make mysql-test-run.pl expect crash and restart
---exec echo "restart" > $MYSQLTEST_VARDIR/tmp/master0.expect
+--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
# Run the crashing query
--error 2013
diff --git a/mysql-test/t/create_not_windows.test b/mysql-test/t/create_not_windows.test
index 56b4002106d..b612e31e3aa 100644
--- a/mysql-test/t/create_not_windows.test
+++ b/mysql-test/t/create_not_windows.test
@@ -29,7 +29,8 @@ drop table if exists t1;
--enable_warnings
create table t1(a int) engine=myisam;
insert into t1 values(1);
---system rm -f $MYSQLTEST_VARDIR/master-data/test/t1.frm
+let $MYSQLD_DATADIR= `select @@datadir`;
+remove_file $MYSQLD_DATADIR/test/t1.frm;
--echo "We get an error because the table is in the definition cache"
--error ER_TABLE_EXISTS_ERROR
create table t1(a int, b int);
diff --git a/mysql-test/t/csv.test b/mysql-test/t/csv.test
index 6c83fbfdc9c..4cb300a223f 100644
--- a/mysql-test/t/csv.test
+++ b/mysql-test/t/csv.test
@@ -1406,7 +1406,8 @@ DROP TABLE test_repair_table;
#
CREATE TABLE test_repair_table2 ( val integer not null ) ENGINE = CSV;
---remove_file $MYSQLTEST_VARDIR/master-data/test/test_repair_table2.CSM
+let $MYSQLD_DATADIR= `select @@datadir`;
+--remove_file $MYSQLD_DATADIR/test/test_repair_table2.CSM
# Should give a warning and perform autorepair. We also disable ps-protocol
# here, as mysql-test eats up warnings in ps-protocol mode
@@ -1417,15 +1418,15 @@ SELECT * from test_repair_table2;
# this should work ok, as the table is already repaired
SELECT * from test_repair_table2;
# check that the metafile appeared again.
---file_exists $MYSQLTEST_VARDIR/master-data/test/test_repair_table2.CSM
+--file_exists $MYSQLD_DATADIR/test/test_repair_table2.CSM
CHECK TABLE test_repair_table2;
DROP TABLE test_repair_table2;
# Corrupt csv file and see if we can repair it
CREATE TABLE test_repair_table3 ( val integer not null ) ENGINE = CSV;
---remove_file $MYSQLTEST_VARDIR/master-data/test/test_repair_table3.CSV
---write_file $MYSQLTEST_VARDIR/master-data/test/test_repair_table3.CSV
+--remove_file $MYSQLD_DATADIR/test/test_repair_table3.CSV
+--write_file $MYSQLD_DATADIR/test/test_repair_table3.CSV
"1"
"4"
"3
@@ -1444,7 +1445,7 @@ CREATE TABLE test_repair_table4 (
founded char(4) DEFAULT '' NOT NULL
) ENGINE = CSV;
---remove_file $MYSQLTEST_VARDIR/master-data/test/test_repair_table4.CSM
+--remove_file $MYSQLD_DATADIR/test/test_repair_table4.CSM
--disable_ps_protocol
SELECT * FROM test_repair_table4;
--enable_ps_protocol
@@ -1477,8 +1478,8 @@ CREATE TABLE test_repair_table5 (
) ENGINE = CSV;
# Corrupt a table -- put a file with wrong # of columns
---remove_file $MYSQLTEST_VARDIR/master-data/test/test_repair_table5.CSV
---write_file $MYSQLTEST_VARDIR/master-data/test/test_repair_table5.CSV
+--remove_file $MYSQLD_DATADIR/test/test_repair_table5.CSV
+--write_file $MYSQLD_DATADIR/test/test_repair_table5.CSV
"1","101","IBM"
EOF
@@ -1489,7 +1490,7 @@ INSERT INTO test_repair_table5 VALUES (1, 102, "CORRECT", 1876);
SELECT * FROM test_repair_table5;
# Corrupt a table -- put a row with wrong # of columns at end of file
---append_file $MYSQLTEST_VARDIR/master-data/test/test_repair_table5.CSV
+--append_file $MYSQLD_DATADIR/test/test_repair_table5.CSV
"1","101","IBM"
EOF
@@ -1502,7 +1503,7 @@ INSERT INTO test_repair_table5 VALUES (1, 102, "CORRECT2", 1876);
SELECT * FROM test_repair_table5;
# Corrupt table again -- put a row with wrong # of columns at end of file
---append_file $MYSQLTEST_VARDIR/master-data/test/test_repair_table5.CSV
+--append_file $MYSQLD_DATADIR/test/test_repair_table5.CSV
"1","101","IBM"
EOF
@@ -1585,14 +1586,14 @@ drop table t1;
create table bug15205 (val int(11) not null) engine=csv;
create table bug15205_2 (val int(11) not null) engine=csv;
---remove_file $MYSQLTEST_VARDIR/master-data/test/bug15205.CSV
+--remove_file $MYSQLD_DATADIR/test/bug15205.CSV
# system error (can't open the datafile)
--replace_result $MYSQLTEST_VARDIR . master-data/ ''
--error 13
select * from bug15205;
select * from bug15205_2;
# Create empty file
---write_file $MYSQLTEST_VARDIR/master-data/test/bug15205.CSV
+--write_file $MYSQLD_DATADIR/test/bug15205.CSV
EOF
select * from bug15205;
drop table bug15205;
@@ -1631,16 +1632,16 @@ insert into bug22080_1 values(2,'string');
insert into bug22080_1 values(3,'string');
# Create first corrupt file as described in bug report
---remove_file $MYSQLTEST_VARDIR/master-data/test/bug22080_2.CSV
---write_file $MYSQLTEST_VARDIR/master-data/test/bug22080_2.CSV
+--remove_file $MYSQLD_DATADIR/test/bug22080_2.CSV
+--write_file $MYSQLD_DATADIR/test/bug22080_2.CSV
1,"string"
2","string"
3,"string"
EOF
# Create second corrupt file as described in bug report
---remove_file $MYSQLTEST_VARDIR/master-data/test/bug22080_3.CSV
---write_file $MYSQLTEST_VARDIR/master-data/test/bug22080_3.CSV
+--remove_file $MYSQLD_DATADIR/test/bug22080_3.CSV
+--write_file $MYSQLD_DATADIR/test/bug22080_3.CSV
1,"string"
"2",string"
3,"string"
@@ -1700,8 +1701,8 @@ check table t1;
drop table t1;
create table t1(a int not null, b int not null) engine=csv;
---remove_file $MYSQLTEST_VARDIR/master-data/test/t1.CSV
---write_file $MYSQLTEST_VARDIR/master-data/test/t1.CSV
+--remove_file $MYSQLD_DATADIR/test/t1.CSV
+--write_file $MYSQLD_DATADIR/test/t1.CSV
1, 1E-2
-2E2, .9
-10E-1, -.9
diff --git a/mysql-test/t/ctype_big5.test b/mysql-test/t/ctype_big5.test
index 5f3357e0406..b1d7d49adc9 100644
--- a/mysql-test/t/ctype_big5.test
+++ b/mysql-test/t/ctype_big5.test
@@ -73,11 +73,12 @@ create table t1 (a blob);
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'));
+let $MYSQLD_DATADIR= `select @@datadir`;
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+--eval select hex(load_file('$MYSQLD_DATADIR/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 $MYSQLD_DATADIR/test/t1.txt
drop table t1;
--echo End of 5.0 tests
diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def
index ab50548499f..ec4385412d0 100644
--- a/mysql-test/t/disabled.def
+++ b/mysql-test/t/disabled.def
@@ -4,12 +4,10 @@
#
# Separate the test case name and the comment with ':'.
#
-# <testcasename> : BUG#<xxxx> <date disabled> <disabler> <comment>
+# <testcasename> : BUG#<xxxx> <comment>
#
# Do not use any TAB characters for whitespace.
#
##############################################################################
-user_limits : Bug#23921 random failure of user_limits.test
-
-concurrent_innodb : BUG#21579 2006-08-11 mleich innodb_concurrent random failures with varying differences
-federated_transactions : Bug#29523 Transactions do not work
+user_limits : Bug#23921 random failure of user_limits.test
+concurrent_innodb : BUG#21579 innodb_concurrent random failures with varying differences
diff --git a/mysql-test/t/distinct.test b/mysql-test/t/distinct.test
index bfdb5f8b9f8..60715c8e9cc 100644
--- a/mysql-test/t/distinct.test
+++ b/mysql-test/t/distinct.test
@@ -490,13 +490,13 @@ DROP TABLE t1;
#default NULL);
#
#SELECT DISTINCT fruit_id, fruit_name INTO OUTFILE
-#'../tmp/data1.tmp' FROM t1 WHERE fruit_name = 'APPLE';
-#LOAD DATA INFILE '../tmp/data1.tmp' INTO TABLE t2;
+#'../../tmp/data1.tmp' FROM t1 WHERE fruit_name = 'APPLE';
+#LOAD DATA INFILE '../../tmp/data1.tmp' INTO TABLE t2;
#--exec rm $MYSQL_TEST_DIR/var/tmp/data1.tmp
#
#SELECT DISTINCT @v19:= fruit_id, @v20:= fruit_name INTO OUTFILE
-#'../tmp/data2.tmp' FROM t1 WHERE fruit_name = 'APPLE';
-#LOAD DATA INFILE '../tmp/data2.tmp' INTO TABLE t2;
+#'../../tmp/data2.tmp' FROM t1 WHERE fruit_name = 'APPLE';
+#LOAD DATA INFILE '../../tmp/data2.tmp' INTO TABLE t2;
#--exec rm $MYSQL_TEST_DIR/var/tmp/data2.tmp
#
#SELECT @v19, @v20;
diff --git a/mysql-test/t/gis.test b/mysql-test/t/gis.test
index b4c515d2e8c..b6151659020 100644
--- a/mysql-test/t/gis.test
+++ b/mysql-test/t/gis.test
@@ -386,7 +386,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 --git a/mysql-test/t/grant_cache_no_prot.test b/mysql-test/t/grant_cache_no_prot.test
index 1f6a9aeb9ed..31209f343b9 100644
--- a/mysql-test/t/grant_cache_no_prot.test
+++ b/mysql-test/t/grant_cache_no_prot.test
@@ -18,7 +18,7 @@
if (`SELECT $PS_PROTOCOL + $SP_PROTOCOL + $CURSOR_PROTOCOL
+ $VIEW_PROTOCOL > 0`)
{
- --skip Test requires: ps-protocol/sp-protocol/cursor-protocol/view-protocol disabled
+ --skip Need normal protocol
}
# The main testing script
diff --git a/mysql-test/t/grant_cache_ps_prot.test b/mysql-test/t/grant_cache_ps_prot.test
index 7b579f869e9..27b3f23de3f 100644
--- a/mysql-test/t/grant_cache_ps_prot.test
+++ b/mysql-test/t/grant_cache_ps_prot.test
@@ -17,7 +17,7 @@
if (`SELECT $SP_PROTOCOL + $CURSOR_PROTOCOL + $VIEW_PROTOCOL > 0
OR $PS_PROTOCOL = 0`)
{
- --skip Test requires: ps-protocol enabled, other protocols disabled
+ --skip Need ps-protocol
}
# The main testing script
diff --git a/mysql-test/t/information_schema_chmod.test b/mysql-test/t/information_schema_chmod.test
index 51e67a0c956..39e2f680bb8 100644
--- a/mysql-test/t/information_schema_chmod.test
+++ b/mysql-test/t/information_schema_chmod.test
@@ -17,7 +17,8 @@
#
create database mysqltest;
create table mysqltest.t1(a int);
-chmod 0000 $MYSQLTEST_VARDIR/master-data/mysqltest;
+let $MYSQLD_DATADIR= `select @@datadir`;
+chmod 0000 $MYSQLD_DATADIR/mysqltest;
select table_schema from information_schema.tables where table_schema='mysqltest';
-chmod 0777 $MYSQLTEST_VARDIR/master-data/mysqltest;
+chmod 0777 $MYSQLD_DATADIR/mysqltest;
drop database mysqltest;
diff --git a/mysql-test/t/loaddata.test b/mysql-test/t/loaddata.test
index 5433d787c14..3ed6852fb46 100644
--- a/mysql-test/t/loaddata.test
+++ b/mysql-test/t/loaddata.test
@@ -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,44 +108,44 @@ 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;
# Reading of all columns with set
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t1 set c=b;
+load data infile '../../std_data/rpl_loaddata.dat' into table t1 set c=b;
select * from t1;
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;
#
@@ -262,6 +262,7 @@ select @@character_set_filesystem;
LOAD DATA INFILE 't@002d1' INTO TABLE t1;
SELECT * FROM t1;
DROP TABLE t1;
-remove_file $MYSQLTEST_VARDIR/master-data/test/t@002d1;
+let $MYSQLD_DATADIR= `select @@datadir`;
+remove_file $MYSQLD_DATADIR/test/t@002d1;
SET character_set_filesystem=default;
select @@character_set_filesystem;
diff --git a/mysql-test/t/log_state.test b/mysql-test/t/log_state.test
index f7795e49b37..f05d687da47 100644
--- a/mysql-test/t/log_state.test
+++ b/mysql-test/t/log_state.test
@@ -224,4 +224,5 @@ disconnect con1;
# Remove the log files that was created in the "default location"
# i.e var/run
---remove_file $MYSQLTEST_VARDIR/run/master.log
+--remove_file $MYSQLTEST_VARDIR/run/mysqld.log
+--remove_file $MYSQLTEST_VARDIR/run/mysqld-slow.log
diff --git a/mysql-test/t/myisam-system.test b/mysql-test/t/myisam-system.test
index c4a7651ac7d..dc5bb58b6a2 100644
--- a/mysql-test/t/myisam-system.test
+++ b/mysql-test/t/myisam-system.test
@@ -7,14 +7,15 @@ drop table if exists t1,t2;
--enable_warnings
create table t1 (a int) engine=myisam;
---remove_file $MYSQLTEST_VARDIR/master-data/test/t1.MYI
+let $MYSQLD_DATADIR= `select @@datadir`;
+--remove_file $MYSQLD_DATADIR/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 $MYSQLD_DATADIR/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 $MYSQLD_DATADIR/test/t1.MYD
--error 1105,6,29
drop table t1;
--error 1051
diff --git a/mysql-test/t/mysql_upgrade.test b/mysql-test/t/mysql_upgrade.test
index 233e8c7c256..6b2ce0cd2d6 100644
--- a/mysql-test/t/mysql_upgrade.test
+++ b/mysql-test/t/mysql_upgrade.test
@@ -15,7 +15,8 @@ select LENGTH("$MYSQL_UPGRADE")>0 as have_mysql_upgrade;
--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;
+let $MYSQLD_DATADIR= `select @@datadir`;
+file_exists $MYSQLD_DATADIR/mysql_upgrade_info;
--echo Run it again - should say already completed
--replace_result $MYSQL_SERVER_VERSION VERSION
@@ -23,13 +24,13 @@ file_exists $MYSQLTEST_VARDIR/master-data/mysql_upgrade_info;
--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 $MYSQLD_DATADIR/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 $MYSQLD_DATADIR/mysql_upgrade_info;
#
diff --git a/mysql-test/t/mysqlbinlog-cp932.test b/mysql-test/t/mysqlbinlog-cp932.test
index 4ca0eedaece..a7055bfc8ca 100644
--- a/mysql-test/t/mysqlbinlog-cp932.test
+++ b/mysql-test/t/mysqlbinlog-cp932.test
@@ -13,7 +13,8 @@ create table t4 (f text character set cp932);
--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
+let $MYSQLD_DATADIR= `select @@datadir`;
+--exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/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 --git a/mysql-test/t/mysqlbinlog.test b/mysql-test/t/mysqlbinlog.test
index 18b08cf11d6..569c5a10c6a 100644
--- a/mysql-test/t/mysqlbinlog.test
+++ b/mysql-test/t/mysqlbinlog.test
@@ -23,11 +23,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,30 +41,30 @@ select "--- Local --" as "";
# We should use --short-form everywhere because in other case output will
# be time dependend. Better than nothing.
#
-
+let $MYSQLD_DATADIR= `select @@datadir`;
--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/ $MYSQLD_DATADIR/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/ $MYSQLD_DATADIR/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 $MYSQLD_DATADIR/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=239 $MYSQLTEST_VARDIR/log/master-bin.000002
+--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --position=239 $MYSQLD_DATADIR/master-bin.000002
# These are tests for remote binlog.
# They should return the same as previous test.
@@ -127,7 +127,7 @@ EOF
# must be digestable for both client and server. In 4.1 the client
# should use default-character-set same as the server.
flush logs;
---exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000004 | $MYSQL
+--exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000004 | $MYSQL
select * from t5 /* must be (1),(1) */;
drop table t5;
@@ -146,7 +146,7 @@ insert into t5 values (3, date_format('2001-01-01','%W'));
select * from t5 order by c1;
flush logs;
drop table t5;
---exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000006 | $MYSQL
+--exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000006 | $MYSQL
select * from t5 order by c1;
drop table t5;
@@ -169,8 +169,8 @@ call p1();
drop procedure p1;
--error 1305
call p1();
---exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000008
---exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000008 | $MYSQL
+--exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000008
+--exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000008 | $MYSQL
call p1();
drop procedure p1;
@@ -189,22 +189,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.000010
+--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLD_DATADIR/master-bin.000010
#
# Bug#28293 missed '#' sign in the hex dump when the dump length
@@ -217,7 +217,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.000012 | grep 'Query' | sed 's/[0-9]\{1,\}/REMOVED/g'
+--exec $MYSQL_BINLOG --hexdump --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLD_DATADIR/master-bin.000012 | grep 'Query' | sed 's/[0-9]\{1,\}/REMOVED/g'
#
# Bug #29928: incorrect connection_id() restoring from mysqlbinlog out
@@ -227,7 +227,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.000014 > $MYSQLTEST_VARDIR/tmp/bug29928.sql
+--exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000014 > $MYSQLTEST_VARDIR/tmp/bug29928.sql
drop table t1;
connect (con1, localhost, root, , test);
connection con1;
@@ -251,8 +251,8 @@ exec $MYSQL_BINLOG $MYSQL_TEST_DIR/std_data/corrupt-relay-bin.000624 > $MYSQLTES
#
flush logs;
--error 1
---exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000016 >/dev/null 2>/dev/null
---exec $MYSQL_BINLOG --force-if-open $MYSQLTEST_VARDIR/log/master-bin.000016 >/dev/null 2>/dev/null
+--exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000016 >/dev/null 2>/dev/null
+--exec $MYSQL_BINLOG --force-if-open $MYSQLD_DATADIR/master-bin.000016 >/dev/null 2>/dev/null
--echo BUG#31611: Security risk with BINLOG statement
@@ -268,7 +268,7 @@ flush logs;
INSERT INTO t1 VALUES (1,USER());
flush logs;
echo mysqlbinlog var/log/master-bin.000017 > var/tmp/bug31611.sql;
-exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000017 > $MYSQLTEST_VARDIR/tmp/bug31611.sql;
+exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000017 > $MYSQLTEST_VARDIR/tmp/bug31611.sql;
connect (unsecure,localhost,untrusted,,mysqltest1);
echo mysql mysqltest1 -uuntrusted < var/tmp/bug31611.sql;
error 1;
@@ -301,7 +301,7 @@ query_vertical SELECT * FROM t1;
DROP TABLE t1;
echo >> mysqlbinlog var/log/master-bin.000019 > var/tmp/bug32580.sql;
-exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000019 > $MYSQLTEST_VARDIR/tmp/bug32580.sql;
+exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000019 > $MYSQLTEST_VARDIR/tmp/bug32580.sql;
echo >> mysql test < var/tmp/bug32580.sql;
exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/bug32580.sql;
remove_file $MYSQLTEST_VARDIR/tmp/bug32580.sql;
diff --git a/mysql-test/t/mysqlbinlog2.test b/mysql-test/t/mysqlbinlog2.test
index be9397aafee..d197114d920 100644
--- a/mysql-test/t/mysqlbinlog2.test
+++ b/mysql-test/t/mysqlbinlog2.test
@@ -40,34 +40,34 @@ select "--- Local --" as "";
# We should use --short-form everywhere because in other case output will
# be time dependent (the Start events). Better than nothing.
#
-
+let $MYSQLD_DATADIR= `select @@datadir`;
--replace_regex /[[:<:]][0-9]{6} [0-9 ][0-9]:[0-9]{2}:[0-9]{2}[[:>:]]/{yymmdd} {HH:MM:SS}/ /=[0-9]+ /={integer} / /# at [0-9]+/# at {pos}/ /(pos:?) [0-9]+/\1 {pos}/ /binlog v [0-9]+, server v [^ ]* created/binlog v #, server v ## created/
---exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000001
+--exec $MYSQL_BINLOG $MYSQLD_DATADIR/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 $MYSQLD_DATADIR/master-bin.000001
--disable_query_log
select "--- start-position --" as "";
--enable_query_log
---exec $MYSQL_BINLOG --short-form --start-position=608 $MYSQLTEST_VARDIR/log/master-bin.000001
+--exec $MYSQL_BINLOG --short-form --start-position=608 $MYSQLD_DATADIR/master-bin.000001
--disable_query_log
select "--- stop-position --" as "";
--enable_query_log
---exec $MYSQL_BINLOG --short-form --stop-position=608 $MYSQLTEST_VARDIR/log/master-bin.000001
+--exec $MYSQL_BINLOG --short-form --stop-position=608 $MYSQLD_DATADIR/master-bin.000001
--disable_query_log
select "--- start and stop positions ---" as "";
--enable_query_log
---exec $MYSQL_BINLOG --short-form --start-position=608 --stop-position 725 $MYSQLTEST_VARDIR/log/master-bin.000001
+--exec $MYSQL_BINLOG --short-form --start-position=608 --stop-position 725 $MYSQLD_DATADIR/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" $MYSQLD_DATADIR/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" $MYSQLD_DATADIR/master-bin.000001
--disable_query_log
select "--- Local with 2 binlogs on command line --" as "";
@@ -76,28 +76,28 @@ select "--- Local with 2 binlogs on command line --" as "";
# This is to verify that some options apply only to first, or last binlog
flush logs;
---exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000001 $MYSQLTEST_VARDIR/log/master-bin.000002
+--exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/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 $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002
--disable_query_log
select "--- start-position --" as "";
--enable_query_log
---exec $MYSQL_BINLOG --short-form --start-position=608 $MYSQLTEST_VARDIR/log/master-bin.000001 $MYSQLTEST_VARDIR/log/master-bin.000002
+--exec $MYSQL_BINLOG --short-form --start-position=608 $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002
--disable_query_log
select "--- stop-position --" as "";
--enable_query_log
---exec $MYSQL_BINLOG --short-form --stop-position=134 $MYSQLTEST_VARDIR/log/master-bin.000001 $MYSQLTEST_VARDIR/log/master-bin.000002
+--exec $MYSQL_BINLOG --short-form --stop-position=134 $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/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" $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/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" $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002
--disable_query_log
select "--- Remote --" as "";
diff --git a/mysql-test/t/mysqlbinlog_base64.test b/mysql-test/t/mysqlbinlog_base64.test
index 1b5dc67c150..9425fd3301d 100644
--- a/mysql-test/t/mysqlbinlog_base64.test
+++ b/mysql-test/t/mysqlbinlog_base64.test
@@ -10,7 +10,7 @@ update t1 set a=a+2 where a=2;
update t1 set a=a+2 where a=3;
create table t2 (word varchar(20));
-load data infile '../std_data_ln/words.dat' into table t2;
+load data infile '../../std_data/words.dat' into table t2;
#
# Save binlog
@@ -38,7 +38,7 @@ select * from t2;
flush logs;
drop table t2;
create table t2 (word varchar(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 select * from t2;
insert into t2 select * from t2;
insert into t2 select * from t2;
diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test
index 0e4e9989ffa..1f6a39c50d1 100644
--- a/mysql-test/t/mysqldump.test
+++ b/mysql-test/t/mysqldump.test
@@ -1633,7 +1633,7 @@ select * from t2;
# Now we test with multiple threads, but less threads than files.
create table words(a varchar(255));
create table words2(b varchar(255));
---exec $MYSQL_IMPORT --silent --use-threads=2 test $MYSQLTEST_VARDIR/tmp/t1.txt $MYSQLTEST_VARDIR/tmp/t2.txt $MYSQLTEST_VARDIR/std_data_ln/words.dat $MYSQLTEST_VARDIR/std_data_ln/words2.dat
+--exec $MYSQL_IMPORT --silent --use-threads=2 test $MYSQLTEST_VARDIR/tmp/t1.txt $MYSQLTEST_VARDIR/tmp/t2.txt $MYSQLTEST_VARDIR/std_data/words.dat $MYSQLTEST_VARDIR/std_data/words2.dat
select * from t1;
select * from t2;
select * from words;
@@ -1643,7 +1643,7 @@ select * from words2;
drop table words;
--replace_regex /.*mysqlimport(\.exe)*/mysql-import/
--error 1
---exec $MYSQL_IMPORT --silent --use-threads=2 test $MYSQLTEST_VARDIR/tmp/t1.txt $MYSQLTEST_VARDIR/tmp/t2.txt $MYSQLTEST_VARDIR/std_data_ln/words.dat $MYSQLTEST_VARDIR/std_data_ln/words2.dat 2>&1
+--exec $MYSQL_IMPORT --silent --use-threads=2 test $MYSQLTEST_VARDIR/tmp/t1.txt $MYSQLTEST_VARDIR/tmp/t2.txt $MYSQLTEST_VARDIR/std_data/words.dat $MYSQLTEST_VARDIR/std_data/words2.dat 2>&1
drop table t1;
drop table t2;
diff --git a/mysql-test/t/outfile.test b/mysql-test/t/outfile.test
index 2b80b0b9d93..064aaa4612e 100644
--- a/mysql-test/t/outfile.test
+++ b/mysql-test/t/outfile.test
@@ -1,7 +1,7 @@
disable_query_log;
-- source include/test_outfile.inc
-# Server are started in "var/master-data", so "../tmp" will be "var/tmp"
-eval set @tmpdir="../tmp";
+# Server are started in "var/master-data", so "../../tmp" will be "var/tmp"
+eval set @tmpdir="../../tmp";
enable_query_log;
-- source include/have_outfile.inc
@@ -16,15 +16,15 @@ drop table if exists t1;
create table t1 (`a` blob);
insert into t1 values("hello world"),("Hello mars"),(NULL);
disable_query_log;
-eval select * into outfile "../tmp/outfile-test.1" from t1;
+eval select * into outfile "../../tmp/outfile-test.1" from t1;
enable_query_log;
select load_file(concat(@tmpdir,"/outfile-test.1"));
disable_query_log;
-eval select * into dumpfile "../tmp/outfile-test.2" from t1 limit 1;
+eval select * into dumpfile "../../tmp/outfile-test.2" from t1 limit 1;
enable_query_log;
select load_file(concat(@tmpdir,"/outfile-test.2"));
disable_query_log;
-eval select * into dumpfile "../tmp/outfile-test.3" from t1 where a is null;
+eval select * into dumpfile "../../tmp/outfile-test.3" from t1 where a is null;
enable_query_log;
select load_file(concat(@tmpdir,"/outfile-test.3"));
@@ -32,13 +32,13 @@ select load_file(concat(@tmpdir,"/outfile-test.3"));
disable_query_log;
--error 1086
-eval select * into outfile "../tmp/outfile-test.1" from t1;
+eval select * into outfile "../../tmp/outfile-test.1" from t1;
--error 1086
-eval select * into dumpfile "../tmp/outfile-test.2" from t1;
+eval select * into dumpfile "../../tmp/outfile-test.2" from t1;
--error 1086
-eval select * into dumpfile "../tmp/outfile-test.3" from t1;
+eval select * into dumpfile "../../tmp/outfile-test.3" from t1;
enable_query_log;
select load_file(concat(@tmpdir,"/outfile-test.not-exist"));
--remove_file $MYSQLTEST_VARDIR/tmp/outfile-test.1
@@ -48,7 +48,7 @@ drop table t1;
# Bug#8191
disable_query_log;
-eval select 1 into outfile "../tmp/outfile-test.4";
+eval select 1 into outfile "../../tmp/outfile-test.4";
enable_query_log;
select load_file(concat(@tmpdir,"/outfile-test.4"));
--remove_file $MYSQLTEST_VARDIR/tmp/outfile-test.4
@@ -71,7 +71,7 @@ DROP TABLE t1;
# Bug#13202 SELECT * INTO OUTFILE ... FROM information_schema.schemata now fails
#
disable_query_log;
-eval SELECT * INTO OUTFILE "../tmp/outfile-test.4"
+eval SELECT * INTO OUTFILE "../../tmp/outfile-test.4"
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
FROM information_schema.schemata LIMIT 0, 5;
# enable_query_log;
@@ -79,7 +79,7 @@ FROM information_schema.schemata LIMIT 0, 5;
use information_schema;
# disable_query_log;
-eval SELECT * INTO OUTFILE "../tmp/outfile-test.4"
+eval SELECT * INTO OUTFILE "../../tmp/outfile-test.4"
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
FROM schemata LIMIT 0, 5;
enable_query_log;
@@ -107,7 +107,7 @@ connect (con28181_1,localhost,user_1,,mysqltest);
--error 1044
eval select schema_name
-into outfile "../tmp/outfile-test.4"
+into outfile "../../tmp/outfile-test.4"
fields terminated by ',' optionally enclosed by '"'
lines terminated by '\n'
from information_schema.schemata
@@ -118,7 +118,7 @@ grant file on *.* to user_1@localhost;
connect (con28181_2,localhost,user_1,,mysqltest);
eval select schema_name
-into outfile "../tmp/outfile-test.4"
+into outfile "../../tmp/outfile-test.4"
fields terminated by ',' optionally enclosed by '"'
lines terminated by '\n'
from information_schema.schemata
diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test
index 65e78a5e740..c6b6df2c8fd 100644
--- a/mysql-test/t/partition.test
+++ b/mysql-test/t/partition.test
@@ -1392,13 +1392,15 @@ drop table t1, t2;
# Bug #24633 SQL MODE "NO_DIR_IN_CREATE" does not work with partitioned tables
#
+let $MYSQLD_DATADIR= `select @@datadir`;
+
disable_query_log;
eval create table t2 (i int )
partition by range (i)
(
partition p01 values less than (1000)
- data directory="$MYSQLTEST_VARDIR/master-data/test/"
- index directory="$MYSQLTEST_VARDIR/master-data/test/"
+ data directory="$MYSQLD_DATADIR/test/"
+ index directory="$MYSQLD_DATADIR/test/"
);
enable_query_log;
diff --git a/mysql-test/t/partition_error.test b/mysql-test/t/partition_error.test
index c9b95fc1664..37fef050147 100644
--- a/mysql-test/t/partition_error.test
+++ b/mysql-test/t/partition_error.test
@@ -103,7 +103,8 @@ partitions 3
partition x2 tablespace ts2,
partition x3 tablespace ts3);
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+let $MYSQLD_DATADIR= `select @@datadir`;
+select load_file('$MYSQLD_DATADIR/test/t1.par');
#
# Partition by hash, invalid field in function
#
@@ -199,7 +200,7 @@ partition by hash (a)
partitions 2
(partition x1 values less than (4),
partition x2 values less than (5));
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+select load_file('$MYSQLD_DATADIR/test/t1.par');
#
# Partition by hash, values in error
@@ -214,7 +215,7 @@ partition by hash (a)
partitions 2
(partition x1 values in (4),
partition x2 values in (5));
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+select load_file('$MYSQLD_DATADIR/test/t1.par');
#
# Partition by hash, values in error
@@ -229,7 +230,7 @@ partition by hash (a)
partitions 2
(partition x1 values in (4,6),
partition x2 values in (5,7));
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+select load_file('$MYSQLD_DATADIR/test/t1.par');
#
# Subpartition by key, no partitions defined, single field
@@ -242,7 +243,7 @@ c int not null,
primary key (a,b))
partition by key (a)
subpartition by key (b);
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+select load_file('$MYSQLD_DATADIR/test/t1.par');
#
# Subpartition by key, no partitions defined, list of fields
@@ -255,7 +256,7 @@ c int not null,
primary key (a,b))
partition by key (a)
subpartition by key (a, b);
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+select load_file('$MYSQLD_DATADIR/test/t1.par');
#
# Subpartition by hash, no partitions defined
@@ -268,7 +269,7 @@ c int not null,
primary key (a,b))
partition by key (a)
subpartition by hash (a+b);
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+select load_file('$MYSQLD_DATADIR/test/t1.par');
#
# Subpartition by key, no partitions defined, single field
@@ -281,7 +282,7 @@ c int not null,
primary key (a,b))
partition by key (a)
subpartition by key (b);
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+select load_file('$MYSQLD_DATADIR/test/t1.par');
#
# Subpartition by key, no partitions defined, list of fields
@@ -294,7 +295,7 @@ c int not null,
primary key (a,b))
partition by key (a)
subpartition by key (a, b);
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+select load_file('$MYSQLD_DATADIR/test/t1.par');
#
# Subpartition by hash, no partitions defined
@@ -307,7 +308,7 @@ c int not null,
primary key (a,b))
partition by key (a)
subpartition by hash (a+b);
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+select load_file('$MYSQLD_DATADIR/test/t1.par');
#
# Subpartition by hash, no partitions defined, wrong subpartition function
@@ -334,7 +335,7 @@ partition by key (a)
subpartition by hash (sin(a+b))
(partition x1 (subpartition x11, subpartition x12),
partition x2 (subpartition x21, subpartition x22));
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+select load_file('$MYSQLD_DATADIR/test/t1.par');
#
# Subpartition by hash, no partitions defined, wrong subpartition function
@@ -363,7 +364,7 @@ partition by range (a)
subpartition by key (a,d)
(partition x1 values less than (1) (subpartition x11, subpartition x12),
partition x2 values less than (2) (subpartition x21, subpartition x22));
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+select load_file('$MYSQLD_DATADIR/test/t1.par');
#
# Subpartition by hash, no partitions defined, wrong subpartition function
@@ -401,7 +402,7 @@ b int not null,
c int not null,
primary key(a,b))
partition by range (a);
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+select load_file('$MYSQLD_DATADIR/test/t1.par');
#
# Partition by range, invalid field in function
diff --git a/mysql-test/t/partition_federated.test b/mysql-test/t/partition_federated.test
index c8483291228..0fe692ecd01 100644
--- a/mysql-test/t/partition_federated.test
+++ b/mysql-test/t/partition_federated.test
@@ -3,7 +3,7 @@
#
-- source include/have_partition.inc
-- source include/not_embedded.inc
--- source include/have_federated_db.inc
+-- source suite/federated/have_federated_db.inc
--disable_warnings
drop table if exists t1;
diff --git a/mysql-test/t/partition_mgm.test b/mysql-test/t/partition_mgm.test
index 68da4a5b390..1e4f723ccc6 100644
--- a/mysql-test/t/partition_mgm.test
+++ b/mysql-test/t/partition_mgm.test
@@ -22,18 +22,19 @@ drop table t1;
CREATE TABLE t1 (f_date DATE, f_varchar VARCHAR(30))
PARTITION BY HASH(YEAR(f_date)) PARTITIONS 2;
SHOW CREATE TABLE t1;
--- file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYD
--- file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYI
--- file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYD
--- file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYI
--- file_exists $MYSQLTEST_VARDIR/master-data/test/t1.frm
--- file_exists $MYSQLTEST_VARDIR/master-data/test/t1.par
+let $MYSQLD_DATADIR= `select @@datadir`;
+-- file_exists $MYSQLD_DATADIR/test/t1#P#p0.MYD
+-- file_exists $MYSQLD_DATADIR/test/t1#P#p0.MYI
+-- file_exists $MYSQLD_DATADIR/test/t1#P#p1.MYD
+-- file_exists $MYSQLD_DATADIR/test/t1#P#p1.MYI
+-- file_exists $MYSQLD_DATADIR/test/t1.frm
+-- file_exists $MYSQLD_DATADIR/test/t1.par
ALTER TABLE t1 COALESCE PARTITION 1;
SHOW CREATE TABLE t1;
--- file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYD
--- file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYI
--- file_exists $MYSQLTEST_VARDIR/master-data/test/t1.frm
--- file_exists $MYSQLTEST_VARDIR/master-data/test/t1.par
+-- file_exists $MYSQLD_DATADIR/test/t1#P#p0.MYD
+-- file_exists $MYSQLD_DATADIR/test/t1#P#p0.MYI
+-- file_exists $MYSQLD_DATADIR/test/t1.frm
+-- file_exists $MYSQLD_DATADIR/test/t1.par
drop table t1;
#
# Bug 20767: REORGANIZE partition crashes
diff --git a/mysql-test/t/partition_not_windows.test b/mysql-test/t/partition_not_windows.test
index 012b8b50dee..4e285535677 100644
--- a/mysql-test/t/partition_not_windows.test
+++ b/mysql-test/t/partition_not_windows.test
@@ -12,16 +12,17 @@
# doesn't remove old directory
--disable_query_log
---exec mkdir $MYSQLTEST_VARDIR/master-data/tmpdata || true
-eval SET @data_dir = 'DATA DIRECTORY = ''$MYSQLTEST_VARDIR/master-data/tmpdata''';
+let $MYSQLD_DATADIR= `select @@datadir`;
+--exec mkdir $MYSQLD_DATADIR/tmpdata || true
+eval SET @data_dir = 'DATA DIRECTORY = ''$MYSQLD_DATADIR/tmpdata''';
let $data_directory = `select @data_dir`;
---exec mkdir $MYSQLTEST_VARDIR/master-data/tmpinx || true
-eval SET @inx_dir = 'INDEX DIRECTORY = ''$MYSQLTEST_VARDIR/master-data/tmpinx''';
+--exec mkdir $MYSQLD_DATADIR/tmpinx || true
+eval SET @inx_dir = 'INDEX DIRECTORY = ''$MYSQLD_DATADIR/tmpinx''';
let $inx_directory = `select @inx_dir`;
--enable_query_log
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
eval create table t1 (a int) engine myisam
partition by range (a)
subpartition by hash (a)
@@ -29,18 +30,18 @@ subpartition by hash (a)
(SUBPARTITION subpart00, SUBPARTITION subpart01));
--echo Checking if file exists before alter
---file_exists $MYSQLTEST_VARDIR/master-data/test/t1.frm
---file_exists $MYSQLTEST_VARDIR/master-data/test/t1.par
---file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p0#SP#subpart00.MYD
---file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p0#SP#subpart00.MYI
---file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p0#SP#subpart01.MYD
---file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p0#SP#subpart01.MYI
---file_exists $MYSQLTEST_VARDIR/master-data/tmpdata/t1#P#p0#SP#subpart00.MYD
---file_exists $MYSQLTEST_VARDIR/master-data/tmpdata/t1#P#p0#SP#subpart01.MYD
---file_exists $MYSQLTEST_VARDIR/master-data/tmpinx/t1#P#p0#SP#subpart00.MYI
---file_exists $MYSQLTEST_VARDIR/master-data/tmpinx/t1#P#p0#SP#subpart01.MYI
+--file_exists $MYSQLD_DATADIR/test/t1.frm
+--file_exists $MYSQLD_DATADIR/test/t1.par
+--file_exists $MYSQLD_DATADIR/test/t1#P#p0#SP#subpart00.MYD
+--file_exists $MYSQLD_DATADIR/test/t1#P#p0#SP#subpart00.MYI
+--file_exists $MYSQLD_DATADIR/test/t1#P#p0#SP#subpart01.MYD
+--file_exists $MYSQLD_DATADIR/test/t1#P#p0#SP#subpart01.MYI
+--file_exists $MYSQLD_DATADIR/tmpdata/t1#P#p0#SP#subpart00.MYD
+--file_exists $MYSQLD_DATADIR/tmpdata/t1#P#p0#SP#subpart01.MYD
+--file_exists $MYSQLD_DATADIR/tmpinx/t1#P#p0#SP#subpart00.MYI
+--file_exists $MYSQLD_DATADIR/tmpinx/t1#P#p0#SP#subpart01.MYI
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
eval ALTER TABLE t1 REORGANIZE PARTITION p0 INTO
(partition p1 VALUES LESS THAN (1) $data_directory $inx_directory
(SUBPARTITION subpart10, SUBPARTITION subpart11),
@@ -48,28 +49,28 @@ eval ALTER TABLE t1 REORGANIZE PARTITION p0 INTO
(SUBPARTITION subpart20, SUBPARTITION subpart21));
--echo Checking if file exists after alter
---file_exists $MYSQLTEST_VARDIR/master-data/test/t1.frm
---file_exists $MYSQLTEST_VARDIR/master-data/test/t1.par
---file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p1#SP#subpart10.MYD
---file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p1#SP#subpart10.MYI
---file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p1#SP#subpart11.MYD
---file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p1#SP#subpart11.MYI
---file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p2#SP#subpart20.MYD
---file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p2#SP#subpart20.MYI
---file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p2#SP#subpart21.MYD
---file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p2#SP#subpart21.MYI
---file_exists $MYSQLTEST_VARDIR/master-data/tmpdata/t1#P#p1#SP#subpart10.MYD
---file_exists $MYSQLTEST_VARDIR/master-data/tmpdata/t1#P#p1#SP#subpart11.MYD
---file_exists $MYSQLTEST_VARDIR/master-data/tmpdata/t1#P#p2#SP#subpart20.MYD
---file_exists $MYSQLTEST_VARDIR/master-data/tmpdata/t1#P#p2#SP#subpart21.MYD
---file_exists $MYSQLTEST_VARDIR/master-data/tmpinx/t1#P#p1#SP#subpart10.MYI
---file_exists $MYSQLTEST_VARDIR/master-data/tmpinx/t1#P#p1#SP#subpart11.MYI
---file_exists $MYSQLTEST_VARDIR/master-data/tmpinx/t1#P#p2#SP#subpart20.MYI
---file_exists $MYSQLTEST_VARDIR/master-data/tmpinx/t1#P#p2#SP#subpart21.MYI
+--file_exists $MYSQLD_DATADIR/test/t1.frm
+--file_exists $MYSQLD_DATADIR/test/t1.par
+--file_exists $MYSQLD_DATADIR/test/t1#P#p1#SP#subpart10.MYD
+--file_exists $MYSQLD_DATADIR/test/t1#P#p1#SP#subpart10.MYI
+--file_exists $MYSQLD_DATADIR/test/t1#P#p1#SP#subpart11.MYD
+--file_exists $MYSQLD_DATADIR/test/t1#P#p1#SP#subpart11.MYI
+--file_exists $MYSQLD_DATADIR/test/t1#P#p2#SP#subpart20.MYD
+--file_exists $MYSQLD_DATADIR/test/t1#P#p2#SP#subpart20.MYI
+--file_exists $MYSQLD_DATADIR/test/t1#P#p2#SP#subpart21.MYD
+--file_exists $MYSQLD_DATADIR/test/t1#P#p2#SP#subpart21.MYI
+--file_exists $MYSQLD_DATADIR/tmpdata/t1#P#p1#SP#subpart10.MYD
+--file_exists $MYSQLD_DATADIR/tmpdata/t1#P#p1#SP#subpart11.MYD
+--file_exists $MYSQLD_DATADIR/tmpdata/t1#P#p2#SP#subpart20.MYD
+--file_exists $MYSQLD_DATADIR/tmpdata/t1#P#p2#SP#subpart21.MYD
+--file_exists $MYSQLD_DATADIR/tmpinx/t1#P#p1#SP#subpart10.MYI
+--file_exists $MYSQLD_DATADIR/tmpinx/t1#P#p1#SP#subpart11.MYI
+--file_exists $MYSQLD_DATADIR/tmpinx/t1#P#p2#SP#subpart20.MYI
+--file_exists $MYSQLD_DATADIR/tmpinx/t1#P#p2#SP#subpart21.MYI
drop table t1;
---exec rmdir $MYSQLTEST_VARDIR/master-data/tmpdata || true
---exec rmdir $MYSQLTEST_VARDIR/master-data/tmpinx || true
+--exec rmdir $MYSQLD_DATADIR/tmpdata || true
+--exec rmdir $MYSQLD_DATADIR/tmpinx || true
# End Windows specific test failures.
diff --git a/mysql-test/t/partition_symlink.test b/mysql-test/t/partition_symlink.test
index ab779ec2b68..0ca60c14c6c 100644
--- a/mysql-test/t/partition_symlink.test
+++ b/mysql-test/t/partition_symlink.test
@@ -35,21 +35,22 @@ DROP DATABASE IF EXISTS mysqltest2;
connect(con1,localhost,mysqltest_1,,);
-- echo # user mysqltest_1:
USE test;
- -- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+let $MYSQLD_DATADIR= `select @@datadir`;
+ --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
eval CREATE TABLE t1 (a INT)
PARTITION BY LIST (a) (
PARTITION p0 VALUES IN (0)
- DATA DIRECTORY '$MYSQLTEST_VARDIR/master-data/mysqltest2'
- INDEX DIRECTORY '$MYSQLTEST_VARDIR/master-data/mysqltest2',
+ DATA DIRECTORY '$MYSQLD_DATADIR/mysqltest2'
+ INDEX DIRECTORY '$MYSQLD_DATADIR/mysqltest2',
PARTITION p1 VALUES IN (1)
- DATA DIRECTORY '$MYSQLTEST_VARDIR/master-data/test'
- INDEX DIRECTORY '$MYSQLTEST_VARDIR/master-data/test',
+ DATA DIRECTORY '$MYSQLD_DATADIR/test'
+ INDEX DIRECTORY '$MYSQLD_DATADIR/test',
PARTITION p2 VALUES IN (2)
);
-- echo # without the patch for bug#32091 this would create
-- echo # files mysqltest2/t1.MYD + .MYI and possible overwrite
-- echo # the mysqltest2.t1 table (depending on bug#32111)
- -- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+ --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
ALTER TABLE t1 REMOVE PARTITIONING;
INSERT INTO t1 VALUES (1);
SELECT * FROM t1;
@@ -76,40 +77,41 @@ connection default;
-- echo # user root:
CREATE DATABASE mysqltest2;
USE mysqltest2;
- -- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+ --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
eval CREATE TABLE t1 (a INT)
PARTITION BY LIST (a) (
PARTITION p0 VALUES IN (0)
- DATA DIRECTORY '$MYSQLTEST_VARDIR/master-data/mysqltest2'
- INDEX DIRECTORY '$MYSQLTEST_VARDIR/master-data/mysqltest2',
+ DATA DIRECTORY '$MYSQLD_DATADIR/mysqltest2'
+ INDEX DIRECTORY '$MYSQLD_DATADIR/mysqltest2',
PARTITION p1 VALUES IN (1)
- DATA DIRECTORY '$MYSQLTEST_VARDIR/master-data/test'
- INDEX DIRECTORY '$MYSQLTEST_VARDIR/master-data/test'
+ DATA DIRECTORY '$MYSQLD_DATADIR/test'
+ INDEX DIRECTORY '$MYSQLD_DATADIR/test'
);
connection con1;
-- echo # user mysqltest_1:
USE test;
- -- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+ --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
-- error 1,1
eval CREATE TABLE t1 (a INT)
PARTITION BY LIST (a) (
PARTITION p0 VALUES IN (0)
- DATA DIRECTORY '$MYSQLTEST_VARDIR/master-data/mysqltest2'
- INDEX DIRECTORY '$MYSQLTEST_VARDIR/master-data/mysqltest2',
+ DATA DIRECTORY '$MYSQLD_DATADIR/mysqltest2'
+ INDEX DIRECTORY '$MYSQLD_DATADIR/mysqltest2',
PARTITION p1 VALUES IN (1)
- DATA DIRECTORY '$MYSQLTEST_VARDIR/master-data/test'
- INDEX DIRECTORY '$MYSQLTEST_VARDIR/master-data/test'
+ DATA DIRECTORY '$MYSQLD_DATADIR/test'
+ INDEX DIRECTORY '$MYSQLD_DATADIR/test'
);
- -- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+
+ --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
-- error 1,1
eval CREATE TABLE t1 (a INT)
PARTITION BY LIST (a) (
PARTITION p0 VALUES IN (0)
- DATA DIRECTORY '$MYSQLTEST_VARDIR/master-data/test'
- INDEX DIRECTORY '$MYSQLTEST_VARDIR/master-data/test',
+ DATA DIRECTORY '$MYSQLD_DATADIR/test'
+ INDEX DIRECTORY '$MYSQLD_DATADIR/test',
PARTITION p1 VALUES IN (1)
- DATA DIRECTORY '$MYSQLTEST_VARDIR/master-data/mysqltest2'
- INDEX DIRECTORY '$MYSQLTEST_VARDIR/master-data/mysqltest2'
+ DATA DIRECTORY '$MYSQLD_DATADIR/mysqltest2'
+ INDEX DIRECTORY '$MYSQLD_DATADIR/mysqltest2'
);
connection default;
-- echo # user root (cleanup):
diff --git a/mysql-test/t/query_cache.test b/mysql-test/t/query_cache.test
index 9e250372d51..25d9ed653c2 100644
--- a/mysql-test/t/query_cache.test
+++ b/mysql-test/t/query_cache.test
@@ -423,7 +423,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 --git a/mysql-test/t/repair.test b/mysql-test/t/repair.test
index b433b8720b9..84614798832 100644
--- a/mysql-test/t/repair.test
+++ b/mysql-test/t/repair.test
@@ -29,7 +29,8 @@ 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 ;
+let $MYSQLD_DATADIR= `select @@datadir`;
+system echo 1 > $MYSQLD_DATADIR/test/t1.MYI ;
repair table t1;
repair table t1 use_frm;
drop table t1;
diff --git a/mysql-test/t/show_check.test b/mysql-test/t/show_check.test
index 34e1941c9d7..50062dfb0c3 100644
--- a/mysql-test/t/show_check.test
+++ b/mysql-test/t/show_check.test
@@ -422,14 +422,15 @@ 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 ;
+let $MYSQLD_DATADIR= `select @@datadir`;
+system echo "this is a junk file for test" >> $MYSQLD_DATADIR/test/t1.frm ;
--replace_column 6 # 7 # 8 # 9 #
SHOW TABLE STATUS like 't1';
--error 1033
show create table t1;
drop table if exists t1;
--error 1,0
---remove_file $MYSQLTEST_VARDIR/master-data/test/t1.frm
+--remove_file $MYSQLD_DATADIR/test/t1.frm
#
# BUG 12183 - SHOW OPEN TABLES behavior doesn't match grammar
diff --git a/mysql-test/t/sp-destruct.test b/mysql-test/t/sp-destruct.test
index 56d99c4435c..ae2bb9f7ea3 100644
--- a/mysql-test/t/sp-destruct.test
+++ b/mysql-test/t/sp-destruct.test
@@ -13,9 +13,10 @@
-- source include/not_embedded.inc
# 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
+let $MYSQLD_DATADIR= `select @@datadir`;
+--copy_file $MYSQLD_DATADIR/mysql/proc.frm $MYSQLTEST_VARDIR/tmp/proc.frm
+--copy_file $MYSQLD_DATADIR/mysql/proc.MYD $MYSQLTEST_VARDIR/tmp/proc.MYD
+--copy_file $MYSQLD_DATADIR/mysql/proc.MYI $MYSQLTEST_VARDIR/tmp/proc.MYI
use test;
@@ -50,8 +51,8 @@ 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 $MYSQLD_DATADIR/mysql/proc.frm
+--write_file $MYSQLD_DATADIR/mysql/proc.frm
saljdfa
EOF
--replace_result $MYSQLTEST_VARDIR . master-data// '' '\\' '/'
@@ -67,9 +68,9 @@ 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 $MYSQLD_DATADIR/mysql/proc.frm
+--remove_file $MYSQLD_DATADIR/mysql/proc.MYD
+--remove_file $MYSQLD_DATADIR/mysql/proc.MYI
--error ER_NO_SUCH_TABLE
call bug14233();
--error ER_NO_SUCH_TABLE
@@ -78,9 +79,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 $MYSQLD_DATADIR/mysql/proc.frm
+--copy_file $MYSQLTEST_VARDIR/tmp/proc.MYD $MYSQLD_DATADIR/mysql/proc.MYD
+--copy_file $MYSQLTEST_VARDIR/tmp/proc.MYI $MYSQLD_DATADIR/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 --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test
index 004e1c4ddd2..979141fb573 100644
--- a/mysql-test/t/sp.test
+++ b/mysql-test/t/sp.test
@@ -703,7 +703,7 @@ drop procedure into_test4|
--disable_warnings
drop procedure if exists into_outfile|
--enable_warnings
---replace_result $MYSQLTEST_VARDIR ..
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval create procedure into_outfile(x char(16), y int)
begin
insert into test.t1 values (x, y);
@@ -722,7 +722,7 @@ drop procedure into_outfile|
--disable_warnings
drop procedure if exists into_dumpfile|
--enable_warnings
---replace_result $MYSQLTEST_VARDIR ..
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval create procedure into_dumpfile(x char(16), y int)
begin
insert into test.t1 values (x, y);
@@ -5260,9 +5260,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()|
--enable_warnings
diff --git a/mysql-test/t/symlink.test b/mysql-test/t/symlink.test
index f339b29c83a..69b1b3cdb4e 100644
--- a/mysql-test/t/symlink.test
+++ b/mysql-test/t/symlink.test
@@ -123,11 +123,12 @@ drop table t1;
#
# BUG#32111 - Security Breach via DATA/INDEX DIRECORY and RENAME TABLE
#
---replace_result $MYSQLTEST_VARDIR TEST_DIR
+let $MYSQLD_DATADIR= `select @@datadir`;
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
eval CREATE TABLE t1(a INT)
-DATA DIRECTORY='$MYSQLTEST_VARDIR/master-data/mysql'
-INDEX DIRECTORY='$MYSQLTEST_VARDIR/master-data/mysql';
---replace_result $MYSQLTEST_VARDIR TEST_DIR
+DATA DIRECTORY='$MYSQLD_DATADIR/mysql'
+INDEX DIRECTORY='$MYSQLD_DATADIR/mysql';
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR/
--error 1
RENAME TABLE t1 TO user;
DROP TABLE t1;
@@ -137,12 +138,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 = "$MYSQLD_DATADIR/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 = "$MYSQLD_DATADIR/test/";
enable_query_log;
show create table t1;
drop table t1;
@@ -196,7 +197,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 = '$MYSQLD_DATADIR/db1/';
--enable_query_log
INSERT INTO db2.t1 VALUES (1);
diff --git a/mysql-test/t/system_mysql_db.test b/mysql-test/t/system_mysql_db.test
index e3d58ab7139..398a222b642 100644
--- a/mysql-test/t/system_mysql_db.test
+++ b/mysql-test/t/system_mysql_db.test
@@ -6,11 +6,6 @@
# depends on the presence of the log tables (which are CSV-based).
--source include/have_csv.inc
-# First delete some tables maybe left over from previous tests
---disable_warnings
-drop table if exists t1,t1aa,t2aa;
---enable_warnings
-
-- disable_query_log
use mysql;
-- enable_query_log
diff --git a/mysql-test/t/system_mysql_db_fix30020.test b/mysql-test/t/system_mysql_db_fix30020.test
index dc68f469d3a..a3dc9adb254 100644
--- a/mysql-test/t/system_mysql_db_fix30020.test
+++ b/mysql-test/t/system_mysql_db_fix30020.test
@@ -21,10 +21,6 @@ if (`SELECT LENGTH("$MYSQL_FIX_SYSTEM_TABLES") <= 0`)
# mysql_fix_system_tables which should be ignored.
# Instead, concentrate on the errors in r/system_mysql_db.reject
---disable_warnings
-drop table if exists t1,t1aa,t2aa;
---enable_warnings
-
-- disable_result_log
-- disable_query_log
diff --git a/mysql-test/t/system_mysql_db_fix40123.test b/mysql-test/t/system_mysql_db_fix40123.test
index 419a9cd1827..440fcc8aa8a 100644
--- a/mysql-test/t/system_mysql_db_fix40123.test
+++ b/mysql-test/t/system_mysql_db_fix40123.test
@@ -18,10 +18,6 @@ if (`SELECT LENGTH("$MYSQL_FIX_PRIVILEGE_TABLES") <= 0`)
# mysql_fix_system_tables which should be ignored.
# Instead, concentrate on the errors in r/system_mysql_db.reject
---disable_warnings
-drop table if exists t1,t1aa,t2aa;
---enable_warnings
-
-- disable_result_log
-- disable_query_log
diff --git a/mysql-test/t/system_mysql_db_fix50030.test b/mysql-test/t/system_mysql_db_fix50030.test
index b4e0ed65242..a1fbe9872f8 100644
--- a/mysql-test/t/system_mysql_db_fix50030.test
+++ b/mysql-test/t/system_mysql_db_fix50030.test
@@ -11,10 +11,6 @@
# mysql_fix_system_tables which should be ignored.
# Instead, concentrate on the errors in r/system_mysql_db.reject
---disable_warnings
-drop table if exists t1,t1aa,t2aa;
---enable_warnings
-
-- disable_result_log
-- disable_query_log
diff --git a/mysql-test/t/system_mysql_db_fix50117.test b/mysql-test/t/system_mysql_db_fix50117.test
index 5f259ac6133..9dc77cdbfc0 100644
--- a/mysql-test/t/system_mysql_db_fix50117.test
+++ b/mysql-test/t/system_mysql_db_fix50117.test
@@ -11,10 +11,6 @@
# mysql_fix_system_tables which should be ignored.
# Instead, concentrate on the errors in r/system_mysql_db.reject
---disable_warnings
- drop table if exists t1,t1aa,t2aa;
---enable_warnings
-
-- disable_result_log
-- disable_query_log
diff --git a/mysql-test/t/trigger-compat.test b/mysql-test/t/trigger-compat.test
index 9f7fd8bc505..bf119cd89e6 100644
--- a/mysql-test/t/trigger-compat.test
+++ b/mysql-test/t/trigger-compat.test
@@ -60,8 +60,9 @@ CREATE TRIGGER wl2818_trg1 BEFORE INSERT ON t1
--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
+let $MYSQLD_DATADIR= `select @@datadir`;
+--exec grep -v 'definers=' $MYSQLD_DATADIR/mysqltest_db1/t1.TRG > $MYSQLTEST_VARDIR/tmp/t1.TRG
+--exec mv $MYSQLTEST_VARDIR/tmp/t1.TRG $MYSQLD_DATADIR/mysqltest_db1/t1.TRG
#
# Create a new trigger.
diff --git a/mysql-test/t/trigger-grant.test b/mysql-test/t/trigger-grant.test
index 8145212ed5b..c31864662d1 100644
--- a/mysql-test/t/trigger-grant.test
+++ b/mysql-test/t/trigger-grant.test
@@ -360,10 +360,11 @@ CREATE TRIGGER trg5 BEFORE DELETE ON t1
SET @a = 5;
# Replace definers with the "weird" definers
+let MYSQLD_DATADIR= `select @@datadir`;
perl;
use strict;
use warnings;
-my $fname= "$ENV{'MYSQLTEST_VARDIR'}/master-data/mysqltest_db1/t1.TRG";
+my $fname= "$ENV{'MYSQLD_DATADIR'}/mysqltest_db1/t1.TRG";
open(FILE, "<", $fname) or die;
my @content= grep($_ !~ /^definers=/, <FILE>);
close FILE;
diff --git a/mysql-test/t/trigger.test b/mysql-test/t/trigger.test
index 1c98a0f8d29..688cf7a996c 100644
--- a/mysql-test/t/trigger.test
+++ b/mysql-test/t/trigger.test
@@ -472,11 +472,11 @@ 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:="";
# 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,10 +1142,11 @@ select trigger_schema, trigger_name, event_object_schema,
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~;
+let $MYSQLD_DATADIR= `select @@datadir`;
+write_file $MYSQLD_DATADIR/test/t1_ai.TRN~;
dummy
EOF
-chmod 0000 $MYSQLTEST_VARDIR/master-data/test/t1_ai.TRN~;
+chmod 0000 $MYSQLD_DATADIR/test/t1_ai.TRN~;
# Normalize the datadir path; the embedded server doesn't chdir to datadir
--replace_result $MYSQLTEST_VARDIR . master-data/ ''
--error 1
@@ -1156,8 +1157,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 $MYSQLD_DATADIR/test/t1_ai.TRN~;
+remove_file $MYSQLD_DATADIR/test/t1_ai.TRN~;
# Let us check that updates to .TRN files were rolled back too
drop trigger t1_bi;
drop trigger t1_ai;
@@ -1190,7 +1191,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
@@ -1200,7 +1201,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 function f1;
drop function f2;
drop table t1, t2;
diff --git a/mysql-test/t/type_blob.test b/mysql-test/t/type_blob.test
index b6febf8e76d..ba66914aac9 100644
--- a/mysql-test/t/type_blob.test
+++ b/mysql-test/t/type_blob.test
@@ -308,20 +308,20 @@ create table t1 (id integer auto_increment unique,imagem LONGBLOB not null defau
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('$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'));
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-eval update t1 set imagem=load_file('$MYSQLTEST_VARDIR/std_data_ln/words.dat') where id=1;
+eval 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;
drop table t1;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-eval create table t1 select load_file('$MYSQLTEST_VARDIR/std_data_ln/words.dat') l;
+eval create table t1 select load_file('$MYSQLTEST_VARDIR/std_data/words.dat') l;
# We mask out the Privileges column because it differs for embedded server
--replace_column 8 #
show full fields from t1;
diff --git a/mysql-test/t/type_varchar.test b/mysql-test/t/type_varchar.test
index 1eb949a21e3..9098881e379 100644
--- a/mysql-test/t/type_varchar.test
+++ b/mysql-test/t/type_varchar.test
@@ -3,7 +3,8 @@ drop table if exists t1, t2;
--enable_warnings
create table t1 (v varchar(30), c char(3), e enum('abc','def','ghi'), t text);
-copy_file $MYSQL_TEST_DIR/std_data/vchar.frm $MYSQLTEST_VARDIR/master-data/test/vchar.frm;
+let $MYSQLD_DATADIR= `select @@datadir`;
+copy_file $MYSQL_TEST_DIR/std_data/vchar.frm $MYSQLD_DATADIR/test/vchar.frm;
truncate table vchar;
show create table t1;
show create table vchar;
@@ -162,8 +163,8 @@ create table t3 (
en varchar(255) character set utf8,
cz varchar(255) character set utf8
);
-remove_file $MYSQLTEST_VARDIR/master-data/test/t3.frm;
-copy_file $MYSQL_TEST_DIR/std_data/14897.frm $MYSQLTEST_VARDIR/master-data/test/t3.frm;
+remove_file $MYSQLD_DATADIR/test/t3.frm;
+copy_file $MYSQL_TEST_DIR/std_data/14897.frm $MYSQLD_DATADIR/test/t3.frm;
truncate table t3;
insert into t3 (id, en, cz) values
(1,'en string 1','cz string 1'),
diff --git a/mysql-test/t/upgrade.test b/mysql-test/t/upgrade.test
index 05f430b087b..fa1db9fcfb7 100644
--- a/mysql-test/t/upgrade.test
+++ b/mysql-test/t/upgrade.test
@@ -57,7 +57,8 @@ drop table `txu#p#p1`;
# Check if old tables work
#
-system cp $MYSQL_TEST_DIR/std_data/old_table-323.frm $MYSQLTEST_VARDIR/master-data/test/t1.frm;
+let $MYSQLD_DATADIR= `select @@datadir`;
+system cp $MYSQL_TEST_DIR/std_data/old_table-323.frm $MYSQLD_DATADIR/test/t1.frm;
truncate t1;
drop table t1;
@@ -75,11 +76,11 @@ create table tabc.t1 (a int);
FLUSH TABLES;
# Manually make a 5.0 database from the template
---exec mkdir $MYSQLTEST_VARDIR/master-data/a-b-c
---copy_file $MYSQLTEST_VARDIR/master-data/tabc/db.opt $MYSQLTEST_VARDIR/master-data/a-b-c/db.opt
---copy_file $MYSQLTEST_VARDIR/master-data/tabc/t1.frm $MYSQLTEST_VARDIR/master-data/a-b-c/t1.frm
---copy_file $MYSQLTEST_VARDIR/master-data/tabc/t1.MYD $MYSQLTEST_VARDIR/master-data/a-b-c/t1.MYD
---copy_file $MYSQLTEST_VARDIR/master-data/tabc/t1.MYI $MYSQLTEST_VARDIR/master-data/a-b-c/t1.MYI
+--exec mkdir $MYSQLD_DATADIR/a-b-c
+--copy_file $MYSQLD_DATADIR/tabc/db.opt $MYSQLD_DATADIR/a-b-c/db.opt
+--copy_file $MYSQLD_DATADIR/tabc/t1.frm $MYSQLD_DATADIR/a-b-c/t1.frm
+--copy_file $MYSQLD_DATADIR/tabc/t1.MYD $MYSQLD_DATADIR/a-b-c/t1.MYD
+--copy_file $MYSQLD_DATADIR/tabc/t1.MYI $MYSQLD_DATADIR/a-b-c/t1.MYI
show databases like '%a-b-c%';
ALTER DATABASE `#mysql50#a-b-c` UPGRADE DATA DIRECTORY NAME;
diff --git a/mysql-test/t/user_var-binlog.test b/mysql-test/t/user_var-binlog.test
index 70f2f0fa7a6..0098f237de9 100644
--- a/mysql-test/t/user_var-binlog.test
+++ b/mysql-test/t/user_var-binlog.test
@@ -16,9 +16,9 @@ source include/show_binlog_events.inc;
# more important than SHOW BINLOG EVENTS, mysqlbinlog (where we
# absolutely need variables names to be quoted and strings to be
# escaped).
---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
+let $MYSQLD_DATADIR= `select @@datadir`;
flush logs;
---exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000001
+--exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000001
drop table t1;
# End of 4.1 tests
diff --git a/mysql-test/t/varbinary.test b/mysql-test/t/varbinary.test
index 9ccbac7cdda..192c9a427f2 100644
--- a/mysql-test/t/varbinary.test
+++ b/mysql-test/t/varbinary.test
@@ -47,12 +47,13 @@ drop table t1;
#
# Test with a saved table from 4.1
-copy_file std_data/bug19371.frm $MYSQLTEST_VARDIR/master-data/test/t1.frm;
-chmod 0777 $MYSQLTEST_VARDIR/master-data/test/t1.frm;
-copy_file std_data/bug19371.MYD $MYSQLTEST_VARDIR/master-data/test/t1.MYD;
-chmod 0777 $MYSQLTEST_VARDIR/master-data/test/t1.MYD;
-copy_file std_data/bug19371.MYI $MYSQLTEST_VARDIR/master-data/test/t1.MYI;
-chmod 0777 $MYSQLTEST_VARDIR/master-data/test/t1.MYI;
+let $MYSQLD_DATADIR= `select @@datadir`;
+copy_file std_data/bug19371.frm $MYSQLD_DATADIR/test/t1.frm;
+chmod 0777 $MYSQLD_DATADIR/test/t1.frm;
+copy_file std_data/bug19371.MYD $MYSQLD_DATADIR/test/t1.MYD;
+chmod 0777 $MYSQLD_DATADIR/test/t1.MYD;
+copy_file std_data/bug19371.MYI $MYSQLD_DATADIR/test/t1.MYI;
+chmod 0777 $MYSQLD_DATADIR/test/t1.MYI;
# Everything _looks_ fine
show create table t1;
diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test
index e388aa61803..e7e361ac9f8 100644
--- a/mysql-test/t/view.test
+++ b/mysql-test/t/view.test
@@ -1228,11 +1228,11 @@ drop table t1;
create table t1 (a int, b char(10));
create view v1 as select * from t1 where a != 0 with check option;
-- error 1369
-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;
select * from t1;
select * from v1;
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;
select * from t1 order by a,b;
select * from v1 order by a,b;
drop view v1;
@@ -1241,11 +1241,11 @@ drop table t1;
create table t1 (a text, b text);
create view v1 as select * from t1 where a <> 'Field A' with check option;
-- error 1369
-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 '''';
select concat('|',a,'|'), concat('|',b,'|') from t1;
select concat('|',a,'|'), concat('|',b,'|') from v1;
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 '''';
select concat('|',a,'|'), concat('|',b,'|') from t1;
select concat('|',a,'|'), concat('|',b,'|') from v1;
drop view v1;
diff --git a/mysql-test/t/warnings.test b/mysql-test/t/warnings.test
index b5bae109f5f..26cef584252 100644
--- a/mysql-test/t/warnings.test
+++ b/mysql-test/t/warnings.test
@@ -50,7 +50,7 @@ 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 ',';
# PS doesn't work good with @@warning_count
--disable_ps_protocol
select @@warning_count;