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.

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