MySQL 8.1.0
Source Code Documentation
Using Include Files to Simplify Test Cases

The include directory contains many files intended for inclusion into test case files.

These include files serve many purposes, but in general, they encapsulate operations of varying complexity into single files so that you can perform each operation in a single step. Include files are available for operations such as these:

  • Ensure that a given feature is available. The file checks to make sure that the feature is available and exits if not.

    • Storage engine tests: These files have names of the form, such as or The MyISAM, MERGE, and MEMORY storage engines are always supported and need not be checked.

    • Windows specific tests: Include file if a test runs only on windows machines.

    • Debugging capabilities: Include the file if a test requires that the server was built for debugging (that is, that the MySQL distribution was configured with the --with-debug option).

  • Wait for a condition to become true. Set the $wait_condition variable to an SQL statement that selects a value and then include the file. The include file executes the statement in a loop with a 0.1 second sleep between executions until the select value is nonzero. For example:

    --let $wait_condition= SELECT c = 3 FROM t
    --source include/

  • Control the binary log format. See Controlling the Binary Log Format Used for Tests.

  • Control replication slave servers. See Writing Replication Tests.

You can think of an include file as a rudimentary form of subroutine that is “called” at the point of inclusion. You can “pass parameters” by setting variables before including the file and referring to them within the file. You can “return” values by setting variables within the file and referring them following inclusion of the file.