Files
turso/Makefile
Jussi Saurio bc9db54d7d testing: run the write, update and constraint CLI suites again
test-write, test-update, test-collate and test-constraint printed
"Skipping ... does not have indexes" in CI and never ran: test-limbo
uses the default SQLITE_EXEC=scripts/limbo-sqlite3, and the Makefile
skipped these suites for it since June 2025, when Turso had no indexes.
It has them now.

test-update and test-constraint pass as they are. test-write could not
pass against any engine: since a later change, run() deletes every row
before the sqlite3 check that expects them all. Run the steps in order
instead: Turso inserts and checks the rows, sqlite3 checks it can read
them all and integrity_check passes, Turso deletes them, and sqlite3
checks integrity again. All 21 cases pass locally.

test-collate stays off for Turso: two of its queries fail because Turso
applies a column's collation to expressions built from it, e.g.
GROUP BY (d || '') and ORDER BY (c || ''), where SQLite uses BINARY
(SQLite: 1 1 2 groups, Turso: one group of 4). The skip message now says
that instead of the outdated index reason.
2026-10-14 10:29:42 +03:00

251 lines
7.9 KiB
Makefile

MINIMUM_RUST_VERSION := 1.73.0
CURRENT_RUST_VERSION := $(shell rustc -V | sed -E 's/rustc ([0-9]+\.[0-9]+\.[0-9]+).*/\1/')
CURRENT_RUST_TARGET := $(shell rustc -vV | grep host | cut -d ' ' -f 2)
RUSTUP := $(shell command -v rustup 2> /dev/null)
UNAME_S := $(shell uname -s)
MINIMUM_TCL_VERSION := 8.6
# Executable used to execute the compatibility tests.
SQLITE_EXEC ?= scripts/limbo-sqlite3
RUST_LOG := off
all: check-rust-version build
.PHONY: all
install-sqlite:
./scripts/install-sqlite3.sh
.PHONY: install-sqlite
check-rust-version:
@echo "Checking Rust version..."
@if [ "$(shell printf '%s\n' "$(MINIMUM_RUST_VERSION)" "$(CURRENT_RUST_VERSION)" | sort -V | head -n1)" = "$(CURRENT_RUST_VERSION)" ]; then \
echo "Rust version greater than $(MINIMUM_RUST_VERSION) is required. Current version is $(CURRENT_RUST_VERSION)."; \
if [ -n "$(RUSTUP)" ]; then \
echo "Updating Rust..."; \
rustup update stable; \
else \
echo "Please update Rust manually to a version greater than $(MINIMUM_RUST_VERSION)."; \
exit 1; \
fi; \
else \
echo "Rust version $(CURRENT_RUST_VERSION) is acceptable."; \
fi
.PHONY: check-rust-version
check-tcl-version:
@printf '%s\n' \
'set need "$(MINIMUM_TCL_VERSION)"' \
'set have [info patchlevel]' \
'if {[package vcompare $$have $$need] < 0} {' \
' puts stderr "tclsh $$have found — need $$need+"' \
' exit 1' \
'}' \
| tclsh
.PHONY: check-tcl-version
build: check-rust-version
cargo build
.PHONY: build
turso-c:
cargo cbuild
.PHONY: turso-c
uv-sync:
uv sync --all-packages
.PHONE: uv-sync
uv-sync-test:
uv sync --all-extras --dev --package turso_test
.PHONE: uv-sync
test: test-without-sqltest test-sqltest test-sqltest-js test-sqltest-cli
.PHONY: test
test-without-sqltest: build uv-sync-test test-compat test-sqlite3 test-shell test-memory test-write test-update test-constraint test-collate test-extensions
.PHONY: test-without-sqltest
test-sqltest:
@make -C sqlite/conformance run
.PHONY: test-sqltest
test-sqltest-js:
@make -C sqlite/conformance run-js
.PHONY: test-sqltest-js
test-sqltest-cli:
@make -C sqlite/conformance run-cli
.PHONY: test-sqltest-cli
test-sqltest-pg:
@make -C postgres/conformance run
.PHONY: test-sqltest-pg
test-extensions: build uv-sync-test
RUST_LOG=$(RUST_LOG) uv run --package turso_test test-extensions
.PHONY: test-extensions
test-shell: build uv-sync-test
RUST_LOG=$(RUST_LOG) SQLITE_EXEC=$(SQLITE_EXEC) uv run --package turso_test test-shell
.PHONY: test-shell
test-compat: check-tcl-version
RUST_LOG=$(RUST_LOG) SQLITE_EXEC=$(SQLITE_EXEC) ./testing/system/all.test
test-single: check-tcl-version
@if [ -z "$(TEST)" ]; then \
echo "Usage: make test-single TEST=path/to/test.test"; \
exit 1; \
fi
RUST_LOG=$(RUST_LOG) SQLITE_EXEC=$(SQLITE_EXEC) ./testing/system/$(TEST)
.PHONY: test-single
.PHONY: test-compat
reset-db:
./scripts/clone_test_db.sh
.PHONY: reset-db
test-fuzz:
RUST_LOG=$(RUST_LOG) cargo test -p core_tester --release -- fuzz
RUST_LOG=$(RUST_LOG) cargo run -p differential-fuzzer --bin custom_types_fuzzer -- --seed $(or $(SEED), $$(date +%s)) -n $(or $(N),200) -t $(or $(TABLES),2)
.PHONY: test-fuzz
test-sqlite3: reset-db
cargo test -p turso_sqlite3 --test compat -- --test-threads=1
./scripts/clone_test_db.sh
cargo test -p turso_sqlite3 --test compat --features sqlite3 -- --test-threads=1
.PHONY: test-sqlite3
test-memory: build uv-sync-test
RUST_LOG=$(RUST_LOG) SQLITE_EXEC=$(SQLITE_EXEC) uv run --package turso_test test-memory
.PHONY: test-memory
test-write: build uv-sync-test
RUST_LOG=$(RUST_LOG) SQLITE_EXEC=$(SQLITE_EXEC) uv run --package turso_test test-write
.PHONY: test-write
test-update: build uv-sync-test
RUST_LOG=$(RUST_LOG) SQLITE_EXEC=$(SQLITE_EXEC) uv run --package turso_test test-update
.PHONY: test-update
# Turso applies a column's collation to expressions built from the column,
# e.g. GROUP BY (d || '') or ORDER BY (c || ''), where SQLite uses BINARY,
# so two of these tests fail against Turso (#8722, #9869). Run them only
# against other shells until that is fixed.
test-collate: build uv-sync-test
@if [ "$(SQLITE_EXEC)" != "scripts/limbo-sqlite3" ]; then \
RUST_LOG=$(RUST_LOG) SQLITE_EXEC=$(SQLITE_EXEC) uv run --package turso_test test-collate; \
else \
echo "Skipping test-collate: Turso applies a column's collation to expressions like (d || ''); SQLite uses BINARY"; \
fi
.PHONY: test-collate
test-constraint: build uv-sync-test
RUST_LOG=$(RUST_LOG) SQLITE_EXEC=$(SQLITE_EXEC) uv run --package turso_test test-constraint
.PHONY: test-constraint
test-multiprocess:
cargo run --release -p turso_whopper -- --mode fast --multiprocess --connections-per-process 4 --processes 4 --kill-probability 0.01
.PHONY: test-multiprocess
WHOPPER_ARGS ?=
WHOPPER_RUNS ?=
whopper-coverage:
./testing/concurrent-simulator/bin/coverage "$(WHOPPER_RUNS)" $(WHOPPER_ARGS)
.PHONY: whopper-coverage
bench-vfs: uv-sync-test build-release
RUST_LOG=$(RUST_LOG) uv run --package turso_test bench-vfs "$(SQL)" "$(N)"
bench-sqlite: uv-sync-test build-release
RUST_LOG=$(RUST_LOG) uv run --package turso_test bench-sqlite "$(VFS)" "$(SQL)" "$(N)"
clickbench:
./perf/clickbench/benchmark.sh
.PHONY: clickbench
build-release: check-rust-version
cargo build --bin tursodb --release --features=tracing_release
bench-exclude-tpc-h:
@benchmarks=$$(cargo bench --bench 2>&1 | grep -A 1000 '^Available bench targets:' | grep -v '^Available bench targets:' | grep -v '^ *$$' | grep -v 'tpc_h_benchmark' | xargs -I {} printf -- "--bench %s " {}); \
if [ -z "$$benchmarks" ]; then \
echo "No benchmarks found (excluding tpc_h_benchmark)."; \
exit 1; \
else \
cargo bench $$benchmarks --features bench; \
fi
.PHONY: bench-exclude-tpc-h
codspeed-benchmarks-exclude-tpc-h:
@cargo bench --bench 2>&1 | awk '/^Available bench targets:/{list=1; next} list && NF {print $$1}' | grep -vx 'tpc_h_benchmark'
.PHONY: codspeed-benchmarks-exclude-tpc-h
codspeed-build-bench-exclude-tpc-h:
@benchmarks=$$($(MAKE) --no-print-directory codspeed-benchmarks-exclude-tpc-h | xargs -I {} printf -- "--bench %s " {}); \
if [ -z "$$benchmarks" ]; then \
echo "No benchmarks found (excluding tpc_h_benchmark)."; \
exit 1; \
else \
cargo codspeed build $$benchmarks --features codspeed; \
fi
.PHONY: codspeed-build-bench-exclude-tpc-h
docker-cli-build:
docker build -f Dockerfile.cli -t turso-cli .
docker-cli-run:
docker run -it -v ./:/app turso-cli
bench-tpc-c:
@cd perf/tpc-c/tpcc-turso && ./run_bench.sh
.PHONY: bench-tpc-c
merge-pr:
ifndef PR
$(error PR is required. Usage: make merge-pr PR=123)
endif
@echo "Setting up environment for PR merge..."
@if [ -z "$(GITHUB_REPOSITORY)" ]; then \
REPO=$$(git remote get-url origin | sed -E 's|.*github\.com[:/]([^/]+/[^/]+?)(\.git)?$$|\1|'); \
if [ -z "$$REPO" ]; then \
echo "Error: Could not detect repository from git remote"; \
exit 1; \
fi; \
export GITHUB_REPOSITORY="$$REPO"; \
else \
export GITHUB_REPOSITORY="$(GITHUB_REPOSITORY)"; \
fi; \
echo "Repository: $$REPO"; \
AUTH=$$(gh auth status); \
if [ -z "$$AUTH" ]; then \
echo "auth: $$AUTH"; \
echo "GitHub CLI not authenticated. Starting login process..."; \
gh auth login --scopes repo,workflow; \
else \
if ! echo "$$AUTH" | grep -q "workflow"; then \
echo "Warning: 'workflow' scope not detected. You may need to re-authenticate if merging PRs with workflow changes."; \
echo "Run: gh auth refresh -s repo,workflow"; \
fi; \
fi; \
if [ "$(LOCAL)" = "1" ]; then \
echo "merging PR #$(PR) locally"; \
uv run scripts/merge-pr.py $(PR) --local; \
else \
echo "merging PR #$(PR) on GitHub"; \
uv run scripts/merge-pr.py $(PR); \
fi
.PHONY: merge-pr
sim-schema:
mkdir -p simulator/configs/custom
cargo run -p limbo_sim -- print-schema > simulator/configs/custom/profile-schema.json
test-shuttle:
RUSTFLAGS='--cfg tokio_unstable --cfg shuttle' cargo nextest run --profile shuttle --package turso_core
test-loom:
RUSTFLAGS='--cfg tokio_unstable --cfg loom' cargo nextest run --profile loom --package turso_core