MySQL Tests

How I typically compile MySQL and run a single test case in Linux:

  1. Make sure I’m not root
  2. Start with a freshly untarred MySQL distribution
  3. Change to the base directory for the distribution
  4. Build using the command: ./compile-amd64-debug-max
  5. Change to the mysql-test directory: cd mysql-test
  6. Run a test case: ./mysql-test-run.pl log_tables

If the test succeeds, I’m done. If it fails, check the files:

  1. t/log_tables.test
  2. r/log_tables.result
  3. r/log_tables.reject
  • The test is in the “test” file
  • The expected results are in the “result” file
  • The actual results are in the “reject” file

Diff the result and the reject to see see the expected versus actual output.

To repeat with the gdb debugger, add the –gdb option to mysql-test-run.pl:

./mysql-test-run.pl --gdb log_tables

 

A gdb session will open in an X window and stop in the mysql_parse() function in the file sql/sql_parse.cc

Debug.