include directory contains many files
intended for inclusion into test case files. For example, if a
test case needs to verify that the server supports the
CSV storage engine, use this line in the test
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
MEMORY storage engines are always
supported and need not be checked.
Character set tests: These files have names of the form
Debugging capabilities: Include the
have_debug.inc file if a test requires
that the server was built for debugging (that is, that the
MySQL distribution was configured with the
Wait for a condition to become true. Set the
$wait_condition variable to an SQL
statement that selects a value and then include the
wait_condition.inc 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
let $wait_condition= SELECT c = 3 FROM t; --source include/wait_condition.inc
Control the binary log format. See Section 4.12, “Controlling the Binary Log Format Used for Tests”.
Control replication slave servers. See Section 4.13, “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.