Skip to content

Comments

Add native TCL extension for in-process SQLite test harness#5497

Open
aalhour wants to merge 2 commits intotursodatabase:mainfrom
aalhour:fix/2408-integrate-sqlite-tcl-tests
Open

Add native TCL extension for in-process SQLite test harness#5497
aalhour wants to merge 2 commits intotursodatabase:mainfrom
aalhour:fix/2408-integrate-sqlite-tcl-tests

Conversation

@aalhour
Copy link
Contributor

@aalhour aalhour commented Feb 20, 2026

Description

Replace the subprocess-per-statement TCL test shim with a native C extension (bindings/tcl/turso_tcl.c) backed by the existing SQLite C ABI in sqlite3/src/lib.rs. This closes three capability gaps in the test harness:

  1. db errorcode now returns real engine error codes (was always 0)
  2. db changes / db total_changes track actual DML counters (were always 0)
  3. db func registers Tcl callbacks into the SQL engine (previously crashed)

The extension is loaded automatically by tester.tcl when present, with transparent fallback to the subprocess shim when absent.

Motivation and context

Closes #2408

Description of AI Usage

Guided problem exploration with GPT-5.3 Codex, prompt here.

@aalhour aalhour requested a review from penberg as a code owner February 20, 2026 19:15
Copy link

@turso-bot turso-bot bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please review @jussisaurio

  Replace the subprocess-per-statement TCL test shim with a native C
  extension (bindings/tcl/turso_tcl.c) backed by the existing SQLite C
  ABI in sqlite3/src/lib.rs. This closes three capability gaps in the
  test harness:

  1. db errorcode now returns real engine error codes (was always 0)
  2. db changes / db total_changes track actual DML counters (were always 0)
  3. db func registers Tcl callbacks into the SQL engine (previously crashed)

  The extension is loaded automatically by tester.tcl when present, with
  transparent fallback to the subprocess shim when absent.

  Closes tursodatabase#2408
@aalhour aalhour force-pushed the fix/2408-integrate-sqlite-tcl-tests branch from 8821835 to 44e0b14 Compare February 20, 2026 19:17
@PThorpe92
Copy link
Collaborator

Hey @aalhour, so we are actually moving away from TCL completely. We have the new test runner in testing/runner and we have migrated almost all of our TCL tests to this new setup. I actually have a local branch that is going to remove the remaining TCL tests to get rid of the dependency all together.

@aalhour
Copy link
Contributor Author

aalhour commented Feb 21, 2026

@PThorpe92, thanks for letting me know. Should I close this PR or refactor it to add tests to the new location?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Integrate SQLite TCL tests with native TCL module

2 participants