You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

4521 lines
125 KiB

mysql-test-run.pl: Let --start-and-exit actually start a server Added that test case names can be specified on the comman line Added embedded server support Added environment variables UMASK, UMASK_DIR Added missing MASTER_MYSOCK1, MASTER_MYPORT1, USE_RUNNING_SERVER Added missing CHARSETSDIR, MYSQL_FIX_SYSTEM_TABLES, MYSQL_CLIENT_TEST Pass on return value from sleep_until_file_created(), to fail test Fail test if early termination of mysqld servers Create intial databases for the second master, and two additional slaves mtr_process.pl: Find out if port is still in use, using simple TCP connect Use non blocking waitpid() to catch terminations early Make a special case spawning the 'mysqltest' application Redo the fork() if it returns EAGAIN Make sure to record if master or slave terminated Improved debugging output Improved code that remove PID files to avoid race Abort if we can't stop all mysqld servers using our ports Many improvements in killing mysqld servers Let sleep_until_file_created() catch if server died early mtr_report.pl: Added option to disable test cases using <testcase>.disabled file If --timer, only try to open file with time data if it exists mtr_io.pl: Remove starting/ending space reading server options from file mysql-test/lib/mtr_io.pl: Remove starting/ending space reading server options from file mysql-test/lib/mtr_report.pl: Added option to disable test cases using <testcase>.disabled file If --timer, only try to open file with time data if it exists mysql-test/lib/mtr_process.pl: Find out if port is still in use, using simple TCP connect Use non blocking waitpid() to catch terminations early Make a special case spawning the 'mysqltest' application Redo the fork() if it returns EAGAIN Make sure to record if master or slave terminated Improved debugging output Improved code that remove PID files to avoid race Abort if we can't stop all mysqld servers using our ports Many improvements in killing mysqld servers Let sleep_until_file_created() catch if server died early mysql-test/mysql-test-run.pl: Let --start-and-exit actually start a server Added that test case names can be specified on the comman line Added embedded server support Added environment variables UMASK, UMASK_DIR Added missing MASTER_MYSOCK1, MASTER_MYPORT1, USE_RUNNING_SERVER Added missing CHARSETSDIR, MYSQL_FIX_SYSTEM_TABLES, MYSQL_CLIENT_TEST Pass on return value from sleep_until_file_created(), to fail test Fail test if early termination of mysqld servers Create intial databases for the second master, and two additional slaves
21 years ago
mysql-test-run.pl: Let --start-and-exit actually start a server Added that test case names can be specified on the comman line Added embedded server support Added environment variables UMASK, UMASK_DIR Added missing MASTER_MYSOCK1, MASTER_MYPORT1, USE_RUNNING_SERVER Added missing CHARSETSDIR, MYSQL_FIX_SYSTEM_TABLES, MYSQL_CLIENT_TEST Pass on return value from sleep_until_file_created(), to fail test Fail test if early termination of mysqld servers Create intial databases for the second master, and two additional slaves mtr_process.pl: Find out if port is still in use, using simple TCP connect Use non blocking waitpid() to catch terminations early Make a special case spawning the 'mysqltest' application Redo the fork() if it returns EAGAIN Make sure to record if master or slave terminated Improved debugging output Improved code that remove PID files to avoid race Abort if we can't stop all mysqld servers using our ports Many improvements in killing mysqld servers Let sleep_until_file_created() catch if server died early mtr_report.pl: Added option to disable test cases using <testcase>.disabled file If --timer, only try to open file with time data if it exists mtr_io.pl: Remove starting/ending space reading server options from file mysql-test/lib/mtr_io.pl: Remove starting/ending space reading server options from file mysql-test/lib/mtr_report.pl: Added option to disable test cases using <testcase>.disabled file If --timer, only try to open file with time data if it exists mysql-test/lib/mtr_process.pl: Find out if port is still in use, using simple TCP connect Use non blocking waitpid() to catch terminations early Make a special case spawning the 'mysqltest' application Redo the fork() if it returns EAGAIN Make sure to record if master or slave terminated Improved debugging output Improved code that remove PID files to avoid race Abort if we can't stop all mysqld servers using our ports Many improvements in killing mysqld servers Let sleep_until_file_created() catch if server died early mysql-test/mysql-test-run.pl: Let --start-and-exit actually start a server Added that test case names can be specified on the comman line Added embedded server support Added environment variables UMASK, UMASK_DIR Added missing MASTER_MYSOCK1, MASTER_MYPORT1, USE_RUNNING_SERVER Added missing CHARSETSDIR, MYSQL_FIX_SYSTEM_TABLES, MYSQL_CLIENT_TEST Pass on return value from sleep_until_file_created(), to fail test Fail test if early termination of mysqld servers Create intial databases for the second master, and two additional slaves
21 years ago
mysql-test-run.pl: Let --start-and-exit actually start a server Added that test case names can be specified on the comman line Added embedded server support Added environment variables UMASK, UMASK_DIR Added missing MASTER_MYSOCK1, MASTER_MYPORT1, USE_RUNNING_SERVER Added missing CHARSETSDIR, MYSQL_FIX_SYSTEM_TABLES, MYSQL_CLIENT_TEST Pass on return value from sleep_until_file_created(), to fail test Fail test if early termination of mysqld servers Create intial databases for the second master, and two additional slaves mtr_process.pl: Find out if port is still in use, using simple TCP connect Use non blocking waitpid() to catch terminations early Make a special case spawning the 'mysqltest' application Redo the fork() if it returns EAGAIN Make sure to record if master or slave terminated Improved debugging output Improved code that remove PID files to avoid race Abort if we can't stop all mysqld servers using our ports Many improvements in killing mysqld servers Let sleep_until_file_created() catch if server died early mtr_report.pl: Added option to disable test cases using <testcase>.disabled file If --timer, only try to open file with time data if it exists mtr_io.pl: Remove starting/ending space reading server options from file mysql-test/lib/mtr_io.pl: Remove starting/ending space reading server options from file mysql-test/lib/mtr_report.pl: Added option to disable test cases using <testcase>.disabled file If --timer, only try to open file with time data if it exists mysql-test/lib/mtr_process.pl: Find out if port is still in use, using simple TCP connect Use non blocking waitpid() to catch terminations early Make a special case spawning the 'mysqltest' application Redo the fork() if it returns EAGAIN Make sure to record if master or slave terminated Improved debugging output Improved code that remove PID files to avoid race Abort if we can't stop all mysqld servers using our ports Many improvements in killing mysqld servers Let sleep_until_file_created() catch if server died early mysql-test/mysql-test-run.pl: Let --start-and-exit actually start a server Added that test case names can be specified on the comman line Added embedded server support Added environment variables UMASK, UMASK_DIR Added missing MASTER_MYSOCK1, MASTER_MYPORT1, USE_RUNNING_SERVER Added missing CHARSETSDIR, MYSQL_FIX_SYSTEM_TABLES, MYSQL_CLIENT_TEST Pass on return value from sleep_until_file_created(), to fail test Fail test if early termination of mysqld servers Create intial databases for the second master, and two additional slaves
21 years ago
mysql-test-run.pl: Let --start-and-exit actually start a server Added that test case names can be specified on the comman line Added embedded server support Added environment variables UMASK, UMASK_DIR Added missing MASTER_MYSOCK1, MASTER_MYPORT1, USE_RUNNING_SERVER Added missing CHARSETSDIR, MYSQL_FIX_SYSTEM_TABLES, MYSQL_CLIENT_TEST Pass on return value from sleep_until_file_created(), to fail test Fail test if early termination of mysqld servers Create intial databases for the second master, and two additional slaves mtr_process.pl: Find out if port is still in use, using simple TCP connect Use non blocking waitpid() to catch terminations early Make a special case spawning the 'mysqltest' application Redo the fork() if it returns EAGAIN Make sure to record if master or slave terminated Improved debugging output Improved code that remove PID files to avoid race Abort if we can't stop all mysqld servers using our ports Many improvements in killing mysqld servers Let sleep_until_file_created() catch if server died early mtr_report.pl: Added option to disable test cases using <testcase>.disabled file If --timer, only try to open file with time data if it exists mtr_io.pl: Remove starting/ending space reading server options from file mysql-test/lib/mtr_io.pl: Remove starting/ending space reading server options from file mysql-test/lib/mtr_report.pl: Added option to disable test cases using <testcase>.disabled file If --timer, only try to open file with time data if it exists mysql-test/lib/mtr_process.pl: Find out if port is still in use, using simple TCP connect Use non blocking waitpid() to catch terminations early Make a special case spawning the 'mysqltest' application Redo the fork() if it returns EAGAIN Make sure to record if master or slave terminated Improved debugging output Improved code that remove PID files to avoid race Abort if we can't stop all mysqld servers using our ports Many improvements in killing mysqld servers Let sleep_until_file_created() catch if server died early mysql-test/mysql-test-run.pl: Let --start-and-exit actually start a server Added that test case names can be specified on the comman line Added embedded server support Added environment variables UMASK, UMASK_DIR Added missing MASTER_MYSOCK1, MASTER_MYPORT1, USE_RUNNING_SERVER Added missing CHARSETSDIR, MYSQL_FIX_SYSTEM_TABLES, MYSQL_CLIENT_TEST Pass on return value from sleep_until_file_created(), to fail test Fail test if early termination of mysqld servers Create intial databases for the second master, and two additional slaves
21 years ago
mysql-test-run.pl: Let --start-and-exit actually start a server Added that test case names can be specified on the comman line Added embedded server support Added environment variables UMASK, UMASK_DIR Added missing MASTER_MYSOCK1, MASTER_MYPORT1, USE_RUNNING_SERVER Added missing CHARSETSDIR, MYSQL_FIX_SYSTEM_TABLES, MYSQL_CLIENT_TEST Pass on return value from sleep_until_file_created(), to fail test Fail test if early termination of mysqld servers Create intial databases for the second master, and two additional slaves mtr_process.pl: Find out if port is still in use, using simple TCP connect Use non blocking waitpid() to catch terminations early Make a special case spawning the 'mysqltest' application Redo the fork() if it returns EAGAIN Make sure to record if master or slave terminated Improved debugging output Improved code that remove PID files to avoid race Abort if we can't stop all mysqld servers using our ports Many improvements in killing mysqld servers Let sleep_until_file_created() catch if server died early mtr_report.pl: Added option to disable test cases using <testcase>.disabled file If --timer, only try to open file with time data if it exists mtr_io.pl: Remove starting/ending space reading server options from file mysql-test/lib/mtr_io.pl: Remove starting/ending space reading server options from file mysql-test/lib/mtr_report.pl: Added option to disable test cases using <testcase>.disabled file If --timer, only try to open file with time data if it exists mysql-test/lib/mtr_process.pl: Find out if port is still in use, using simple TCP connect Use non blocking waitpid() to catch terminations early Make a special case spawning the 'mysqltest' application Redo the fork() if it returns EAGAIN Make sure to record if master or slave terminated Improved debugging output Improved code that remove PID files to avoid race Abort if we can't stop all mysqld servers using our ports Many improvements in killing mysqld servers Let sleep_until_file_created() catch if server died early mysql-test/mysql-test-run.pl: Let --start-and-exit actually start a server Added that test case names can be specified on the comman line Added embedded server support Added environment variables UMASK, UMASK_DIR Added missing MASTER_MYSOCK1, MASTER_MYPORT1, USE_RUNNING_SERVER Added missing CHARSETSDIR, MYSQL_FIX_SYSTEM_TABLES, MYSQL_CLIENT_TEST Pass on return value from sleep_until_file_created(), to fail test Fail test if early termination of mysqld servers Create intial databases for the second master, and two additional slaves
21 years ago
mysql-test-run.pl: Let --start-and-exit actually start a server Added that test case names can be specified on the comman line Added embedded server support Added environment variables UMASK, UMASK_DIR Added missing MASTER_MYSOCK1, MASTER_MYPORT1, USE_RUNNING_SERVER Added missing CHARSETSDIR, MYSQL_FIX_SYSTEM_TABLES, MYSQL_CLIENT_TEST Pass on return value from sleep_until_file_created(), to fail test Fail test if early termination of mysqld servers Create intial databases for the second master, and two additional slaves mtr_process.pl: Find out if port is still in use, using simple TCP connect Use non blocking waitpid() to catch terminations early Make a special case spawning the 'mysqltest' application Redo the fork() if it returns EAGAIN Make sure to record if master or slave terminated Improved debugging output Improved code that remove PID files to avoid race Abort if we can't stop all mysqld servers using our ports Many improvements in killing mysqld servers Let sleep_until_file_created() catch if server died early mtr_report.pl: Added option to disable test cases using <testcase>.disabled file If --timer, only try to open file with time data if it exists mtr_io.pl: Remove starting/ending space reading server options from file mysql-test/lib/mtr_io.pl: Remove starting/ending space reading server options from file mysql-test/lib/mtr_report.pl: Added option to disable test cases using <testcase>.disabled file If --timer, only try to open file with time data if it exists mysql-test/lib/mtr_process.pl: Find out if port is still in use, using simple TCP connect Use non blocking waitpid() to catch terminations early Make a special case spawning the 'mysqltest' application Redo the fork() if it returns EAGAIN Make sure to record if master or slave terminated Improved debugging output Improved code that remove PID files to avoid race Abort if we can't stop all mysqld servers using our ports Many improvements in killing mysqld servers Let sleep_until_file_created() catch if server died early mysql-test/mysql-test-run.pl: Let --start-and-exit actually start a server Added that test case names can be specified on the comman line Added embedded server support Added environment variables UMASK, UMASK_DIR Added missing MASTER_MYSOCK1, MASTER_MYPORT1, USE_RUNNING_SERVER Added missing CHARSETSDIR, MYSQL_FIX_SYSTEM_TABLES, MYSQL_CLIENT_TEST Pass on return value from sleep_until_file_created(), to fail test Fail test if early termination of mysqld servers Create intial databases for the second master, and two additional slaves
21 years ago
mysql-test-run.pl: Let --start-and-exit actually start a server Added that test case names can be specified on the comman line Added embedded server support Added environment variables UMASK, UMASK_DIR Added missing MASTER_MYSOCK1, MASTER_MYPORT1, USE_RUNNING_SERVER Added missing CHARSETSDIR, MYSQL_FIX_SYSTEM_TABLES, MYSQL_CLIENT_TEST Pass on return value from sleep_until_file_created(), to fail test Fail test if early termination of mysqld servers Create intial databases for the second master, and two additional slaves mtr_process.pl: Find out if port is still in use, using simple TCP connect Use non blocking waitpid() to catch terminations early Make a special case spawning the 'mysqltest' application Redo the fork() if it returns EAGAIN Make sure to record if master or slave terminated Improved debugging output Improved code that remove PID files to avoid race Abort if we can't stop all mysqld servers using our ports Many improvements in killing mysqld servers Let sleep_until_file_created() catch if server died early mtr_report.pl: Added option to disable test cases using <testcase>.disabled file If --timer, only try to open file with time data if it exists mtr_io.pl: Remove starting/ending space reading server options from file mysql-test/lib/mtr_io.pl: Remove starting/ending space reading server options from file mysql-test/lib/mtr_report.pl: Added option to disable test cases using <testcase>.disabled file If --timer, only try to open file with time data if it exists mysql-test/lib/mtr_process.pl: Find out if port is still in use, using simple TCP connect Use non blocking waitpid() to catch terminations early Make a special case spawning the 'mysqltest' application Redo the fork() if it returns EAGAIN Make sure to record if master or slave terminated Improved debugging output Improved code that remove PID files to avoid race Abort if we can't stop all mysqld servers using our ports Many improvements in killing mysqld servers Let sleep_until_file_created() catch if server died early mysql-test/mysql-test-run.pl: Let --start-and-exit actually start a server Added that test case names can be specified on the comman line Added embedded server support Added environment variables UMASK, UMASK_DIR Added missing MASTER_MYSOCK1, MASTER_MYPORT1, USE_RUNNING_SERVER Added missing CHARSETSDIR, MYSQL_FIX_SYSTEM_TABLES, MYSQL_CLIENT_TEST Pass on return value from sleep_until_file_created(), to fail test Fail test if early termination of mysqld servers Create intial databases for the second master, and two additional slaves
21 years ago
mysql-test-run.pl: Let --start-and-exit actually start a server Added that test case names can be specified on the comman line Added embedded server support Added environment variables UMASK, UMASK_DIR Added missing MASTER_MYSOCK1, MASTER_MYPORT1, USE_RUNNING_SERVER Added missing CHARSETSDIR, MYSQL_FIX_SYSTEM_TABLES, MYSQL_CLIENT_TEST Pass on return value from sleep_until_file_created(), to fail test Fail test if early termination of mysqld servers Create intial databases for the second master, and two additional slaves mtr_process.pl: Find out if port is still in use, using simple TCP connect Use non blocking waitpid() to catch terminations early Make a special case spawning the 'mysqltest' application Redo the fork() if it returns EAGAIN Make sure to record if master or slave terminated Improved debugging output Improved code that remove PID files to avoid race Abort if we can't stop all mysqld servers using our ports Many improvements in killing mysqld servers Let sleep_until_file_created() catch if server died early mtr_report.pl: Added option to disable test cases using <testcase>.disabled file If --timer, only try to open file with time data if it exists mtr_io.pl: Remove starting/ending space reading server options from file mysql-test/lib/mtr_io.pl: Remove starting/ending space reading server options from file mysql-test/lib/mtr_report.pl: Added option to disable test cases using <testcase>.disabled file If --timer, only try to open file with time data if it exists mysql-test/lib/mtr_process.pl: Find out if port is still in use, using simple TCP connect Use non blocking waitpid() to catch terminations early Make a special case spawning the 'mysqltest' application Redo the fork() if it returns EAGAIN Make sure to record if master or slave terminated Improved debugging output Improved code that remove PID files to avoid race Abort if we can't stop all mysqld servers using our ports Many improvements in killing mysqld servers Let sleep_until_file_created() catch if server died early mysql-test/mysql-test-run.pl: Let --start-and-exit actually start a server Added that test case names can be specified on the comman line Added embedded server support Added environment variables UMASK, UMASK_DIR Added missing MASTER_MYSOCK1, MASTER_MYPORT1, USE_RUNNING_SERVER Added missing CHARSETSDIR, MYSQL_FIX_SYSTEM_TABLES, MYSQL_CLIENT_TEST Pass on return value from sleep_until_file_created(), to fail test Fail test if early termination of mysqld servers Create intial databases for the second master, and two additional slaves
21 years ago
mysql-test-run.pl: Let --start-and-exit actually start a server Added that test case names can be specified on the comman line Added embedded server support Added environment variables UMASK, UMASK_DIR Added missing MASTER_MYSOCK1, MASTER_MYPORT1, USE_RUNNING_SERVER Added missing CHARSETSDIR, MYSQL_FIX_SYSTEM_TABLES, MYSQL_CLIENT_TEST Pass on return value from sleep_until_file_created(), to fail test Fail test if early termination of mysqld servers Create intial databases for the second master, and two additional slaves mtr_process.pl: Find out if port is still in use, using simple TCP connect Use non blocking waitpid() to catch terminations early Make a special case spawning the 'mysqltest' application Redo the fork() if it returns EAGAIN Make sure to record if master or slave terminated Improved debugging output Improved code that remove PID files to avoid race Abort if we can't stop all mysqld servers using our ports Many improvements in killing mysqld servers Let sleep_until_file_created() catch if server died early mtr_report.pl: Added option to disable test cases using <testcase>.disabled file If --timer, only try to open file with time data if it exists mtr_io.pl: Remove starting/ending space reading server options from file mysql-test/lib/mtr_io.pl: Remove starting/ending space reading server options from file mysql-test/lib/mtr_report.pl: Added option to disable test cases using <testcase>.disabled file If --timer, only try to open file with time data if it exists mysql-test/lib/mtr_process.pl: Find out if port is still in use, using simple TCP connect Use non blocking waitpid() to catch terminations early Make a special case spawning the 'mysqltest' application Redo the fork() if it returns EAGAIN Make sure to record if master or slave terminated Improved debugging output Improved code that remove PID files to avoid race Abort if we can't stop all mysqld servers using our ports Many improvements in killing mysqld servers Let sleep_until_file_created() catch if server died early mysql-test/mysql-test-run.pl: Let --start-and-exit actually start a server Added that test case names can be specified on the comman line Added embedded server support Added environment variables UMASK, UMASK_DIR Added missing MASTER_MYSOCK1, MASTER_MYPORT1, USE_RUNNING_SERVER Added missing CHARSETSDIR, MYSQL_FIX_SYSTEM_TABLES, MYSQL_CLIENT_TEST Pass on return value from sleep_until_file_created(), to fail test Fail test if early termination of mysqld servers Create intial databases for the second master, and two additional slaves
21 years ago
mysql-test-run.pl: Let --start-and-exit actually start a server Added that test case names can be specified on the comman line Added embedded server support Added environment variables UMASK, UMASK_DIR Added missing MASTER_MYSOCK1, MASTER_MYPORT1, USE_RUNNING_SERVER Added missing CHARSETSDIR, MYSQL_FIX_SYSTEM_TABLES, MYSQL_CLIENT_TEST Pass on return value from sleep_until_file_created(), to fail test Fail test if early termination of mysqld servers Create intial databases for the second master, and two additional slaves mtr_process.pl: Find out if port is still in use, using simple TCP connect Use non blocking waitpid() to catch terminations early Make a special case spawning the 'mysqltest' application Redo the fork() if it returns EAGAIN Make sure to record if master or slave terminated Improved debugging output Improved code that remove PID files to avoid race Abort if we can't stop all mysqld servers using our ports Many improvements in killing mysqld servers Let sleep_until_file_created() catch if server died early mtr_report.pl: Added option to disable test cases using <testcase>.disabled file If --timer, only try to open file with time data if it exists mtr_io.pl: Remove starting/ending space reading server options from file mysql-test/lib/mtr_io.pl: Remove starting/ending space reading server options from file mysql-test/lib/mtr_report.pl: Added option to disable test cases using <testcase>.disabled file If --timer, only try to open file with time data if it exists mysql-test/lib/mtr_process.pl: Find out if port is still in use, using simple TCP connect Use non blocking waitpid() to catch terminations early Make a special case spawning the 'mysqltest' application Redo the fork() if it returns EAGAIN Make sure to record if master or slave terminated Improved debugging output Improved code that remove PID files to avoid race Abort if we can't stop all mysqld servers using our ports Many improvements in killing mysqld servers Let sleep_until_file_created() catch if server died early mysql-test/mysql-test-run.pl: Let --start-and-exit actually start a server Added that test case names can be specified on the comman line Added embedded server support Added environment variables UMASK, UMASK_DIR Added missing MASTER_MYSOCK1, MASTER_MYPORT1, USE_RUNNING_SERVER Added missing CHARSETSDIR, MYSQL_FIX_SYSTEM_TABLES, MYSQL_CLIENT_TEST Pass on return value from sleep_until_file_created(), to fail test Fail test if early termination of mysqld servers Create intial databases for the second master, and two additional slaves
21 years ago
mysql-test-run.pl: Let --start-and-exit actually start a server Added that test case names can be specified on the comman line Added embedded server support Added environment variables UMASK, UMASK_DIR Added missing MASTER_MYSOCK1, MASTER_MYPORT1, USE_RUNNING_SERVER Added missing CHARSETSDIR, MYSQL_FIX_SYSTEM_TABLES, MYSQL_CLIENT_TEST Pass on return value from sleep_until_file_created(), to fail test Fail test if early termination of mysqld servers Create intial databases for the second master, and two additional slaves mtr_process.pl: Find out if port is still in use, using simple TCP connect Use non blocking waitpid() to catch terminations early Make a special case spawning the 'mysqltest' application Redo the fork() if it returns EAGAIN Make sure to record if master or slave terminated Improved debugging output Improved code that remove PID files to avoid race Abort if we can't stop all mysqld servers using our ports Many improvements in killing mysqld servers Let sleep_until_file_created() catch if server died early mtr_report.pl: Added option to disable test cases using <testcase>.disabled file If --timer, only try to open file with time data if it exists mtr_io.pl: Remove starting/ending space reading server options from file mysql-test/lib/mtr_io.pl: Remove starting/ending space reading server options from file mysql-test/lib/mtr_report.pl: Added option to disable test cases using <testcase>.disabled file If --timer, only try to open file with time data if it exists mysql-test/lib/mtr_process.pl: Find out if port is still in use, using simple TCP connect Use non blocking waitpid() to catch terminations early Make a special case spawning the 'mysqltest' application Redo the fork() if it returns EAGAIN Make sure to record if master or slave terminated Improved debugging output Improved code that remove PID files to avoid race Abort if we can't stop all mysqld servers using our ports Many improvements in killing mysqld servers Let sleep_until_file_created() catch if server died early mysql-test/mysql-test-run.pl: Let --start-and-exit actually start a server Added that test case names can be specified on the comman line Added embedded server support Added environment variables UMASK, UMASK_DIR Added missing MASTER_MYSOCK1, MASTER_MYPORT1, USE_RUNNING_SERVER Added missing CHARSETSDIR, MYSQL_FIX_SYSTEM_TABLES, MYSQL_CLIENT_TEST Pass on return value from sleep_until_file_created(), to fail test Fail test if early termination of mysqld servers Create intial databases for the second master, and two additional slaves
21 years ago
mysql-test-run.pl: Let --start-and-exit actually start a server Added that test case names can be specified on the comman line Added embedded server support Added environment variables UMASK, UMASK_DIR Added missing MASTER_MYSOCK1, MASTER_MYPORT1, USE_RUNNING_SERVER Added missing CHARSETSDIR, MYSQL_FIX_SYSTEM_TABLES, MYSQL_CLIENT_TEST Pass on return value from sleep_until_file_created(), to fail test Fail test if early termination of mysqld servers Create intial databases for the second master, and two additional slaves mtr_process.pl: Find out if port is still in use, using simple TCP connect Use non blocking waitpid() to catch terminations early Make a special case spawning the 'mysqltest' application Redo the fork() if it returns EAGAIN Make sure to record if master or slave terminated Improved debugging output Improved code that remove PID files to avoid race Abort if we can't stop all mysqld servers using our ports Many improvements in killing mysqld servers Let sleep_until_file_created() catch if server died early mtr_report.pl: Added option to disable test cases using <testcase>.disabled file If --timer, only try to open file with time data if it exists mtr_io.pl: Remove starting/ending space reading server options from file mysql-test/lib/mtr_io.pl: Remove starting/ending space reading server options from file mysql-test/lib/mtr_report.pl: Added option to disable test cases using <testcase>.disabled file If --timer, only try to open file with time data if it exists mysql-test/lib/mtr_process.pl: Find out if port is still in use, using simple TCP connect Use non blocking waitpid() to catch terminations early Make a special case spawning the 'mysqltest' application Redo the fork() if it returns EAGAIN Make sure to record if master or slave terminated Improved debugging output Improved code that remove PID files to avoid race Abort if we can't stop all mysqld servers using our ports Many improvements in killing mysqld servers Let sleep_until_file_created() catch if server died early mysql-test/mysql-test-run.pl: Let --start-and-exit actually start a server Added that test case names can be specified on the comman line Added embedded server support Added environment variables UMASK, UMASK_DIR Added missing MASTER_MYSOCK1, MASTER_MYPORT1, USE_RUNNING_SERVER Added missing CHARSETSDIR, MYSQL_FIX_SYSTEM_TABLES, MYSQL_CLIENT_TEST Pass on return value from sleep_until_file_created(), to fail test Fail test if early termination of mysqld servers Create intial databases for the second master, and two additional slaves
21 years ago
mysql-test-run.pl: Let --start-and-exit actually start a server Added that test case names can be specified on the comman line Added embedded server support Added environment variables UMASK, UMASK_DIR Added missing MASTER_MYSOCK1, MASTER_MYPORT1, USE_RUNNING_SERVER Added missing CHARSETSDIR, MYSQL_FIX_SYSTEM_TABLES, MYSQL_CLIENT_TEST Pass on return value from sleep_until_file_created(), to fail test Fail test if early termination of mysqld servers Create intial databases for the second master, and two additional slaves mtr_process.pl: Find out if port is still in use, using simple TCP connect Use non blocking waitpid() to catch terminations early Make a special case spawning the 'mysqltest' application Redo the fork() if it returns EAGAIN Make sure to record if master or slave terminated Improved debugging output Improved code that remove PID files to avoid race Abort if we can't stop all mysqld servers using our ports Many improvements in killing mysqld servers Let sleep_until_file_created() catch if server died early mtr_report.pl: Added option to disable test cases using <testcase>.disabled file If --timer, only try to open file with time data if it exists mtr_io.pl: Remove starting/ending space reading server options from file mysql-test/lib/mtr_io.pl: Remove starting/ending space reading server options from file mysql-test/lib/mtr_report.pl: Added option to disable test cases using <testcase>.disabled file If --timer, only try to open file with time data if it exists mysql-test/lib/mtr_process.pl: Find out if port is still in use, using simple TCP connect Use non blocking waitpid() to catch terminations early Make a special case spawning the 'mysqltest' application Redo the fork() if it returns EAGAIN Make sure to record if master or slave terminated Improved debugging output Improved code that remove PID files to avoid race Abort if we can't stop all mysqld servers using our ports Many improvements in killing mysqld servers Let sleep_until_file_created() catch if server died early mysql-test/mysql-test-run.pl: Let --start-and-exit actually start a server Added that test case names can be specified on the comman line Added embedded server support Added environment variables UMASK, UMASK_DIR Added missing MASTER_MYSOCK1, MASTER_MYPORT1, USE_RUNNING_SERVER Added missing CHARSETSDIR, MYSQL_FIX_SYSTEM_TABLES, MYSQL_CLIENT_TEST Pass on return value from sleep_until_file_created(), to fail test Fail test if early termination of mysqld servers Create intial databases for the second master, and two additional slaves
21 years ago
mysql-test-run.pl: Let --start-and-exit actually start a server Added that test case names can be specified on the comman line Added embedded server support Added environment variables UMASK, UMASK_DIR Added missing MASTER_MYSOCK1, MASTER_MYPORT1, USE_RUNNING_SERVER Added missing CHARSETSDIR, MYSQL_FIX_SYSTEM_TABLES, MYSQL_CLIENT_TEST Pass on return value from sleep_until_file_created(), to fail test Fail test if early termination of mysqld servers Create intial databases for the second master, and two additional slaves mtr_process.pl: Find out if port is still in use, using simple TCP connect Use non blocking waitpid() to catch terminations early Make a special case spawning the 'mysqltest' application Redo the fork() if it returns EAGAIN Make sure to record if master or slave terminated Improved debugging output Improved code that remove PID files to avoid race Abort if we can't stop all mysqld servers using our ports Many improvements in killing mysqld servers Let sleep_until_file_created() catch if server died early mtr_report.pl: Added option to disable test cases using <testcase>.disabled file If --timer, only try to open file with time data if it exists mtr_io.pl: Remove starting/ending space reading server options from file mysql-test/lib/mtr_io.pl: Remove starting/ending space reading server options from file mysql-test/lib/mtr_report.pl: Added option to disable test cases using <testcase>.disabled file If --timer, only try to open file with time data if it exists mysql-test/lib/mtr_process.pl: Find out if port is still in use, using simple TCP connect Use non blocking waitpid() to catch terminations early Make a special case spawning the 'mysqltest' application Redo the fork() if it returns EAGAIN Make sure to record if master or slave terminated Improved debugging output Improved code that remove PID files to avoid race Abort if we can't stop all mysqld servers using our ports Many improvements in killing mysqld servers Let sleep_until_file_created() catch if server died early mysql-test/mysql-test-run.pl: Let --start-and-exit actually start a server Added that test case names can be specified on the comman line Added embedded server support Added environment variables UMASK, UMASK_DIR Added missing MASTER_MYSOCK1, MASTER_MYPORT1, USE_RUNNING_SERVER Added missing CHARSETSDIR, MYSQL_FIX_SYSTEM_TABLES, MYSQL_CLIENT_TEST Pass on return value from sleep_until_file_created(), to fail test Fail test if early termination of mysqld servers Create intial databases for the second master, and two additional slaves
21 years ago
mysql-test-run.pl: Let --start-and-exit actually start a server Added that test case names can be specified on the comman line Added embedded server support Added environment variables UMASK, UMASK_DIR Added missing MASTER_MYSOCK1, MASTER_MYPORT1, USE_RUNNING_SERVER Added missing CHARSETSDIR, MYSQL_FIX_SYSTEM_TABLES, MYSQL_CLIENT_TEST Pass on return value from sleep_until_file_created(), to fail test Fail test if early termination of mysqld servers Create intial databases for the second master, and two additional slaves mtr_process.pl: Find out if port is still in use, using simple TCP connect Use non blocking waitpid() to catch terminations early Make a special case spawning the 'mysqltest' application Redo the fork() if it returns EAGAIN Make sure to record if master or slave terminated Improved debugging output Improved code that remove PID files to avoid race Abort if we can't stop all mysqld servers using our ports Many improvements in killing mysqld servers Let sleep_until_file_created() catch if server died early mtr_report.pl: Added option to disable test cases using <testcase>.disabled file If --timer, only try to open file with time data if it exists mtr_io.pl: Remove starting/ending space reading server options from file mysql-test/lib/mtr_io.pl: Remove starting/ending space reading server options from file mysql-test/lib/mtr_report.pl: Added option to disable test cases using <testcase>.disabled file If --timer, only try to open file with time data if it exists mysql-test/lib/mtr_process.pl: Find out if port is still in use, using simple TCP connect Use non blocking waitpid() to catch terminations early Make a special case spawning the 'mysqltest' application Redo the fork() if it returns EAGAIN Make sure to record if master or slave terminated Improved debugging output Improved code that remove PID files to avoid race Abort if we can't stop all mysqld servers using our ports Many improvements in killing mysqld servers Let sleep_until_file_created() catch if server died early mysql-test/mysql-test-run.pl: Let --start-and-exit actually start a server Added that test case names can be specified on the comman line Added embedded server support Added environment variables UMASK, UMASK_DIR Added missing MASTER_MYSOCK1, MASTER_MYPORT1, USE_RUNNING_SERVER Added missing CHARSETSDIR, MYSQL_FIX_SYSTEM_TABLES, MYSQL_CLIENT_TEST Pass on return value from sleep_until_file_created(), to fail test Fail test if early termination of mysqld servers Create intial databases for the second master, and two additional slaves
21 years ago
mysql-test-run.pl: Let --start-and-exit actually start a server Added that test case names can be specified on the comman line Added embedded server support Added environment variables UMASK, UMASK_DIR Added missing MASTER_MYSOCK1, MASTER_MYPORT1, USE_RUNNING_SERVER Added missing CHARSETSDIR, MYSQL_FIX_SYSTEM_TABLES, MYSQL_CLIENT_TEST Pass on return value from sleep_until_file_created(), to fail test Fail test if early termination of mysqld servers Create intial databases for the second master, and two additional slaves mtr_process.pl: Find out if port is still in use, using simple TCP connect Use non blocking waitpid() to catch terminations early Make a special case spawning the 'mysqltest' application Redo the fork() if it returns EAGAIN Make sure to record if master or slave terminated Improved debugging output Improved code that remove PID files to avoid race Abort if we can't stop all mysqld servers using our ports Many improvements in killing mysqld servers Let sleep_until_file_created() catch if server died early mtr_report.pl: Added option to disable test cases using <testcase>.disabled file If --timer, only try to open file with time data if it exists mtr_io.pl: Remove starting/ending space reading server options from file mysql-test/lib/mtr_io.pl: Remove starting/ending space reading server options from file mysql-test/lib/mtr_report.pl: Added option to disable test cases using <testcase>.disabled file If --timer, only try to open file with time data if it exists mysql-test/lib/mtr_process.pl: Find out if port is still in use, using simple TCP connect Use non blocking waitpid() to catch terminations early Make a special case spawning the 'mysqltest' application Redo the fork() if it returns EAGAIN Make sure to record if master or slave terminated Improved debugging output Improved code that remove PID files to avoid race Abort if we can't stop all mysqld servers using our ports Many improvements in killing mysqld servers Let sleep_until_file_created() catch if server died early mysql-test/mysql-test-run.pl: Let --start-and-exit actually start a server Added that test case names can be specified on the comman line Added embedded server support Added environment variables UMASK, UMASK_DIR Added missing MASTER_MYSOCK1, MASTER_MYPORT1, USE_RUNNING_SERVER Added missing CHARSETSDIR, MYSQL_FIX_SYSTEM_TABLES, MYSQL_CLIENT_TEST Pass on return value from sleep_until_file_created(), to fail test Fail test if early termination of mysqld servers Create intial databases for the second master, and two additional slaves
21 years ago
mysql-test-run.pl: Let --start-and-exit actually start a server Added that test case names can be specified on the comman line Added embedded server support Added environment variables UMASK, UMASK_DIR Added missing MASTER_MYSOCK1, MASTER_MYPORT1, USE_RUNNING_SERVER Added missing CHARSETSDIR, MYSQL_FIX_SYSTEM_TABLES, MYSQL_CLIENT_TEST Pass on return value from sleep_until_file_created(), to fail test Fail test if early termination of mysqld servers Create intial databases for the second master, and two additional slaves mtr_process.pl: Find out if port is still in use, using simple TCP connect Use non blocking waitpid() to catch terminations early Make a special case spawning the 'mysqltest' application Redo the fork() if it returns EAGAIN Make sure to record if master or slave terminated Improved debugging output Improved code that remove PID files to avoid race Abort if we can't stop all mysqld servers using our ports Many improvements in killing mysqld servers Let sleep_until_file_created() catch if server died early mtr_report.pl: Added option to disable test cases using <testcase>.disabled file If --timer, only try to open file with time data if it exists mtr_io.pl: Remove starting/ending space reading server options from file mysql-test/lib/mtr_io.pl: Remove starting/ending space reading server options from file mysql-test/lib/mtr_report.pl: Added option to disable test cases using <testcase>.disabled file If --timer, only try to open file with time data if it exists mysql-test/lib/mtr_process.pl: Find out if port is still in use, using simple TCP connect Use non blocking waitpid() to catch terminations early Make a special case spawning the 'mysqltest' application Redo the fork() if it returns EAGAIN Make sure to record if master or slave terminated Improved debugging output Improved code that remove PID files to avoid race Abort if we can't stop all mysqld servers using our ports Many improvements in killing mysqld servers Let sleep_until_file_created() catch if server died early mysql-test/mysql-test-run.pl: Let --start-and-exit actually start a server Added that test case names can be specified on the comman line Added embedded server support Added environment variables UMASK, UMASK_DIR Added missing MASTER_MYSOCK1, MASTER_MYPORT1, USE_RUNNING_SERVER Added missing CHARSETSDIR, MYSQL_FIX_SYSTEM_TABLES, MYSQL_CLIENT_TEST Pass on return value from sleep_until_file_created(), to fail test Fail test if early termination of mysqld servers Create intial databases for the second master, and two additional slaves
21 years ago
mysql-test-run.pl: Let --start-and-exit actually start a server Added that test case names can be specified on the comman line Added embedded server support Added environment variables UMASK, UMASK_DIR Added missing MASTER_MYSOCK1, MASTER_MYPORT1, USE_RUNNING_SERVER Added missing CHARSETSDIR, MYSQL_FIX_SYSTEM_TABLES, MYSQL_CLIENT_TEST Pass on return value from sleep_until_file_created(), to fail test Fail test if early termination of mysqld servers Create intial databases for the second master, and two additional slaves mtr_process.pl: Find out if port is still in use, using simple TCP connect Use non blocking waitpid() to catch terminations early Make a special case spawning the 'mysqltest' application Redo the fork() if it returns EAGAIN Make sure to record if master or slave terminated Improved debugging output Improved code that remove PID files to avoid race Abort if we can't stop all mysqld servers using our ports Many improvements in killing mysqld servers Let sleep_until_file_created() catch if server died early mtr_report.pl: Added option to disable test cases using <testcase>.disabled file If --timer, only try to open file with time data if it exists mtr_io.pl: Remove starting/ending space reading server options from file mysql-test/lib/mtr_io.pl: Remove starting/ending space reading server options from file mysql-test/lib/mtr_report.pl: Added option to disable test cases using <testcase>.disabled file If --timer, only try to open file with time data if it exists mysql-test/lib/mtr_process.pl: Find out if port is still in use, using simple TCP connect Use non blocking waitpid() to catch terminations early Make a special case spawning the 'mysqltest' application Redo the fork() if it returns EAGAIN Make sure to record if master or slave terminated Improved debugging output Improved code that remove PID files to avoid race Abort if we can't stop all mysqld servers using our ports Many improvements in killing mysqld servers Let sleep_until_file_created() catch if server died early mysql-test/mysql-test-run.pl: Let --start-and-exit actually start a server Added that test case names can be specified on the comman line Added embedded server support Added environment variables UMASK, UMASK_DIR Added missing MASTER_MYSOCK1, MASTER_MYPORT1, USE_RUNNING_SERVER Added missing CHARSETSDIR, MYSQL_FIX_SYSTEM_TABLES, MYSQL_CLIENT_TEST Pass on return value from sleep_until_file_created(), to fail test Fail test if early termination of mysqld servers Create intial databases for the second master, and two additional slaves
21 years ago
mysql-test-run.pl: Let --start-and-exit actually start a server Added that test case names can be specified on the comman line Added embedded server support Added environment variables UMASK, UMASK_DIR Added missing MASTER_MYSOCK1, MASTER_MYPORT1, USE_RUNNING_SERVER Added missing CHARSETSDIR, MYSQL_FIX_SYSTEM_TABLES, MYSQL_CLIENT_TEST Pass on return value from sleep_until_file_created(), to fail test Fail test if early termination of mysqld servers Create intial databases for the second master, and two additional slaves mtr_process.pl: Find out if port is still in use, using simple TCP connect Use non blocking waitpid() to catch terminations early Make a special case spawning the 'mysqltest' application Redo the fork() if it returns EAGAIN Make sure to record if master or slave terminated Improved debugging output Improved code that remove PID files to avoid race Abort if we can't stop all mysqld servers using our ports Many improvements in killing mysqld servers Let sleep_until_file_created() catch if server died early mtr_report.pl: Added option to disable test cases using <testcase>.disabled file If --timer, only try to open file with time data if it exists mtr_io.pl: Remove starting/ending space reading server options from file mysql-test/lib/mtr_io.pl: Remove starting/ending space reading server options from file mysql-test/lib/mtr_report.pl: Added option to disable test cases using <testcase>.disabled file If --timer, only try to open file with time data if it exists mysql-test/lib/mtr_process.pl: Find out if port is still in use, using simple TCP connect Use non blocking waitpid() to catch terminations early Make a special case spawning the 'mysqltest' application Redo the fork() if it returns EAGAIN Make sure to record if master or slave terminated Improved debugging output Improved code that remove PID files to avoid race Abort if we can't stop all mysqld servers using our ports Many improvements in killing mysqld servers Let sleep_until_file_created() catch if server died early mysql-test/mysql-test-run.pl: Let --start-and-exit actually start a server Added that test case names can be specified on the comman line Added embedded server support Added environment variables UMASK, UMASK_DIR Added missing MASTER_MYSOCK1, MASTER_MYPORT1, USE_RUNNING_SERVER Added missing CHARSETSDIR, MYSQL_FIX_SYSTEM_TABLES, MYSQL_CLIENT_TEST Pass on return value from sleep_until_file_created(), to fail test Fail test if early termination of mysqld servers Create intial databases for the second master, and two additional slaves
21 years ago
mysql-test-run.pl: Let --start-and-exit actually start a server Added that test case names can be specified on the comman line Added embedded server support Added environment variables UMASK, UMASK_DIR Added missing MASTER_MYSOCK1, MASTER_MYPORT1, USE_RUNNING_SERVER Added missing CHARSETSDIR, MYSQL_FIX_SYSTEM_TABLES, MYSQL_CLIENT_TEST Pass on return value from sleep_until_file_created(), to fail test Fail test if early termination of mysqld servers Create intial databases for the second master, and two additional slaves mtr_process.pl: Find out if port is still in use, using simple TCP connect Use non blocking waitpid() to catch terminations early Make a special case spawning the 'mysqltest' application Redo the fork() if it returns EAGAIN Make sure to record if master or slave terminated Improved debugging output Improved code that remove PID files to avoid race Abort if we can't stop all mysqld servers using our ports Many improvements in killing mysqld servers Let sleep_until_file_created() catch if server died early mtr_report.pl: Added option to disable test cases using <testcase>.disabled file If --timer, only try to open file with time data if it exists mtr_io.pl: Remove starting/ending space reading server options from file mysql-test/lib/mtr_io.pl: Remove starting/ending space reading server options from file mysql-test/lib/mtr_report.pl: Added option to disable test cases using <testcase>.disabled file If --timer, only try to open file with time data if it exists mysql-test/lib/mtr_process.pl: Find out if port is still in use, using simple TCP connect Use non blocking waitpid() to catch terminations early Make a special case spawning the 'mysqltest' application Redo the fork() if it returns EAGAIN Make sure to record if master or slave terminated Improved debugging output Improved code that remove PID files to avoid race Abort if we can't stop all mysqld servers using our ports Many improvements in killing mysqld servers Let sleep_until_file_created() catch if server died early mysql-test/mysql-test-run.pl: Let --start-and-exit actually start a server Added that test case names can be specified on the comman line Added embedded server support Added environment variables UMASK, UMASK_DIR Added missing MASTER_MYSOCK1, MASTER_MYPORT1, USE_RUNNING_SERVER Added missing CHARSETSDIR, MYSQL_FIX_SYSTEM_TABLES, MYSQL_CLIENT_TEST Pass on return value from sleep_until_file_created(), to fail test Fail test if early termination of mysqld servers Create intial databases for the second master, and two additional slaves
21 years ago
mysql-test-run.pl: Let --start-and-exit actually start a server Added that test case names can be specified on the comman line Added embedded server support Added environment variables UMASK, UMASK_DIR Added missing MASTER_MYSOCK1, MASTER_MYPORT1, USE_RUNNING_SERVER Added missing CHARSETSDIR, MYSQL_FIX_SYSTEM_TABLES, MYSQL_CLIENT_TEST Pass on return value from sleep_until_file_created(), to fail test Fail test if early termination of mysqld servers Create intial databases for the second master, and two additional slaves mtr_process.pl: Find out if port is still in use, using simple TCP connect Use non blocking waitpid() to catch terminations early Make a special case spawning the 'mysqltest' application Redo the fork() if it returns EAGAIN Make sure to record if master or slave terminated Improved debugging output Improved code that remove PID files to avoid race Abort if we can't stop all mysqld servers using our ports Many improvements in killing mysqld servers Let sleep_until_file_created() catch if server died early mtr_report.pl: Added option to disable test cases using <testcase>.disabled file If --timer, only try to open file with time data if it exists mtr_io.pl: Remove starting/ending space reading server options from file mysql-test/lib/mtr_io.pl: Remove starting/ending space reading server options from file mysql-test/lib/mtr_report.pl: Added option to disable test cases using <testcase>.disabled file If --timer, only try to open file with time data if it exists mysql-test/lib/mtr_process.pl: Find out if port is still in use, using simple TCP connect Use non blocking waitpid() to catch terminations early Make a special case spawning the 'mysqltest' application Redo the fork() if it returns EAGAIN Make sure to record if master or slave terminated Improved debugging output Improved code that remove PID files to avoid race Abort if we can't stop all mysqld servers using our ports Many improvements in killing mysqld servers Let sleep_until_file_created() catch if server died early mysql-test/mysql-test-run.pl: Let --start-and-exit actually start a server Added that test case names can be specified on the comman line Added embedded server support Added environment variables UMASK, UMASK_DIR Added missing MASTER_MYSOCK1, MASTER_MYPORT1, USE_RUNNING_SERVER Added missing CHARSETSDIR, MYSQL_FIX_SYSTEM_TABLES, MYSQL_CLIENT_TEST Pass on return value from sleep_until_file_created(), to fail test Fail test if early termination of mysqld servers Create intial databases for the second master, and two additional slaves
21 years ago
mysql-test-run.pl: Let --start-and-exit actually start a server Added that test case names can be specified on the comman line Added embedded server support Added environment variables UMASK, UMASK_DIR Added missing MASTER_MYSOCK1, MASTER_MYPORT1, USE_RUNNING_SERVER Added missing CHARSETSDIR, MYSQL_FIX_SYSTEM_TABLES, MYSQL_CLIENT_TEST Pass on return value from sleep_until_file_created(), to fail test Fail test if early termination of mysqld servers Create intial databases for the second master, and two additional slaves mtr_process.pl: Find out if port is still in use, using simple TCP connect Use non blocking waitpid() to catch terminations early Make a special case spawning the 'mysqltest' application Redo the fork() if it returns EAGAIN Make sure to record if master or slave terminated Improved debugging output Improved code that remove PID files to avoid race Abort if we can't stop all mysqld servers using our ports Many improvements in killing mysqld servers Let sleep_until_file_created() catch if server died early mtr_report.pl: Added option to disable test cases using <testcase>.disabled file If --timer, only try to open file with time data if it exists mtr_io.pl: Remove starting/ending space reading server options from file mysql-test/lib/mtr_io.pl: Remove starting/ending space reading server options from file mysql-test/lib/mtr_report.pl: Added option to disable test cases using <testcase>.disabled file If --timer, only try to open file with time data if it exists mysql-test/lib/mtr_process.pl: Find out if port is still in use, using simple TCP connect Use non blocking waitpid() to catch terminations early Make a special case spawning the 'mysqltest' application Redo the fork() if it returns EAGAIN Make sure to record if master or slave terminated Improved debugging output Improved code that remove PID files to avoid race Abort if we can't stop all mysqld servers using our ports Many improvements in killing mysqld servers Let sleep_until_file_created() catch if server died early mysql-test/mysql-test-run.pl: Let --start-and-exit actually start a server Added that test case names can be specified on the comman line Added embedded server support Added environment variables UMASK, UMASK_DIR Added missing MASTER_MYSOCK1, MASTER_MYPORT1, USE_RUNNING_SERVER Added missing CHARSETSDIR, MYSQL_FIX_SYSTEM_TABLES, MYSQL_CLIENT_TEST Pass on return value from sleep_until_file_created(), to fail test Fail test if early termination of mysqld servers Create intial databases for the second master, and two additional slaves
21 years ago
mysql-test-run.pl: Let --start-and-exit actually start a server Added that test case names can be specified on the comman line Added embedded server support Added environment variables UMASK, UMASK_DIR Added missing MASTER_MYSOCK1, MASTER_MYPORT1, USE_RUNNING_SERVER Added missing CHARSETSDIR, MYSQL_FIX_SYSTEM_TABLES, MYSQL_CLIENT_TEST Pass on return value from sleep_until_file_created(), to fail test Fail test if early termination of mysqld servers Create intial databases for the second master, and two additional slaves mtr_process.pl: Find out if port is still in use, using simple TCP connect Use non blocking waitpid() to catch terminations early Make a special case spawning the 'mysqltest' application Redo the fork() if it returns EAGAIN Make sure to record if master or slave terminated Improved debugging output Improved code that remove PID files to avoid race Abort if we can't stop all mysqld servers using our ports Many improvements in killing mysqld servers Let sleep_until_file_created() catch if server died early mtr_report.pl: Added option to disable test cases using <testcase>.disabled file If --timer, only try to open file with time data if it exists mtr_io.pl: Remove starting/ending space reading server options from file mysql-test/lib/mtr_io.pl: Remove starting/ending space reading server options from file mysql-test/lib/mtr_report.pl: Added option to disable test cases using <testcase>.disabled file If --timer, only try to open file with time data if it exists mysql-test/lib/mtr_process.pl: Find out if port is still in use, using simple TCP connect Use non blocking waitpid() to catch terminations early Make a special case spawning the 'mysqltest' application Redo the fork() if it returns EAGAIN Make sure to record if master or slave terminated Improved debugging output Improved code that remove PID files to avoid race Abort if we can't stop all mysqld servers using our ports Many improvements in killing mysqld servers Let sleep_until_file_created() catch if server died early mysql-test/mysql-test-run.pl: Let --start-and-exit actually start a server Added that test case names can be specified on the comman line Added embedded server support Added environment variables UMASK, UMASK_DIR Added missing MASTER_MYSOCK1, MASTER_MYPORT1, USE_RUNNING_SERVER Added missing CHARSETSDIR, MYSQL_FIX_SYSTEM_TABLES, MYSQL_CLIENT_TEST Pass on return value from sleep_until_file_created(), to fail test Fail test if early termination of mysqld servers Create intial databases for the second master, and two additional slaves
21 years ago
mysql-test-run.pl: Let --start-and-exit actually start a server Added that test case names can be specified on the comman line Added embedded server support Added environment variables UMASK, UMASK_DIR Added missing MASTER_MYSOCK1, MASTER_MYPORT1, USE_RUNNING_SERVER Added missing CHARSETSDIR, MYSQL_FIX_SYSTEM_TABLES, MYSQL_CLIENT_TEST Pass on return value from sleep_until_file_created(), to fail test Fail test if early termination of mysqld servers Create intial databases for the second master, and two additional slaves mtr_process.pl: Find out if port is still in use, using simple TCP connect Use non blocking waitpid() to catch terminations early Make a special case spawning the 'mysqltest' application Redo the fork() if it returns EAGAIN Make sure to record if master or slave terminated Improved debugging output Improved code that remove PID files to avoid race Abort if we can't stop all mysqld servers using our ports Many improvements in killing mysqld servers Let sleep_until_file_created() catch if server died early mtr_report.pl: Added option to disable test cases using <testcase>.disabled file If --timer, only try to open file with time data if it exists mtr_io.pl: Remove starting/ending space reading server options from file mysql-test/lib/mtr_io.pl: Remove starting/ending space reading server options from file mysql-test/lib/mtr_report.pl: Added option to disable test cases using <testcase>.disabled file If --timer, only try to open file with time data if it exists mysql-test/lib/mtr_process.pl: Find out if port is still in use, using simple TCP connect Use non blocking waitpid() to catch terminations early Make a special case spawning the 'mysqltest' application Redo the fork() if it returns EAGAIN Make sure to record if master or slave terminated Improved debugging output Improved code that remove PID files to avoid race Abort if we can't stop all mysqld servers using our ports Many improvements in killing mysqld servers Let sleep_until_file_created() catch if server died early mysql-test/mysql-test-run.pl: Let --start-and-exit actually start a server Added that test case names can be specified on the comman line Added embedded server support Added environment variables UMASK, UMASK_DIR Added missing MASTER_MYSOCK1, MASTER_MYPORT1, USE_RUNNING_SERVER Added missing CHARSETSDIR, MYSQL_FIX_SYSTEM_TABLES, MYSQL_CLIENT_TEST Pass on return value from sleep_until_file_created(), to fail test Fail test if early termination of mysqld servers Create intial databases for the second master, and two additional slaves
21 years ago
BUG#11316 mysqltest, problems when assigning value with '#' to $variable - Fixed problem, only detect comment if the # is on start of line AND starting line of the current command. - Wrote tests for most of the mysqltest commands, added stricter checking of correct syntax. client/mysqltest.c: Updated mysql test to do stricter checking of syntax. For example when the number of arguments to a command is known, everything else is "junk" => die. Better checking of argument types. Added better debug printouts. Added improved printouts when wrong syntax is detected. Fix two bugs where mysqltest could not detect end of comamnd properly, as described in bug#11316 Fix segfault when performing too many source commands. Fix segfault when doing too many while loop levels. Add printout of line number in die Remove lineno and \n in all strings passed to die function. Decrese BLOCK_STACK_DEPTH from 32 to 16, does any test use more than 1 level? mysql-test/mysql-test-run.pl: export MYSQL_TEST environment variable, used from msyqltest.test mysql-test/mysql-test-run.sh: export MYSQL_TEST environment variable, used from msyqltest.test mysql-test/r/mysqltest.result: Updated test results mysql-test/r/rpl_flush_log_loop.result: Updated test result. Approved by lars mysql-test/t/innodb-deadlock.test: Correct wrong syntax Superfluos ; mysql-test/t/innodb-lock.test: Correct wrong syntax Superfluos ; mysql-test/t/mysqltest.test: Add several new tests for mysqltest. Foxus on detecting wrong syntax in test files. Use exec with expected error to execute test scripts that will kill mysqltest Change some negative test that were previously commented out to use the above method. mysql-test/t/ndb_autodiscover2.test: Correct wrong syntax Superfluos ; mysql-test/t/rpl_change_master.test: Correct wrong syntax Superfluos ; mysql-test/t/rpl_deadlock.test: Correct wrong syntax Superfluos ; mysql-test/t/rpl_drop_temp.test: Correct wrong syntax Superfluos ; mysql-test/t/rpl_flush_log_loop.test: Fix after detecting wrong syntax, missing ; Discussed with lars. mysql-test/t/rpl_insert_id.test: Missing ; mysql-test/t/rpl_rotate_logs.test: Correct wrong syntax Superfluos ; mysql-test/t/rpl_until.test: Missing delimiter mysql-test/include/mysqltest_while.inc: New file to test too many while levels
21 years ago
  1. #!/usr/bin/perl
  2. # -*- cperl -*-
  3. #
  4. ##############################################################################
  5. #
  6. # mysql-test-run.pl
  7. #
  8. # Tool used for executing a suite of .test file
  9. #
  10. # See the "MySQL Test framework manual" for more information
  11. # http://dev.mysql.com/doc/mysqltest/en/index.html
  12. #
  13. # Please keep the test framework tools identical in all versions!
  14. #
  15. ##############################################################################
  16. #
  17. # Coding style directions for this perl script
  18. #
  19. # - To make this Perl script easy to alter even for those that not
  20. # code Perl that often, keeep the coding style as close as possible to
  21. # the C/C++ MySQL coding standard.
  22. #
  23. # - All lists of arguments to send to commands are Perl lists/arrays,
  24. # not strings we append args to. Within reason, most string
  25. # concatenation for arguments should be avoided.
  26. #
  27. # - Functions defined in the main program are not to be prefixed,
  28. # functions in "library files" are to be prefixed with "mtr_" (for
  29. # Mysql-Test-Run). There are some exceptions, code that fits best in
  30. # the main program, but are put into separate files to avoid
  31. # clutter, may be without prefix.
  32. #
  33. # - All stat/opendir/-f/ is to be kept in collect_test_cases(). It
  34. # will create a struct that the rest of the program can use to get
  35. # the information. This separates the "find information" from the
  36. # "do the work" and makes the program more easy to maintain.
  37. #
  38. # - The rule when it comes to the logic of this program is
  39. #
  40. # command_line_setup() - is to handle the logic between flags
  41. # collect_test_cases() - is to do its best to select what tests
  42. # to run, dig out options, if needs restart etc.
  43. # run_testcase() - is to run a single testcase, and follow the
  44. # logic set in both above. No, or rare file
  45. # system operations. If a test seems complex,
  46. # it should probably not be here.
  47. #
  48. # A nice way to trace the execution of this script while debugging
  49. # is to use the Devel::Trace package found at
  50. # "http://www.plover.com/~mjd/perl/Trace/" and run this script like
  51. # "perl -d:Trace mysql-test-run.pl"
  52. #
  53. $Devel::Trace::TRACE= 0; # Don't trace boring init stuff
  54. #require 5.6.1;
  55. use File::Path;
  56. use File::Basename;
  57. use File::Copy;
  58. use Cwd;
  59. use Getopt::Long;
  60. use Sys::Hostname;
  61. use IO::Socket;
  62. use IO::Socket::INET;
  63. use Data::Dumper;
  64. use strict;
  65. use diagnostics;
  66. our $glob_win32_perl= ($^O eq "MSWin32"); # ActiveState Win32 Perl
  67. our $glob_cygwin_perl= ($^O eq "cygwin"); # Cygwin Perl
  68. our $glob_win32= ($glob_win32_perl or $glob_cygwin_perl);
  69. our $glob_netware= ($^O eq "NetWare"); # NetWare
  70. require "lib/mtr_cases.pl";
  71. require "lib/mtr_im.pl";
  72. require "lib/mtr_process.pl";
  73. require "lib/mtr_timer.pl";
  74. require "lib/mtr_io.pl";
  75. require "lib/mtr_gcov.pl";
  76. require "lib/mtr_gprof.pl";
  77. require "lib/mtr_report.pl";
  78. require "lib/mtr_diff.pl";
  79. require "lib/mtr_match.pl";
  80. require "lib/mtr_misc.pl";
  81. require "lib/mtr_stress.pl";
  82. $Devel::Trace::TRACE= 1;
  83. ##############################################################################
  84. #
  85. # Default settings
  86. #
  87. ##############################################################################
  88. # We are to use handle_options() in "mysys/my_getopt.c" for the C version
  89. #
  90. # In the C version we want to use structs and, in some cases, arrays of
  91. # structs. We let each struct be a separate hash.
  92. # Misc global variables
  93. our $mysql_version_id;
  94. our $glob_mysql_test_dir= undef;
  95. our $glob_mysql_bench_dir= undef;
  96. our $glob_hostname= undef;
  97. our $glob_scriptname= undef;
  98. our $glob_timers= undef;
  99. our $glob_use_running_server= 0;
  100. our $glob_use_running_ndbcluster= 0;
  101. our $glob_use_running_ndbcluster_slave= 0;
  102. our $glob_use_embedded_server= 0;
  103. our @glob_test_mode;
  104. our $glob_basedir;
  105. our $path_charsetsdir;
  106. our $path_client_bindir;
  107. our $path_language;
  108. our $path_timefile;
  109. our $path_snapshot;
  110. our $path_mysqltest_log;
  111. our $path_current_test_log;
  112. our $path_my_basedir;
  113. our $opt_vardir; # A path but set directly on cmd line
  114. our $path_vardir_trace; # unix formatted opt_vardir for trace files
  115. our $opt_tmpdir; # A path but set directly on cmd line
  116. our $default_vardir;
  117. our $opt_usage;
  118. our $opt_suite;
  119. our $opt_script_debug= 0; # Script debugging, enable with --script-debug
  120. our $opt_verbose= 0; # Verbose output, enable with --verbose
  121. our $exe_master_mysqld;
  122. our $exe_mysql;
  123. our $exe_mysqladmin;
  124. our $exe_mysqlbinlog;
  125. our $exe_mysql_client_test;
  126. our $exe_mysqld;
  127. our $exe_mysqlcheck;
  128. our $exe_mysqldump;
  129. our $exe_mysqlslap;
  130. our $exe_mysqlimport;
  131. our $exe_mysqlshow;
  132. our $exe_mysql_fix_system_tables;
  133. our $exe_mysqltest;
  134. our $exe_ndbd;
  135. our $exe_ndb_mgmd;
  136. our $exe_slave_mysqld;
  137. our $exe_im;
  138. our $exe_my_print_defaults;
  139. our $exe_perror;
  140. our $lib_udf_example;
  141. our $exe_libtool;
  142. our $opt_bench= 0;
  143. our $opt_small_bench= 0;
  144. our $opt_big_test= 0; # Send --big-test to mysqltest
  145. our @opt_extra_mysqld_opt;
  146. our $opt_compress;
  147. our $opt_ssl;
  148. our $opt_skip_ssl;
  149. our $opt_ssl_supported;
  150. our $opt_ps_protocol;
  151. our $opt_sp_protocol;
  152. our $opt_cursor_protocol;
  153. our $opt_view_protocol;
  154. our $opt_debug;
  155. our $opt_do_test;
  156. our @opt_cases; # The test cases names in argv
  157. our $opt_embedded_server;
  158. our $opt_extern;
  159. our $opt_fast;
  160. our $opt_force;
  161. our $opt_reorder= 0;
  162. our $opt_enable_disabled;
  163. our $opt_mem;
  164. our $opt_gcov;
  165. our $opt_gcov_err;
  166. our $opt_gcov_msg;
  167. our $glob_debugger= 0;
  168. our $opt_gdb;
  169. our $opt_client_gdb;
  170. our $opt_ddd;
  171. our $opt_client_ddd;
  172. our $opt_manual_gdb;
  173. our $opt_manual_ddd;
  174. our $opt_manual_debug;
  175. our $opt_debugger;
  176. our $opt_client_debugger;
  177. our $opt_gprof;
  178. our $opt_gprof_dir;
  179. our $opt_gprof_master;
  180. our $opt_gprof_slave;
  181. our $master;
  182. our $slave;
  183. our $clusters;
  184. our $instance_manager;
  185. our $opt_ndbcluster_port;
  186. our $opt_ndbconnectstring;
  187. our $opt_ndbcluster_port_slave;
  188. our $opt_ndbconnectstring_slave;
  189. our $opt_record;
  190. our $opt_check_testcases;
  191. our $opt_skip;
  192. our $opt_skip_rpl;
  193. our $max_slave_num= 0;
  194. our $use_innodb;
  195. our $opt_skip_test;
  196. our $opt_skip_im;
  197. our $opt_sleep;
  198. our $opt_sleep_time_after_restart= 1;
  199. our $opt_sleep_time_for_delete= 10;
  200. our $opt_testcase_timeout;
  201. our $opt_suite_timeout;
  202. my $default_testcase_timeout= 15; # 15 min max
  203. my $default_suite_timeout= 180; # 3 hours max
  204. our $opt_socket;
  205. our $opt_source_dist;
  206. our $opt_start_and_exit;
  207. our $opt_start_dirty;
  208. our $opt_start_from;
  209. our $opt_strace_client;
  210. our $opt_timer= 1;
  211. our $opt_user;
  212. our $opt_user_test;
  213. our $opt_valgrind= 0;
  214. our $opt_valgrind_mysqld= 0;
  215. our $opt_valgrind_mysqltest= 0;
  216. our $default_valgrind_options= "--show-reachable=yes";
  217. our $opt_valgrind_options;
  218. our $opt_valgrind_path;
  219. our $opt_callgrind;
  220. our $opt_stress= "";
  221. our $opt_stress_suite= "main";
  222. our $opt_stress_mode= "random";
  223. our $opt_stress_threads= 5;
  224. our $opt_stress_test_count= 0;
  225. our $opt_stress_loop_count= 0;
  226. our $opt_stress_test_duration= 0;
  227. our $opt_stress_init_file= "";
  228. our $opt_stress_test_file= "";
  229. our $opt_wait_for_master;
  230. our $opt_wait_for_slave;
  231. our $opt_wait_timeout= 10;
  232. our $opt_warnings;
  233. our $opt_udiff;
  234. our $opt_skip_ndbcluster= 0;
  235. our $opt_skip_ndbcluster_slave= 0;
  236. our $opt_with_ndbcluster= 0;
  237. our $opt_with_ndbcluster_only= 0;
  238. our $opt_ndbcluster_supported= 0;
  239. our $opt_ndb_extra_test= 0;
  240. our $opt_skip_master_binlog= 0;
  241. our $opt_skip_slave_binlog= 0;
  242. our $exe_ndb_mgm;
  243. our $exe_ndb_waiter;
  244. our $path_ndb_tools_dir;
  245. our $path_ndb_examples_dir;
  246. our $exe_ndb_example;
  247. our $path_ndb_testrun_log;
  248. our @data_dir_lst;
  249. our $used_binlog_format;
  250. our $debug_compiled_binaries;
  251. our $glob_tot_real_time= 0;
  252. our %mysqld_variables;
  253. ######################################################################
  254. #
  255. # Function declarations
  256. #
  257. ######################################################################
  258. sub main ();
  259. sub initial_setup ();
  260. sub command_line_setup ();
  261. sub datadir_setup ();
  262. sub executable_setup ();
  263. sub environment_setup ();
  264. sub kill_running_server ();
  265. sub cleanup_stale_files ();
  266. sub check_ssl_support ($);
  267. sub check_running_as_root();
  268. sub check_ndbcluster_support ($);
  269. sub rm_ndbcluster_tables ($);
  270. sub ndbcluster_start_install ($);
  271. sub ndbcluster_start ($$);
  272. sub ndbcluster_wait_started ($$);
  273. sub mysqld_wait_started($);
  274. sub run_benchmarks ($);
  275. sub initialize_servers ();
  276. sub mysql_install_db ();
  277. sub install_db ($$);
  278. sub copy_install_db ($$);
  279. sub run_testcase ($);
  280. sub run_testcase_stop_servers ($$$);
  281. sub run_testcase_start_servers ($);
  282. sub run_testcase_check_skip_test($);
  283. sub report_failure_and_restart ($);
  284. sub do_before_start_master ($);
  285. sub do_before_start_slave ($);
  286. sub ndbd_start ($$$);
  287. sub ndb_mgmd_start ($);
  288. sub mysqld_start ($$$);
  289. sub mysqld_arguments ($$$$$);
  290. sub stop_all_servers ();
  291. sub run_mysqltest ($);
  292. sub usage ($);
  293. ######################################################################
  294. #
  295. # Main program
  296. #
  297. ######################################################################
  298. main();
  299. sub main () {
  300. initial_setup();
  301. command_line_setup();
  302. check_ndbcluster_support(\%mysqld_variables);
  303. check_ssl_support(\%mysqld_variables);
  304. check_debug_support(\%mysqld_variables);
  305. executable_setup();
  306. environment_setup();
  307. signal_setup();
  308. if ( $opt_gcov )
  309. {
  310. gcov_prepare();
  311. }
  312. if ( $opt_gprof )
  313. {
  314. gprof_prepare();
  315. }
  316. if ( $opt_bench )
  317. {
  318. initialize_servers();
  319. run_benchmarks(shift); # Shift what? Extra arguments?!
  320. }
  321. elsif ( $opt_stress )
  322. {
  323. initialize_servers();
  324. run_stress_test()
  325. }
  326. else
  327. {
  328. # Figure out which tests we are going to run
  329. my $tests= collect_test_cases($opt_suite);
  330. # Turn off NDB and other similar options if no tests use it
  331. my ($need_ndbcluster,$need_im);
  332. foreach my $test (@$tests)
  333. {
  334. $need_ndbcluster||= $test->{ndb_test};
  335. $need_im||= $test->{component_id} eq 'im';
  336. # Count max number of slaves used by a test case
  337. if ( $test->{slave_num} > $max_slave_num)
  338. {
  339. $max_slave_num= $test->{slave_num};
  340. mtr_error("Too many slaves") if $max_slave_num > 3;
  341. }
  342. $use_innodb||= $test->{'innodb_test'};
  343. }
  344. $opt_skip_ndbcluster= $opt_skip_ndbcluster_slave= 1
  345. unless $need_ndbcluster;
  346. $opt_skip_im= 1 unless $need_im;
  347. initialize_servers();
  348. run_suite($opt_suite, $tests);
  349. }
  350. mtr_exit(0);
  351. }
  352. ##############################################################################
  353. #
  354. # Initial setup independent on command line arguments
  355. #
  356. ##############################################################################
  357. sub initial_setup () {
  358. select(STDOUT);
  359. $| = 1; # Make unbuffered
  360. $glob_scriptname= basename($0);
  361. # We require that we are in the "mysql-test" directory
  362. # to run mysql-test-run
  363. if (! -f $glob_scriptname)
  364. {
  365. mtr_error("Can't find the location for the mysql-test-run script\n" .
  366. "Go to to the mysql-test directory and execute the script " .
  367. "as follows:\n./$glob_scriptname");
  368. }
  369. if ( -d "../sql" )
  370. {
  371. $opt_source_dist= 1;
  372. }
  373. $glob_hostname= mtr_short_hostname();
  374. # 'basedir' is always parent of "mysql-test" directory
  375. $glob_mysql_test_dir= cwd();
  376. if ( $glob_cygwin_perl )
  377. {
  378. # Windows programs like 'mysqld' needs Windows paths
  379. $glob_mysql_test_dir= `cygpath -m "$glob_mysql_test_dir"`;
  380. chomp($glob_mysql_test_dir);
  381. }
  382. $glob_basedir= dirname($glob_mysql_test_dir);
  383. # Expect mysql-bench to be located adjacent to the source tree, by default
  384. $glob_mysql_bench_dir= "$glob_basedir/../mysql-bench"
  385. unless defined $glob_mysql_bench_dir;
  386. $path_my_basedir=
  387. $opt_source_dist ? $glob_mysql_test_dir : $glob_basedir;
  388. $glob_timers= mtr_init_timers();
  389. #
  390. # Find the mysqld executable to be able to find the mysqld version
  391. # number as early as possible
  392. #
  393. # Look for the path where to find the client binaries
  394. $path_client_bindir= mtr_path_exists("$glob_basedir/client/release",
  395. "$glob_basedir/client/debug",
  396. "$glob_basedir/client",
  397. "$glob_basedir/client_release",
  398. "$glob_basedir/client_debug",
  399. "$glob_basedir/bin");
  400. # Look for the mysqld executable
  401. $exe_mysqld= mtr_exe_exists ("$glob_basedir/sql/mysqld",
  402. "$path_client_bindir/mysqld-max-nt",
  403. "$path_client_bindir/mysqld-max",
  404. "$path_client_bindir/mysqld-nt",
  405. "$path_client_bindir/mysqld",
  406. "$path_client_bindir/mysqld-debug",
  407. "$path_client_bindir/mysqld-max",
  408. "$glob_basedir/libexec/mysqld",
  409. "$glob_basedir/sql/release/mysqld",
  410. "$glob_basedir/sql/debug/mysqld");
  411. # Use the mysqld found above to find out what features are available
  412. collect_mysqld_features();
  413. }
  414. ##############################################################################
  415. #
  416. # Default settings
  417. #
  418. ##############################################################################
  419. sub command_line_setup () {
  420. # These are defaults for things that are set on the command line
  421. $opt_suite= "main"; # Special default suite
  422. my $opt_comment;
  423. my $opt_master_myport= 9306;
  424. my $opt_slave_myport= 9308;
  425. $opt_ndbcluster_port= 9310;
  426. $opt_ndbcluster_port_slave= 9311;
  427. my $im_port= 9312;
  428. my $im_mysqld1_port= 9313;
  429. my $im_mysqld2_port= 9314;
  430. #
  431. # To make it easier for different devs to work on the same host,
  432. # an environment variable can be used to control all ports. A small
  433. # number is to be used, 0 - 16 or similar.
  434. #
  435. # Note the MASTER_MYPORT has to be set the same in all 4.x and 5.x
  436. # versions of this script, else a 4.0 test run might conflict with a
  437. # 5.1 test run, even if different MTR_BUILD_THREAD is used. This means
  438. # all port numbers might not be used in this version of the script.
  439. #
  440. # Also note the limiteation of ports we are allowed to hand out. This
  441. # differs between operating systems and configuration, see
  442. # http://www.ncftp.com/ncftpd/doc/misc/ephemeral_ports.html
  443. # But a fairly safe range seems to be 5001 - 32767
  444. if ( $ENV{'MTR_BUILD_THREAD'} )
  445. {
  446. # Up to two masters, up to three slaves
  447. $opt_master_myport= $ENV{'MTR_BUILD_THREAD'} * 10 + 10000; # and 1
  448. $opt_slave_myport= $opt_master_myport + 2; # and 3 4
  449. $opt_ndbcluster_port= $opt_master_myport + 5;
  450. $opt_ndbcluster_port_slave= $opt_master_myport + 6;
  451. $im_port= $opt_master_myport + 7;
  452. $im_mysqld1_port= $opt_master_myport + 8;
  453. $im_mysqld2_port= $opt_master_myport + 9;
  454. }
  455. if ( $opt_master_myport < 5001 or $opt_master_myport + 10 >= 32767 )
  456. {
  457. mtr_error("MTR_BUILD_THREAD number results in a port",
  458. "outside 5001 - 32767",
  459. "($opt_master_myport - $opt_master_myport + 10)");
  460. }
  461. # This is needed for test log evaluation in "gen-build-status-page"
  462. # in all cases where the calling tool does not log the commands
  463. # directly before it executes them, like "make test-force-pl" in RPM builds.
  464. print "Logging: $0 ", join(" ", @ARGV), "\n";
  465. # Read the command line
  466. # Note: Keep list, and the order, in sync with usage at end of this file
  467. Getopt::Long::Configure("pass_through");
  468. GetOptions(
  469. # Control what engine/variation to run
  470. 'embedded-server' => \$opt_embedded_server,
  471. 'ps-protocol' => \$opt_ps_protocol,
  472. 'sp-protocol' => \$opt_sp_protocol,
  473. 'view-protocol' => \$opt_view_protocol,
  474. 'cursor-protocol' => \$opt_cursor_protocol,
  475. 'ssl|with-openssl' => \$opt_ssl,
  476. 'skip-ssl' => \$opt_skip_ssl,
  477. 'compress' => \$opt_compress,
  478. 'bench' => \$opt_bench,
  479. 'small-bench' => \$opt_small_bench,
  480. # Control what test suites or cases to run
  481. 'force' => \$opt_force,
  482. 'with-ndbcluster' => \$opt_with_ndbcluster,
  483. 'with-ndbcluster-only' => \$opt_with_ndbcluster_only,
  484. 'skip-ndbcluster|skip-ndb' => \$opt_skip_ndbcluster,
  485. 'skip-ndbcluster-slave|skip-ndb-slave'
  486. => \$opt_skip_ndbcluster_slave,
  487. 'ndb-extra-test' => \$opt_ndb_extra_test,
  488. 'skip-master-binlog' => \$opt_skip_master_binlog,
  489. 'skip-slave-binlog' => \$opt_skip_slave_binlog,
  490. 'do-test=s' => \$opt_do_test,
  491. 'start-from=s' => \$opt_start_from,
  492. 'suite=s' => \$opt_suite,
  493. 'skip-rpl' => \$opt_skip_rpl,
  494. 'skip-im' => \$opt_skip_im,
  495. 'skip-test=s' => \$opt_skip_test,
  496. 'big-test' => \$opt_big_test,
  497. # Specify ports
  498. 'master_port=i' => \$opt_master_myport,
  499. 'slave_port=i' => \$opt_slave_myport,
  500. 'ndbcluster-port|ndbcluster_port=i' => \$opt_ndbcluster_port,
  501. 'ndbcluster-port-slave=i' => \$opt_ndbcluster_port_slave,
  502. 'im-port=i' => \$im_port, # Instance Manager port.
  503. 'im-mysqld1-port=i' => \$im_mysqld1_port, # Port of mysqld, controlled by IM
  504. 'im-mysqld2-port=i' => \$im_mysqld2_port, # Port of mysqld, controlled by IM
  505. # Test case authoring
  506. 'record' => \$opt_record,
  507. 'check-testcases' => \$opt_check_testcases,
  508. # Extra options used when starting mysqld
  509. 'mysqld=s' => \@opt_extra_mysqld_opt,
  510. # Run test on running server
  511. 'extern' => \$opt_extern,
  512. 'ndb-connectstring=s' => \$opt_ndbconnectstring,
  513. 'ndb-connectstring-slave=s' => \$opt_ndbconnectstring_slave,
  514. # Debugging
  515. 'gdb' => \$opt_gdb,
  516. 'client-gdb' => \$opt_client_gdb,
  517. 'manual-gdb' => \$opt_manual_gdb,
  518. 'manual-debug' => \$opt_manual_debug,
  519. 'ddd' => \$opt_ddd,
  520. 'client-ddd' => \$opt_client_ddd,
  521. 'debugger=s' => \$opt_debugger,
  522. 'client-debugger=s' => \$opt_client_debugger,
  523. 'strace-client' => \$opt_strace_client,
  524. 'master-binary=s' => \$exe_master_mysqld,
  525. 'slave-binary=s' => \$exe_slave_mysqld,
  526. # Coverage, profiling etc
  527. 'gcov' => \$opt_gcov,
  528. 'gprof' => \$opt_gprof,
  529. 'valgrind|valgrind-all' => \$opt_valgrind,
  530. 'valgrind-mysqltest' => \$opt_valgrind_mysqltest,
  531. 'valgrind-mysqld' => \$opt_valgrind_mysqld,
  532. 'valgrind-options=s' => \$opt_valgrind_options,
  533. 'valgrind-path=s' => \$opt_valgrind_path,
  534. 'callgrind' => \$opt_callgrind,
  535. # Stress testing
  536. 'stress' => \$opt_stress,
  537. 'stress-suite=s' => \$opt_stress_suite,
  538. 'stress-threads=i' => \$opt_stress_threads,
  539. 'stress-test-file=s' => \$opt_stress_test_file,
  540. 'stress-init-file=s' => \$opt_stress_init_file,
  541. 'stress-mode=s' => \$opt_stress_mode,
  542. 'stress-loop-count=i' => \$opt_stress_loop_count,
  543. 'stress-test-count=i' => \$opt_stress_test_count,
  544. 'stress-test-duration=i' => \$opt_stress_test_duration,
  545. # Directories
  546. 'tmpdir=s' => \$opt_tmpdir,
  547. 'vardir=s' => \$opt_vardir,
  548. 'benchdir=s' => \$glob_mysql_bench_dir,
  549. 'mem' => \$opt_mem,
  550. # Misc
  551. 'comment=s' => \$opt_comment,
  552. 'debug' => \$opt_debug,
  553. 'fast' => \$opt_fast,
  554. 'reorder' => \$opt_reorder,
  555. 'enable-disabled' => \$opt_enable_disabled,
  556. 'script-debug' => \$opt_script_debug,
  557. 'verbose' => \$opt_verbose,
  558. 'sleep=i' => \$opt_sleep,
  559. 'socket=s' => \$opt_socket,
  560. 'start-dirty' => \$opt_start_dirty,
  561. 'start-and-exit' => \$opt_start_and_exit,
  562. 'timer!' => \$opt_timer,
  563. 'unified-diff|udiff' => \$opt_udiff,
  564. 'user-test=s' => \$opt_user_test,
  565. 'user=s' => \$opt_user,
  566. 'wait-timeout=i' => \$opt_wait_timeout,
  567. 'testcase-timeout=i' => \$opt_testcase_timeout,
  568. 'suite-timeout=i' => \$opt_suite_timeout,
  569. 'warnings|log-warnings' => \$opt_warnings,
  570. 'help|h' => \$opt_usage,
  571. ) or usage("Can't read options");
  572. usage("") if $opt_usage;
  573. if ( $opt_comment )
  574. {
  575. print "\n";
  576. print '#' x 78, "\n";
  577. print "# $opt_comment\n";
  578. print '#' x 78, "\n\n";
  579. }
  580. foreach my $arg ( @ARGV )
  581. {
  582. if ( $arg =~ /^--skip-/ )
  583. {
  584. push(@opt_extra_mysqld_opt, $arg);
  585. }
  586. elsif ( $arg =~ /^--$/ )
  587. {
  588. # It is an effect of setting 'pass_through' in option processing
  589. # that the lone '--' separating options from arguments survives,
  590. # simply ignore it.
  591. }
  592. elsif ( $arg =~ /^-/ )
  593. {
  594. usage("Invalid option \"$arg\"");
  595. }
  596. else
  597. {
  598. push(@opt_cases, $arg);
  599. }
  600. }
  601. # --------------------------------------------------------------------------
  602. # Find out type of logging that are being used
  603. # --------------------------------------------------------------------------
  604. # NOTE if the default binlog format is changed, this has to be changed
  605. $used_binlog_format= "stmt";
  606. foreach my $arg ( @opt_extra_mysqld_opt )
  607. {
  608. if ( defined mtr_match_substring($arg,"binlog-format=row"))
  609. {
  610. $used_binlog_format= "row";
  611. }
  612. }
  613. mtr_report("Using binlog format '$used_binlog_format'");
  614. # --------------------------------------------------------------------------
  615. # Check if we should speed up tests by trying to run on tmpfs
  616. # --------------------------------------------------------------------------
  617. if ( $opt_mem )
  618. {
  619. mtr_error("Can't use --mem and --vardir at the same time ")
  620. if $opt_vardir;
  621. mtr_error("Can't use --mem and --tmpdir at the same time ")
  622. if $opt_tmpdir;
  623. # Use /dev/shm as the preferred location for vardir and
  624. # thus implicitly also tmpdir. Add other locations to list
  625. my @tmpfs_locations= ("/dev/shm");
  626. # One could maybe use "mount" to find tmpfs location(s)
  627. foreach my $fs (@tmpfs_locations)
  628. {
  629. if ( -d $fs )
  630. {
  631. mtr_report("Using tmpfs in $fs");
  632. $opt_mem= "$fs/var";
  633. $opt_mem .= $ENV{'MTR_BUILD_THREAD'} if $ENV{'MTR_BUILD_THREAD'};
  634. last;
  635. }
  636. }
  637. }
  638. # --------------------------------------------------------------------------
  639. # Set the "var/" directory, as it is the base for everything else
  640. # --------------------------------------------------------------------------
  641. $default_vardir= "$glob_mysql_test_dir/var";
  642. if ( ! $opt_vardir )
  643. {
  644. $opt_vardir= $default_vardir;
  645. }
  646. elsif ( $mysql_version_id < 50000 and
  647. $opt_vardir ne $default_vardir )
  648. {
  649. # Version 4.1 and --vardir was specified
  650. # Only supported as a symlink from var/
  651. # by setting up $opt_mem that symlink will be created
  652. $opt_mem= $opt_vardir;
  653. $opt_vardir= $default_vardir;
  654. mtr_report("Using 4.1 vardir trick");
  655. }
  656. $path_vardir_trace= $opt_vardir;
  657. # Chop off any "c:", DBUG likes a unix path ex: c:/src/... => /src/...
  658. $path_vardir_trace=~ s/^\w://;
  659. # We make the path absolute, as the server will do a chdir() before usage
  660. unless ( $opt_vardir =~ m,^/, or
  661. ($glob_win32 and $opt_vardir =~ m,^[a-z]:/,i) )
  662. {
  663. # Make absolute path, relative test dir
  664. $opt_vardir= "$glob_mysql_test_dir/$opt_vardir";
  665. }
  666. # --------------------------------------------------------------------------
  667. # Set tmpdir
  668. # --------------------------------------------------------------------------
  669. $opt_tmpdir= "$opt_vardir/tmp" unless $opt_tmpdir;
  670. $opt_tmpdir =~ s,/+$,,; # Remove ending slash if any
  671. # --------------------------------------------------------------------------
  672. # Set socket
  673. # --------------------------------------------------------------------------
  674. if (!$opt_socket)
  675. {
  676. $opt_socket= $mysqld_variables{'socket'};
  677. }
  678. # --------------------------------------------------------------------------
  679. # Check im suport
  680. # --------------------------------------------------------------------------
  681. if ( $mysql_version_id < 50000 )
  682. {
  683. # Instance manager is not supported until 5.0
  684. $opt_skip_im= 1;
  685. }
  686. if ( $glob_win32 )
  687. {
  688. mtr_report("Disable Instance manager - not supported on Windows");
  689. $opt_skip_im= 1;
  690. }
  691. # --------------------------------------------------------------------------
  692. # Record flag
  693. # --------------------------------------------------------------------------
  694. if ( $opt_record and ! @opt_cases )
  695. {
  696. mtr_error("Will not run in record mode without a specific test case");
  697. }
  698. # --------------------------------------------------------------------------
  699. # Embedded server flag
  700. # --------------------------------------------------------------------------
  701. if ( $opt_embedded_server )
  702. {
  703. $glob_use_embedded_server= 1;
  704. push(@glob_test_mode, "embedded");
  705. $opt_skip_rpl= 1; # We never run replication with embedded
  706. $opt_skip_ndbcluster= 1; # Turn off use of NDB cluster
  707. $opt_skip_ssl= 1; # Turn off use of SSL
  708. if ( $opt_extern )
  709. {
  710. mtr_error("Can't use --extern with --embedded-server");
  711. }
  712. }
  713. # --------------------------------------------------------------------------
  714. # ps protcol flag
  715. # --------------------------------------------------------------------------
  716. if ( $opt_ps_protocol )
  717. {
  718. push(@glob_test_mode, "ps-protocol");
  719. }
  720. # --------------------------------------------------------------------------
  721. # Ndb cluster flags
  722. # --------------------------------------------------------------------------
  723. if ( $opt_with_ndbcluster and $opt_skip_ndbcluster)
  724. {
  725. mtr_error("Can't specify both --with-ndbcluster and --skip-ndbcluster");
  726. }
  727. if ( $opt_ndbconnectstring )
  728. {
  729. $glob_use_running_ndbcluster= 1;
  730. mtr_error("Can't specify --ndb-connectstring and --skip-ndbcluster")
  731. if $opt_skip_ndbcluster;
  732. mtr_error("Can't specify --ndb-connectstring and --ndbcluster-port")
  733. if $opt_ndbcluster_port;
  734. }
  735. else
  736. {
  737. # Set default connect string
  738. $opt_ndbconnectstring= "host=localhost:$opt_ndbcluster_port";
  739. }
  740. if ( $opt_ndbconnectstring_slave )
  741. {
  742. $glob_use_running_ndbcluster_slave= 1;
  743. mtr_error("Can't specify ndb-connectstring_slave and " .
  744. "--skip-ndbcluster-slave")
  745. if $opt_skip_ndbcluster;
  746. mtr_error("Can't specify --ndb-connectstring-slave and " .
  747. "--ndbcluster-port-slave")
  748. if $opt_ndbcluster_port_slave;
  749. }
  750. else
  751. {
  752. # Set default connect string
  753. $opt_ndbconnectstring_slave= "host=localhost:$opt_ndbcluster_port_slave";
  754. }
  755. # --------------------------------------------------------------------------
  756. # Bench flags
  757. # --------------------------------------------------------------------------
  758. if ( $opt_small_bench )
  759. {
  760. $opt_bench= 1;
  761. }
  762. # --------------------------------------------------------------------------
  763. # Sleep flag
  764. # --------------------------------------------------------------------------
  765. if ( $opt_sleep )
  766. {
  767. $opt_sleep_time_after_restart= $opt_sleep;
  768. }
  769. # --------------------------------------------------------------------------
  770. # Gcov flag
  771. # --------------------------------------------------------------------------
  772. if ( $opt_gcov and ! $opt_source_dist )
  773. {
  774. mtr_error("Coverage test needs the source - please use source dist");
  775. }
  776. # --------------------------------------------------------------------------
  777. # Check debug related options
  778. # --------------------------------------------------------------------------
  779. if ( $opt_gdb || $opt_client_gdb || $opt_ddd || $opt_client_ddd ||
  780. $opt_manual_gdb || $opt_manual_ddd || $opt_manual_debug ||
  781. $opt_debugger || $opt_client_debugger )
  782. {
  783. # Indicate that we are using debugger
  784. $glob_debugger= 1;
  785. # Increase timeouts
  786. $opt_wait_timeout= 300;
  787. if ( $opt_extern )
  788. {
  789. mtr_error("Can't use --extern when using debugger");
  790. }
  791. }
  792. # --------------------------------------------------------------------------
  793. # Check if special exe was selected for master or slave
  794. # --------------------------------------------------------------------------
  795. $exe_master_mysqld= $exe_master_mysqld || $exe_mysqld;
  796. $exe_slave_mysqld= $exe_slave_mysqld || $exe_mysqld;
  797. # --------------------------------------------------------------------------
  798. # Check valgrind arguments
  799. # --------------------------------------------------------------------------
  800. if ( $opt_valgrind or $opt_valgrind_path or defined $opt_valgrind_options)
  801. {
  802. mtr_report("Turning on valgrind for all executables");
  803. $opt_valgrind= 1;
  804. $opt_valgrind_mysqld= 1;
  805. $opt_valgrind_mysqltest= 1;
  806. }
  807. elsif ( $opt_valgrind_mysqld )
  808. {
  809. mtr_report("Turning on valgrind for mysqld(s) only");
  810. $opt_valgrind= 1;
  811. }
  812. elsif ( $opt_valgrind_mysqltest )
  813. {
  814. mtr_report("Turning on valgrind for mysqltest only");
  815. $opt_valgrind= 1;
  816. }
  817. if ( $opt_callgrind )
  818. {
  819. mtr_report("Turning on valgrind with callgrind for mysqld(s)");
  820. $opt_valgrind= 1;
  821. $opt_valgrind_mysqld= 1;
  822. # Set special valgrind options unless options passed on command line
  823. $opt_valgrind_options="--trace-children=yes"
  824. unless defined $opt_valgrind_options;
  825. }
  826. if ( $opt_valgrind )
  827. {
  828. # Set valgrind_options to default unless already defined
  829. $opt_valgrind_options=$default_valgrind_options
  830. unless defined $opt_valgrind_options;
  831. mtr_report("Running valgrind with options \"$opt_valgrind_options\"");
  832. }
  833. if ( ! $opt_testcase_timeout )
  834. {
  835. $opt_testcase_timeout= $default_testcase_timeout;
  836. $opt_testcase_timeout*= 10 if $opt_valgrind;
  837. }
  838. if ( ! $opt_suite_timeout )
  839. {
  840. $opt_suite_timeout= $default_suite_timeout;
  841. $opt_suite_timeout*= 6 if $opt_valgrind;
  842. }
  843. # Increase times to wait for executables to start if using valgrind
  844. if ( $opt_valgrind )
  845. {
  846. $opt_sleep_time_after_restart= 10;
  847. $opt_sleep_time_for_delete= 60;
  848. }
  849. if ( ! $opt_user )
  850. {
  851. if ( $glob_use_running_server )
  852. {
  853. $opt_user= "test";
  854. }
  855. else
  856. {
  857. $opt_user= "root"; # We want to do FLUSH xxx commands
  858. }
  859. }
  860. # On QNX, /tmp/dir/master.sock and /tmp/dir//master.sock seem to be
  861. # considered different, so avoid the extra slash (/) in the socket
  862. # paths.
  863. my $sockdir = $opt_tmpdir;
  864. $sockdir =~ s|/+$||;
  865. # Put this into a hash, will be a C struct
  866. $master->[0]=
  867. {
  868. pid => 0,
  869. type => "master",
  870. idx => 0,
  871. path_myddir => "$opt_vardir/master-data",
  872. path_myerr => "$opt_vardir/log/master.err",
  873. path_mylog => "$opt_vardir/log/master.log",
  874. path_pid => "$opt_vardir/run/master.pid",
  875. path_sock => "$sockdir/master.sock",
  876. port => $opt_master_myport,
  877. start_timeout => 400, # enough time create innodb tables
  878. cluster => 0, # index in clusters list
  879. start_opts => [],
  880. };
  881. $master->[1]=
  882. {
  883. pid => 0,
  884. type => "master",
  885. idx => 1,
  886. path_myddir => "$opt_vardir/master1-data",
  887. path_myerr => "$opt_vardir/log/master1.err",
  888. path_mylog => "$opt_vardir/log/master1.log",
  889. path_pid => "$opt_vardir/run/master1.pid",
  890. path_sock => "$sockdir/master1.sock",
  891. port => $opt_master_myport + 1,
  892. start_timeout => 400, # enough time create innodb tables
  893. cluster => 0, # index in clusters list
  894. start_opts => [],
  895. };
  896. $slave->[0]=
  897. {
  898. pid => 0,
  899. type => "slave",
  900. idx => 0,
  901. path_myddir => "$opt_vardir/slave-data",
  902. path_myerr => "$opt_vardir/log/slave.err",
  903. path_mylog => "$opt_vardir/log/slave.log",
  904. path_pid => "$opt_vardir/run/slave.pid",
  905. path_sock => "$sockdir/slave.sock",
  906. port => $opt_slave_myport,
  907. start_timeout => 400,
  908. cluster => 1, # index in clusters list
  909. start_opts => [],
  910. };
  911. $slave->[1]=
  912. {
  913. pid => 0,
  914. type => "slave",
  915. idx => 1,
  916. path_myddir => "$opt_vardir/slave1-data",
  917. path_myerr => "$opt_vardir/log/slave1.err",
  918. path_mylog => "$opt_vardir/log/slave1.log",
  919. path_pid => "$opt_vardir/run/slave1.pid",
  920. path_sock => "$sockdir/slave1.sock",
  921. port => $opt_slave_myport + 1,
  922. start_timeout => 300,
  923. cluster => -1, # index in clusters list
  924. start_opts => [],
  925. };
  926. $slave->[2]=
  927. {
  928. pid => 0,
  929. type => "slave",
  930. idx => 2,
  931. path_myddir => "$opt_vardir/slave2-data",
  932. path_myerr => "$opt_vardir/log/slave2.err",
  933. path_mylog => "$opt_vardir/log/slave2.log",
  934. path_pid => "$opt_vardir/run/slave2.pid",
  935. path_sock => "$sockdir/slave2.sock",
  936. port => $opt_slave_myport + 2,
  937. start_timeout => 300,
  938. cluster => -1, # index in clusters list
  939. start_opts => [],
  940. };
  941. $instance_manager=
  942. {
  943. path_err => "$opt_vardir/log/im.err",
  944. path_log => "$opt_vardir/log/im.log",
  945. path_pid => "$opt_vardir/run/im.pid",
  946. path_angel_pid => "$opt_vardir/run/im.angel.pid",
  947. path_sock => "$sockdir/im.sock",
  948. port => $im_port,
  949. start_timeout => $master->[0]->{'start_timeout'},
  950. admin_login => 'im_admin',
  951. admin_password => 'im_admin_secret',
  952. admin_sha1 => '*598D51AD2DFF7792045D6DF3DDF9AA1AF737B295',
  953. password_file => "$opt_vardir/im.passwd",
  954. defaults_file => "$opt_vardir/im.cnf",
  955. };
  956. $instance_manager->{'instances'}->[0]=
  957. {
  958. server_id => 1,
  959. port => $im_mysqld1_port,
  960. path_datadir => "$opt_vardir/im_mysqld_1.data",
  961. path_sock => "$sockdir/mysqld_1.sock",
  962. path_pid => "$opt_vardir/run/mysqld_1.pid",
  963. start_timeout => 400, # enough time create innodb tables
  964. old_log_format => 1
  965. };
  966. $instance_manager->{'instances'}->[1]=
  967. {
  968. server_id => 2,
  969. port => $im_mysqld2_port,
  970. path_datadir => "$opt_vardir/im_mysqld_2.data",
  971. path_sock => "$sockdir/mysqld_2.sock",
  972. path_pid => "$opt_vardir/run/mysqld_2.pid",
  973. nonguarded => 1,
  974. start_timeout => 400, # enough time create innodb tables
  975. old_log_format => 1
  976. };
  977. my $data_dir= "$opt_vardir/ndbcluster-$opt_ndbcluster_port";
  978. $clusters->[0]=
  979. {
  980. name => "Master",
  981. nodes => 2,
  982. port => "$opt_ndbcluster_port",
  983. data_dir => "$data_dir",
  984. connect_string => "$opt_ndbconnectstring",
  985. path_pid => "$data_dir/ndb_3.pid", # Nodes + 1
  986. pid => 0, # pid of ndb_mgmd
  987. installed_ok => 0,
  988. };
  989. $data_dir= "$opt_vardir/ndbcluster-$opt_ndbcluster_port_slave";
  990. $clusters->[1]=
  991. {
  992. name => "Slave",
  993. nodes => 1,
  994. port => "$opt_ndbcluster_port_slave",
  995. data_dir => "$data_dir",
  996. connect_string => "$opt_ndbconnectstring_slave",
  997. path_pid => "$data_dir/ndb_2.pid", # Nodes + 1
  998. pid => 0, # pid of ndb_mgmd
  999. installed_ok => 0,
  1000. };
  1001. # Init pids of ndbd's
  1002. foreach my $cluster ( @{$clusters} )
  1003. {
  1004. for ( my $idx= 0; $idx < $cluster->{'nodes'}; $idx++ )
  1005. {
  1006. my $nodeid= $idx+1;
  1007. $cluster->{'ndbds'}->[$idx]=
  1008. {
  1009. pid => 0,
  1010. nodeid => $nodeid,
  1011. path_pid => "$cluster->{'data_dir'}/ndb_${nodeid}.pid",
  1012. path_fs => "$cluster->{'data_dir'}/ndb_${nodeid}_fs",
  1013. };
  1014. }
  1015. }
  1016. if ( $opt_extern )
  1017. {
  1018. $glob_use_running_server= 1;
  1019. $opt_skip_rpl= 1; # We don't run rpl test cases
  1020. $master->[0]->{'path_sock'}= $opt_socket;
  1021. }
  1022. $path_timefile= "$opt_vardir/log/mysqltest-time";
  1023. $path_mysqltest_log= "$opt_vardir/log/mysqltest.log";
  1024. $path_current_test_log= "$opt_vardir/log/current_test";
  1025. $path_ndb_testrun_log= "$opt_vardir/log/ndb_testrun.log";
  1026. $path_snapshot= "$opt_tmpdir/snapshot_$opt_master_myport/";
  1027. }
  1028. sub datadir_setup () {
  1029. # Make a list of all data_dirs
  1030. @data_dir_lst = (
  1031. $master->[0]->{'path_myddir'},
  1032. $master->[1]->{'path_myddir'});
  1033. for (my $idx= 0; $idx < $max_slave_num; $idx++)
  1034. {
  1035. push(@data_dir_lst, $slave->[$idx]->{'path_myddir'});
  1036. }
  1037. unless ($opt_skip_im)
  1038. {
  1039. foreach my $instance (@{$instance_manager->{'instances'}})
  1040. {
  1041. push(@data_dir_lst, $instance->{'path_datadir'});
  1042. }
  1043. }
  1044. }
  1045. ##############################################################################
  1046. #
  1047. # Set paths to various executable programs
  1048. #
  1049. ##############################################################################
  1050. sub collect_mysqld_features () {
  1051. #
  1052. # Execute "mysqld --no-defaults --help --verbose", that will
  1053. # print out version and a list of all features and settings
  1054. #
  1055. my $found_variable_list_start= 0;
  1056. my $spec_file= "$glob_mysql_test_dir/mysqld.spec.$$";
  1057. if ( mtr_run($exe_mysqld,
  1058. ["--no-defaults",
  1059. "--verbose",
  1060. "--help"],
  1061. "", "$spec_file", "$spec_file", "") != 0 )
  1062. {
  1063. mtr_error("Failed to get version and list of features from %s",
  1064. $exe_mysqld);
  1065. }
  1066. my $F= IO::File->new($spec_file) or
  1067. mtr_error("can't open file \"$spec_file\": $!");
  1068. while ( my $line= <$F> )
  1069. {
  1070. # First look for version
  1071. if ( !$mysql_version_id )
  1072. {
  1073. # Look for version
  1074. my $exe_name= basename($exe_mysqld);
  1075. mtr_verbose("exe_name: $exe_name");
  1076. if ( $line =~ /^\S*$exe_name\s\sVer\s([0-9]*)\.([0-9]*)\.([0-9]*)/ )
  1077. {
  1078. #print "Major: $1 Minor: $2 Build: $3\n";
  1079. $mysql_version_id= $1*10000 + $2*100 + $3;
  1080. #print "mysql_version_id: $mysql_version_id\n";
  1081. mtr_report("MySQL Version $1.$2.$3");
  1082. }
  1083. }
  1084. else
  1085. {
  1086. if (!$found_variable_list_start)
  1087. {
  1088. # Look for start of variables list
  1089. if ( $line =~ /[\-]+\s[\-]+/ )
  1090. {
  1091. $found_variable_list_start= 1;
  1092. }
  1093. }
  1094. else
  1095. {
  1096. # Put variables into hash
  1097. if ( $line =~ /^([\S]+)[ \t]+(.*)$/ )
  1098. {
  1099. # print "$1=$2\n";
  1100. $mysqld_variables{$1}= $2;
  1101. }
  1102. else
  1103. {
  1104. # The variable list is ended with a blank line
  1105. if ( $line =~ /^[\s]*$/ )
  1106. {
  1107. last;
  1108. }
  1109. else
  1110. {
  1111. # Send out a warning, we should fix the variables that has no
  1112. # space between variable name and it's value
  1113. # or should it be fixed width column parsing? It does not
  1114. # look like that in function my_print_variables in my_getopt.c
  1115. mtr_warning("Could not parse variable list line : $line");
  1116. }
  1117. }
  1118. }
  1119. }
  1120. }
  1121. unlink($spec_file);
  1122. mtr_error("Could not find version of MySQL") unless $mysql_version_id;
  1123. mtr_error("Could not find variabes list") unless $found_variable_list_start;
  1124. }
  1125. sub executable_setup () {
  1126. #
  1127. # Check if libtool is available in this distribution/clone
  1128. # we need it when valgrinding or debugging non installed binary
  1129. # Otherwise valgrind will valgrind the libtool wrapper or bash
  1130. # and gdb will not find the real executable to debug
  1131. #
  1132. if ( -x "../libtool")
  1133. {
  1134. $exe_libtool= "../libtool";
  1135. if ($opt_valgrind or $glob_debugger)
  1136. {
  1137. mtr_report("Using \"$exe_libtool\" when running valgrind or debugger");
  1138. }
  1139. }
  1140. # Look for language files and charsetsdir, use same share
  1141. my $path_share= mtr_path_exists("$glob_basedir/share",
  1142. "$glob_basedir/sql/share",
  1143. "$glob_basedir/share/mysql",
  1144. "$glob_basedir/share");
  1145. $path_language= mtr_path_exists("$path_share/english");
  1146. $path_charsetsdir= mtr_path_exists("$path_share/charsets");
  1147. # Look for my_print_defaults
  1148. $exe_my_print_defaults=
  1149. mtr_exe_exists("$path_client_bindir/my_print_defaults",
  1150. "$glob_basedir/extra/my_print_defaults",
  1151. "$glob_basedir/extra/release/my_print_defaults",
  1152. "$glob_basedir/extra/debug/my_print_defaults");
  1153. # Look for perror
  1154. $exe_perror= mtr_exe_exists("$glob_basedir/extra/perror",
  1155. "$path_client_bindir/perror",
  1156. "$glob_basedir/extra/release/perror",
  1157. "$glob_basedir/extra/debug/perror");
  1158. if ( ! $opt_skip_im )
  1159. {
  1160. # Look for instance manager binary - mysqlmanager
  1161. $exe_im=
  1162. mtr_exe_exists(
  1163. "$glob_basedir/server-tools/instance-manager/mysqlmanager",
  1164. "$glob_basedir/libexec/mysqlmanager");
  1165. }
  1166. else
  1167. {
  1168. $exe_im= "not_available";
  1169. }
  1170. # Look for the client binaries
  1171. $exe_mysqlcheck= mtr_exe_exists("$path_client_bindir/mysqlcheck");
  1172. $exe_mysqldump= mtr_exe_exists("$path_client_bindir/mysqldump");
  1173. $exe_mysqlimport= mtr_exe_exists("$path_client_bindir/mysqlimport");
  1174. $exe_mysqlshow= mtr_exe_exists("$path_client_bindir/mysqlshow");
  1175. $exe_mysqlbinlog= mtr_exe_exists("$path_client_bindir/mysqlbinlog");
  1176. $exe_mysqladmin= mtr_exe_exists("$path_client_bindir/mysqladmin");
  1177. $exe_mysql= mtr_exe_exists("$path_client_bindir/mysql");
  1178. if ( $mysql_version_id >= 50100 )
  1179. {
  1180. $exe_mysqlslap= mtr_exe_exists("$path_client_bindir/mysqlslap");
  1181. }
  1182. if ( ! $glob_win32 )
  1183. {
  1184. # Look for mysql_fix_system_table script
  1185. $exe_mysql_fix_system_tables=
  1186. mtr_script_exists("$glob_basedir/scripts/mysql_fix_privilege_tables",
  1187. "$path_client_bindir/mysql_fix_privilege_tables");
  1188. }
  1189. if ( ! $opt_skip_ndbcluster)
  1190. {
  1191. # Look for ndb tols and binaries
  1192. my $ndb_path= mtr_path_exists("$glob_basedir/ndb",
  1193. "$glob_basedir/storage/ndb");
  1194. $path_ndb_tools_dir= mtr_path_exists("$ndb_path/tools",
  1195. "$glob_basedir/bin");
  1196. $exe_ndb_mgm=
  1197. mtr_exe_exists("$ndb_path/src/mgmclient/ndb_mgm",
  1198. "$glob_basedir/bin/ndb_mgm");
  1199. $exe_ndb_mgmd=
  1200. mtr_exe_exists("$ndb_path/src/mgmsrv/ndb_mgmd",
  1201. "$glob_basedir/bin/ndb_mgmd");
  1202. $exe_ndb_waiter=
  1203. mtr_exe_exists("$ndb_path/tools/ndb_waiter",
  1204. "$glob_basedir/bin/ndb_waiter");
  1205. $exe_ndbd=
  1206. mtr_exe_exists("$ndb_path/src/kernel/ndbd",
  1207. "$glob_basedir/bin/ndbd");
  1208. $path_ndb_examples_dir=
  1209. mtr_path_exists("$ndb_path/ndbapi-examples",
  1210. "$ndb_path/examples");
  1211. $exe_ndb_example=
  1212. mtr_file_exists("$path_ndb_examples_dir/ndbapi_simple/ndbapi_simple");
  1213. }
  1214. # Look for the udf_example library
  1215. $lib_udf_example=
  1216. mtr_file_exists("$glob_basedir/sql/.libs/udf_example.so",
  1217. "$glob_basedir/sql/release/udf_example.dll",
  1218. "$glob_basedir/sql/debug/udf_example.dll");
  1219. # Look for mysqltest executable
  1220. if ( $glob_use_embedded_server )
  1221. {
  1222. $exe_mysqltest=
  1223. mtr_exe_exists("$glob_basedir/libmysqld/examples/mysqltest_embedded",
  1224. "$path_client_bindir/mysqltest_embedded");
  1225. }
  1226. else
  1227. {
  1228. $exe_mysqltest= mtr_exe_exists("$path_client_bindir/mysqltest");
  1229. }
  1230. # Look for mysql_client_test executable
  1231. if ( $glob_use_embedded_server )
  1232. {
  1233. $exe_mysql_client_test=
  1234. mtr_exe_exists("$glob_basedir/libmysqld/examples/mysql_client_test_embedded",
  1235. "$glob_basedir/tests/mysqltest_embedded");
  1236. }
  1237. else
  1238. {
  1239. $exe_mysql_client_test=
  1240. mtr_exe_exists("$glob_basedir/tests/mysql_client_test");
  1241. }
  1242. }
  1243. sub generate_cmdline_mysqldump ($) {
  1244. my($mysqld) = @_;
  1245. return
  1246. "$exe_mysqldump --no-defaults -uroot " .
  1247. "--port=$mysqld->{'port'} " .
  1248. "--socket=$mysqld->{'path_sock'} --password=";
  1249. }
  1250. ##############################################################################
  1251. #
  1252. # Set environment to be used by childs of this process for
  1253. # things that are constant duting the whole lifetime of mysql-test-run.pl
  1254. #
  1255. ##############################################################################
  1256. # Note that some env is setup in spawn/run, in "mtr_process.pl"
  1257. sub environment_setup () {
  1258. umask(022);
  1259. my @ld_library_paths;
  1260. # --------------------------------------------------------------------------
  1261. # Setup LD_LIBRARY_PATH so the libraries from this distro/clone
  1262. # are used in favor of the system installed ones
  1263. # --------------------------------------------------------------------------
  1264. if ( $opt_source_dist )
  1265. {
  1266. push(@ld_library_paths, "$glob_basedir/libmysql/.libs/",
  1267. "$glob_basedir/libmysql_r/.libs/");
  1268. }
  1269. else
  1270. {
  1271. push(@ld_library_paths, "$glob_basedir/lib");
  1272. }
  1273. # --------------------------------------------------------------------------
  1274. # Add the path where libndbclient can be found
  1275. # --------------------------------------------------------------------------
  1276. if ( $opt_ndbcluster_supported )
  1277. {
  1278. push(@ld_library_paths, "$glob_basedir/storage/ndb/src/.libs");
  1279. }
  1280. # --------------------------------------------------------------------------
  1281. # Add the path where mysqld will find udf_example.so
  1282. # --------------------------------------------------------------------------
  1283. if ( $lib_udf_example )
  1284. {
  1285. push(@ld_library_paths, dirname($lib_udf_example));
  1286. }
  1287. # --------------------------------------------------------------------------
  1288. # Valgrind need to be run with debug libraries otherwise it's almost
  1289. # impossible to add correct supressions, that means if "/usr/lib/debug"
  1290. # is available, it should be added to
  1291. # LD_LIBRARY_PATH
  1292. # --------------------------------------------------------------------------
  1293. my $debug_libraries_path= "/usr/lib/debug";
  1294. if ( $opt_valgrind and -d $debug_libraries_path )
  1295. {
  1296. push(@ld_library_paths, $debug_libraries_path);
  1297. }
  1298. $ENV{'LD_LIBRARY_PATH'}= join(":", @ld_library_paths,
  1299. $ENV{'LD_LIBRARY_PATHS'} ?
  1300. split(':', $ENV{'LD_LIBRARY_PATH'}) : ());
  1301. mtr_debug("LD_LIBRARY_PATH: $ENV{'LD_LIBRARY_PATH'}");
  1302. $ENV{'DYLD_LIBRARY_PATH'}= join(":", @ld_library_paths,
  1303. $ENV{'DYLD_LIBRARY_PATH'} ?
  1304. split(':', $ENV{'DYLD_LIBRARY_PATH'}) : ());
  1305. mtr_debug("DYLD_LIBRARY_PATH: $ENV{'DYLD_LIBRARY_PATH'}");
  1306. # --------------------------------------------------------------------------
  1307. # Also command lines in .opt files may contain env vars
  1308. # --------------------------------------------------------------------------
  1309. $ENV{'CHARSETSDIR'}= $path_charsetsdir;
  1310. $ENV{'UMASK'}= "0660"; # The octal *string*
  1311. $ENV{'UMASK_DIR'}= "0770"; # The octal *string*
  1312. $ENV{'LC_COLLATE'}= "C";
  1313. $ENV{'USE_RUNNING_SERVER'}= $glob_use_running_server;
  1314. $ENV{'MYSQL_TEST_DIR'}= $glob_mysql_test_dir;
  1315. $ENV{'MYSQLTEST_VARDIR'}= $opt_vardir;
  1316. $ENV{'MYSQL_TMP_DIR'}= $opt_tmpdir;
  1317. $ENV{'MASTER_MYSOCK'}= $master->[0]->{'path_sock'};
  1318. $ENV{'MASTER_MYSOCK1'}= $master->[1]->{'path_sock'};
  1319. $ENV{'MASTER_MYPORT'}= $master->[0]->{'port'};
  1320. $ENV{'MASTER_MYPORT1'}= $master->[1]->{'port'};
  1321. $ENV{'SLAVE_MYSOCK'}= $slave->[0]->{'path_sock'};
  1322. $ENV{'SLAVE_MYPORT'}= $slave->[0]->{'port'};
  1323. $ENV{'SLAVE_MYPORT1'}= $slave->[1]->{'port'};
  1324. $ENV{'SLAVE_MYPORT2'}= $slave->[2]->{'port'};
  1325. $ENV{'MYSQL_TCP_PORT'}= $mysqld_variables{'port'};
  1326. $ENV{MTR_BUILD_THREAD}= 0 unless $ENV{MTR_BUILD_THREAD}; # Set if not set
  1327. # ----------------------------------------------------
  1328. # Setup env for NDB
  1329. # ----------------------------------------------------
  1330. if ( ! $opt_skip_ndbcluster )
  1331. {
  1332. $ENV{'NDB_MGM'}= $exe_ndb_mgm;
  1333. $ENV{'NDBCLUSTER_PORT'}= $opt_ndbcluster_port;
  1334. $ENV{'NDBCLUSTER_PORT_SLAVE'}= $opt_ndbcluster_port_slave;
  1335. $ENV{'NDB_EXTRA_TEST'}= $opt_ndb_extra_test;
  1336. $ENV{'NDB_BACKUP_DIR'}= $clusters->[0]->{'data_dir'};
  1337. $ENV{'NDB_DATA_DIR'}= $clusters->[0]->{'data_dir'};
  1338. $ENV{'NDB_TOOLS_DIR'}= $path_ndb_tools_dir;
  1339. $ENV{'NDB_TOOLS_OUTPUT'}= $path_ndb_testrun_log;
  1340. $ENV{'NDB_CONNECTSTRING'}= $opt_ndbconnectstring;
  1341. $ENV{'NDB_EXAMPLES_DIR'}= $path_ndb_examples_dir;
  1342. $ENV{'MY_NDB_EXAMPLES_BINARY'}= $exe_ndb_example;
  1343. $ENV{'NDB_EXAMPLES_OUTPUT'}= $path_ndb_testrun_log;
  1344. }
  1345. # ----------------------------------------------------
  1346. # Setup env for IM
  1347. # ----------------------------------------------------
  1348. $ENV{'IM_EXE'}= $exe_im;
  1349. $ENV{'IM_PATH_PID'}= $instance_manager->{path_pid};
  1350. $ENV{'IM_PATH_ANGEL_PID'}= $instance_manager->{path_angel_pid};
  1351. $ENV{'IM_PORT'}= $instance_manager->{port};
  1352. $ENV{'IM_DEFAULTS_PATH'}= $instance_manager->{defaults_file};
  1353. $ENV{'IM_PASSWORD_PATH'}= $instance_manager->{password_file};
  1354. $ENV{'IM_MYSQLD1_SOCK'}= $instance_manager->{instances}->[0]->{path_sock};
  1355. $ENV{'IM_MYSQLD1_PORT'}= $instance_manager->{instances}->[0]->{port};
  1356. $ENV{'IM_MYSQLD1_PATH_PID'}=$instance_manager->{instances}->[0]->{path_pid};
  1357. $ENV{'IM_MYSQLD2_SOCK'}= $instance_manager->{instances}->[1]->{path_sock};
  1358. $ENV{'IM_MYSQLD2_PORT'}= $instance_manager->{instances}->[1]->{port};
  1359. $ENV{'IM_MYSQLD2_PATH_PID'}=$instance_manager->{instances}->[1]->{path_pid};
  1360. # ----------------------------------------------------
  1361. # Setup env so childs can execute mysqlcheck
  1362. # ----------------------------------------------------
  1363. my $cmdline_mysqlcheck=
  1364. "$exe_mysqlcheck --no-defaults -uroot " .
  1365. "--port=$master->[0]->{'port'} " .
  1366. "--socket=$master->[0]->{'path_sock'} --password=";
  1367. if ( $opt_debug )
  1368. {
  1369. $cmdline_mysqlcheck .=
  1370. " --debug=d:t:A,$path_vardir_trace/log/mysqlcheck.trace";
  1371. }
  1372. $ENV{'MYSQL_CHECK'}= $cmdline_mysqlcheck;
  1373. # ----------------------------------------------------
  1374. # Setup env to childs can execute myqldump
  1375. # ----------------------------------------------------
  1376. my $cmdline_mysqldump= generate_cmdline_mysqldump($master->[0]);
  1377. my $cmdline_mysqldumpslave= generate_cmdline_mysqldump($slave->[0]);
  1378. if ( $opt_debug )
  1379. {
  1380. $cmdline_mysqldump .=
  1381. " --debug=d:t:A,$path_vardir_trace/log/mysqldump-master.trace";
  1382. $cmdline_mysqldumpslave .=
  1383. " --debug=d:t:A,$path_vardir_trace/log/mysqldump-slave.trace";
  1384. }
  1385. $ENV{'MYSQL_DUMP'}= $cmdline_mysqldump;
  1386. $ENV{'MYSQL_DUMP_SLAVE'}= $cmdline_mysqldumpslave;
  1387. # ----------------------------------------------------
  1388. # Setup env so childs can execute mysqlslap
  1389. # ----------------------------------------------------
  1390. if ( $exe_mysqlslap )
  1391. {
  1392. my $cmdline_mysqlslap=
  1393. "$exe_mysqlslap -uroot " .
  1394. "--port=$master->[0]->{'port'} " .
  1395. "--socket=$master->[0]->{'path_sock'} --password= " .
  1396. "--lock-directory=$opt_tmpdir";
  1397. if ( $opt_debug )
  1398. {
  1399. $cmdline_mysqlslap .=
  1400. " --debug=d:t:A,$path_vardir_trace/log/mysqlslap.trace";
  1401. }
  1402. $ENV{'MYSQL_SLAP'}= $cmdline_mysqlslap;
  1403. }
  1404. # ----------------------------------------------------
  1405. # Setup env so childs can execute mysqlimport
  1406. # ----------------------------------------------------
  1407. my $cmdline_mysqlimport=
  1408. "$exe_mysqlimport -uroot " .
  1409. "--port=$master->[0]->{'port'} " .
  1410. "--socket=$master->[0]->{'path_sock'} --password=";
  1411. if ( $opt_debug )
  1412. {
  1413. $cmdline_mysqlimport .=
  1414. " --debug=d:t:A,$path_vardir_trace/log/mysqlimport.trace";
  1415. }
  1416. $ENV{'MYSQL_IMPORT'}= $cmdline_mysqlimport;
  1417. # ----------------------------------------------------
  1418. # Setup env so childs can execute mysqlshow
  1419. # ----------------------------------------------------
  1420. my $cmdline_mysqlshow=
  1421. "$exe_mysqlshow -uroot " .
  1422. "--port=$master->[0]->{'port'} " .
  1423. "--socket=$master->[0]->{'path_sock'} --password=";
  1424. if ( $opt_debug )
  1425. {
  1426. $cmdline_mysqlshow .=
  1427. " --debug=d:t:A,$path_vardir_trace/log/mysqlshow.trace";
  1428. }
  1429. $ENV{'MYSQL_SHOW'}= $cmdline_mysqlshow;
  1430. # ----------------------------------------------------
  1431. # Setup env so childs can execute mysqlbinlog
  1432. # ----------------------------------------------------
  1433. my $cmdline_mysqlbinlog=
  1434. "$exe_mysqlbinlog" .
  1435. " --no-defaults --local-load=$opt_tmpdir";
  1436. if ( $mysql_version_id >= 50000 )
  1437. {
  1438. $cmdline_mysqlbinlog .=" --character-sets-dir=$path_charsetsdir";
  1439. }
  1440. if ( $opt_debug )
  1441. {
  1442. $cmdline_mysqlbinlog .=
  1443. " --debug=d:t:A,$path_vardir_trace/log/mysqlbinlog.trace";
  1444. }
  1445. $ENV{'MYSQL_BINLOG'}= $cmdline_mysqlbinlog;
  1446. # ----------------------------------------------------
  1447. # Setup env so childs can execute mysql
  1448. # ----------------------------------------------------
  1449. my $cmdline_mysql=
  1450. "$exe_mysql --no-defaults --host=localhost --user=root --password= " .
  1451. "--port=$master->[0]->{'port'} " .
  1452. "--socket=$master->[0]->{'path_sock'} ".
  1453. "--character-sets-dir=$path_charsetsdir";
  1454. $ENV{'MYSQL'}= $cmdline_mysql;
  1455. # ----------------------------------------------------
  1456. # Setup env so childs can execute mysql_client_test
  1457. # ----------------------------------------------------
  1458. my $cmdline_mysql_client_test=
  1459. "$exe_mysql_client_test --no-defaults --testcase --user=root --silent " .
  1460. "--port=$master->[0]->{'port'} " .
  1461. "--socket=$master->[0]->{'path_sock'}";
  1462. if ( $mysql_version_id >= 50000 )
  1463. {
  1464. $cmdline_mysql_client_test .=" --vardir=$opt_vardir";
  1465. }
  1466. if ( $opt_debug )
  1467. {
  1468. $cmdline_mysql_client_test .=
  1469. " --debug=d:t:A,$path_vardir_trace/log/mysql_client_test.trace";
  1470. }
  1471. if ( $glob_use_embedded_server )
  1472. {
  1473. $cmdline_mysql_client_test.=
  1474. " -A --language=$path_language" .
  1475. " -A --datadir=$slave->[0]->{'path_myddir'}" .
  1476. " -A --character-sets-dir=$path_charsetsdir";
  1477. }
  1478. $ENV{'MYSQL_CLIENT_TEST'}= $cmdline_mysql_client_test;
  1479. # ----------------------------------------------------
  1480. # Setup env so childs can execute mysql_fix_system_tables
  1481. # ----------------------------------------------------
  1482. my $cmdline_mysql_fix_system_tables=
  1483. "$exe_mysql_fix_system_tables --no-defaults --host=localhost " .
  1484. "--user=root --password= " .
  1485. "--basedir=$glob_basedir --bindir=$path_client_bindir --verbose " .
  1486. "--port=$master->[0]->{'port'} " .
  1487. "--socket=$master->[0]->{'path_sock'}";
  1488. $ENV{'MYSQL_FIX_SYSTEM_TABLES'}= $cmdline_mysql_fix_system_tables;
  1489. # ----------------------------------------------------
  1490. # Setup env so childs can execute my_print_defaults
  1491. # ----------------------------------------------------
  1492. $ENV{'MYSQL_MY_PRINT_DEFAULTS'}= $exe_my_print_defaults;
  1493. # ----------------------------------------------------
  1494. # Setup env so childs can execute perror
  1495. # ----------------------------------------------------
  1496. $ENV{'MY_PERROR'}= $exe_perror;
  1497. # ----------------------------------------------------
  1498. # Add the path where mysqld will find udf_example.so
  1499. # ----------------------------------------------------
  1500. $ENV{'UDF_EXAMPLE_LIB'}=
  1501. ($lib_udf_example ? basename($lib_udf_example) : "");
  1502. $ENV{'LD_LIBRARY_PATH'}=
  1503. ($lib_udf_example ? dirname($lib_udf_example) : "") .
  1504. ($ENV{'LD_LIBRARY_PATH'} ? ":$ENV{'LD_LIBRARY_PATH'}" : "");
  1505. # ----------------------------------------------------
  1506. # We are nice and report a bit about our settings
  1507. # ----------------------------------------------------
  1508. if (!$opt_extern)
  1509. {
  1510. print "Using MTR_BUILD_THREAD = $ENV{MTR_BUILD_THREAD}\n";
  1511. print "Using MASTER_MYPORT = $ENV{MASTER_MYPORT}\n";
  1512. print "Using MASTER_MYPORT1 = $ENV{MASTER_MYPORT1}\n";
  1513. print "Using SLAVE_MYPORT = $ENV{SLAVE_MYPORT}\n";
  1514. print "Using SLAVE_MYPORT1 = $ENV{SLAVE_MYPORT1}\n";
  1515. print "Using SLAVE_MYPORT2 = $ENV{SLAVE_MYPORT2}\n";
  1516. if ( ! $opt_skip_ndbcluster )
  1517. {
  1518. print "Using NDBCLUSTER_PORT = $ENV{NDBCLUSTER_PORT}\n";
  1519. if ( ! $opt_skip_ndbcluster_slave )
  1520. {
  1521. print "Using NDBCLUSTER_PORT_SLAVE = $ENV{NDBCLUSTER_PORT_SLAVE}\n";
  1522. }
  1523. }
  1524. if ( ! $opt_skip_im )
  1525. {
  1526. print "Using IM_PORT = $ENV{IM_PORT}\n";
  1527. print "Using IM_MYSQLD1_PORT = $ENV{IM_MYSQLD1_PORT}\n";
  1528. print "Using IM_MYSQLD2_PORT = $ENV{IM_MYSQLD2_PORT}\n";
  1529. }
  1530. }
  1531. # Create an environment variable to make it possible
  1532. # to detect that valgrind is being used from test cases
  1533. $ENV{'VALGRIND_TEST'}= $opt_valgrind;
  1534. }
  1535. ##############################################################################
  1536. #
  1537. # If we get a ^C, we try to clean up before termination
  1538. #
  1539. ##############################################################################
  1540. # FIXME check restrictions what to do in a signal handler
  1541. sub signal_setup () {
  1542. $SIG{INT}= \&handle_int_signal;
  1543. }
  1544. sub handle_int_signal () {
  1545. $SIG{INT}= 'DEFAULT'; # If we get a ^C again, we die...
  1546. mtr_warning("got INT signal, cleaning up.....");
  1547. stop_all_servers();
  1548. mtr_error("We die from ^C signal from user");
  1549. }
  1550. ##############################################################################
  1551. #
  1552. # Handle left overs from previous runs
  1553. #
  1554. ##############################################################################
  1555. sub kill_running_server () {
  1556. if ( $opt_fast or $glob_use_embedded_server )
  1557. {
  1558. # FIXME is embedded server really using PID files?!
  1559. unlink($master->[0]->{'path_pid'});
  1560. unlink($master->[1]->{'path_pid'});
  1561. unlink($slave->[0]->{'path_pid'});
  1562. unlink($slave->[1]->{'path_pid'});
  1563. unlink($slave->[2]->{'path_pid'});
  1564. }
  1565. else
  1566. {
  1567. # Ensure that no old mysqld test servers are running
  1568. # This is different from terminating processes we have
  1569. # started from this run of the script, this is terminating
  1570. # leftovers from previous runs.
  1571. mtr_kill_leftovers();
  1572. }
  1573. }
  1574. sub cleanup_stale_files () {
  1575. my $created_by_mem_file= "$glob_mysql_test_dir/var/created_by_mem";
  1576. mtr_report("Removing Stale Files");
  1577. if ( $opt_vardir eq $default_vardir )
  1578. {
  1579. #
  1580. # Running with "var" in mysql-test dir
  1581. #
  1582. if ( -l $opt_vardir)
  1583. {
  1584. # var is a symlink
  1585. if (-f $created_by_mem_file)
  1586. {
  1587. # Remove the directory which the link points at
  1588. rmtree(readlink($opt_vardir));
  1589. # Remove the entire "var" dir
  1590. rmtree("$opt_vardir/");
  1591. }
  1592. else
  1593. {
  1594. # Some users creates a soft link in mysql-test/var to another area
  1595. # - allow it
  1596. mtr_report("WARNING: Using the 'mysql-test/var' symlink");
  1597. rmtree("$opt_vardir/log");
  1598. rmtree("$opt_vardir/ndbcluster-$opt_ndbcluster_port");
  1599. rmtree("$opt_vardir/run");
  1600. rmtree("$opt_vardir/tmp");
  1601. }
  1602. }
  1603. else
  1604. {
  1605. # Remove the entire "var" dir
  1606. rmtree("$opt_vardir/");
  1607. }
  1608. }
  1609. else
  1610. {
  1611. #
  1612. # Running with "var" in some other place
  1613. #
  1614. # Remove the var/ dir in mysql-test dir if any
  1615. # this could be an old symlink that shouldn't be there
  1616. rmtree($default_vardir);
  1617. # Remove the "var" dir
  1618. rmtree("$opt_vardir/");
  1619. }
  1620. if ( $opt_mem )
  1621. {
  1622. # Runinng with var as a link to some "memory" location, normally tmpfs
  1623. rmtree($opt_mem);
  1624. mkpath($opt_mem);
  1625. mtr_report("Creating symlink from $opt_vardir to $opt_mem");
  1626. symlink($opt_mem, $opt_vardir);
  1627. # Put a small file to recognize this dir was created by --mem
  1628. mtr_tofile($created_by_mem_file, $opt_mem);
  1629. }
  1630. mkpath("$opt_vardir/log");
  1631. mkpath("$opt_vardir/run");
  1632. mkpath("$opt_vardir/tmp");
  1633. mkpath($opt_tmpdir) if $opt_tmpdir ne "$opt_vardir/tmp";
  1634. # Remove old and create new data dirs
  1635. foreach my $data_dir (@data_dir_lst)
  1636. {
  1637. rmtree("$data_dir");
  1638. mkpath("$data_dir/mysql");
  1639. mkpath("$data_dir/test");
  1640. }
  1641. # Make a link std_data_ln in var/ that points to std_data
  1642. if ( ! $glob_win32 )
  1643. {
  1644. symlink("$glob_mysql_test_dir/std_data", "$opt_vardir/std_data_ln");
  1645. }
  1646. else
  1647. {
  1648. # on windows, copy all files from std_data into var/std_data_ln
  1649. mkpath("$opt_vardir/std_data_ln");
  1650. opendir(DIR, "$glob_mysql_test_dir/std_data")
  1651. or mtr_error("Can't find the std_data directory: $!");
  1652. for(readdir(DIR)) {
  1653. next if -d "$glob_mysql_test_dir/std_data/$_";
  1654. copy("$glob_mysql_test_dir/std_data/$_", "$opt_vardir/std_data_ln/$_");
  1655. }
  1656. closedir(DIR);
  1657. }
  1658. }
  1659. sub check_running_as_root () {
  1660. # Check if running as root
  1661. # i.e a file can be read regardless what mode we set it to
  1662. my $test_file= "$opt_vardir/test_running_as_root.txt";
  1663. mtr_tofile($test_file, "MySQL");
  1664. chmod(oct("0000"), $test_file);
  1665. my $result="";
  1666. if (open(FILE,"<",$test_file))
  1667. {
  1668. $result= join('', <FILE>);
  1669. close FILE;
  1670. }
  1671. chmod(oct("0755"), $test_file);
  1672. unlink($test_file);
  1673. $ENV{'MYSQL_TEST_ROOT'}= "NO";
  1674. if ($result eq "MySQL")
  1675. {
  1676. mtr_warning("running this script as _root_ will cause some " .
  1677. "tests to be skipped");
  1678. $ENV{'MYSQL_TEST_ROOT'}= "YES";
  1679. }
  1680. }
  1681. sub check_ssl_support ($) {
  1682. my $mysqld_variables= shift;
  1683. if ($opt_skip_ssl || $opt_extern)
  1684. {
  1685. mtr_report("Skipping SSL");
  1686. $opt_ssl_supported= 0;
  1687. $opt_ssl= 0;
  1688. return;
  1689. }
  1690. if ( ! $mysqld_variables->{'ssl'} )
  1691. {
  1692. if ( $opt_ssl)
  1693. {
  1694. mtr_error("Couldn't find support for SSL");
  1695. return;
  1696. }
  1697. mtr_report("Skipping SSL, mysqld not compiled with SSL");
  1698. $opt_ssl_supported= 0;
  1699. $opt_ssl= 0;
  1700. return;
  1701. }
  1702. mtr_report("Setting mysqld to support SSL connections");
  1703. $opt_ssl_supported= 1;
  1704. }
  1705. sub check_debug_support ($) {
  1706. my $mysqld_variables= shift;
  1707. if ( ! $mysqld_variables->{'debug'} )
  1708. {
  1709. #mtr_report("Binaries are not debug compiled");
  1710. $debug_compiled_binaries= 0;
  1711. if ( $opt_debug )
  1712. {
  1713. mtr_error("Can't use --debug, binaries does not support it");
  1714. }
  1715. return;
  1716. }
  1717. mtr_report("Binaries are debug compiled");
  1718. $debug_compiled_binaries= 1;
  1719. }
  1720. ##############################################################################
  1721. #
  1722. # Start the ndb cluster
  1723. #
  1724. ##############################################################################
  1725. sub check_ndbcluster_support ($) {
  1726. my $mysqld_variables= shift;
  1727. if ($opt_skip_ndbcluster)
  1728. {
  1729. mtr_report("Skipping ndbcluster");
  1730. $opt_skip_ndbcluster_slave= 1;
  1731. return;
  1732. }
  1733. if ( ! $mysqld_variables->{'ndb-connectstring'} )
  1734. {
  1735. mtr_report("Skipping ndbcluster, mysqld not compiled with ndbcluster");
  1736. $opt_skip_ndbcluster= 1;
  1737. $opt_skip_ndbcluster_slave= 1;
  1738. return;
  1739. }
  1740. $opt_ndbcluster_supported= 1;
  1741. mtr_report("Using ndbcluster when necessary, mysqld supports it");
  1742. if ( $mysql_version_id < 50100 )
  1743. {
  1744. # Slave cluster is not supported until 5.1
  1745. $opt_skip_ndbcluster_slave= 1;
  1746. }
  1747. return;
  1748. }
  1749. sub ndbcluster_start_install ($) {
  1750. my $cluster= shift;
  1751. if ( $opt_skip_ndbcluster or $glob_use_running_ndbcluster )
  1752. {
  1753. return 0;
  1754. }
  1755. mtr_report("Installing $cluster->{'name'} Cluster");
  1756. mkdir($cluster->{'data_dir'});
  1757. # Create a config file from template
  1758. my $ndb_no_ord=512;
  1759. my $ndb_no_attr=2048;
  1760. my $ndb_con_op=105000;
  1761. my $ndb_dmem="80M";
  1762. my $ndb_imem="24M";
  1763. my $ndb_pbmem="32M";
  1764. my $nodes= $cluster->{'nodes'};
  1765. my $ndb_host= "localhost";
  1766. my $ndb_diskless= 0;
  1767. if (!$opt_bench)
  1768. {
  1769. # Use a smaller configuration
  1770. if ( $mysql_version_id < 50100 )
  1771. {
  1772. # 4.1 and 5.0 is using a "larger" --small configuration
  1773. $ndb_no_ord=128;
  1774. $ndb_con_op=10000;
  1775. $ndb_dmem="40M";
  1776. $ndb_imem="12M";
  1777. }
  1778. else
  1779. {
  1780. $ndb_no_ord=32;
  1781. $ndb_con_op=5000;
  1782. $ndb_dmem="20M";
  1783. $ndb_imem="1M";
  1784. $ndb_pbmem="4M";
  1785. }
  1786. }
  1787. my $config_file_template= "ndb/ndb_config_${nodes}_node.ini";
  1788. my $config_file= "$cluster->{'data_dir'}/config.ini";
  1789. open(IN, $config_file_template)
  1790. or mtr_error("Can't open $config_file_template: $!");
  1791. open(OUT, ">", $config_file)
  1792. or mtr_error("Can't write to $config_file: $!");
  1793. while (<IN>)
  1794. {
  1795. chomp;
  1796. s/CHOOSE_MaxNoOfAttributes/$ndb_no_attr/;
  1797. s/CHOOSE_MaxNoOfOrderedIndexes/$ndb_no_ord/;
  1798. s/CHOOSE_MaxNoOfConcurrentOperations/$ndb_con_op/;
  1799. s/CHOOSE_DataMemory/$ndb_dmem/;
  1800. s/CHOOSE_IndexMemory/$ndb_imem/;
  1801. s/CHOOSE_Diskless/$ndb_diskless/;
  1802. s/CHOOSE_HOSTNAME_.*/$ndb_host/;
  1803. s/CHOOSE_FILESYSTEM/$cluster->{'data_dir'}/;
  1804. s/CHOOSE_PORT_MGM/$cluster->{'port'}/;
  1805. if ( $mysql_version_id < 50000 )
  1806. {
  1807. my $base_port= $cluster->{'port'} + 1;
  1808. s/CHOOSE_PORT_TRANSPORTER/$base_port/;
  1809. }
  1810. s/CHOOSE_DiskPageBufferMemory/$ndb_pbmem/;
  1811. print OUT "$_ \n";
  1812. }
  1813. close OUT;
  1814. close IN;
  1815. # Start cluster with "--initial"
  1816. ndbcluster_start($cluster, "--initial");
  1817. return 0;
  1818. }
  1819. sub ndbcluster_wait_started($$){
  1820. my $cluster= shift;
  1821. my $ndb_waiter_extra_opt= shift;
  1822. my $path_waiter_log= "$cluster->{'data_dir'}/ndb_waiter.log";
  1823. my $args;
  1824. mtr_init_args(\$args);
  1825. mtr_add_arg($args, "--no-defaults");
  1826. mtr_add_arg($args, "--core");
  1827. mtr_add_arg($args, "--ndb-connectstring=%s", $cluster->{'connect_string'});
  1828. mtr_add_arg($args, "--timeout=60");
  1829. if ($ndb_waiter_extra_opt)
  1830. {
  1831. mtr_add_arg($args, "$ndb_waiter_extra_opt");
  1832. }
  1833. # Start the ndb_waiter which will connect to the ndb_mgmd
  1834. # and poll it for state of the ndbd's, will return when
  1835. # all nodes in the cluster is started
  1836. my $res= mtr_run($exe_ndb_waiter, $args,
  1837. "", $path_waiter_log, $path_waiter_log, "");
  1838. mtr_verbose("ndbcluster_wait_started, returns: $res") if $res;
  1839. return $res;
  1840. }
  1841. sub mysqld_wait_started($){
  1842. my $mysqld= shift;
  1843. my $res= sleep_until_file_created($mysqld->{'path_pid'},
  1844. $mysqld->{'start_timeout'},
  1845. $mysqld->{'pid'});
  1846. return $res == 0;
  1847. }
  1848. sub ndb_mgmd_wait_started($) {
  1849. my ($cluster)= @_;
  1850. my $retries= 100;
  1851. while (ndbcluster_wait_started($cluster, "--no-contact") and
  1852. $retries)
  1853. {
  1854. # Millisceond sleep emulated with select
  1855. select(undef, undef, undef, (0.1));
  1856. $retries--;
  1857. }
  1858. return $retries == 0;
  1859. }
  1860. sub ndb_mgmd_start ($) {
  1861. my $cluster= shift;
  1862. my $args; # Arg vector
  1863. my $pid= -1;
  1864. mtr_init_args(\$args);
  1865. mtr_add_arg($args, "--no-defaults");
  1866. mtr_add_arg($args, "--core");
  1867. mtr_add_arg($args, "--nodaemon");
  1868. mtr_add_arg($args, "--config-file=%s", "$cluster->{'data_dir'}/config.ini");
  1869. my $path_ndb_mgmd_log= "$cluster->{'data_dir'}/\l$cluster->{'name'}_ndb_mgmd.log";
  1870. $pid= mtr_spawn($exe_ndb_mgmd, $args, "",
  1871. $path_ndb_mgmd_log,
  1872. $path_ndb_mgmd_log,
  1873. "",
  1874. { append_log_file => 1 });
  1875. # FIXME Should not be needed
  1876. # Unfortunately the cluster nodes will fail to start
  1877. # if ndb_mgmd has not started properly
  1878. if (ndb_mgmd_wait_started($cluster))
  1879. {
  1880. mtr_error("Failed to wait for start of ndb_mgmd");
  1881. }
  1882. # Remember pid of ndb_mgmd
  1883. $cluster->{'pid'}= $pid;
  1884. mtr_verbose("ndb_mgmd_start, pid: $pid");
  1885. return $pid;
  1886. }
  1887. sub ndbd_start ($$$) {
  1888. my $cluster= shift;
  1889. my $idx= shift;
  1890. my $extra_args= shift;
  1891. my $args; # Arg vector
  1892. my $pid= -1;
  1893. mtr_init_args(\$args);
  1894. mtr_add_arg($args, "--no-defaults");
  1895. mtr_add_arg($args, "--core");
  1896. mtr_add_arg($args, "--ndb-connectstring=%s", "$cluster->{'connect_string'}");
  1897. if ( $mysql_version_id >= 50000)
  1898. {
  1899. mtr_add_arg($args, "--character-sets-dir=%s", "$path_charsetsdir");
  1900. }
  1901. mtr_add_arg($args, "--nodaemon");
  1902. mtr_add_arg($args, "$extra_args");
  1903. my $nodeid= $cluster->{'ndbds'}->[$idx]->{'nodeid'};
  1904. my $path_ndbd_log= "$cluster->{'data_dir'}/ndb_${nodeid}.log";
  1905. $pid= mtr_spawn($exe_ndbd, $args, "",
  1906. $path_ndbd_log,
  1907. $path_ndbd_log,
  1908. "",
  1909. { append_log_file => 1 });
  1910. # Add pid to list of pids for this cluster
  1911. $cluster->{'ndbds'}->[$idx]->{'pid'}= $pid;
  1912. # Rememeber options used when starting
  1913. $cluster->{'ndbds'}->[$idx]->{'start_extra_args'}= $extra_args;
  1914. $cluster->{'ndbds'}->[$idx]->{'idx'}= $idx;
  1915. mtr_verbose("ndbd_start, pid: $pid");
  1916. return $pid;
  1917. }
  1918. sub ndbcluster_start ($$) {
  1919. my $cluster= shift;
  1920. my $extra_args= shift;
  1921. mtr_verbose("ndbcluster_start '$cluster->{'name'}'");
  1922. if ( $glob_use_running_ndbcluster )
  1923. {
  1924. return 0;
  1925. }
  1926. if ( $cluster->{'pid'} )
  1927. {
  1928. mtr_error("Cluster '$cluster->{'name'}' already started");
  1929. }
  1930. ndb_mgmd_start($cluster);
  1931. for ( my $idx= 0; $idx < $cluster->{'nodes'}; $idx++ )
  1932. {
  1933. ndbd_start($cluster, $idx, $extra_args);
  1934. }
  1935. return 0;
  1936. }
  1937. sub rm_ndbcluster_tables ($) {
  1938. my $dir= shift;
  1939. foreach my $bin ( glob("$dir/cluster/apply_status*"),
  1940. glob("$dir/cluster/schema*") )
  1941. {
  1942. unlink($bin);
  1943. }
  1944. }
  1945. ##############################################################################
  1946. #
  1947. # Run the benchmark suite
  1948. #
  1949. ##############################################################################
  1950. sub run_benchmarks ($) {
  1951. my $benchmark= shift;
  1952. my $args;
  1953. if ( ! $glob_use_embedded_server )
  1954. {
  1955. mysqld_start($master->[0],[],[]);
  1956. if ( ! $master->[0]->{'pid'} )
  1957. {
  1958. mtr_error("Can't start the mysqld server");
  1959. }
  1960. }
  1961. mtr_init_args(\$args);
  1962. mtr_add_arg($args, "--socket=%s", $master->[0]->{'path_sock'});
  1963. mtr_add_arg($args, "--user=%s", $opt_user);
  1964. if ( $opt_small_bench )
  1965. {
  1966. mtr_add_arg($args, "--small-test");
  1967. mtr_add_arg($args, "--small-tables");
  1968. }
  1969. if ( $opt_with_ndbcluster )
  1970. {
  1971. mtr_add_arg($args, "--create-options=TYPE=ndb");
  1972. }
  1973. chdir($glob_mysql_bench_dir)
  1974. or mtr_error("Couldn't chdir to '$glob_mysql_bench_dir': $!");
  1975. if ( ! $benchmark )
  1976. {
  1977. mtr_add_arg($args, "--log");
  1978. mtr_run("$glob_mysql_bench_dir/run-all-tests", $args, "", "", "", "");
  1979. # FIXME check result code?!
  1980. }
  1981. elsif ( -x $benchmark )
  1982. {
  1983. mtr_run("$glob_mysql_bench_dir/$benchmark", $args, "", "", "", "");
  1984. # FIXME check result code?!
  1985. }
  1986. else
  1987. {
  1988. mtr_error("Benchmark $benchmark not found");
  1989. }
  1990. chdir($glob_mysql_test_dir); # Go back
  1991. if ( ! $glob_use_embedded_server )
  1992. {
  1993. stop_masters();
  1994. }
  1995. }
  1996. ##############################################################################
  1997. #
  1998. # Run the test suite
  1999. #
  2000. ##############################################################################
  2001. sub run_suite () {
  2002. my ($suite, $tests)= @_;
  2003. mtr_print_thick_line();
  2004. mtr_timer_start($glob_timers,"suite", 60 * $opt_suite_timeout);
  2005. mtr_report("Starting Tests in the '$suite' suite");
  2006. mtr_report_tests_not_skipped_though_disabled($tests);
  2007. mtr_print_header();
  2008. foreach my $tinfo ( @$tests )
  2009. {
  2010. if (run_testcase_check_skip_test($tinfo))
  2011. {
  2012. next;
  2013. }
  2014. mtr_timer_start($glob_timers,"testcase", 60 * $opt_testcase_timeout);
  2015. run_testcase($tinfo);
  2016. mtr_timer_stop($glob_timers,"testcase");
  2017. }
  2018. mtr_print_line();
  2019. if ( ! $glob_debugger and
  2020. ! $glob_use_running_server and
  2021. ! $glob_use_embedded_server )
  2022. {
  2023. stop_all_servers();
  2024. }
  2025. if ( $opt_gcov )
  2026. {
  2027. gcov_collect(); # collect coverage information
  2028. }
  2029. if ( $opt_gprof )
  2030. {
  2031. gprof_collect(); # collect coverage information
  2032. }
  2033. mtr_report_stats($tests);
  2034. mtr_timer_stop($glob_timers,"suite");
  2035. }
  2036. ##############################################################################
  2037. #
  2038. # Initiate the test databases
  2039. #
  2040. ##############################################################################
  2041. sub initialize_servers () {
  2042. datadir_setup();
  2043. if ( ! $glob_use_running_server )
  2044. {
  2045. kill_running_server();
  2046. unless ( $opt_start_dirty )
  2047. {
  2048. cleanup_stale_files();
  2049. mysql_install_db();
  2050. if ( $opt_force )
  2051. {
  2052. save_installed_db();
  2053. }
  2054. }
  2055. check_running_as_root();
  2056. }
  2057. }
  2058. sub mysql_install_db () {
  2059. install_db('master', $master->[0]->{'path_myddir'});
  2060. # FIXME check if testcase really is using second master
  2061. copy_install_db('master', $master->[1]->{'path_myddir'});
  2062. # Install the number of slave databses needed
  2063. for (my $idx= 0; $idx < $max_slave_num; $idx++)
  2064. {
  2065. copy_install_db("slave".($idx+1), $slave->[$idx]->{'path_myddir'});
  2066. }
  2067. if ( ! $opt_skip_im )
  2068. {
  2069. im_prepare_env($instance_manager);
  2070. }
  2071. my $cluster_started_ok= 1; # Assume it can be started
  2072. if (ndbcluster_start_install($clusters->[0]) ||
  2073. ($max_slave_num && !$opt_skip_ndbcluster_slave &&
  2074. ndbcluster_start_install($clusters->[1])))
  2075. {
  2076. mtr_warning("Failed to start install of cluster");
  2077. $cluster_started_ok= 0;
  2078. }
  2079. foreach my $cluster (@{$clusters})
  2080. {
  2081. next if !$cluster->{'pid'};
  2082. $cluster->{'installed_ok'}= 1; # Assume install suceeds
  2083. if (ndbcluster_wait_started($cluster, ""))
  2084. {
  2085. # failed to install, disable usage and flag that its no ok
  2086. mtr_report("ndbcluster_install of $cluster->{'name'} failed");
  2087. $cluster->{"installed_ok"}= 0;
  2088. $cluster_started_ok= 0;
  2089. }
  2090. }
  2091. if ( ! $cluster_started_ok )
  2092. {
  2093. if ( $opt_force)
  2094. {
  2095. # Continue without cluster
  2096. }
  2097. else
  2098. {
  2099. mtr_error("To continue, re-run with '--force'.");
  2100. }
  2101. }
  2102. # Stop clusters...
  2103. stop_all_servers();
  2104. return 0;
  2105. }
  2106. sub copy_install_db ($$) {
  2107. my $type= shift;
  2108. my $data_dir= shift;
  2109. mtr_report("Installing \u$type Database");
  2110. # Just copy the installed db from first master
  2111. mtr_copy_dir($master->[0]->{'path_myddir'}, $data_dir);
  2112. }
  2113. sub install_db ($$) {
  2114. my $type= shift;
  2115. my $data_dir= shift;
  2116. my $init_db_sql= "lib/init_db.sql";
  2117. my $init_db_sql_tmp= "/tmp/init_db.sql$$";
  2118. my $args;
  2119. mtr_report("Installing \u$type Database");
  2120. open(IN, $init_db_sql)
  2121. or mtr_error("Can't open $init_db_sql: $!");
  2122. open(OUT, ">", $init_db_sql_tmp)
  2123. or mtr_error("Can't write to $init_db_sql_tmp: $!");
  2124. while (<IN>)
  2125. {
  2126. chomp;
  2127. s/\@HOSTNAME\@/$glob_hostname/;
  2128. if ( /^\s*$/ )
  2129. {
  2130. print OUT "\n";
  2131. }
  2132. elsif (/;$/)
  2133. {
  2134. print OUT "$_\n";
  2135. }
  2136. else
  2137. {
  2138. print OUT "$_ ";
  2139. }
  2140. }
  2141. close OUT;
  2142. close IN;
  2143. mtr_init_args(\$args);
  2144. mtr_add_arg($args, "--no-defaults");
  2145. mtr_add_arg($args, "--bootstrap");
  2146. mtr_add_arg($args, "--console");
  2147. mtr_add_arg($args, "--skip-grant-tables");
  2148. mtr_add_arg($args, "--basedir=%s", $path_my_basedir);
  2149. mtr_add_arg($args, "--datadir=%s", $data_dir);
  2150. mtr_add_arg($args, "--skip-innodb");
  2151. mtr_add_arg($args, "--skip-ndbcluster");
  2152. mtr_add_arg($args, "--tmpdir=.");
  2153. if ( $opt_debug )
  2154. {
  2155. mtr_add_arg($args, "--debug=d:t:i:A,%s/log/bootstrap_%s.trace",
  2156. $path_vardir_trace, $type);
  2157. }
  2158. if ( ! $glob_netware )
  2159. {
  2160. mtr_add_arg($args, "--language=%s", $path_language);
  2161. mtr_add_arg($args, "--character-sets-dir=%s", $path_charsetsdir);
  2162. }
  2163. # Log bootstrap command
  2164. my $path_bootstrap_log= "$opt_vardir/log/bootstrap.log";
  2165. mtr_tofile($path_bootstrap_log,
  2166. "$exe_mysqld " . join(" ", @$args) . "\n");
  2167. if ( mtr_run($exe_mysqld, $args, $init_db_sql_tmp,
  2168. $path_bootstrap_log, $path_bootstrap_log,
  2169. "", { append_log_file => 1 }) != 0 )
  2170. {
  2171. unlink($init_db_sql_tmp);
  2172. mtr_error("Error executing mysqld --bootstrap\n" .
  2173. "Could not install $type test DBs");
  2174. }
  2175. unlink($init_db_sql_tmp);
  2176. }
  2177. sub im_prepare_env($) {
  2178. my $instance_manager = shift;
  2179. im_create_passwd_file($instance_manager);
  2180. im_prepare_data_dir($instance_manager);
  2181. }
  2182. sub im_create_passwd_file($) {
  2183. my $instance_manager = shift;
  2184. my $pwd_file_path = $instance_manager->{'password_file'};
  2185. mtr_report("Creating IM password file ($pwd_file_path)");
  2186. open(OUT, ">", $pwd_file_path)
  2187. or mtr_error("Can't write to $pwd_file_path: $!");
  2188. print OUT $instance_manager->{'admin_login'}, ":",
  2189. $instance_manager->{'admin_sha1'}, "\n";
  2190. close(OUT);
  2191. }
  2192. sub im_create_defaults_file($) {
  2193. my $instance_manager = shift;
  2194. my $defaults_file = $instance_manager->{'defaults_file'};
  2195. open(OUT, ">", $defaults_file)
  2196. or mtr_error("Can't write to $defaults_file: $!");
  2197. print OUT <<EOF
  2198. [mysql]
  2199. [manager]
  2200. pid-file = $instance_manager->{path_pid}
  2201. angel-pid-file = $instance_manager->{path_angel_pid}
  2202. socket = $instance_manager->{path_sock}
  2203. port = $instance_manager->{port}
  2204. password-file = $instance_manager->{password_file}
  2205. default-mysqld-path = $exe_mysqld
  2206. EOF
  2207. ;
  2208. foreach my $instance (@{$instance_manager->{'instances'}})
  2209. {
  2210. my $server_id = $instance->{'server_id'};
  2211. print OUT <<EOF
  2212. [mysqld$server_id]
  2213. socket = $instance->{path_sock}
  2214. pid-file = $instance->{path_pid}
  2215. port = $instance->{port}
  2216. datadir = $instance->{path_datadir}
  2217. log = $instance->{path_datadir}/mysqld$server_id.log
  2218. log-error = $instance->{path_datadir}/mysqld$server_id.err.log
  2219. log-slow-queries = $instance->{path_datadir}/mysqld$server_id.slow.log
  2220. language = $path_language
  2221. character-sets-dir = $path_charsetsdir
  2222. basedir = $path_my_basedir
  2223. server_id = $server_id
  2224. skip-stack-trace
  2225. skip-innodb
  2226. skip-ndbcluster
  2227. EOF
  2228. ;
  2229. if ( $mysql_version_id < 50100 )
  2230. {
  2231. print OUT "skip-bdb\n";
  2232. }
  2233. print OUT "nonguarded\n" if $instance->{'nonguarded'};
  2234. if ( $mysql_version_id >= 50100 )
  2235. {
  2236. print OUT "log-output=FILE\n" if $instance->{'old_log_format'};
  2237. }
  2238. print OUT "\n";
  2239. }
  2240. close(OUT);
  2241. }
  2242. sub im_prepare_data_dir($) {
  2243. my $instance_manager = shift;
  2244. foreach my $instance (@{$instance_manager->{'instances'}})
  2245. {
  2246. copy_install_db(
  2247. 'im_mysqld_' . $instance->{'server_id'},
  2248. $instance->{'path_datadir'});
  2249. }
  2250. }
  2251. #
  2252. # Restore snapshot of the installed slave databases
  2253. # if the snapshot exists
  2254. #
  2255. sub restore_slave_databases ($) {
  2256. my ($num_slaves)= @_;
  2257. if ( -d $path_snapshot)
  2258. {
  2259. for (my $idx= 0; $idx < $num_slaves; $idx++)
  2260. {
  2261. my $data_dir= $slave->[$idx]->{'path_myddir'};
  2262. my $name= basename($data_dir);
  2263. rmtree($data_dir);
  2264. mtr_copy_dir("$path_snapshot/$name", $data_dir);
  2265. }
  2266. }
  2267. }
  2268. sub run_testcase_check_skip_test($)
  2269. {
  2270. my ($tinfo)= @_;
  2271. # ----------------------------------------------------------------------
  2272. # If marked to skip, just print out and return.
  2273. # Note that a test case not marked as 'skip' can still be
  2274. # skipped later, because of the test case itself in cooperation
  2275. # with the mysqltest program tells us so.
  2276. # ----------------------------------------------------------------------
  2277. if ( $tinfo->{'skip'} )
  2278. {
  2279. mtr_report_test_name($tinfo);
  2280. mtr_report_test_skipped($tinfo);
  2281. return 1;
  2282. }
  2283. if ($tinfo->{'ndb_test'})
  2284. {
  2285. foreach my $cluster (@{$clusters})
  2286. {
  2287. last if ($opt_skip_ndbcluster_slave and
  2288. $cluster->{'name'} eq 'Slave');
  2289. # If test needs this cluster, check it was installed ok
  2290. if ( !$cluster->{'installed_ok'} )
  2291. {
  2292. mtr_tofile($path_timefile,
  2293. "Test marked as failed because $cluster->{'name'} " .
  2294. "was not installed ok!");
  2295. mtr_report_test_name($tinfo);
  2296. mtr_report_test_failed($tinfo);
  2297. return 1;
  2298. }
  2299. }
  2300. }
  2301. return 0;
  2302. }
  2303. sub do_before_run_mysqltest($)
  2304. {
  2305. my $tinfo= shift;
  2306. my $tname= $tinfo->{'name'};
  2307. # Remove old files produced by mysqltest
  2308. my $result_dir= "r";
  2309. if ( $opt_suite ne "main" )
  2310. {
  2311. $result_dir= "suite/$opt_suite/r";
  2312. }
  2313. unlink("$result_dir/$tname.reject");
  2314. unlink("$result_dir/$tname.progress");
  2315. unlink("$result_dir/$tname.log");
  2316. unlink("$result_dir/$tname.warnings");
  2317. mtr_tonewfile($path_current_test_log,"$tname\n"); # Always tell where we are
  2318. # output current test to ndbcluster log file to enable diagnostics
  2319. mtr_tofile($path_ndb_testrun_log,"CURRENT TEST $tname\n");
  2320. mtr_tofile($master->[0]->{'path_myerr'},"CURRENT_TEST: $tname\n");
  2321. if ( $master->[1]->{'pid'} )
  2322. {
  2323. mtr_tofile($master->[1]->{'path_myerr'},"CURRENT_TEST: $tname\n");
  2324. }
  2325. if ( $mysql_version_id < 50000 )
  2326. {
  2327. # Set envirnoment variable NDB_STATUS_OK to 1
  2328. # if script decided to run mysqltest cluster _is_ installed ok
  2329. $ENV{'NDB_STATUS_OK'} = "1";
  2330. }
  2331. elsif ( $mysql_version_id < 50100 )
  2332. {
  2333. # Set envirnoment variable NDB_STATUS_OK to YES
  2334. # if script decided to run mysqltest cluster _is_ installed ok
  2335. $ENV{'NDB_STATUS_OK'} = "YES";
  2336. }
  2337. }
  2338. sub do_after_run_mysqltest($)
  2339. {
  2340. my $tinfo= shift;
  2341. my $tname= $tinfo->{'name'};
  2342. mtr_tofile($path_mysqltest_log,"CURRENT TEST $tname\n");
  2343. # Save info from this testcase run to mysqltest.log
  2344. mtr_appendfile_to_file($path_timefile, $path_mysqltest_log)
  2345. if -f $path_timefile;
  2346. # Remove the file that mysqltest writes info to
  2347. unlink($path_timefile);
  2348. }
  2349. ##############################################################################
  2350. #
  2351. # Run a single test case
  2352. #
  2353. ##############################################################################
  2354. # When we get here, we have already filtered out test cases that doesn't
  2355. # apply to the current setup, for example if we use a running server, test
  2356. # cases that restart the server are dropped. So this function should mostly
  2357. # be about doing things, not a lot of logic.
  2358. # We don't start and kill the servers for each testcase. But some
  2359. # testcases needs a restart, because they specify options to start
  2360. # mysqld with. After that testcase, we need to restart again, to set
  2361. # back the normal options.
  2362. sub run_testcase ($) {
  2363. my $tinfo= shift;
  2364. my $master_restart= run_testcase_need_master_restart($tinfo);
  2365. my $slave_restart= run_testcase_need_slave_restart($tinfo);
  2366. if ($master_restart or $slave_restart)
  2367. {
  2368. # Can't restart a running server that may be in use
  2369. if ( $glob_use_running_server )
  2370. {
  2371. $tinfo->{'skip'}= 1;
  2372. $tinfo->{'comment'}= "Can't restart a running server";
  2373. mtr_report_test_name($tinfo);
  2374. mtr_report_test_skipped($tinfo);
  2375. return;
  2376. }
  2377. run_testcase_stop_servers($tinfo, $master_restart, $slave_restart);
  2378. }
  2379. my $died= mtr_record_dead_children();
  2380. if ($died or $master_restart or $slave_restart)
  2381. {
  2382. if (run_testcase_start_servers($tinfo))
  2383. {
  2384. mtr_report_test_name($tinfo);
  2385. report_failure_and_restart($tinfo);
  2386. return 1;
  2387. }
  2388. }
  2389. # ----------------------------------------------------------------------
  2390. # If --start-and-exit or --start-dirty given, stop here to let user manually
  2391. # run tests
  2392. # ----------------------------------------------------------------------
  2393. if ( $opt_start_and_exit or $opt_start_dirty )
  2394. {
  2395. mtr_report("\nServers started, exiting");
  2396. exit(0);
  2397. }
  2398. {
  2399. do_before_run_mysqltest($tinfo);
  2400. my $res= run_mysqltest($tinfo);
  2401. mtr_report_test_name($tinfo);
  2402. if ( $res == 0 )
  2403. {
  2404. mtr_report_test_passed($tinfo);
  2405. }
  2406. elsif ( $res == 62 )
  2407. {
  2408. # Testcase itself tell us to skip this one
  2409. # Try to get reason from mysqltest.log
  2410. my $last_line= mtr_lastlinefromfile($path_timefile) if -f $path_timefile;
  2411. my $reason= mtr_match_prefix($last_line, "reason: ");
  2412. $tinfo->{'comment'}=
  2413. defined $reason ? $reason : "Detected by testcase(reason unknown) ";
  2414. mtr_report_test_skipped($tinfo);
  2415. }
  2416. elsif ( $res == 63 )
  2417. {
  2418. $tinfo->{'timeout'}= 1; # Mark as timeout
  2419. report_failure_and_restart($tinfo);
  2420. }
  2421. else
  2422. {
  2423. # Test case failed, if in control mysqltest returns 1
  2424. if ( $res != 1 )
  2425. {
  2426. mtr_tofile($path_timefile,
  2427. "mysqltest returned unexpected code $res, " .
  2428. "it has probably crashed");
  2429. }
  2430. report_failure_and_restart($tinfo);
  2431. }
  2432. do_after_run_mysqltest($tinfo);
  2433. }
  2434. # ----------------------------------------------------------------------
  2435. # Stop Instance Manager if we are processing an IM-test case.
  2436. # ----------------------------------------------------------------------
  2437. if ( $tinfo->{'component_id'} eq 'im' and
  2438. mtr_im_stop($instance_manager, $tinfo->{'name'}) != 0 )
  2439. {
  2440. mtr_error("Failed to stop Instance Manager.")
  2441. }
  2442. }
  2443. #
  2444. # Save a snapshot of the installed test db(s)
  2445. # I.e take a snapshot of the var/ dir
  2446. #
  2447. sub save_installed_db () {
  2448. mtr_report("Saving snapshot of installed databases");
  2449. rmtree($path_snapshot);
  2450. foreach my $data_dir (@data_dir_lst)
  2451. {
  2452. my $name= basename($data_dir);
  2453. mtr_copy_dir("$data_dir", "$path_snapshot/$name");
  2454. }
  2455. }
  2456. #
  2457. # Save any interesting files in the data_dir
  2458. # before the data dir is removed.
  2459. #
  2460. sub save_files_before_restore($$) {
  2461. my $test_name= shift;
  2462. my $data_dir= shift;
  2463. my $save_name= "$opt_vardir/log/$test_name";
  2464. # Look for core files
  2465. foreach my $core_file ( glob("$data_dir/core*") )
  2466. {
  2467. my $core_name= basename($core_file);
  2468. mtr_report("Saving $core_name");
  2469. mkdir($save_name) if ! -d $save_name;
  2470. rename("$core_file", "$save_name/$core_name");
  2471. }
  2472. }
  2473. #
  2474. # Restore snapshot of the installed test db(s)
  2475. # if the snapshot exists
  2476. #
  2477. sub restore_installed_db ($) {
  2478. my $test_name= shift;
  2479. if ( -d $path_snapshot)
  2480. {
  2481. mtr_report("Restoring snapshot of databases");
  2482. foreach my $data_dir (@data_dir_lst)
  2483. {
  2484. my $name= basename($data_dir);
  2485. save_files_before_restore($test_name, $data_dir);
  2486. rmtree("$data_dir");
  2487. mtr_copy_dir("$path_snapshot/$name", "$data_dir");
  2488. }
  2489. # Remove the ndb_*_fs dirs for all ndbd nodes
  2490. # forcing a clean start of ndb
  2491. foreach my $cluster (@{$clusters})
  2492. {
  2493. foreach my $ndbd (@{$cluster->{'ndbds'}})
  2494. {
  2495. rmtree("$ndbd->{'path_fs'}" );
  2496. }
  2497. }
  2498. }
  2499. else
  2500. {
  2501. # No snapshot existed
  2502. mtr_error("No snapshot existed");
  2503. }
  2504. }
  2505. sub report_failure_and_restart ($) {
  2506. my $tinfo= shift;
  2507. mtr_report_test_failed($tinfo);
  2508. mtr_show_failed_diff($tinfo->{'name'});
  2509. print "\n";
  2510. if ( $opt_force )
  2511. {
  2512. # Stop all servers that are known to be running
  2513. stop_all_servers();
  2514. # Restore the snapshot of the installed test db
  2515. restore_installed_db($tinfo->{'name'});
  2516. print "Resuming Tests\n\n";
  2517. return;
  2518. }
  2519. my $test_mode= join(" ", @::glob_test_mode) || "default";
  2520. print "Aborting: $tinfo->{'name'} failed in $test_mode mode. ";
  2521. print "To continue, re-run with '--force'.\n";
  2522. if ( ! $glob_debugger and
  2523. ! $glob_use_running_server and
  2524. ! $glob_use_embedded_server )
  2525. {
  2526. stop_all_servers();
  2527. }
  2528. mtr_exit(1);
  2529. }
  2530. ##############################################################################
  2531. #
  2532. # Start and stop servers
  2533. #
  2534. ##############################################################################
  2535. sub do_before_start_master ($) {
  2536. my ($tinfo)= @_;
  2537. my $tname= $tinfo->{'name'};
  2538. my $init_script= $tinfo->{'master_sh'};
  2539. # FIXME what about second master.....
  2540. foreach my $bin ( glob("$opt_vardir/log/master*-bin*") )
  2541. {
  2542. unlink($bin);
  2543. }
  2544. # FIXME only remove the ones that are tied to this master
  2545. # Remove old master.info and relay-log.info files
  2546. unlink("$master->[0]->{'path_myddir'}/master.info");
  2547. unlink("$master->[0]->{'path_myddir'}/relay-log.info");
  2548. unlink("$master->[1]->{'path_myddir'}/master.info");
  2549. unlink("$master->[1]->{'path_myddir'}/relay-log.info");
  2550. # Run master initialization shell script if one exists
  2551. if ( $init_script )
  2552. {
  2553. my $ret= mtr_run("/bin/sh", [$init_script], "", "", "", "");
  2554. if ( $ret != 0 )
  2555. {
  2556. # FIXME rewrite those scripts to return 0 if successful
  2557. # mtr_warning("$init_script exited with code $ret");
  2558. }
  2559. }
  2560. }
  2561. sub do_before_start_slave ($) {
  2562. my ($tinfo)= @_;
  2563. my $tname= $tinfo->{'name'};
  2564. my $init_script= $tinfo->{'master_sh'};
  2565. foreach my $bin ( glob("$opt_vardir/log/slave*-bin*") )
  2566. {
  2567. unlink($bin);
  2568. }
  2569. unlink("$slave->[0]->{'path_myddir'}/master.info");
  2570. unlink("$slave->[0]->{'path_myddir'}/relay-log.info");
  2571. # Run slave initialization shell script if one exists
  2572. if ( $init_script )
  2573. {
  2574. my $ret= mtr_run("/bin/sh", [$init_script], "", "", "", "");
  2575. if ( $ret != 0 )
  2576. {
  2577. # FIXME rewrite those scripts to return 0 if successful
  2578. # mtr_warning("$init_script exited with code $ret");
  2579. }
  2580. }
  2581. foreach my $bin ( glob("$slave->[0]->{'path_myddir'}/log.*") )
  2582. {
  2583. unlink($bin);
  2584. }
  2585. }
  2586. sub mysqld_arguments ($$$$$) {
  2587. my $args= shift;
  2588. my $type= shift;
  2589. my $idx= shift;
  2590. my $extra_opt= shift;
  2591. my $slave_master_info= shift;
  2592. my $sidx= ""; # Index as string, 0 is empty string
  2593. if ( $idx > 0 )
  2594. {
  2595. $sidx= "$idx";
  2596. }
  2597. my $prefix= ""; # If mysqltest server arg
  2598. if ( $glob_use_embedded_server )
  2599. {
  2600. $prefix= "--server-arg=";
  2601. } else {
  2602. # We can't pass embedded server --no-defaults
  2603. mtr_add_arg($args, "%s--no-defaults", $prefix);
  2604. }
  2605. mtr_add_arg($args, "%s--console", $prefix);
  2606. mtr_add_arg($args, "%s--basedir=%s", $prefix, $path_my_basedir);
  2607. mtr_add_arg($args, "%s--character-sets-dir=%s", $prefix, $path_charsetsdir);
  2608. if ( $mysql_version_id >= 50000 )
  2609. {
  2610. mtr_add_arg($args, "%s--log-bin-trust-function-creators", $prefix);
  2611. }
  2612. mtr_add_arg($args, "%s--default-character-set=latin1", $prefix);
  2613. mtr_add_arg($args, "%s--language=%s", $prefix, $path_language);
  2614. mtr_add_arg($args, "%s--tmpdir=$opt_tmpdir", $prefix);
  2615. if ( $opt_valgrind_mysqld )
  2616. {
  2617. mtr_add_arg($args, "%s--skip-safemalloc", $prefix);
  2618. }
  2619. my $pidfile;
  2620. if ( $type eq 'master' )
  2621. {
  2622. my $id= $idx > 0 ? $idx + 101 : 1;
  2623. if (! $opt_skip_master_binlog)
  2624. {
  2625. mtr_add_arg($args, "%s--log-bin=%s/log/master-bin%s", $prefix,
  2626. $opt_vardir, $sidx);
  2627. }
  2628. mtr_add_arg($args, "%s--pid-file=%s", $prefix,
  2629. $master->[$idx]->{'path_pid'});
  2630. mtr_add_arg($args, "%s--port=%d", $prefix,
  2631. $master->[$idx]->{'port'});
  2632. mtr_add_arg($args, "%s--server-id=%d", $prefix, $id);
  2633. mtr_add_arg($args, "%s--socket=%s", $prefix,
  2634. $master->[$idx]->{'path_sock'});
  2635. mtr_add_arg($args, "%s--innodb_data_file_path=ibdata1:10M:autoextend", $prefix);
  2636. mtr_add_arg($args, "%s--local-infile", $prefix);
  2637. mtr_add_arg($args, "%s--datadir=%s", $prefix,
  2638. $master->[$idx]->{'path_myddir'});
  2639. if ( $idx > 0 or !$use_innodb)
  2640. {
  2641. mtr_add_arg($args, "%s--skip-innodb", $prefix);
  2642. }
  2643. my $cluster= $clusters->[$master->[$idx]->{'cluster'}];
  2644. if ( $opt_skip_ndbcluster ||
  2645. !$cluster->{'pid'})
  2646. {
  2647. mtr_add_arg($args, "%s--skip-ndbcluster", $prefix);
  2648. }
  2649. else
  2650. {
  2651. mtr_add_arg($args, "%s--ndbcluster", $prefix);
  2652. mtr_add_arg($args, "%s--ndb-connectstring=%s", $prefix,
  2653. $cluster->{'connect_string'});
  2654. if ( $mysql_version_id >= 50100 )
  2655. {
  2656. mtr_add_arg($args, "%s--ndb-extra-logging", $prefix);
  2657. }
  2658. }
  2659. }
  2660. if ( $type eq 'slave' )
  2661. {
  2662. my $slave_server_id= 2 + $idx;
  2663. my $slave_rpl_rank= $slave_server_id;
  2664. mtr_add_arg($args, "%s--datadir=%s", $prefix,
  2665. $slave->[$idx]->{'path_myddir'});
  2666. mtr_add_arg($args, "%s--init-rpl-role=slave", $prefix);
  2667. if (! $opt_skip_slave_binlog)
  2668. {
  2669. mtr_add_arg($args, "%s--log-bin=%s/log/slave%s-bin", $prefix,
  2670. $opt_vardir, $sidx); # FIXME use own dir for binlogs
  2671. mtr_add_arg($args, "%s--log-slave-updates", $prefix);
  2672. }
  2673. mtr_add_arg($args, "%s--log=%s", $prefix,
  2674. $slave->[$idx]->{'path_mylog'});
  2675. mtr_add_arg($args, "%s--master-retry-count=10", $prefix);
  2676. mtr_add_arg($args, "%s--pid-file=%s", $prefix,
  2677. $slave->[$idx]->{'path_pid'});
  2678. mtr_add_arg($args, "%s--port=%d", $prefix,
  2679. $slave->[$idx]->{'port'});
  2680. mtr_add_arg($args, "%s--relay-log=%s/log/slave%s-relay-bin", $prefix,
  2681. $opt_vardir, $sidx);
  2682. mtr_add_arg($args, "%s--report-host=127.0.0.1", $prefix);
  2683. mtr_add_arg($args, "%s--report-port=%d", $prefix,
  2684. $slave->[$idx]->{'port'});
  2685. mtr_add_arg($args, "%s--report-user=root", $prefix);
  2686. mtr_add_arg($args, "%s--skip-innodb", $prefix);
  2687. mtr_add_arg($args, "%s--skip-ndbcluster", $prefix);
  2688. mtr_add_arg($args, "%s--skip-slave-start", $prefix);
  2689. # Directory where slaves find the dumps generated by "load data"
  2690. # on the server. The path need to have constant length otherwise
  2691. # test results will vary, thus a relative path is used.
  2692. my $slave_load_path= "../tmp";
  2693. mtr_add_arg($args, "%s--slave-load-tmpdir=%s", $prefix,
  2694. $slave_load_path);
  2695. mtr_add_arg($args, "%s--socket=%s", $prefix,
  2696. $slave->[$idx]->{'path_sock'});
  2697. mtr_add_arg($args, "%s--set-variable=slave_net_timeout=10", $prefix);
  2698. if ( @$slave_master_info )
  2699. {
  2700. foreach my $arg ( @$slave_master_info )
  2701. {
  2702. mtr_add_arg($args, "%s%s", $prefix, $arg);
  2703. }
  2704. }
  2705. else
  2706. {
  2707. mtr_add_arg($args, "%s--master-user=root", $prefix);
  2708. mtr_add_arg($args, "%s--master-connect-retry=1", $prefix);
  2709. mtr_add_arg($args, "%s--master-host=127.0.0.1", $prefix);
  2710. mtr_add_arg($args, "%s--master-password=", $prefix);
  2711. mtr_add_arg($args, "%s--master-port=%d", $prefix,
  2712. $master->[0]->{'port'}); # First master
  2713. mtr_add_arg($args, "%s--server-id=%d", $prefix, $slave_server_id);
  2714. mtr_add_arg($args, "%s--rpl-recovery-rank=%d", $prefix, $slave_rpl_rank);
  2715. }
  2716. if ( $opt_skip_ndbcluster_slave ||
  2717. $slave->[$idx]->{'cluster'} == -1 ||
  2718. !$clusters->[$slave->[$idx]->{'cluster'}]->{'pid'} )
  2719. {
  2720. mtr_add_arg($args, "%s--skip-ndbcluster", $prefix);
  2721. }
  2722. else
  2723. {
  2724. mtr_add_arg($args, "%s--ndbcluster", $prefix);
  2725. mtr_add_arg($args, "%s--ndb-connectstring=%s", $prefix,
  2726. $clusters->[$slave->[$idx]->{'cluster'}]->{'connect_string'});
  2727. if ( $mysql_version_id >= 50100 )
  2728. {
  2729. mtr_add_arg($args, "%s--ndb-extra-logging", $prefix);
  2730. }
  2731. }
  2732. } # end slave
  2733. if ( $opt_debug )
  2734. {
  2735. if ( $type eq 'master' )
  2736. {
  2737. mtr_add_arg($args, "%s--debug=d:t:i:A,%s/log/master%s.trace",
  2738. $prefix, $path_vardir_trace, $sidx);
  2739. }
  2740. if ( $type eq 'slave' )
  2741. {
  2742. mtr_add_arg($args, "%s--debug=d:t:i:A,%s/log/slave%s.trace",
  2743. $prefix, $path_vardir_trace, $sidx);
  2744. }
  2745. }
  2746. # FIXME always set nowdays??? SMALL_SERVER
  2747. mtr_add_arg($args, "%s--key_buffer_size=1M", $prefix);
  2748. mtr_add_arg($args, "%s--sort_buffer=256K", $prefix);
  2749. mtr_add_arg($args, "%s--max_heap_table_size=1M", $prefix);
  2750. if ( $opt_ssl_supported )
  2751. {
  2752. mtr_add_arg($args, "%s--ssl-ca=%s/std_data/cacert.pem", $prefix,
  2753. $glob_mysql_test_dir);
  2754. mtr_add_arg($args, "%s--ssl-cert=%s/std_data/server-cert.pem", $prefix,
  2755. $glob_mysql_test_dir);
  2756. mtr_add_arg($args, "%s--ssl-key=%s/std_data/server-key.pem", $prefix,
  2757. $glob_mysql_test_dir);
  2758. }
  2759. if ( $opt_warnings )
  2760. {
  2761. mtr_add_arg($args, "%s--log-warnings", $prefix);
  2762. }
  2763. # Indicate to "mysqld" it will be debugged in debugger
  2764. if ( $glob_debugger )
  2765. {
  2766. mtr_add_arg($args, "%s--gdb", $prefix);
  2767. }
  2768. # If we should run all tests cases, we will use a local server for that
  2769. if ( -w "/" )
  2770. {
  2771. # We are running as root; We need to add the --root argument
  2772. mtr_add_arg($args, "%s--user=root", $prefix);
  2773. }
  2774. my $found_skip_core= 0;
  2775. foreach my $arg ( @opt_extra_mysqld_opt, @$extra_opt )
  2776. {
  2777. # Allow --skip-core-file to be set in master.opt file
  2778. if ($arg eq "--skip-core-file")
  2779. {
  2780. $found_skip_core= 1;
  2781. }
  2782. else
  2783. {
  2784. mtr_add_arg($args, "%s%s", $prefix, $arg);
  2785. }
  2786. }
  2787. if ( !$found_skip_core )
  2788. {
  2789. mtr_add_arg($args, "%s%s", $prefix, "--core-file");
  2790. }
  2791. if ( $opt_bench )
  2792. {
  2793. mtr_add_arg($args, "%s--rpl-recovery-rank=1", $prefix);
  2794. mtr_add_arg($args, "%s--init-rpl-role=master", $prefix);
  2795. }
  2796. elsif ( $type eq 'master' )
  2797. {
  2798. mtr_add_arg($args, "%s--open-files-limit=1024", $prefix);
  2799. mtr_add_arg($args, "%s--log=%s", $prefix, $master->[0]->{'path_mylog'});
  2800. }
  2801. return $args;
  2802. }
  2803. ##############################################################################
  2804. #
  2805. # Start mysqld and return the PID
  2806. #
  2807. ##############################################################################
  2808. sub mysqld_start ($$$) {
  2809. my $mysqld= shift;
  2810. my $extra_opt= shift;
  2811. my $slave_master_info= shift;
  2812. my $args; # Arg vector
  2813. my $exe;
  2814. my $pid= -1;
  2815. my $wait_for_pid_file= 1;
  2816. my $type= $mysqld->{'type'};
  2817. my $idx= $mysqld->{'idx'};
  2818. if ( $type eq 'master' )
  2819. {
  2820. $exe= $exe_master_mysqld;
  2821. }
  2822. elsif ( $type eq 'slave' )
  2823. {
  2824. $exe= $exe_slave_mysqld;
  2825. }
  2826. else
  2827. {
  2828. mtr_error("Unknown 'type' \"$type\" passed to mysqld_start");
  2829. }
  2830. mtr_init_args(\$args);
  2831. if ( $opt_valgrind_mysqld )
  2832. {
  2833. valgrind_arguments($args, \$exe);
  2834. }
  2835. mysqld_arguments($args,$type,$idx,$extra_opt,$slave_master_info);
  2836. if ( $opt_gdb || $opt_manual_gdb)
  2837. {
  2838. gdb_arguments(\$args, \$exe, "$type"."_$idx");
  2839. }
  2840. elsif ( $opt_ddd || $opt_manual_ddd )
  2841. {
  2842. ddd_arguments(\$args, \$exe, "$type"."_$idx");
  2843. }
  2844. elsif ( $opt_debugger )
  2845. {
  2846. debugger_arguments(\$args, \$exe, "$type"."_$idx");
  2847. }
  2848. elsif ( $opt_manual_debug )
  2849. {
  2850. print "\nStart $type in your debugger\n" .
  2851. "dir: $glob_mysql_test_dir\n" .
  2852. "exe: $exe\n" .
  2853. "args: " . join(" ", @$args) . "\n\n" .
  2854. "Waiting ....\n";
  2855. # Indicate the exe should not be started
  2856. $exe= undef;
  2857. }
  2858. else
  2859. {
  2860. # Default to not wait until pid file has been created
  2861. $wait_for_pid_file= 0;
  2862. }
  2863. if ($exe_libtool and $opt_valgrind)
  2864. {
  2865. # Add "libtool --mode-execute"
  2866. # if running in valgrind(to avoid valgrinding bash)
  2867. unshift(@$args, "--mode=execute", $exe);
  2868. $exe= $exe_libtool;
  2869. }
  2870. if ( defined $exe )
  2871. {
  2872. $pid= mtr_spawn($exe, $args, "",
  2873. $mysqld->{'path_myerr'},
  2874. $mysqld->{'path_myerr'},
  2875. "",
  2876. { append_log_file => 1 });
  2877. }
  2878. if ( $wait_for_pid_file && !sleep_until_file_created($mysqld->{'path_pid'},
  2879. $mysqld->{'start_timeout'},
  2880. $pid))
  2881. {
  2882. mtr_error("Failed to start mysqld $mysqld->{'type'}");
  2883. }
  2884. # Remember pid of the started process
  2885. $mysqld->{'pid'}= $pid;
  2886. # Remember options used when starting
  2887. $mysqld->{'start_opts'}= $extra_opt;
  2888. $mysqld->{'start_slave_master_info'}= $slave_master_info;
  2889. mtr_verbose("mysqld pid: $pid");
  2890. return $pid;
  2891. }
  2892. sub stop_all_servers () {
  2893. print "Stopping All Servers\n";
  2894. if ( ! $opt_skip_im )
  2895. {
  2896. print "Shutting-down Instance Manager\n";
  2897. unless (mtr_im_stop($instance_manager, "stop_all_servers"))
  2898. {
  2899. mtr_error("Failed to stop Instance Manager.")
  2900. }
  2901. }
  2902. my %admin_pids; # hash of admin processes that requests shutdown
  2903. my @kill_pids; # list of processes to shutdown/kill
  2904. my $pid;
  2905. # Start shutdown of all started masters
  2906. foreach my $mysqld (@{$master}, @{$slave})
  2907. {
  2908. if ( $mysqld->{'pid'} )
  2909. {
  2910. $pid= mtr_mysqladmin_start($mysqld, "shutdown", 70);
  2911. $admin_pids{$pid}= 1;
  2912. push(@kill_pids,{
  2913. pid => $mysqld->{'pid'},
  2914. pidfile => $mysqld->{'path_pid'},
  2915. sockfile => $mysqld->{'path_sock'},
  2916. port => $mysqld->{'port'},
  2917. });
  2918. $mysqld->{'pid'}= 0; # Assume we are done with it
  2919. }
  2920. }
  2921. # Start shutdown of clusters
  2922. foreach my $cluster (@{$clusters})
  2923. {
  2924. if ( $cluster->{'pid'} )
  2925. {
  2926. $pid= mtr_ndbmgm_start($cluster, "shutdown");
  2927. $admin_pids{$pid}= 1;
  2928. push(@kill_pids,{
  2929. pid => $cluster->{'pid'},
  2930. pidfile => $cluster->{'path_pid'}
  2931. });
  2932. $cluster->{'pid'}= 0; # Assume we are done with it
  2933. foreach my $ndbd (@{$cluster->{'ndbds'}})
  2934. {
  2935. if ( $ndbd->{'pid'} )
  2936. {
  2937. push(@kill_pids,{
  2938. pid => $ndbd->{'pid'},
  2939. pidfile => $ndbd->{'path_pid'},
  2940. });
  2941. $ndbd->{'pid'}= 0;
  2942. }
  2943. }
  2944. }
  2945. }
  2946. # Wait blocking until all shutdown processes has completed
  2947. mtr_wait_blocking(\%admin_pids);
  2948. # Make sure that process has shutdown else try to kill them
  2949. mtr_check_stop_servers(\@kill_pids);
  2950. foreach my $mysqld (@{$master}, @{$slave})
  2951. {
  2952. rm_ndbcluster_tables($mysqld->{'path_myddir'});
  2953. }
  2954. }
  2955. sub run_testcase_need_master_restart($)
  2956. {
  2957. my ($tinfo)= @_;
  2958. # We try to find out if we are to restart the master(s)
  2959. my $do_restart= 0; # Assumes we don't have to
  2960. if ( $tinfo->{'master_sh'} )
  2961. {
  2962. $do_restart= 1; # Always restart if script to run
  2963. mtr_verbose("Restart master: Always restart if script to run");
  2964. }
  2965. if ( $tinfo->{'force_restart'} )
  2966. {
  2967. $do_restart= 1; # Always restart if --force-restart in -opt file
  2968. mtr_verbose("Restart master: Restart forced with --force-restart");
  2969. }
  2970. elsif ( ! $opt_skip_ndbcluster and
  2971. $tinfo->{'ndb_test'} == 0 and
  2972. $clusters->[0]->{'pid'} != 0 )
  2973. {
  2974. $do_restart= 1; # Restart without cluster
  2975. mtr_verbose("Restart master: Test does not need cluster");
  2976. }
  2977. elsif ( ! $opt_skip_ndbcluster and
  2978. $tinfo->{'ndb_test'} == 1 and
  2979. $clusters->[0]->{'pid'} == 0 )
  2980. {
  2981. $do_restart= 1; # Restart with cluster
  2982. mtr_verbose("Restart master: Test need cluster");
  2983. }
  2984. elsif( $tinfo->{'component_id'} eq 'im' )
  2985. {
  2986. $do_restart= 1;
  2987. mtr_verbose("Restart master: Always restart for im tests");
  2988. }
  2989. elsif ( $master->[0]->{'running_master_options'} and
  2990. $master->[0]->{'running_master_options'}->{'timezone'} ne
  2991. $tinfo->{'timezone'})
  2992. {
  2993. $do_restart= 1;
  2994. mtr_verbose("Restart master: Different timezone");
  2995. }
  2996. # Check that running master was started with same options
  2997. # as the current test requires
  2998. elsif (! mtr_same_opts($master->[0]->{'start_opts'},
  2999. $tinfo->{'master_opt'}) )
  3000. {
  3001. $do_restart= 1;
  3002. mtr_verbose("Restart master: running with different options '" .
  3003. join(" ", @{$tinfo->{'master_opt'}}) . "' != '" .
  3004. join(" ", @{$master->[0]->{'start_opts'}}) . "'" );
  3005. }
  3006. elsif( ! $master->[0]->{'pid'} )
  3007. {
  3008. $do_restart= 1;
  3009. mtr_verbose("Restart master: master is not started");
  3010. }
  3011. return $do_restart;
  3012. }
  3013. sub run_testcase_need_slave_restart($)
  3014. {
  3015. my ($tinfo)= @_;
  3016. # We try to find out if we are to restart the slaves
  3017. my $do_slave_restart= 0; # Assumes we don't have to
  3018. if ( $max_slave_num == 0)
  3019. {
  3020. mtr_verbose("Skip slave restart: No testcase use slaves");
  3021. }
  3022. else
  3023. {
  3024. # Check if any slave is currently started
  3025. my $any_slave_started= 0;
  3026. foreach my $mysqld (@{$slave})
  3027. {
  3028. if ( $mysqld->{'pid'} )
  3029. {
  3030. $any_slave_started= 1;
  3031. last;
  3032. }
  3033. }
  3034. if ($any_slave_started)
  3035. {
  3036. mtr_verbose("Restart slave: Slave is started, always restart");
  3037. $do_slave_restart= 1;
  3038. }
  3039. elsif ( $tinfo->{'slave_num'} )
  3040. {
  3041. mtr_verbose("Restart slave: Test need slave");
  3042. $do_slave_restart= 1;
  3043. }
  3044. }
  3045. return $do_slave_restart;
  3046. }
  3047. # ----------------------------------------------------------------------
  3048. # If not using a running servers we may need to stop and restart.
  3049. # We restart in the case we have initiation scripts, server options
  3050. # etc to run. But we also restart again after the test first restart
  3051. # and test is run, to get back to normal server settings.
  3052. #
  3053. # To make the code a bit more clean, we actually only stop servers
  3054. # here, and mark this to be done. Then a generic "start" part will
  3055. # start up the needed servers again.
  3056. # ----------------------------------------------------------------------
  3057. sub run_testcase_stop_servers($$$) {
  3058. my ($tinfo, $do_restart, $do_slave_restart)= @_;
  3059. my $pid;
  3060. my %admin_pids; # hash of admin processes that requests shutdown
  3061. my @kill_pids; # list of processes to shutdown/kill
  3062. # Remember if we restarted for this test case (count restarts)
  3063. $tinfo->{'restarted'}= $do_restart;
  3064. if ( $do_restart )
  3065. {
  3066. delete $master->[0]->{'running_master_options'}; # Forget history
  3067. # Start shutdown of all started masters
  3068. foreach my $mysqld (@{$master})
  3069. {
  3070. if ( $mysqld->{'pid'} )
  3071. {
  3072. $pid= mtr_mysqladmin_start($mysqld, "shutdown", 70);
  3073. $admin_pids{$pid}= 1;
  3074. push(@kill_pids,{
  3075. pid => $mysqld->{'pid'},
  3076. pidfile => $mysqld->{'path_pid'},
  3077. sockfile => $mysqld->{'path_sock'},
  3078. port => $mysqld->{'port'},
  3079. });
  3080. $mysqld->{'pid'}= 0; # Assume we are done with it
  3081. }
  3082. }
  3083. # Start shutdown of master cluster
  3084. my $cluster= $clusters->[0];
  3085. if ( $cluster->{'pid'} )
  3086. {
  3087. $pid= mtr_ndbmgm_start($cluster, "shutdown");
  3088. $admin_pids{$pid}= 1;
  3089. push(@kill_pids,{
  3090. pid => $cluster->{'pid'},
  3091. pidfile => $cluster->{'path_pid'}
  3092. });
  3093. $cluster->{'pid'}= 0; # Assume we are done with it
  3094. foreach my $ndbd (@{$cluster->{'ndbds'}})
  3095. {
  3096. push(@kill_pids,{
  3097. pid => $ndbd->{'pid'},
  3098. pidfile => $ndbd->{'path_pid'},
  3099. });
  3100. $ndbd->{'pid'}= 0; # Assume we are done with it
  3101. }
  3102. }
  3103. }
  3104. if ( $do_restart || $do_slave_restart )
  3105. {
  3106. delete $slave->[0]->{'running_slave_options'}; # Forget history
  3107. # Start shutdown of all started slaves
  3108. foreach my $mysqld (@{$slave})
  3109. {
  3110. if ( $mysqld->{'pid'} )
  3111. {
  3112. $pid= mtr_mysqladmin_start($mysqld, "shutdown", 70);
  3113. $admin_pids{$pid}= 1;
  3114. push(@kill_pids,{
  3115. pid => $mysqld->{'pid'},
  3116. pidfile => $mysqld->{'path_pid'},
  3117. sockfile => $mysqld->{'path_sock'},
  3118. port => $mysqld->{'port'},
  3119. });
  3120. $mysqld->{'pid'}= 0; # Assume we are done with it
  3121. }
  3122. }
  3123. # Start shutdown of slave cluster
  3124. my $cluster= $clusters->[1];
  3125. if ( $cluster->{'pid'} )
  3126. {
  3127. $pid= mtr_ndbmgm_start($cluster, "shutdown");
  3128. $admin_pids{$pid}= 1;
  3129. push(@kill_pids,{
  3130. pid => $cluster->{'pid'},
  3131. pidfile => $cluster->{'path_pid'}
  3132. });
  3133. $cluster->{'pid'}= 0; # Assume we are done with it
  3134. foreach my $ndbd (@{$cluster->{'ndbds'}} )
  3135. {
  3136. push(@kill_pids,{
  3137. pid => $ndbd->{'pid'},
  3138. pidfile => $ndbd->{'path_pid'},
  3139. });
  3140. $ndbd->{'pid'}= 0; # Assume we are done with it
  3141. }
  3142. }
  3143. }
  3144. # ----------------------------------------------------------------------
  3145. # Shutdown has now been started and lists for the shutdown processes
  3146. # and the processes to be killed has been created
  3147. # ----------------------------------------------------------------------
  3148. # Wait blocking until all shutdown processes has completed
  3149. mtr_wait_blocking(\%admin_pids);
  3150. # Make sure that process has shutdown else try to kill them
  3151. mtr_check_stop_servers(\@kill_pids);
  3152. foreach my $mysqld (@{$master}, @{$slave})
  3153. {
  3154. if ( ! $mysqld->{'pid'} )
  3155. {
  3156. # Remove ndbcluster tables if server is stopped
  3157. rm_ndbcluster_tables($mysqld->{'path_myddir'});
  3158. }
  3159. }
  3160. }
  3161. #
  3162. # run_testcase_start_servers
  3163. #
  3164. # Start the servers neede by this test case
  3165. #
  3166. # RETURN
  3167. # 0 OK
  3168. # 1 Start failed
  3169. #
  3170. sub run_testcase_start_servers($) {
  3171. my $tinfo= shift;
  3172. my $tname= $tinfo->{'name'};
  3173. # -------------------------------------------------------
  3174. # Init variables that can change between server starts
  3175. # -------------------------------------------------------
  3176. $ENV{'TZ'}= $tinfo->{'timezone'};
  3177. mtr_verbose("Starting server with timezone: $tinfo->{'timezone'}");
  3178. if ( $tinfo->{'component_id'} eq 'mysqld' )
  3179. {
  3180. if ( ! $opt_skip_ndbcluster and
  3181. !$clusters->[0]->{'pid'} and
  3182. $tinfo->{'ndb_test'} )
  3183. {
  3184. # Test need cluster, cluster is not started, start it
  3185. ndbcluster_start($clusters->[0], "");
  3186. }
  3187. if ( !$master->[0]->{'pid'} )
  3188. {
  3189. # Master mysqld is not started
  3190. do_before_start_master($tinfo);
  3191. mysqld_start($master->[0],$tinfo->{'master_opt'},[]);
  3192. }
  3193. if ( $clusters->[0]->{'pid'} and ! $master->[1]->{'pid'} )
  3194. {
  3195. # Test needs cluster, start an extra mysqld connected to cluster
  3196. if ( $mysql_version_id >= 50100 )
  3197. {
  3198. # First wait for first mysql server to have created ndb system
  3199. # tables ok FIXME This is a workaround so that only one mysqld
  3200. # create the tables
  3201. if ( ! sleep_until_file_created(
  3202. "$master->[0]->{'path_myddir'}/cluster/apply_status.ndb",
  3203. $master->[0]->{'start_timeout'},
  3204. $master->[0]->{'pid'}))
  3205. {
  3206. $tinfo->{'comment'}= "Failed to create 'cluster/apply_status' table";
  3207. return 1;
  3208. }
  3209. }
  3210. mtr_tofile($master->[1]->{'path_myerr'},"CURRENT_TEST: $tname\n");
  3211. mysqld_start($master->[1],$tinfo->{'master_opt'},[]);
  3212. }
  3213. # Save this test case information, so next can examine it
  3214. $master->[0]->{'running_master_options'}= $tinfo;
  3215. }
  3216. elsif ( ! $opt_skip_im and $tinfo->{'component_id'} eq 'im' )
  3217. {
  3218. # We have to create defaults file every time, in order to ensure that it
  3219. # will be the same for each test. The problem is that test can change the
  3220. # file (by SET/UNSET commands), so w/o recreating the file, execution of
  3221. # one test can affect the other.
  3222. im_create_defaults_file($instance_manager);
  3223. if ( ! mtr_im_start($instance_manager, $tinfo->{im_opts}) )
  3224. {
  3225. $tinfo->{'comment'}= "Failed to start Instance Manager. ";
  3226. return 1;
  3227. }
  3228. }
  3229. # ----------------------------------------------------------------------
  3230. # Start slaves - if needed
  3231. # ----------------------------------------------------------------------
  3232. if ( $tinfo->{'slave_num'} )
  3233. {
  3234. mtr_tofile($slave->[0]->{'path_myerr'},"CURRENT_TEST: $tname\n");
  3235. restore_slave_databases($tinfo->{'slave_num'});
  3236. do_before_start_slave($tinfo);
  3237. if ( ! $opt_skip_ndbcluster_slave and
  3238. !$clusters->[1]->{'pid'} and
  3239. $tinfo->{'ndb_test'} )
  3240. {
  3241. # Test need slave cluster, cluster is not started, start it
  3242. ndbcluster_start($clusters->[1], "");
  3243. }
  3244. for ( my $idx= 0; $idx < $tinfo->{'slave_num'}; $idx++ )
  3245. {
  3246. if ( ! $slave->[$idx]->{'pid'} )
  3247. {
  3248. mysqld_start($slave->[$idx],$tinfo->{'slave_opt'},
  3249. $tinfo->{'slave_mi'});
  3250. }
  3251. }
  3252. # Save this test case information, so next can examine it
  3253. $slave->[0]->{'running_slave_options'}= $tinfo;
  3254. }
  3255. # Wait for clusters to start
  3256. foreach my $cluster (@{$clusters})
  3257. {
  3258. next if !$cluster->{'pid'};
  3259. if (ndbcluster_wait_started($cluster, ""))
  3260. {
  3261. # failed to start
  3262. $tinfo->{'comment'}= "Start of $cluster->{'name'} cluster failed";
  3263. return 1;
  3264. }
  3265. }
  3266. # Wait for mysqld's to start
  3267. foreach my $mysqld (@{$master},@{$slave})
  3268. {
  3269. next if !$mysqld->{'pid'};
  3270. if (mysqld_wait_started($mysqld))
  3271. {
  3272. # failed to start
  3273. $tinfo->{'comment'}=
  3274. "Failed to start $mysqld->{'type'} mysqld $mysqld->{'idx'}";
  3275. return 1;
  3276. }
  3277. }
  3278. return 0;
  3279. }
  3280. #
  3281. # Run include/check-testcase.test
  3282. # Before a testcase, run in record mode, save result file to var
  3283. # After testcase, run and compare with the recorded file, they should be equal!
  3284. #
  3285. # RETURN VALUE
  3286. # 0 OK
  3287. # 1 Check failed
  3288. #
  3289. sub run_check_testcase ($$) {
  3290. my $mode= shift;
  3291. my $mysqld= shift;
  3292. my $name= "check-" . $mysqld->{'type'} . $mysqld->{'idx'};
  3293. my $args;
  3294. mtr_init_args(\$args);
  3295. mtr_add_arg($args, "--no-defaults");
  3296. mtr_add_arg($args, "--silent");
  3297. mtr_add_arg($args, "-v");
  3298. mtr_add_arg($args, "--skip-safemalloc");
  3299. mtr_add_arg($args, "--tmpdir=%s", $opt_tmpdir);
  3300. mtr_add_arg($args, "--socket=%s", $mysqld->{'path_sock'});
  3301. mtr_add_arg($args, "--port=%d", $mysqld->{'port'});
  3302. mtr_add_arg($args, "--database=test");
  3303. mtr_add_arg($args, "--user=%s", $opt_user);
  3304. mtr_add_arg($args, "--password=");
  3305. mtr_add_arg($args, "-R");
  3306. mtr_add_arg($args, "$opt_vardir/tmp/$name.result");
  3307. if ( $mode eq "before" )
  3308. {
  3309. mtr_add_arg($args, "--record");
  3310. }
  3311. my $res = mtr_run_test($exe_mysqltest,$args,
  3312. "include/check-testcase.test", "", "", "");
  3313. if ( $res == 1 and $mode eq "after")
  3314. {
  3315. mtr_run("diff",["-u",
  3316. "$opt_vardir/tmp/$name.result",
  3317. "$opt_vardir/tmp/$name.reject"],
  3318. "", "", "", "");
  3319. }
  3320. elsif ( $res )
  3321. {
  3322. mtr_error("Could not execute 'check-testcase' $mode testcase");
  3323. }
  3324. return $res;
  3325. }
  3326. sub run_mysqltest ($) {
  3327. my ($tinfo)= @_;
  3328. my $exe= $exe_mysqltest;
  3329. my $args;
  3330. mtr_init_args(\$args);
  3331. mtr_add_arg($args, "--no-defaults");
  3332. mtr_add_arg($args, "--silent");
  3333. mtr_add_arg($args, "-v");
  3334. mtr_add_arg($args, "--skip-safemalloc");
  3335. mtr_add_arg($args, "--tmpdir=%s", $opt_tmpdir);
  3336. if ($tinfo->{'component_id'} eq 'im')
  3337. {
  3338. mtr_add_arg($args, "--socket=%s", $instance_manager->{'path_sock'});
  3339. mtr_add_arg($args, "--port=%d", $instance_manager->{'port'});
  3340. mtr_add_arg($args, "--user=%s", $instance_manager->{'admin_login'});
  3341. mtr_add_arg($args, "--password=%s", $instance_manager->{'admin_password'});
  3342. }
  3343. else # component_id == mysqld
  3344. {
  3345. mtr_add_arg($args, "--socket=%s", $master->[0]->{'path_sock'});
  3346. mtr_add_arg($args, "--port=%d", $master->[0]->{'port'});
  3347. mtr_add_arg($args, "--database=test");
  3348. mtr_add_arg($args, "--user=%s", $opt_user);
  3349. mtr_add_arg($args, "--password=");
  3350. }
  3351. if ( $opt_ps_protocol )
  3352. {
  3353. mtr_add_arg($args, "--ps-protocol");
  3354. }
  3355. if ( $opt_sp_protocol )
  3356. {
  3357. mtr_add_arg($args, "--sp-protocol");
  3358. }
  3359. if ( $opt_view_protocol )
  3360. {
  3361. mtr_add_arg($args, "--view-protocol");
  3362. }
  3363. if ( $opt_cursor_protocol )
  3364. {
  3365. mtr_add_arg($args, "--cursor-protocol");
  3366. }
  3367. if ( $opt_strace_client )
  3368. {
  3369. $exe= "strace"; # FIXME there are ktrace, ....
  3370. mtr_add_arg($args, "-o");
  3371. mtr_add_arg($args, "%s/log/mysqltest.strace", $opt_vardir);
  3372. mtr_add_arg($args, "$exe_mysqltest");
  3373. }
  3374. if ( $opt_timer )
  3375. {
  3376. mtr_add_arg($args, "--timer-file=%s/log/timer", $opt_vardir);
  3377. }
  3378. if ( $opt_big_test )
  3379. {
  3380. mtr_add_arg($args, "--big-test");
  3381. }
  3382. if ( $opt_compress )
  3383. {
  3384. mtr_add_arg($args, "--compress");
  3385. }
  3386. if ( $opt_sleep )
  3387. {
  3388. mtr_add_arg($args, "--sleep=%d", $opt_sleep);
  3389. }
  3390. if ( $opt_debug )
  3391. {
  3392. mtr_add_arg($args, "--debug=d:t:A,%s/log/mysqltest.trace",
  3393. $path_vardir_trace);
  3394. }
  3395. if ( $opt_ssl_supported )
  3396. {
  3397. mtr_add_arg($args, "--ssl-ca=%s/std_data/cacert.pem",
  3398. $glob_mysql_test_dir);
  3399. mtr_add_arg($args, "--ssl-cert=%s/std_data/client-cert.pem",
  3400. $glob_mysql_test_dir);
  3401. mtr_add_arg($args, "--ssl-key=%s/std_data/client-key.pem",
  3402. $glob_mysql_test_dir);
  3403. }
  3404. if ( $opt_ssl )
  3405. {
  3406. # Turn on SSL for _all_ test cases if option --ssl was used
  3407. mtr_add_arg($args, "--ssl",
  3408. $glob_mysql_test_dir);
  3409. }
  3410. elsif ( $opt_ssl_supported )
  3411. {
  3412. mtr_add_arg($args, "--skip-ssl",
  3413. $glob_mysql_test_dir);
  3414. }
  3415. # ----------------------------------------------------------------------
  3416. # If embedded server, we create server args to give mysqltest to pass on
  3417. # ----------------------------------------------------------------------
  3418. if ( $glob_use_embedded_server )
  3419. {
  3420. mysqld_arguments($args,'master',0,$tinfo->{'master_opt'},[]);
  3421. }
  3422. # ----------------------------------------------------------------------
  3423. # export MYSQL_TEST variable containing <path>/mysqltest <args>
  3424. # ----------------------------------------------------------------------
  3425. $ENV{'MYSQL_TEST'}= "$exe_mysqltest " . join(" ", @$args);
  3426. # ----------------------------------------------------------------------
  3427. # Add arguments that should not go into the MYSQL_TEST env var
  3428. # ----------------------------------------------------------------------
  3429. if ( $opt_valgrind_mysqltest )
  3430. {
  3431. # Prefix the Valgrind options to the argument list.
  3432. # We do this here, since we do not want to Valgrind the nested invocations
  3433. # of mysqltest; that would mess up the stderr output causing test failure.
  3434. my @args_saved = @$args;
  3435. mtr_init_args(\$args);
  3436. valgrind_arguments($args, \$exe);
  3437. mtr_add_arg($args, "%s", $_) for @args_saved;
  3438. }
  3439. mtr_add_arg($args, "--test-file");
  3440. mtr_add_arg($args, $tinfo->{'path'});
  3441. mtr_add_arg($args, "--result-file");
  3442. mtr_add_arg($args, $tinfo->{'result_file'});
  3443. if ( $opt_record )
  3444. {
  3445. mtr_add_arg($args, "--record");
  3446. }
  3447. if ( $opt_client_gdb )
  3448. {
  3449. gdb_arguments(\$args, \$exe, "client");
  3450. }
  3451. elsif ( $opt_client_ddd )
  3452. {
  3453. ddd_arguments(\$args, \$exe, "client");
  3454. }
  3455. elsif ( $opt_client_debugger )
  3456. {
  3457. debugger_arguments(\$args, \$exe, "client");
  3458. }
  3459. if ($exe_libtool and $opt_valgrind)
  3460. {
  3461. # Add "libtool --mode-execute" before the test to execute
  3462. # if running in valgrind(to avoid valgrinding bash)
  3463. unshift(@$args, "--mode=execute", $exe);
  3464. $exe= $exe_libtool;
  3465. }
  3466. if ( $opt_check_testcases )
  3467. {
  3468. foreach my $mysqld (@{$master}, @{$slave})
  3469. {
  3470. if ($mysqld->{'pid'})
  3471. {
  3472. run_check_testcase("before", $mysqld);
  3473. }
  3474. }
  3475. }
  3476. my $res = mtr_run_test($exe,$args,"","",$path_timefile,"");
  3477. if ( $opt_check_testcases )
  3478. {
  3479. foreach my $mysqld (@{$master}, @{$slave})
  3480. {
  3481. if ($mysqld->{'pid'})
  3482. {
  3483. if (run_check_testcase("after", $mysqld))
  3484. {
  3485. # Check failed, mark the test case with that info
  3486. $tinfo->{'check_testcase_failed'}= 1;
  3487. }
  3488. }
  3489. }
  3490. }
  3491. return $res;
  3492. }
  3493. #
  3494. # Modify the exe and args so that program is run in gdb in xterm
  3495. #
  3496. sub gdb_arguments {
  3497. my $args= shift;
  3498. my $exe= shift;
  3499. my $type= shift;
  3500. # Write $args to gdb init file
  3501. my $str= join(" ", @$$args);
  3502. my $gdb_init_file= "$opt_tmpdir/gdbinit.$type";
  3503. # Remove the old gdbinit file
  3504. unlink($gdb_init_file);
  3505. if ( $type eq "client" )
  3506. {
  3507. # write init file for client
  3508. mtr_tofile($gdb_init_file,
  3509. "set args $str\n" .
  3510. "break main\n");
  3511. }
  3512. else
  3513. {
  3514. # write init file for mysqld
  3515. mtr_tofile($gdb_init_file,
  3516. "set args $str\n" .
  3517. "break mysql_parse\n" .
  3518. "commands 1\n" .
  3519. "disable 1\n" .
  3520. "end\n" .
  3521. "run");
  3522. }
  3523. if ( $opt_manual_gdb )
  3524. {
  3525. print "\nTo start gdb for $type, type in another window:\n";
  3526. print "cd $glob_mysql_test_dir;\n";
  3527. print "gdb -x $gdb_init_file $$exe\n";
  3528. # Indicate the exe should not be started
  3529. $$exe= undef;
  3530. return;
  3531. }
  3532. $$args= [];
  3533. mtr_add_arg($$args, "-title");
  3534. mtr_add_arg($$args, "$type");
  3535. mtr_add_arg($$args, "-e");
  3536. if ( $exe_libtool )
  3537. {
  3538. mtr_add_arg($$args, $exe_libtool);
  3539. mtr_add_arg($$args, "--mode=execute");
  3540. }
  3541. mtr_add_arg($$args, "gdb");
  3542. mtr_add_arg($$args, "-x");
  3543. mtr_add_arg($$args, "$gdb_init_file");
  3544. mtr_add_arg($$args, "$$exe");
  3545. $$exe= "xterm";
  3546. }
  3547. #
  3548. # Modify the exe and args so that program is run in ddd
  3549. #
  3550. sub ddd_arguments {
  3551. my $args= shift;
  3552. my $exe= shift;
  3553. my $type= shift;
  3554. # Write $args to ddd init file
  3555. my $str= join(" ", @$$args);
  3556. my $gdb_init_file= "$opt_tmpdir/gdbinit.$type";
  3557. # Remove the old gdbinit file
  3558. unlink($gdb_init_file);
  3559. if ( $type eq "client" )
  3560. {
  3561. # write init file for client
  3562. mtr_tofile($gdb_init_file,
  3563. "set args $str\n" .
  3564. "break main\n");
  3565. }
  3566. else
  3567. {
  3568. # write init file for mysqld
  3569. mtr_tofile($gdb_init_file,
  3570. "file $$exe\n" .
  3571. "set args $str\n" .
  3572. "break mysql_parse\n" .
  3573. "commands 1\n" .
  3574. "disable 1\n" .
  3575. "end");
  3576. }
  3577. if ( $opt_manual_ddd )
  3578. {
  3579. print "\nTo start ddd for $type, type in another window:\n";
  3580. print "cd $glob_mysql_test_dir;\n";
  3581. print "ddd -x $gdb_init_file $$exe\n";
  3582. # Indicate the exe should not be started
  3583. $$exe= undef;
  3584. return;
  3585. }
  3586. my $save_exe= $$exe;
  3587. $$args= [];
  3588. if ( $exe_libtool )
  3589. {
  3590. $$exe= $exe_libtool;
  3591. mtr_add_arg($$args, "--mode=execute");
  3592. mtr_add_arg($$args, "ddd");
  3593. }
  3594. else
  3595. {
  3596. $$exe= "ddd";
  3597. }
  3598. mtr_add_arg($$args, "--command=$gdb_init_file");
  3599. mtr_add_arg($$args, "$save_exe");
  3600. }
  3601. #
  3602. # Modify the exe and args so that program is run in the selected debugger
  3603. #
  3604. sub debugger_arguments {
  3605. my $args= shift;
  3606. my $exe= shift;
  3607. my $debugger= $opt_debugger || $opt_client_debugger;
  3608. # FIXME Need to change the below "eq"'s to
  3609. # "case unsensitive string contains"
  3610. if ( $debugger eq "vcexpress" or $debugger eq "vc")
  3611. {
  3612. # vc[express] /debugexe exe arg1 .. argn
  3613. # Add /debugexe and name of the exe before args
  3614. unshift(@$$args, "/debugexe");
  3615. unshift(@$$args, "$$exe");
  3616. }
  3617. elsif ( $debugger eq "windbg" )
  3618. {
  3619. # windbg exe arg1 .. argn
  3620. # Add name of the exe before args
  3621. unshift(@$$args, "$$exe");
  3622. }
  3623. else
  3624. {
  3625. mtr_error("Unknown argument \"$debugger\" passed to --debugger");
  3626. }
  3627. # Set exe to debuggername
  3628. $$exe= $debugger;
  3629. }
  3630. #
  3631. # Modify the exe and args so that program is run in valgrind
  3632. #
  3633. sub valgrind_arguments {
  3634. my $args= shift;
  3635. my $exe= shift;
  3636. if ( $opt_callgrind)
  3637. {
  3638. mtr_add_arg($args, "--tool=callgrind");
  3639. mtr_add_arg($args, "--base=$opt_vardir/log");
  3640. }
  3641. else
  3642. {
  3643. mtr_add_arg($args, "--tool=memcheck"); # From >= 2.1.2 needs this option
  3644. mtr_add_arg($args, "--alignment=8");
  3645. mtr_add_arg($args, "--leak-check=yes");
  3646. mtr_add_arg($args, "--num-callers=16");
  3647. mtr_add_arg($args, "--suppressions=%s/valgrind.supp", $glob_mysql_test_dir)
  3648. if -f "$glob_mysql_test_dir/valgrind.supp";
  3649. }
  3650. # Add valgrind options, can be overriden by user
  3651. mtr_add_arg($args, '%s', $_) for (split(' ', $opt_valgrind_options));
  3652. mtr_add_arg($args, $$exe);
  3653. $$exe= $opt_valgrind_path || "valgrind";
  3654. }
  3655. ##############################################################################
  3656. #
  3657. # Usage
  3658. #
  3659. ##############################################################################
  3660. sub usage ($) {
  3661. my $message= shift;
  3662. if ( $message )
  3663. {
  3664. print STDERR "$message \n";
  3665. }
  3666. print STDERR <<HERE;
  3667. $0 [ OPTIONS ] [ TESTCASE ]
  3668. Options to control what engine/variation to run
  3669. embedded-server Use the embedded server, i.e. no mysqld daemons
  3670. ps-protocol Use the binary protocol between client and server
  3671. cursor-protocol Use the cursor protocol between client and server
  3672. (implies --ps-protocol)
  3673. view-protocol Create a view to execute all non updating queries
  3674. sp-protocol Create a stored procedure to execute all queries
  3675. compress Use the compressed protocol between client and server
  3676. ssl Use ssl protocol between client and server
  3677. skip-ssl Dont start server with support for ssl connections
  3678. bench Run the benchmark suite
  3679. small-bench Run the benchmarks with --small-tests --small-tables
  3680. Options to control directories to use
  3681. benchdir=DIR The directory where the benchmark suite is stored
  3682. (default: ../../mysql-bench)
  3683. tmpdir=DIR The directory where temporary files are stored
  3684. (default: ./var/tmp).
  3685. vardir=DIR The directory where files generated from the test run
  3686. is stored (default: ./var). Specifying a ramdisk or
  3687. tmpfs will speed up tests.
  3688. mem=DIR Run testsuite in "memory" using tmpfs if
  3689. available(default: /dev/shm)
  3690. Options to control what test suites or cases to run
  3691. force Continue to run the suite after failure
  3692. with-ndbcluster Use cluster in all tests
  3693. with-ndbcluster-only Run only tests that include "ndb" in the filename
  3694. skip-ndb[cluster] Skip all tests that need cluster
  3695. skip-ndb[cluster]-slave Skip all tests that need a slave cluster
  3696. ndb-extra Run extra tests from ndb directory
  3697. do-test=PREFIX Run test cases which name are prefixed with PREFIX
  3698. start-from=PREFIX Run test cases starting from test prefixed with PREFIX
  3699. suite=NAME Run the test suite named NAME. The default is "main"
  3700. skip-rpl Skip the replication test cases.
  3701. skip-im Don't start IM, and skip the IM test cases
  3702. skip-test=PREFIX Skip test cases which name are prefixed with PREFIX
  3703. big-test Pass "--big-test" to mysqltest which will set the
  3704. environment variable BIG_TEST, which can be checked
  3705. from test cases.
  3706. Options that specify ports
  3707. master_port=PORT Specify the port number used by the first master
  3708. slave_port=PORT Specify the port number used by the first slave
  3709. ndbcluster-port=PORT Specify the port number used by cluster
  3710. ndbcluster-port-slave=PORT Specify the port number used by slave cluster
  3711. Options for test case authoring
  3712. record TESTNAME (Re)genereate the result file for TESTNAME
  3713. check-testcases Check testcases for sideeffects
  3714. Options that pass on options
  3715. mysqld=ARGS Specify additional arguments to "mysqld"
  3716. Options to run test on running server
  3717. extern Use running server for tests FIXME DANGEROUS
  3718. ndb-connectstring=STR Use running cluster, and connect using STR
  3719. ndb-connectstring-slave=STR Use running slave cluster, and connect using STR
  3720. user=USER User for connect to server
  3721. Options for debugging the product
  3722. client-ddd Start mysqltest client in ddd
  3723. client-debugger=NAME Start mysqltest in the selected debugger
  3724. client-gdb Start mysqltest client in gdb
  3725. ddd Start mysqld in ddd
  3726. debug Dump trace output for all servers and client programs
  3727. debugger=NAME Start mysqld in the selected debugger
  3728. gdb Start the mysqld(s) in gdb
  3729. manual-debug Let user manually start mysqld in debugger, before
  3730. running test(s)
  3731. manual-gdb Let user manually start mysqld in gdb, before running
  3732. test(s)
  3733. master-binary=PATH Specify the master "mysqld" to use
  3734. slave-binary=PATH Specify the slave "mysqld" to use
  3735. strace-client Create strace output for mysqltest client
  3736. Options for coverage, profiling etc
  3737. gcov FIXME
  3738. gprof FIXME
  3739. valgrind Run the "mysqltest" and "mysqld" executables using
  3740. valgrind with options($default_valgrind_options)
  3741. valgrind-all Synonym for --valgrind
  3742. valgrind-mysqltest Run the "mysqltest" executable with valgrind
  3743. valgrind-mysqld Run the "mysqld" executable with valgrind
  3744. valgrind-options=ARGS Options to give valgrind, replaces default options
  3745. valgrind-path=[EXE] Path to the valgrind executable
  3746. callgrind Instruct valgrind to use callgrind
  3747. Misc options
  3748. comment=STR Write STR to the output
  3749. notimer Don't show test case execution time
  3750. script-debug Debug this script itself
  3751. verbose More verbose output
  3752. start-and-exit Only initialize and start the servers, using the
  3753. startup settings for the specified test case (if any)
  3754. start-dirty Only start the servers (without initialization) for
  3755. the specified test case (if any)
  3756. fast Don't try to clean up from earlier runs
  3757. reorder Reorder tests to get fewer server restarts
  3758. help Get this help text
  3759. unified-diff | udiff When presenting differences, use unified diff
  3760. testcase-timeout=MINUTES Max test case run time (default $default_testcase_timeout)
  3761. suite-timeout=MINUTES Max test suite run time (default $default_suite_timeout)
  3762. Deprecated options
  3763. with-openssl Deprecated option for ssl
  3764. Options not yet described, or that I want to look into more
  3765. local
  3766. netware
  3767. sleep=SECONDS
  3768. socket=PATH
  3769. user-test=s
  3770. wait-timeout=SECONDS
  3771. warnings
  3772. log-warnings
  3773. HERE
  3774. mtr_exit(1);
  3775. }