Skip to content

Commit 2ee4128

Browse files
committed
test: functional test suite for the sqlengine binary
scripts/test_sqlengine.sh drives ./sqlengine itself (not the C++ API) and asserts on its stdout. Covers in-memory expression evaluation, single-backend queries against parsersql-single, and sharded queries against parsersql-shard1+shard2. Four modes (in-memory / single / sharded / all). Loud-failure preconditions: missing binary, missing docker, or missing container exits with code 2 and prints the exact remediation command. Never silent-skips. Exit 1 on any test assertion failure, 0 only when every selected test passes. Wired into the Makefile as test-sqlengine{,-in-memory,-single,-sharded}. Current state on the working-tree code: 30/34 tests pass. The four failures are real engine bugs surfaced by this infrastructure (filed as separate issues): aggregate projection schema in 1-shard mode and shard-key route misdirection for some keys.
1 parent c26adcc commit 2ee4128

2 files changed

Lines changed: 386 additions & 1 deletion

File tree

Makefile

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ LIB_TARGET = $(PROJECT_ROOT)/libsqlparser.a
2323
ENGINE_SRCS = $(ENGINE_SRC_DIR)/function_registry.cpp \
2424
$(ENGINE_SRC_DIR)/in_memory_catalog.cpp \
2525
$(ENGINE_SRC_DIR)/datetime_parse.cpp \
26+
$(ENGINE_SRC_DIR)/tool_config_parser.cpp \
2627
$(ENGINE_SRC_DIR)/mysql_remote_executor.cpp \
2728
$(ENGINE_SRC_DIR)/pgsql_remote_executor.cpp \
2829
$(ENGINE_SRC_DIR)/multi_remote_executor.cpp
@@ -119,7 +120,7 @@ ENGINE_STRESS_TARGET = engine_stress_test
119120
MYSQL_SERVER_SRC = $(PROJECT_ROOT)/tools/mysql_server.cpp
120121
MYSQL_SERVER_TARGET = mysql_server
121122

122-
.PHONY: all lib test bench bench-compare bench-distributed build-corpus-test build-sqlengine engine-stress mysql-server clean
123+
.PHONY: all lib test test-sqlengine test-sqlengine-in-memory test-sqlengine-single test-sqlengine-sharded bench bench-compare bench-distributed build-corpus-test build-sqlengine engine-stress mysql-server clean
123124

124125
build-corpus-test: $(CORPUS_TEST_TARGET)
125126

@@ -151,6 +152,23 @@ $(TEST_DIR)/%.o: $(TEST_DIR)/%.cpp
151152
test: $(TEST_TARGET)
152153
./$(TEST_TARGET)
153154

155+
# Functional tests of the ./sqlengine binary itself.
156+
# Loud failure (exit 2) if prerequisites are missing — never silent skip.
157+
# Caller starts the required containers before invoking these targets:
158+
# scripts/setup_single_backend.sh (for test-sqlengine-single / test-sqlengine)
159+
# scripts/start_sharding_demo.sh (for test-sqlengine-sharded / test-sqlengine)
160+
test-sqlengine: $(SQLENGINE_TARGET)
161+
./scripts/test_sqlengine.sh all
162+
163+
test-sqlengine-in-memory: $(SQLENGINE_TARGET)
164+
./scripts/test_sqlengine.sh in-memory
165+
166+
test-sqlengine-single: $(SQLENGINE_TARGET)
167+
./scripts/test_sqlengine.sh single
168+
169+
test-sqlengine-sharded: $(SQLENGINE_TARGET)
170+
./scripts/test_sqlengine.sh sharded
171+
154172
$(TEST_TARGET): $(TEST_OBJS) $(GTEST_OBJ) $(LIB_TARGET) $(ENGINE_OBJS)
155173
$(CXX) $(CXXFLAGS) -o $@ $(TEST_OBJS) $(GTEST_OBJ) $(ENGINE_OBJS) -L$(PROJECT_ROOT) -lsqlparser -lpthread $(MYSQL_LIBS) $(PG_LIBS)
156174

0 commit comments

Comments
 (0)