From 33d55c4a9e10a4978b04e66b8101f29fa4b8283a Mon Sep 17 00:00:00 2001 From: Jan Jakes Date: Wed, 13 Nov 2024 12:49:39 +0100 Subject: [PATCH] Use more descriptive file name for MySQL test queries --- tests/mysql/WP_MySQL_Server_Suite_Lexer_Tests.php | 2 +- tests/mysql/WP_MySQL_Server_Suite_Parser_Tests.php | 4 ++-- .../data/{queries.csv => mysql-server-tests-queries.csv} | 0 tests/tools/mysql-extract-queries.php | 4 ++-- tests/tools/run-lexer-benchmark.php | 2 +- tests/tools/run-parser-benchmark.php | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) rename tests/mysql/data/{queries.csv => mysql-server-tests-queries.csv} (100%) diff --git a/tests/mysql/WP_MySQL_Server_Suite_Lexer_Tests.php b/tests/mysql/WP_MySQL_Server_Suite_Lexer_Tests.php index 53a786ab..0688a26c 100644 --- a/tests/mysql/WP_MySQL_Server_Suite_Lexer_Tests.php +++ b/tests/mysql/WP_MySQL_Server_Suite_Lexer_Tests.php @@ -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'." ); diff --git a/tests/mysql/WP_MySQL_Server_Suite_Parser_Tests.php b/tests/mysql/WP_MySQL_Server_Suite_Parser_Tests.php index 96efc733..6a8a96dc 100644 --- a/tests/mysql/WP_MySQL_Server_Suite_Parser_Tests.php +++ b/tests/mysql/WP_MySQL_Server_Suite_Parser_Tests.php @@ -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'; /** @@ -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'." ); diff --git a/tests/mysql/data/queries.csv b/tests/mysql/data/mysql-server-tests-queries.csv similarity index 100% rename from tests/mysql/data/queries.csv rename to tests/mysql/data/mysql-server-tests-queries.csv diff --git a/tests/tools/mysql-extract-queries.php b/tests/tools/mysql-extract-queries.php index 52f0329c..337d4a94 100644 --- a/tests/tools/mysql-extract-queries.php +++ b/tests/tools/mysql-extract-queries.php @@ -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. @@ -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( diff --git a/tests/tools/run-lexer-benchmark.php b/tests/tools/run-lexer-benchmark.php index e970e448..5fd0e2cb 100644 --- a/tests/tools/run-lexer-benchmark.php +++ b/tests/tools/run-lexer-benchmark.php @@ -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; diff --git a/tests/tools/run-parser-benchmark.php b/tests/tools/run-parser-benchmark.php index 66ce6ccf..6d162335 100644 --- a/tests/tools/run-parser-benchmark.php +++ b/tests/tools/run-parser-benchmark.php @@ -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;