Setting Up Your Environment
To develop VillageSQL, you first need to build the server from source. Follow the Clone and Build from Source guide to clone the repository and compile the binaries. Once you have a build directory (e.g.,build/), you are ready to run the regression tests.
Running Regression Tests
VillageSQL uses the MySQL Test Framework (mysql-test-run.pl or mtr) for regression testing. The test suite is located in the mysql-test directory.
Running the Full Suite
To run the complete set of VillageSQL-specific tests, including all sub-suites (Insert, Select, Stored Procedures, etc.), use the--do-suite option:
Using
--suite=villagesql (without do-) typically only runs the top-level tests in the villagesql directory and skips the sub-directories. Always use --do-suite=villagesql for full coverage.Running Specific Sub-Suites
VillageSQL tests are organized into sub-suites based on functionality (e.g.,insert, select, update). You can run a specific sub-suite to focus on a particular area:
villagesql/insertvillagesql/selectvillagesql/updatevillagesql/deletevillagesql/replacevillagesql/table_dmlvillagesql/valuesvillagesql/handlervillagesql/load_datavillagesql/load_xmlvillagesql/stored_procedurevillagesql/prepared_statementvillagesql/triggervillagesql/viewvillagesql/expression
Running Individual Tests
To run a single test case, specify the suite path and test name:Creating New Tests
When adding new features or fixing bugs, you should add corresponding regression tests.Test Location
Tests are located inmysql-test/suite/villagesql/. Choose the appropriate sub-directory based on the SQL statement or feature being tested.
- Test files end with
.testand go in thet/directory. - Expected result files end with
.resultand go in ther/directory.
Test File Conventions
VillageSQL tests often involve the customCOMPLEX type. We follow a specific pattern to ensure tests are skipped gracefully if the feature is not yet fully implemented:
Steps to Add a Test
- Create the
.testfile in the appropriatet/directory (e.g.,mysql-test/suite/villagesql/select/t/my_new_test.test). - Create an empty
.resultfile in the correspondingr/directory (e.g.,mysql-test/suite/villagesql/select/r/my_new_test.result). - Run the test with
--recordto generate the expected output: - Verify the output in the generated
.resultfile to ensure it matches your expectations.
Debugging Tests
If a test fails,mtr provides detailed logs.
- Test output: Check
build/mysql-test/var/log/my_new_test.log. - Server error log: Check
build/mysql-test/var/log/mysqld.1.err. - Diff:
mtrusually outputs a diff between the actual output and the expected.resultfile.

