|
66 | 66 | run: cargo build |
67 | 67 | working-directory: packages/mysql-on-sqlite/ext/wp-mysql-parser |
68 | 68 |
|
69 | | - - name: Run PHPUnit tests with parser extension |
70 | | - run: php -d extension="$GITHUB_WORKSPACE/packages/mysql-on-sqlite/ext/wp-mysql-parser/target/debug/libwp_mysql_parser.so" ./vendor/bin/phpunit -c ./phpunit.xml.dist |
| 69 | + - name: Run native parser smoke tests |
| 70 | + run: | |
| 71 | + php -d extension="$GITHUB_WORKSPACE/packages/mysql-on-sqlite/ext/wp-mysql-parser/target/debug/libwp_mysql_parser.so" -r ' |
| 72 | + require "src/load.php"; |
| 73 | + $lexer = new WP_MySQL_Lexer( "SELECT ID, post_title FROM wp_posts WHERE ID IN (1, 2, 3)" ); |
| 74 | + if ( ! method_exists( $lexer, "native_token_stream" ) ) { |
| 75 | + fwrite( STDERR, "Native token stream is not available.\n" ); |
| 76 | + exit( 1 ); |
| 77 | + } |
| 78 | + $tokens = $lexer->remaining_tokens(); |
| 79 | + $parser = new WP_MySQL_Parser( new WP_Parser_Grammar( include "src/mysql/mysql-grammar.php" ), $tokens ); |
| 80 | + $ast = $parser->parse(); |
| 81 | + if ( ! $ast instanceof WP_Parser_Node || "query" !== $ast->rule_name ) { |
| 82 | + fwrite( STDERR, "Native parser did not produce the expected query AST.\n" ); |
| 83 | + exit( 1 ); |
| 84 | + } |
| 85 | + ' |
| 86 | + ./vendor/bin/phpunit -c ./phpunit.xml.dist tests/mysql/WP_MySQL_Lexer_Tests.php tests/parser/WP_Parser_Node_Tests.php |
71 | 87 | working-directory: packages/mysql-on-sqlite |
72 | 88 |
|
73 | 89 | sqlite-driver-extension-tests: |
@@ -136,9 +152,5 @@ jobs: |
136 | 152 | } |
137 | 153 | ' |
138 | 154 |
|
139 | | - - name: Run PHPUnit tests with SQLite driver using parser extension |
140 | | - run: php -d extension="$GITHUB_WORKSPACE/packages/mysql-on-sqlite/ext/wp-mysql-parser/target/debug/libwp_mysql_parser.so" ./vendor/bin/phpunit -c ./phpunit.xml.dist |
141 | | - working-directory: packages/mysql-on-sqlite |
142 | | - |
143 | 155 | - name: Run native SQLite facade smoke workload |
144 | 156 | run: php -d extension="$GITHUB_WORKSPACE/packages/mysql-on-sqlite/ext/wp-mysql-parser/target/debug/libwp_mysql_parser.so" tmp-test-native/run-sqlite-facade-smoke.php |
0 commit comments