mirror of
https://github.com/aljazceru/turso.git
synced 2025-12-26 04:24:21 +01:00
59 lines
2.8 KiB
Markdown
59 lines
2.8 KiB
Markdown
# Contributing to Limbo
|
|
|
|
We'd love to have you contribute to Limbo!
|
|
|
|
This document is a quick helper to get you going.
|
|
|
|
## Finding things to work on
|
|
|
|
The issue tracker has issues tagged with [good first issue](https://github.com/penberg/limbo/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22),
|
|
which are considered to be things to work on to get going. If you're interested in working on one of them, comment on the issue tracker, and we're happy to help you get going.
|
|
|
|
## Submitting your work
|
|
|
|
Fork the repository and open a pull request to submit your work. Please consider:
|
|
|
|
* Running `cargo fmt` and `cargo clippy` to keep the code formatting in check.
|
|
* Running `make` to run the test suite.
|
|
|
|
## Debugging query execution
|
|
|
|
Limbo aims towards SQLite compatibility. If you find a query that has different behavior than SQLite, the first step is to check what the generated bytecode looks like.
|
|
|
|
To do that, first run the `EXPLAIN` command in `sqlite3` shell:
|
|
|
|
```
|
|
sqlite> EXPLAIN SELECT first_name FROM users;
|
|
addr opcode p1 p2 p3 p4 p5 comment
|
|
---- ------------- ---- ---- ---- ------------- -- -------------
|
|
0 Init 0 7 0 0 Start at 7
|
|
1 OpenRead 0 2 0 2 0 root=2 iDb=0; users
|
|
2 Rewind 0 6 0 0
|
|
3 Column 0 1 1 0 r[1]= cursor 0 column 1
|
|
4 ResultRow 1 1 0 0 output=r[1]
|
|
5 Next 0 3 0 1
|
|
6 Halt 0 0 0 0
|
|
7 Transaction 0 0 1 0 1 usesStmtJournal=0
|
|
8 Goto 0 1 0 0
|
|
```
|
|
|
|
and then run the same command in Limbo's shell.
|
|
|
|
If the bytecode is different, that's the bug -- work towards fixing code generation.
|
|
If the bytecode is the same, but query results are different, then the bug is somewhere in the virtual machine interpreter or storage layer.
|
|
|
|
## Compatibility tests
|
|
|
|
The `testing/test.all` is a starting point for adding functional tests using a similar syntax to SQLite.
|
|
When you run `make` the test cases are run with `cargo run`, which uses the latest build of the Limbo shell.
|
|
If you run `testing/test.all` directly, it will run the tests with `sqlite3`.
|
|
The purpose of these tests is to verify behavior matches with SQLite and Limbo.
|
|
When working on a new feature, please consider adding a test case for it.
|
|
|
|
## Deterministic simulation tests
|
|
|
|
The `simulator` directory contains a deterministic simulator for testing.
|
|
What this means is that the behavior of a test run is deterministic based on the seed value.
|
|
If the simulator catches a bug, you can always reproduce the exact same sequence of events by passing the same seed.
|
|
The simulator also performs fault injection to discover interesting bugs.
|