mirror of
https://github.com/allankoechke/turso.git
synced 2026-11-30 11:12:58 +00:00
`make -C postgres/conformance run-postgres` runs the corpus with the postgres backend. It uses the server at PG_DSN. If PG_DSN is not set, with-postgres.sh starts a throwaway PostgreSQL container with Docker and gives it a role that has CREATEDB and is not a superuser. A new CI job, "Run SQL tests (PostgreSQL)", runs the target. The container keeps its data on tmpfs and runs with fsync, synchronous_commit, full_page_writes, autovacuum and JIT off, and with wal_level=minimal. These settings do not change query results. The target runs two tests per CPU, because a test often waits for the server. With the LATERAL tests of #9468, 848 tests take about 6 s on 4 CPUs, against about 60 s with the default settings. The PostgreSQL version is one line in with-postgres.sh, and POSTGRES_VERSION changes it for one run. The image comes from mirror.gcr.io, because Docker Hub limits the pull rate of anonymous clients. 40 of the 187 tests failed on PostgreSQL 17. They check Turso-specific behavior: the EXPLAIN output, the catalogs that Turso keeps empty, and the error for a write to a catalog table. Three of them fail because Turso has the ACLs of PostgreSQL 16, without the MAINTAIN privilege of PostgreSQL 17. Mark them with @skip-if postgres, with a reason that tells what PostgreSQL does. Tests: make -C postgres/conformance run-postgres, which failed 40 tests before the skips; make -C postgres/conformance run Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01R3hzXhfjBgyLPUF7vd3PHW
79 lines
2.5 KiB
Makefile
79 lines
2.5 KiB
Makefile
# Turso PostgreSQL conformance test Makefile
|
|
#
|
|
# The .sqltest corpora live here; the sqltest runner crate lives in testing/sqltest.
|
|
|
|
# Paths
|
|
ROOT_DIR := $(shell cd ../.. && pwd)
|
|
RUNNER_DIR := $(ROOT_DIR)/testing/sqltest
|
|
|
|
# Use release mode in CI, debug mode locally
|
|
ifdef CI
|
|
CARGO_PROFILE := --release
|
|
TARGET_DIR := release
|
|
else
|
|
CARGO_PROFILE :=
|
|
TARGET_DIR := debug
|
|
endif
|
|
|
|
# Honor a CARGO_TARGET_DIR override; default to the workspace target dir.
|
|
TARGET_ROOT := $(or $(CARGO_TARGET_DIR),$(ROOT_DIR)/target)
|
|
TURSOPG := $(TARGET_ROOT)/$(TARGET_DIR)/tursopg
|
|
SQLTEST := cargo run --manifest-path $(RUNNER_DIR)/Cargo.toml --bin sqltest $(CARGO_PROFILE)
|
|
|
|
# Test corpora (relative to this directory)
|
|
PG_TESTS := pg-sqltests
|
|
|
|
# 2 * num_cpu (arbitrary multiplier)
|
|
POSTGRES_JOBS ?= $(shell expr 2 \* $$(getconf _NPROCESSORS_ONLN 2>/dev/null || echo 2))
|
|
|
|
.PHONY: all build build-tursopg build-runner check run test run-one run-postgres run-one-postgres run-upstream clean
|
|
|
|
# Build everything
|
|
all: build
|
|
|
|
# Build both tursopg and the sqltest runner
|
|
build: build-tursopg build-runner
|
|
|
|
# Build the tursopg server binary
|
|
build-tursopg:
|
|
cd $(ROOT_DIR) && cargo build $(CARGO_PROFILE) --package tursopg
|
|
|
|
# Build the sqltest runner
|
|
build-runner:
|
|
cargo build --manifest-path $(RUNNER_DIR)/Cargo.toml $(CARGO_PROFILE)
|
|
|
|
# Check syntax of all test files
|
|
check: build-runner
|
|
$(SQLTEST) check $(PG_TESTS)
|
|
|
|
# Run all tests against a spawned tursopg server
|
|
run: build
|
|
$(SQLTEST) run $(PG_TESTS) --timeout 600 --backend tursopg --binary $(TURSOPG)
|
|
|
|
# Alias for run
|
|
test: run
|
|
|
|
# Run a single test file: make run-one FILE=pg-sqltests/select.sqltest
|
|
run-one: build
|
|
$(SQLTEST) run $(FILE) --backend tursopg --binary $(TURSOPG)
|
|
|
|
# Run all tests against a real PostgreSQL server. Uses the server at PG_DSN,
|
|
# or starts a throwaway Docker container (see with-postgres.sh).
|
|
run-postgres: build-runner
|
|
./with-postgres.sh sh -c '$(SQLTEST) run $(PG_TESTS) --jobs $(POSTGRES_JOBS) --backend postgres --postgres-dsn "$$PG_DSN"'
|
|
|
|
# Run a single test file against a real PostgreSQL server:
|
|
# make run-one-postgres FILE=pg-sqltests/select.sqltest
|
|
run-one-postgres: build-runner
|
|
./with-postgres.sh sh -c '$(SQLTEST) run $(FILE) --jobs $(POSTGRES_JOBS) --backend postgres --postgres-dsn "$$PG_DSN"'
|
|
|
|
# Run the upstream PostgreSQL regress corpus with pass/fail statuses.
|
|
# Exit 0 means every test matched its status in run.py's STATUS table;
|
|
# regressions in blessed tests or unblessed new passes fail the run.
|
|
run-upstream:
|
|
./run.py
|
|
|
|
# Clean build artifacts
|
|
clean:
|
|
cargo clean --manifest-path $(RUNNER_DIR)/Cargo.toml
|