Merge 'Enforce TCL 8.6+ in compatibility tests' from Mikaël Francoeur

The compatibility test suite fails on older versions of TCL, because
they didn't handle characters outside the Basic Multilingual Plane (BMP)
properly. TCL 8.6 fixed this problem ([source](https://wiki.tcl-
lang.org/page/emoji+with+Tcl%2FTk+8.6)).
MacOS comes with an older TCL 8.5.9, so running compatibility tests
locally on the default TCL will give this error:
```
(testing/testing.db)                        Running test: unicode-emoji
Test FAILED: SELECT unicode('🠘 Š ');
returned '240'
expected '128522'
make: *** [test-compat] Error 1
```
This PR adds a target in the Makefile to enforce that TCL 8.6+ is used.
If not, it will fail with a message like this:
```
tclsh 9.0.2 found — need 11.12.13+
make: *** [check-tcl-version] Error 1
```

Closes #2020
This commit is contained in:
Pekka Enberg
2025-07-10 10:17:19 +03:00

View File

@@ -3,6 +3,7 @@ CURRENT_RUST_VERSION := $(shell rustc -V | sed -E 's/rustc ([0-9]+\.[0-9]+\.[0-9
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
@@ -27,6 +28,17 @@ check-rust-version:
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
check-wasm-target:
@echo "Checking wasm32-wasi target..."
@if ! rustup target list | grep -q "wasm32-wasi (installed)"; then \
@@ -67,7 +79,7 @@ test-shell: limbo uv-sync-test
RUST_LOG=$(RUST_LOG) SQLITE_EXEC=$(SQLITE_EXEC) uv run --project limbo_test test-shell
.PHONY: test-shell
test-compat:
test-compat: check-tcl-version
RUST_LOG=$(RUST_LOG) SQLITE_EXEC=$(SQLITE_EXEC) ./testing/all.test
.PHONY: test-compat