Skip to content

Commit

Permalink
Use more descriptive file name for MySQL test queries
Browse files Browse the repository at this point in the history
  • Loading branch information
JanJakes committed Nov 13, 2024
1 parent afc70bb commit 33d55c4
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion tests/mysql/WP_MySQL_Server_Suite_Lexer_Tests.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class WP_MySQL_Server_Suite_Lexer_Tests extends TestCase {
* is too large for PHPUnit to run a test per query, causing memory errors.
*/
public function test_tokenize_mysql_test_suite(): void {
$path = __DIR__ . '/data/queries.csv';
$path = __DIR__ . '/data/mysql-server-tests-queries.csv';
$handle = @fopen( $path, 'r' );
if ( false === $handle ) {
$this->fail( "Failed to open file '$path'." );
Expand Down
4 changes: 2 additions & 2 deletions tests/mysql/WP_MySQL_Server_Suite_Parser_Tests.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Parser tests using the full MySQL server test suite.
*/
class WP_MySQL_Server_Suite_Parser_Tests extends TestCase {
const TEST_DATA_PATH = __DIR__ . '/data/queries.csv';
const TEST_DATA_PATH = __DIR__ . '/data/mysql-server-tests-queries.csv';
const GRAMMAR_PATH = __DIR__ . '/../../wp-includes/mysql/mysql-grammar.php';

/**
Expand Down Expand Up @@ -67,7 +67,7 @@ public function test_parse_mysql_test_suite( array $batch ): void {
}

public function data_parse_mysql_test_suite(): Generator {
$path = __DIR__ . '/data/queries.csv';
$path = __DIR__ . '/data/mysql-server-tests-queries.csv';
$handle = @fopen( $path, 'r' );
if ( false === $handle ) {
$this->fail( "Failed to open file '$path'." );
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions tests/tools/mysql-extract-queries.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/**
* This script scans MySQL server test files, extracts SQL queries from them,
* and saves the queries in a CSV file under "tests/mysql/data/queries.csv".
* and saves them as CSV under "tests/mysql/data/mysql-server-tests-queries.csv".
*
* The test files first need to be downloaded from the MySQL server repository.
* See the "mysql-download-tests.sh" script for more details.
Expand All @@ -25,7 +25,7 @@

// Paths:
$data_dir = __DIR__ . '/../mysql/data';
$query_file = $data_dir . '/queries.csv';
$query_file = $data_dir . '/mysql-server-tests-queries.csv';

// Comments and other prefixes to skip:
$prefixes = array(
Expand Down
2 changes: 1 addition & 1 deletion tests/tools/run-lexer-benchmark.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function ( $severity, $message, $file, $line ) {
require_once __DIR__ . '/../../wp-includes/mysql/class-wp-mysql-lexer.php';

// Load the queries.
$handle = fopen( __DIR__ . '/../mysql/data/queries.csv', 'r' );
$handle = fopen( __DIR__ . '/../mysql/data/mysql-server-tests-queries.csv', 'r' );
$records = array();
while ( ( $record = fgetcsv( $handle ) ) !== false ) {
$records[] = $record;
Expand Down
2 changes: 1 addition & 1 deletion tests/tools/run-parser-benchmark.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function getStats( $total, $failures, $exceptions ) {

// Load the queries.
$data_dir = __DIR__ . '/../mysql/data';
$handle = fopen( "$data_dir/queries.csv", 'r' );
$handle = fopen( "$data_dir/mysql-server-tests-queries.csv", 'r' );
$records = array();
while ( ( $record = fgetcsv( $handle ) ) !== false ) {
$records[] = $record;
Expand Down

0 comments on commit 33d55c4

Please sign in to comment.