Skip to content

Commit 6cfd531

Browse files
committed
Extend Turso smoke test to narrow down PHPUnit segfault
PHPUnit currently segfaults right after printing its banner, before any test runs. Replace the single sqlite_version() check with a script that exercises PDO basics (create table, insert with exec and with prepared statement, select, destruction) so CI logs show which operation Turso can't handle.
1 parent 3460fa3 commit 6cfd531

1 file changed

Lines changed: 27 additions & 2 deletions

File tree

.github/workflows/phpunit-tests-turso.yml

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,37 @@ jobs:
7878
php-version: '8.5'
7979
tools: phpunit-polyfills
8080

81-
- name: Report SQLite version via Turso preload
81+
- name: Smoke-test pdo_sqlite against Turso
8282
continue-on-error: true
8383
env:
8484
LD_PRELOAD: ${{ steps.turso-lib.outputs.path }}
8585
run: |
86-
php -r "echo 'Turso sqlite_version(): ' . (new PDO('sqlite::memory:'))->query('SELECT sqlite_version()')->fetch()[0] . PHP_EOL;"
86+
php <<'PHP'
87+
<?php
88+
echo "version: ", (new PDO('sqlite::memory:'))->query('SELECT sqlite_version()')->fetch()[0], "\n";
89+
90+
$pdo = new PDO('sqlite::memory:');
91+
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
92+
$pdo->exec('CREATE TABLE t (id INTEGER PRIMARY KEY, v TEXT)');
93+
echo "create table: ok\n";
94+
95+
$pdo->exec("INSERT INTO t (v) VALUES ('hello')");
96+
echo "insert exec: ok\n";
97+
98+
$stmt = $pdo->prepare('INSERT INTO t (v) VALUES (?)');
99+
$stmt->execute(['world']);
100+
echo "insert prepared: ok\n";
101+
102+
$rows = $pdo->query('SELECT id, v FROM t ORDER BY id')->fetchAll(PDO::FETCH_ASSOC);
103+
echo "select: ", json_encode($rows), "\n";
104+
105+
$stmt = $pdo->prepare('SELECT v FROM t WHERE id = ?');
106+
$stmt->execute([1]);
107+
echo "select prepared: ", $stmt->fetchColumn(), "\n";
108+
109+
unset($stmt, $pdo);
110+
echo "close: ok\n";
111+
PHP
87112
88113
- name: Install Composer dependencies (root)
89114
uses: ramsey/composer-install@v3

0 commit comments

Comments
 (0)