Skip to content

Commit 8bc6484

Browse files
authored
Merge 'Move test runner to testing/runner' from Pedro Muniz
Makes more and @penberg asked for it Reviewed-by: Preston Thorpe <preston@turso.tech> Closes #4962
2 parents 66473e1 + 33e600e commit 8bc6484

File tree

164 files changed

+152
-134
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

164 files changed

+152
-134
lines changed

.claude/skills/testing/SKILL.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ description: How to write tests, when to use each type of test, and how to run t
88

99
| Type | Location | Use Case |
1010
|------|----------|----------|
11-
| `.sqltest` | `turso-test-runner/tests/` | SQL compatibility. **Preferred for new tests** |
11+
| `.sqltest` | `testing/runner/tests/` | SQL compatibility. **Preferred for new tests** |
1212
| TCL `.test` | `testing/` | Legacy SQL compat (being phased out) |
1313
| Rust integration | `tests/integration/` | Regression tests, complex scenarios |
1414
| Fuzz | `tests/fuzz/` | Complex features, edge case discovery |
1515

16-
**Note:** TCL tests are being phased out in favor of turso-test-runner. The `.sqltest` format allows the same test cases to run against multiple backends (CLI, Rust bindings, etc.).
16+
**Note:** TCL tests are being phased out in favor of testing/runner. The `.sqltest` format allows the same test cases to run against multiple backends (CLI, Rust bindings, etc.).
1717

1818
## Running Tests
1919

@@ -25,7 +25,7 @@ make test
2525
make test-single TEST=select.test
2626

2727
# SQL test runner
28-
make -C turso-test-runner run-cli
28+
make -C testing/runner run-cli
2929

3030
# Rust unit/integration tests (full workspace)
3131
cargo test
@@ -52,9 +52,9 @@ expect {
5252
2|bob
5353
}
5454
```
55-
Location: `turso-test-runner/tests/*.sqltest`
55+
Location: `testing/runner/tests/*.sqltest`
5656

57-
You must start converting TCL tests with the `convert` command from the test runner (e.g `cargo run -- convert <TCL_test_path> -o <out_dir>`). It is not always accurate, but it will convert most of the tests. If some conversion emits a warning you will have to write by hand whatever is missing from it (e.g unroll a for each loop by hand). Then you need to verify the tests work by running them with `make -C turso-test-runner run-rust`, and adjust their output if something was wrong with the conversion. Also, we use harcoded databases in TCL, but with `.sqltest` we generate the database with a different seed, so you will probably need to change the expected test result to match the new database query output. Avoid changing the SQL statements from the test, just change the expected result
57+
You must start converting TCL tests with the `convert` command from the test runner (e.g `cargo run -- convert <TCL_test_path> -o <out_dir>`). It is not always accurate, but it will convert most of the tests. If some conversion emits a warning you will have to write by hand whatever is missing from it (e.g unroll a for each loop by hand). Then you need to verify the tests work by running them with `make -C testing/runner run-rust`, and adjust their output if something was wrong with the conversion. Also, we use harcoded databases in TCL, but with `.sqltest` we generate the database with a different seed, so you will probably need to change the expected test result to match the new database query output. Avoid changing the SQL statements from the test, just change the expected result
5858

5959
### TCL
6060
```tcl

.github/workflows/sqltest.yml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ jobs:
2525
with:
2626
prefix-key: "v1-rust"
2727
- name: Build test runner
28-
run: make -C turso-test-runner build-runner
28+
run: make -C testing/runner build-runner
2929
- name: Check test syntax
30-
run: make -C turso-test-runner check
30+
run: make -C testing/runner check
3131

3232
sqltest-run-cli:
3333
name: Run SQL tests (CLI backend)
@@ -44,16 +44,16 @@ jobs:
4444
env:
4545
SCCACHE_GHA_ENABLED: "true"
4646
RUSTC_WRAPPER: "sccache"
47-
run: make -C turso-test-runner build-tursodb
47+
run: make -C testing/runner build-tursodb
4848
- name: Build test runner
4949
env:
5050
SCCACHE_GHA_ENABLED: "true"
5151
RUSTC_WRAPPER: "sccache"
52-
run: make -C turso-test-runner build-runner
52+
run: make -C testing/runner build-runner
5353
- name: Run tests
54-
run: make -C turso-test-runner run-cli
54+
run: make -C testing/runner run-cli
5555
- name: Run tests (MVCC)
56-
run: make -C turso-test-runner run-cli MVCC=1
56+
run: make -C testing/runner run-cli MVCC=1
5757

5858
sqltest-run-rust:
5959
name: Run SQL tests (Rust backend)
@@ -65,11 +65,11 @@ jobs:
6565
with:
6666
prefix-key: "v1-rust"
6767
- name: Build test runner
68-
run: make -C turso-test-runner build-runner
68+
run: make -C testing/runner build-runner
6969
- name: Run tests
70-
run: make -C turso-test-runner run-rust
70+
run: make -C testing/runner run-rust
7171
- name: Run tests (MVCC)
72-
run: make -C turso-test-runner run-rust MVCC=1
72+
run: make -C testing/runner run-rust MVCC=1
7373

7474
sqltest-run-js:
7575
name: Run SQL tests (JS backend)
@@ -101,16 +101,16 @@ jobs:
101101
- name: Build TypeScript
102102
run: yarn workspace @tursodatabase/database tsc-build
103103
- name: Build test runner
104-
working-directory: turso-test-runner
104+
working-directory: testing/runner
105105
env:
106106
SCCACHE_GHA_ENABLED: "true"
107107
RUSTC_WRAPPER: "sccache"
108108
run: cargo build --release
109109
- name: Run tests
110-
working-directory: turso-test-runner
110+
working-directory: testing/runner
111111
run: make run-js
112112
- name: Run tests (MVCC)
113-
working-directory: turso-test-runner
113+
working-directory: testing/runner
114114
run: make run-js MVCC=1
115115

116116
sqltest-sqlite:
@@ -124,6 +124,6 @@ jobs:
124124
prefix-key: "v1-rust"
125125
- uses: "./.github/shared/install_sqlite"
126126
- name: Build test runner
127-
run: make -C turso-test-runner build-runner
127+
run: make -C testing/runner build-runner
128128
- name: Run tests against SQLite
129-
run: make -C turso-test-runner test-sqlite
129+
run: make -C testing/runner test-sqlite

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ settings.local.json
5757
.build-hash
5858

5959
# Track empty wals for read only databases
60-
!turso-test-runner/database/*
60+
!testing/runner/database/*
6161

6262

6363
# For simulator redo

AGENTS.md

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,39 @@ cargo fmt # format (required)
1111
cargo clippy --workspace --all-features --all-targets -- --deny=warnings # lint
1212
cargo run -q --bin tursodb -- -q # run the interactive cli
1313

14-
make test # TCL compat, sqlite3 compat, Python wrappers
15-
make test-single TEST=foo.test # single TCL test file (requires separate build)
16-
make -C turso-test-runner run-cli # sqltest runner (preferred for new tests)
14+
make test # TCL compat + sqlite3 + extensions + MVCC
15+
make test-single TEST=foo.test # single TCL test
16+
make -C testing/runner run-rust # sqltest runner (preferred for new tests)
1717
```
1818

19-
## Project Structure
20-
21-
| Directory | Purpose |
22-
|-----------|---------|
23-
| `core/` | Main database engine |
24-
| `parser/` | SQL parser |
25-
| `cli/` | `tursodb` CLI |
26-
| `bindings/*` | Language bindings (Python, JS, Java, Rust, Dart, .NET) |
27-
| `extensions/*` | SQL extensions (crypto, regexp, csv, etc.) |
28-
| `testing/simulator/` | Deterministic simulation testing |
29-
| `testing/concurrent-simulator/` | Concurrent query execution DST |
19+
## Structure
20+
21+
```
22+
limbo/
23+
├── core/ # Database engine (translate/, storage/, vdbe/, io/, mvcc/)
24+
├── parser/ # SQL parser (lexer, AST, grammar)
25+
├── cli/ # tursodb CLI (REPL, MCP server, sync server)
26+
├── bindings/ # Python, JS, Java, Dart, .NET, Go, Rust
27+
├── extensions/ # crypto, regexp, csv, fuzzy, ipaddr, percentile
28+
├── testing/ # simulator/, concurrent-simulator/, differential-oracle/
29+
├── sync/ # engine/, sdk-kit/ (Turso Cloud sync)
30+
├── sdk-kit/ # High-level SDK abstraction
31+
└── tools/ # dbhash utility
32+
```
33+
34+
## Where to Look
35+
36+
| Task | Location | Notes |
37+
|------|----------|-------|
38+
| Query execution | `core/vdbe/execute.rs` | 12k LOC bytecode interpreter |
39+
| SQL compilation | `core/translate/` | AST → bytecode, optimizer in `optimizer/` |
40+
| B-tree/pages | `core/storage/btree.rs` | 10k LOC, SQLite-compatible format |
41+
| WAL/durability | `core/storage/wal.rs` | Write-ahead log, checkpointing |
42+
| SQL parsing | `parser/src/parser.rs` | 11k LOC recursive descent |
43+
| Add extension | `extensions/core/` | ExtensionApi, scalar/aggregate/vtab traits |
44+
| Add binding | `bindings/` | PyO3, NAPI, JNI, FRB, CGO patterns |
45+
| Deterministic tests | `testing/simulator/` | Fault injection, differential testing |
46+
| New SQL tests | `testing/runner/tests/` | `.sqltest` format preferred |
3047

3148
## Guides
3249

CONTRIBUTING.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -254,16 +254,16 @@ When working on a new feature, please consider adding a test case for it.
254254

255255
## SQL Test Runner
256256

257-
The `turso-test-runner` crate provides a dedicated test runner with a custom DSL for writing SQL tests.
258-
Tests should be added to `turso-test-runner/tests/` using the `.sqltest` format.
257+
The `test-runner` crate provides a dedicated test runner with a custom DSL for writing SQL tests.
258+
Tests should be added to `testing/runner/tests/` using the `.sqltest` format.
259259

260260
To run tests:
261261

262262
```console
263-
make -c turso-test-runner run
263+
make -C testing/runner run
264264
```
265265

266-
For full documentation on the DSL syntax and CLI usage, see the [turso-test-runner docs](turso-test-runner/docs/).
266+
For full documentation on the DSL syntax and CLI usage, see the [test-runner docs](testing/runner/docs/).
267267

268268
## TPC-H
269269

Cargo.lock

Lines changed: 32 additions & 32 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ members = [
4040
"sdk-kit-macros",
4141
"testing/differential-oracle/sql_gen_prop",
4242
"testing/differential-oracle/fuzzer",
43-
"turso-test-runner"
43+
"testing/runner"
4444
]
4545
exclude = ["perf/latency/limbo"]
4646

Dockerfile.antithesis

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ COPY ./sync ./sync/
3535
COPY ./testing/sqlite_test_ext ./testing/sqlite_test_ext/
3636
COPY ./testing/unreliable-libc ./testing/unreliable-libc/
3737
COPY ./tests ./tests/
38-
COPY ./turso-test-runner ./turso-test-runner/
38+
COPY ./testing/runner ./testing/runner/
3939
COPY ./testing/concurrent-simulator ./testing/concurrent-simulator/
4040
COPY ./testing/differential-oracle ./testing/differential-oracle/
4141
COPY ./sdk-kit ./sdk-kit/
@@ -83,7 +83,7 @@ COPY --from=planner /app/sync ./sync/
8383
COPY --from=planner /app/testing/sqlite_test_ext ./testing/sqlite_test_ext/
8484
COPY --from=planner /app/testing/unreliable-libc ./testing/unreliable-libc/
8585
COPY --from=planner /app/tests ./tests/
86-
COPY --from=planner /app/turso-test-runner ./turso-test-runner/
86+
COPY --from=planner /app/testing/runner ./testing/runner/
8787
COPY --from=planner /app/testing/concurrent-simulator ./testing/concurrent-simulator/
8888
COPY --from=planner /app/testing/differential-oracle ./testing/differential-oracle
8989
COPY --from=planner /app/sdk-kit ./sdk-kit/

bindings/javascript/turso-sql-runner.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env node
22
/**
3-
* SQL runner script for turso-test-runner JavaScript backend.
3+
* SQL runner script for test-runner JavaScript backend.
44
* Reads SQL from stdin, executes via @tursodatabase/database, outputs pipe-separated results.
55
*
66
* Usage: node turso-sql-runner.mjs <database_path> [--readonly]

docs/agent-guides/testing.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ description: Test types, when to use each, how to write and run tests
88

99
| Type | Location | Use Case |
1010
|------|----------|----------|
11-
| `.sqltest` | `turso-test-runner/tests/` | SQL compatibility. **Preferred for new tests** |
11+
| `.sqltest` | `testing/runner/tests/` | SQL compatibility. **Preferred for new tests** |
1212
| TCL `.test` | `testing/` | Legacy SQL compat (being phased out) |
1313
| Rust integration | `tests/integration/` | Regression tests, complex scenarios |
1414
| Fuzz | `tests/fuzz/` | Complex features, edge case discovery |
1515

16-
**Note:** TCL tests are being phased out in favor of turso-test-runner. The `.sqltest` format allows the same test cases to run against multiple backends (CLI, Rust bindings, etc.).
16+
**Note:** TCL tests are being phased out in favor of testing/runner. The `.sqltest` format allows the same test cases to run against multiple backends (CLI, Rust bindings, etc.).
1717

1818
## Running Tests
1919

@@ -25,7 +25,7 @@ make test
2525
make test-single TEST=select.test
2626

2727
# SQL test runner
28-
make -C turso-test-runner run-cli
28+
make -C testing/runner run-cli
2929

3030
# Rust unit/integration tests (full workspace)
3131
cargo test
@@ -42,7 +42,7 @@ SELECT 1 + 1;
4242
@expected
4343
2
4444
```
45-
Location: `turso-test-runner/tests/*.sqltest`
45+
Location: `testing/runner/tests/*.sqltest`
4646

4747
### TCL
4848
```tcl

0 commit comments

Comments
 (0)