Documentation Home
The MySQL Test Framework, Version 2.0
Download this Manual
PDF (US Ltr) - 0.5Mb
PDF (A4) - 0.5Mb
EPUB - 126.7Kb


The MySQL Test Framework, Version 2.0  /  Writing Test Cases  /  Thread Synchronization in Test Cases

4.14 Thread Synchronization in Test Cases

The Debug Sync facility allows placement of synchronization points in the code. They can be activated by statements that set the debug_sync system variable. An active synchronization point can emit a signal or wait for a signal to be emitted by another thread. This waiting times out after 300 seconds by default. The --debug-sync-timeout=N option for mysql-test-run.pl changes that timeout to N seconds. A timeout of zero disables the facility altogether, so that synchronization points will not emit or wait for signals, even if activated.

The purpose of the timeout is to avoid a complete lockup in test cases. If for some reason the expected signal is not emitted by any thread, the execution of the affected statement will not block forever. A warning shows up when the timeout happens. That makes a difference in the test result so that it will not go undetected.

For test cases that require the Debug Sync facility, include the following line in the test case file:

--source include/have_debug_sync.inc

For a description of the Debug Sync facility and how to use synchronization points, see MySQL Internals: Test Synchronization.