See t/mysqltest.test for testing mtr command itself. # it should be -1 before testing eval select $mysql_errno as "before_testing" ; ./mtr --start-and-exit innodb Reference Manual: http://dev.mysql.com/doc/mysqltest/2.0/en/index.html Guide: http://forge.mysql.com/wiki/How_to_Create_Good_Tests Tip 1: Do not assign the storage engine within your CREATE TABLE statements. ./myql-test-run.pl --mysqld="--default-storage-engine=" Tip 2: How to invoke mysqld using config files generated by mtr ? ./mysql-test-run.pl --manual-debug alter_table Start master in your debugger dir: z:/mysql-5.1-maint_win/mysql-test exe: z:/mysql-5.1-maint_win/sql/debug/mysqld.exe args: --no-defaults --basedir=.... Waiting .... Now kill the client and invoke the same command manually. Tip 3: ./mtr --start meb.integrity Just start the servers using the startup settings for the first test case. Tip 4: Use perl snippets like below: --perl if ( expr ) { die " There is error ... \n" ; } Tip 5: let $myvar = "..." ; local variable. let myvar = "..." ; sets env variable. --let $myvar = "some" # This does not need terminator ";" let $myvar = "some"; # This needs terminator ";" let files= one two three; exec ls $files; # Expands files as one argument embedding spaces. Tip 6: Use eval for repeating long statements : let $select= SELECT * FROM information_schema.column_privileges WHERE grantee LIKE '''testuser%''' ORDER BY grantee, table_schema,table_name,column_name,privilege_type; eval $select; Tip 7: How to write complicated mtr tests ? Use these commands to produce .txt files. Use perl to set temp values. SELECT * INTO OUTFILE .... OR LOAD DATA IN INFILE OR create a temporary table which keeps track of list of strings. Use query get value to retrieve one by one. Follow this style to prevent variable output: # --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR # eval SELECT * FROM mysql.proc INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/proc.txt'; # What does suite/meb/my.cnf do ? - uses @mysqld.1 instance specification similar to include/default_my.cnf - inlcude/default_my.cnf defines MASTER_MYPORT and MASTER_MYSOCKET - Defines innodb_* values in [mysqld], then reuses that in [mysqld.1]. Is it required ??!! - rpl tests indicate that there is a variable called loose-innodb What does loose- prefix do to variables ? - causes the client/server not to complain and die if it does not understand the variable. - can be used in my.cnf as well as cmd line options. How does have_meb.inc work ? - If IBBACKUP or INNOBACKUP vars are not defined, then skip test - Sets $SERVER_CNF = $MYSQLTEST_VARDIR/my.cnf - Initializes $TMP_DIR/ib.cnf using env variables defined in my.cnf How does extreme_data.inc work ? creates 3 extream_db1, db2, db3 databases; create db1.table1 using 79 different columns of all types; inserts min and max values on these. insert a row with null values; create a row with arbirary values; create specific table spaces if env var defined for that. bzr+ssh://bk-internal/bzrroot/server/mysql-5.1-innodb --remove_files_wildcard $DATA_DIR ib* --copy_file errors if the destination file exists. --remove_file errors if the destination file does not exist. --copytree overwrites destination directory. Creates dir if not exists. let $value= query_get_value(SHOW COLUMNS FROM t1, Field, 0); let $value= query_get_value(SELECT a FROM t1, a, 1); let $nmp= query_get_value("SHOW VARIABLES LIKE 'named_pipe'", Value, 1); let $nmp= query_get_value(cmd, col_name, row_number); let $Field= query_get_value($show_statement, Field, $rowno); if (`SELECT '$Field' = 'No such row'`) let $result=`select table_name from information_schema.tables where table_schema = 'db1'`; --echo result of list of tables is $result # This contains first table. Note: If multiple results are returned, first result is stored!!!