Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
942 lines (847 loc) · 49.8 KB
/
Copy pathMakefile
File metadata and controls
942 lines (847 loc) · 49.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
PROJ_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
# Configuration of extension
EXT_NAME=vgi
EXT_CONFIG=${PROJ_DIR}extension_config.cmake
# Auto-detect vcpkg toolchain if present in the project tree
VCPKG_TOOLCHAIN_PATH ?= $(wildcard ${PROJ_DIR}vcpkg/scripts/buildsystems/vcpkg.cmake)
# Compile packaged dependencies for shared WASM memory as well as the extension.
# Keep a distinct triplet/cache from wasm_mvp and wasm_eh. CI supplies the ordinary
# wasm triplet explicitly, so override that default while preserving custom ones.
ifneq ($(filter wasm_threads,$(MAKECMDGOALS) $(DUCKDB_PLATFORM)),)
ifeq ($(filter-out wasm32-emscripten,$(strip $(VCPKG_TARGET_TRIPLET))),)
override VCPKG_TARGET_TRIPLET := wasm32-emscripten-threads
endif
endif
# Include the Makefile from extension-ci-tools
include extension-ci-tools/makefiles/duckdb_extension.Makefile
# Engine features the SQL tests gate on with `require-env VAR 1` and
# `require-env-not VAR` (docs/upstream-duckdb-build.md): 1 on Haybarn, UNSET
# otherwise -- `require-env-not VAR value` would skip when VAR is unset. Like
# extension_config.cmake and src/include/vgi_engine_compat.hpp, the engine is
# Haybarn iff it ships duckdb/haybarn.h. Exported, so every recipe's environment
# has them -- including extension-ci-tools' own `make test`, whose runner passes
# its environment to unittest. A direct ./build/<mode>/test/unittest run must
# export them itself; test/sql/engine_features/ fails if they don't match the
# binary. Upstream v2.0.0 has none of these features, so leave them unset there.
VGI_ENGINE_TEST_VARS := VGI_ENGINE_CORRELATED_NAMED_ARGS VGI_ENGINE_DELETE_RETURNING_VIRTUAL_COLUMNS
ifneq ($(wildcard $(DUCKDB_SRCDIR)/src/include/duckdb/haybarn.h),)
VGI_ENGINE_CORRELATED_NAMED_ARGS ?= 1
VGI_ENGINE_DELETE_RETURNING_VIRTUAL_COLUMNS ?= 1
export $(VGI_ENGINE_TEST_VARS)
endif
# Each is 1 or unset. Any other value, empty included, satisfies neither
# `require-env VAR 1` nor `require-env-not VAR`: both sides of every split, and
# both drift guards, would skip without a word.
$(foreach v,$(VGI_ENGINE_TEST_VARS),$(if $(filter-out undefined,$(origin $(v))),$(if $(filter 1,$($(v))),,$(error $(v)='$($(v))': engine test variables must be 1 or unset (docs/upstream-duckdb-build.md)))))
# The skip reasons engine gating produces, for lanes that pass --allow-skip: on
# Haybarn the "absent" files skip (`require-env-not VAR`), on upstream the files
# needing the feature do (`require-env VAR 1`). An unset variable on Haybarn
# still fails such a lane, through the unlisted reason and the drift guards.
ifneq ($(wildcard $(DUCKDB_SRCDIR)/src/include/duckdb/haybarn.h),)
VGI_ENGINE_EXPECTED_SKIPS := $(foreach v,$(VGI_ENGINE_TEST_VARS),--allow-skip 'require-env-not $(v)')
else
VGI_ENGINE_EXPECTED_SKIPS := $(foreach v,$(VGI_ENGINE_TEST_VARS),--allow-skip 'require-env $(v) 1')
endif
# Execution floors (--min-executed) are calibrated on Haybarn. Upstream skips
# the files that need an engine feature, so lower them by that many there.
ifneq ($(wildcard $(DUCKDB_SRCDIR)/src/include/duckdb/haybarn.h),)
VGI_ENGINE_FLOOR_SLACK := 0
else
VGI_ENGINE_FLOOR_SLACK := $(shell grep -rlE '^require-env VGI_ENGINE_[A-Z0-9_]+ 1' test/sql 2>/dev/null | wc -l | tr -d ' ')
endif
# The variables above as NAME=value lines (none on upstream), for anything that
# runs the tests outside make: CI appends them to $GITHUB_ENV, the native SDK
# runner records them in its manifest, and a shell can load them with
# set -a; eval "$(make -s --no-print-directory engine_test_env)"; set +a
.PHONY: engine_test_env
engine_test_env:
@$(foreach v,$(VGI_ENGINE_TEST_VARS),$(if $($(v)),echo '$(v)=$($(v))';)) true
# Resource benchmarks run on Linux. See benchmarks/README.md for the isolated
# EC2 workflow, repeatable baselines, and CPU/allocation profiles.
.PHONY: benchmark_build benchmark_test benchmark benchmark_compare
benchmark_build:
bash benchmarks/build.sh $(BENCH_CMAKE_ARGS)
benchmark_test:
VGI_BENCH_DRIVER="$(PROJ_DIR)build/benchmark/extension/vgi/vgi_bench_driver" python3 -m unittest discover -s benchmarks -v
benchmark:
python3 benchmarks/bench.py run $(BENCH_ARGS)
benchmark_compare:
python3 benchmarks/bench.py compare $(BENCH_ARGS)
# vgi-python checkout that provides the fixture workers below (exported: the
# HTTP / AF_UNIX integration scripts read it too).
VGI_PYTHON_DIR ?= $(HOME)/Development/vgi-python
export VGI_PYTHON_DIR
# VGI test worker (subprocess transport)
VGI_TEST_WORKER ?= uv run --project $(VGI_PYTHON_DIR) vgi-fixture-worker
# The shared-transport matrix exercises the local RPC checkout when present so
# protocol/transport fixes can be validated end-to-end before they are released
# to PyPI. A nonexistent path is harmless (Python falls back to the version in
# vgi-python's environment); override with VGI_RPC_PYTHON_DIR as needed.
VGI_RPC_PYTHON_DIR ?= $(HOME)/Development/vgi-rpc-python
VGI_TRANSPORT_PYTHONPATH = $(VGI_RPC_PYTHON_DIR)$${PYTHONPATH:+:$$PYTHONPATH}
# Shared scratch dir for native-branch fixtures (read_parquet / read_csv arms in
# the multi_branch_* and required_field_filter_paths_native tests). The vgi-python
# fixture bakes this into its branch definitions and the coupled .test files write
# their parquet/csv there via ${VGI_TEST_BRANCH_DIR} — both must name the SAME path.
# Defaults to a fresh directory under the OS temp dir, created once per `make`
# run (simply expanded, so every recipe and sub-make sees the same one), so
# lanes running side by side on one host never share these fixed-name files.
# Exported so both the unittest process and the subprocess worker it spawns see
# it. (Hardcoded /tmp broke on Windows, which has no /tmp.) Files within one run
# that share names declare a `# serial-group:` (see scripts/run_tests.py).
ifeq ($(origin VGI_TEST_BRANCH_DIR),undefined)
VGI_TEST_BRANCH_DIR := $(shell python3 -c 'import tempfile;print(tempfile.mkdtemp(prefix="vgi-branches-"))')
endif
export VGI_TEST_BRANCH_DIR
# The vgi-python example worker implements the secret-lookup conformance
# fixtures (docs/secret_lookup_fixtures.md), which secret/secret_lookup_*.test
# gate on. Set to empty when testing a worker that does not implement them.
VGI_SECRET_LOOKUP_FIXTURES ?= 1
export VGI_SECRET_LOOKUP_FIXTURES
# spatial_filter_example(..., edge_rows := true), which
# table/spatial_extent_edge_rows.test gates on (vgi-python fixtures 0.50.1+).
VGI_SPATIAL_EDGE_ROWS_FIXTURE ?= 1
export VGI_SPATIAL_EDGE_ROWS_FIXTURE
# Writable-table and transaction-hook fixtures (docs/writable_tx_fixtures.md),
# which writable_tx/*.test gate on together with VGI_WRITABLE_TX_WORKER (the
# fixture worker LOCATION). Neither is set by default; pass both (e.g. the
# vgi-python fixture, vgi-fixture-writable-tx-worker) to run the files. Only
# exported when non-empty: require-env treats an empty variable as set.
ifneq ($(strip $(VGI_WRITABLE_TX_FIXTURES)),)
export VGI_WRITABLE_TX_FIXTURES
endif
ifneq ($(strip $(VGI_WRITABLE_TX_WORKER)),)
export VGI_WRITABLE_TX_WORKER
endif
# Versioned fixture workers for attach/versioning*.test. Set to overrideable
# defaults so `require-env` gates pass under `make test_spawn` by default.
VGI_VERSIONED_WORKER ?= uv run --project $(VGI_PYTHON_DIR) vgi-fixture-versioned-worker
VGI_VERSIONED_TABLES_WORKER ?= uv run --project $(VGI_PYTHON_DIR) vgi-fixture-versioned-tables-worker
VGI_ATTACH_OPTIONS_REQUIRED_WORKER ?= uv run --project $(VGI_PYTHON_DIR) vgi-fixture-attach-options-worker
VGI_ATTACH_OPTIONS_WORKER ?= uv run --project $(VGI_PYTHON_DIR) vgi-fixture-attach-options-worker
# Worker that advertises the previous incompatible protocol minor (3.1.0) to drive
# test/sql/integration/protocol_version/version_mismatch.test.
VGI_BAD_PROTOCOL_WORKER ?= env VGI_BAD_PROTOCOL_VERSION=3.1.0 uv run --project $(VGI_PYTHON_DIR) vgi-fixture-bad-protocol-worker
# Worker that advertises an unrecognized null_handling enum value ("WEIRD") for
# one scalar function, to drive test/sql/integration/bad_enum.test.
VGI_BAD_ENUM_WORKER ?= uv run --project $(VGI_PYTHON_DIR) vgi-fixture-bad-enum-worker
# Minimal SQLite-backed writable fixture: exercises the INSERT/UPDATE/DELETE wire
# path without requiring duckdb-python's subcursor() (which the production
# writable fixture uses). Skips real transactional semantics; tests under
# test/sql/integration/simple_writable/ assume that.
VGI_SIMPLE_WRITABLE_WORKER ?= uv run --project $(VGI_PYTHON_DIR) vgi-fixture-simple-writable-worker
# Hostile-metadata fixture (constraints naming the row_id column); lives in this
# repo and runs in vgi-python's environment, like the Iroh fixtures.
VGI_ROWID_CONSTRAINT_WORKER ?= uv run --project $(VGI_PYTHON_DIR) python $(CURDIR)/test/support/rowid_constraint_worker.py
# Hostile-data fixture (well-framed IPC with malformed buffer contents).
VGI_MALFORMED_BATCH_WORKER ?= uv run --project $(VGI_PYTHON_DIR) python $(CURDIR)/test/support/malformed_batch_worker.py
# Protocol 3.3 function visibility fixture (docs/function_visibility.md).
VGI_VISIBILITY_WORKER ?= uv run --project $(VGI_PYTHON_DIR) python $(CURDIR)/test/support/visibility_worker.py
# Protocol 3.3 write-path fixture (MERGE without rowid, branches/create replies).
VGI_WRITE_CONTRACT_WORKER ?= uv run --project $(VGI_PYTHON_DIR) python $(CURDIR)/test/support/write_contract_worker.py
# The fixture worker with every result externalized (test_launcher_external_storage).
VGI_EXTERNAL_STORAGE_WORKER ?= uv run --project $(VGI_PYTHON_DIR) python $(CURDIR)/test/support/external_storage_worker.py
# The fixture worker without vgi_rpc.Reflection.v1, standing in for a worker
# that predates reflection (test/sql/integration/reflection/pre_reflection.test).
VGI_NO_REFLECTION_WORKER ?= uv run --project $(VGI_PYTHON_DIR) python $(CURDIR)/test/support/no_reflection_worker.py
# The schema_reconcile and projection_pushdown_repro fixtures are now
# hosted inside vgi-fixture-worker (VGI_TEST_WORKER) — no separate worker
# binaries are needed.
# Subprocess transport tests.
# Writable tests are excluded from the default targets because they require
# a vgi-python worker with writable-catalog support enabled; run them
# explicitly via `make test_writable` when that worker is available.
.PHONY: test_spawn test_spawn_debug test_unix test_unix_debug test_http test_http_debug \
test_http_demo_storage test_http_demo_storage_debug test_launcher_external_storage \
test_shm test_shm_debug \
test_launcher test_launcher_debug \
test_http_attach_ticket test_http_attach_ticket_debug \
test_launcher_cloudflare_do test_launcher_cloudflare_do_debug \
test_http_versioned_tables test_http_versioned_tables_debug \
test_http_attach_options test_http_attach_options_debug \
test_http_no_compression test_http_no_compression_debug \
test_writable test_writable_debug \
test_simple_writable test_simple_writable_debug \
test_docker test_docker_debug \
test_companion test_companion_debug \
test_iceberg test_iceberg_debug \
test_transport_matrix test_transport_matrix_debug \
test_all test_all_debug
# Shared-memory transport tests — runs the same .test suite as test_spawn
# but with VGI_RPC_SHM_SIZE_BYTES set so the subprocess workers advertise a
# POSIX shm segment on init and route every data batch through the zero-copy
# side-channel (see *Shared-Memory Transport* in CLAUDE.md). The worker attaches
# the segment transparently via vgi_rpc's _maybe_attach_shm, so no separate
# fixture is needed — the env var alone flips the transport. Catalog RPCs are
# unaffected; this exercises the batch read/free/reset lockstep and the inline
# fallback when a batch overflows the segment. 64 MiB comfortably holds the
# suite's batches; overflow falls back to inline transport, not failure.
VGI_RPC_SHM_SIZE_BYTES ?= 67108864
# Routes through scripts/run_tests.py so each .test file runs in its own
# unittest subprocess, N at a time (override with VGI_RUN_TESTS_JOBS). Serial
# unittest wastes wall-clock here because each test is mostly waiting on the
# subprocess worker's I/O.
test_shm:
VGI_TRANSACTOR_DB_DIR="$$(mktemp -d)" \
VGI_RPC_SHM_SIZE_BYTES="$(VGI_RPC_SHM_SIZE_BYTES)" \
VGI_TEST_WORKER="$(VGI_TEST_WORKER)" \
VGI_VERSIONED_WORKER="$(VGI_VERSIONED_WORKER)" \
VGI_VERSIONED_TABLES_WORKER="$(VGI_VERSIONED_TABLES_WORKER)" \
VGI_ATTACH_OPTIONS_WORKER="$(VGI_ATTACH_OPTIONS_WORKER)" \
VGI_ATTACH_OPTIONS_REQUIRED_WORKER="$(VGI_ATTACH_OPTIONS_REQUIRED_WORKER)" \
VGI_BAD_PROTOCOL_WORKER="$(VGI_BAD_PROTOCOL_WORKER)" \
VGI_BAD_ENUM_WORKER="$(VGI_BAD_ENUM_WORKER)" \
VGI_SIMPLE_WRITABLE_WORKER="$(VGI_SIMPLE_WRITABLE_WORKER)" \
VGI_ROWID_CONSTRAINT_WORKER="$(VGI_ROWID_CONSTRAINT_WORKER)" \
VGI_MALFORMED_BATCH_WORKER="$(VGI_MALFORMED_BATCH_WORKER)" \
VGI_VISIBILITY_WORKER="$(VGI_VISIBILITY_WORKER)" \
VGI_WRITE_CONTRACT_WORKER="$(VGI_WRITE_CONTRACT_WORKER)" \
VGI_NO_REFLECTION_WORKER="$(VGI_NO_REFLECTION_WORKER)" \
VGI_SCHEMA_RECONCILE_DB="$$(mktemp -d)/vgi_schema_reconcile.sqlite" \
python3 scripts/run_tests.py --build release "test/*" "~test/sql/integration/writable/*"
test_shm_debug:
VGI_TRANSACTOR_DB_DIR="$$(mktemp -d)" \
VGI_RPC_SHM_SIZE_BYTES="$(VGI_RPC_SHM_SIZE_BYTES)" \
VGI_TEST_WORKER="$(VGI_TEST_WORKER)" \
VGI_VERSIONED_WORKER="$(VGI_VERSIONED_WORKER)" \
VGI_VERSIONED_TABLES_WORKER="$(VGI_VERSIONED_TABLES_WORKER)" \
VGI_ATTACH_OPTIONS_WORKER="$(VGI_ATTACH_OPTIONS_WORKER)" \
VGI_ATTACH_OPTIONS_REQUIRED_WORKER="$(VGI_ATTACH_OPTIONS_REQUIRED_WORKER)" \
VGI_BAD_PROTOCOL_WORKER="$(VGI_BAD_PROTOCOL_WORKER)" \
VGI_BAD_ENUM_WORKER="$(VGI_BAD_ENUM_WORKER)" \
VGI_SIMPLE_WRITABLE_WORKER="$(VGI_SIMPLE_WRITABLE_WORKER)" \
VGI_ROWID_CONSTRAINT_WORKER="$(VGI_ROWID_CONSTRAINT_WORKER)" \
VGI_MALFORMED_BATCH_WORKER="$(VGI_MALFORMED_BATCH_WORKER)" \
VGI_VISIBILITY_WORKER="$(VGI_VISIBILITY_WORKER)" \
VGI_WRITE_CONTRACT_WORKER="$(VGI_WRITE_CONTRACT_WORKER)" \
VGI_NO_REFLECTION_WORKER="$(VGI_NO_REFLECTION_WORKER)" \
VGI_SCHEMA_RECONCILE_DB="$$(mktemp -d)/vgi_schema_reconcile.sqlite" \
python3 scripts/run_tests.py --build debug "test/*" "~test/sql/integration/writable/*"
# Cold-spawn transport tests: every worker connection starts a *fresh* Python
# process (`uv run … vgi-fixture-worker`), so most of the wall clock is interpreter
# and project-resolution startup rather than extension code. Prefer
# `make test_launcher`, which runs the same .test suite through the pooled launcher
# transport and is dramatically faster; reach for this target when you specifically
# need to exercise the cold per-connection spawn path.
#
# Routes through scripts/run_tests.py so each .test file runs in its own
# unittest subprocess, N at a time (override with VGI_RUN_TESTS_JOBS). Serial
# unittest wastes wall-clock here because each test is mostly waiting on the
# subprocess worker's I/O.
test_spawn:
VGI_TRANSACTOR_DB_DIR="$$(mktemp -d)" \
VGI_TEST_WORKER="$(VGI_TEST_WORKER)" \
VGI_VERSIONED_WORKER="$(VGI_VERSIONED_WORKER)" \
VGI_VERSIONED_TABLES_WORKER="$(VGI_VERSIONED_TABLES_WORKER)" \
VGI_ATTACH_OPTIONS_WORKER="$(VGI_ATTACH_OPTIONS_WORKER)" \
VGI_ATTACH_OPTIONS_REQUIRED_WORKER="$(VGI_ATTACH_OPTIONS_REQUIRED_WORKER)" \
VGI_BAD_PROTOCOL_WORKER="$(VGI_BAD_PROTOCOL_WORKER)" \
VGI_BAD_ENUM_WORKER="$(VGI_BAD_ENUM_WORKER)" \
VGI_SIMPLE_WRITABLE_WORKER="$(VGI_SIMPLE_WRITABLE_WORKER)" \
VGI_ROWID_CONSTRAINT_WORKER="$(VGI_ROWID_CONSTRAINT_WORKER)" \
VGI_MALFORMED_BATCH_WORKER="$(VGI_MALFORMED_BATCH_WORKER)" \
VGI_VISIBILITY_WORKER="$(VGI_VISIBILITY_WORKER)" \
VGI_WRITE_CONTRACT_WORKER="$(VGI_WRITE_CONTRACT_WORKER)" \
VGI_NO_REFLECTION_WORKER="$(VGI_NO_REFLECTION_WORKER)" \
VGI_SCHEMA_RECONCILE_DB="$$(mktemp -d)/vgi_schema_reconcile.sqlite" \
python3 scripts/run_tests.py --build release "test/*" "~test/sql/integration/writable/*"
test_spawn_debug:
VGI_TRANSACTOR_DB_DIR="$$(mktemp -d)" \
VGI_TEST_WORKER="$(VGI_TEST_WORKER)" \
VGI_VERSIONED_WORKER="$(VGI_VERSIONED_WORKER)" \
VGI_VERSIONED_TABLES_WORKER="$(VGI_VERSIONED_TABLES_WORKER)" \
VGI_ATTACH_OPTIONS_WORKER="$(VGI_ATTACH_OPTIONS_WORKER)" \
VGI_ATTACH_OPTIONS_REQUIRED_WORKER="$(VGI_ATTACH_OPTIONS_REQUIRED_WORKER)" \
VGI_BAD_PROTOCOL_WORKER="$(VGI_BAD_PROTOCOL_WORKER)" \
VGI_BAD_ENUM_WORKER="$(VGI_BAD_ENUM_WORKER)" \
VGI_SIMPLE_WRITABLE_WORKER="$(VGI_SIMPLE_WRITABLE_WORKER)" \
VGI_ROWID_CONSTRAINT_WORKER="$(VGI_ROWID_CONSTRAINT_WORKER)" \
VGI_MALFORMED_BATCH_WORKER="$(VGI_MALFORMED_BATCH_WORKER)" \
VGI_VISIBILITY_WORKER="$(VGI_VISIBILITY_WORKER)" \
VGI_WRITE_CONTRACT_WORKER="$(VGI_WRITE_CONTRACT_WORKER)" \
VGI_NO_REFLECTION_WORKER="$(VGI_NO_REFLECTION_WORKER)" \
VGI_SCHEMA_RECONCILE_DB="$$(mktemp -d)/vgi_schema_reconcile.sqlite" \
python3 scripts/run_tests.py --build debug "test/*" "~test/sql/integration/writable/*"
# The `require spatial` files on stock DuckDB (the Haybarn engine cannot load
# spatial): this tree's release extension plus the real spatial extension,
# against VGI_TEST_WORKER. CI runs them on the upstream-DuckDB build before
# each deploy, over the subprocess and HTTP transports
# (scripts/ci_spatial_stock.sh). A local release build is Haybarn-engine: it
# works on macOS, but on Linux use CI or the published query_farm binary.
VGI_SPATIAL_TESTS := test/sql/integration/table/spatial_extent_derived.test \
test/sql/integration/table/expression_filter.test
.PHONY: test_spatial_stock
test_spatial_stock:
VGI_TEST_WORKER="$(VGI_TEST_WORKER)" uv run --no-project --with duckdb==2.0.0 \
python scripts/run_stock_duckdb_slt.py --no-skip \
--extension build/release/extension/vgi/vgi.duckdb_extension $(VGI_SPATIAL_TESTS)
# Launcher transport tests — runs the same .test suite as test_spawn but
# with each worker fronted by `launch:` so traffic flows through the C++
# launcher: ResolveLauncherSocketPath → AF_UNIX → UnixSocketWorker. Validates
# that the launcher path produces identical query results to the subprocess
# path. Idle workers self-shutdown after the configured timeout (default
# 300s), so concurrent test runs don't pile up — each unique worker argv
# gets one warm process shared across every test that uses it.
#
# One test is excluded from this target because its assertion is
# subprocess-pool-specific:
# - vgi_worker_pool.test — asserts pool count >= 1
# AF_UNIX workers are pooled by the OS socket (one shared warm worker serves
# every concurrent caller via internal threading) rather than by DuckDB's
# per-process subprocess pool, so that assertion is incidental to the
# transport, not a regression.
#
# filter_echo_partitioned was excluded here too, on the stated grounds that it
# "asserts >1 distinct worker_pid across parallel partitions". It does not, and
# has not since 2026-05-14: the only parallelism assertion in that file is
# `COUNT(DISTINCT conn=…) >= 2` (line 145), and its own comment calls conn= the
# transport-neutral form precisely because worker_pid is subprocess-only.
# Verified passing on the launcher transport 2026-08-21. Three SDKs had copied
# the wrong reason verbatim into their own Makefiles, which is what a stale
# exclusion comment does — it propagates. (versioned_tables_impl was excluded
# once too; its pool-count assertion was removed, so it passes on both.)
test_launcher:
VGI_TRANSACTOR_DB_DIR="$$(mktemp -d)" \
VGI_TEST_WORKER="launch:$(VGI_TEST_WORKER)" \
VGI_VERSIONED_WORKER="launch:$(VGI_VERSIONED_WORKER)" \
VGI_VERSIONED_TABLES_WORKER="launch:$(VGI_VERSIONED_TABLES_WORKER)" \
VGI_ATTACH_OPTIONS_WORKER="launch:$(VGI_ATTACH_OPTIONS_WORKER)" \
VGI_ATTACH_OPTIONS_REQUIRED_WORKER="launch:$(VGI_ATTACH_OPTIONS_REQUIRED_WORKER)" \
VGI_BAD_PROTOCOL_WORKER="launch:$(VGI_BAD_PROTOCOL_WORKER)" \
VGI_BAD_ENUM_WORKER="launch:$(VGI_BAD_ENUM_WORKER)" \
VGI_SIMPLE_WRITABLE_WORKER="launch:$(VGI_SIMPLE_WRITABLE_WORKER)" \
VGI_ROWID_CONSTRAINT_WORKER="launch:$(VGI_ROWID_CONSTRAINT_WORKER)" \
VGI_MALFORMED_BATCH_WORKER="launch:$(VGI_MALFORMED_BATCH_WORKER)" \
VGI_VISIBILITY_WORKER="launch:$(VGI_VISIBILITY_WORKER)" \
VGI_WRITE_CONTRACT_WORKER="launch:$(VGI_WRITE_CONTRACT_WORKER)" \
VGI_NO_REFLECTION_WORKER="launch:$(VGI_NO_REFLECTION_WORKER)" \
VGI_REQUIRE_LAUNCHER_TRANSPORT=1 \
VGI_SCHEMA_RECONCILE_DB="$$(mktemp -d)/vgi_schema_reconcile.sqlite" \
python3 scripts/run_tests.py --build release --isolate-launcher "test/*" \
"~test/sql/integration/writable/*" \
"~test/sql/vgi_worker_pool.test"
test_launcher_debug:
VGI_TRANSACTOR_DB_DIR="$$(mktemp -d)" \
VGI_TEST_WORKER="launch:$(VGI_TEST_WORKER)" \
VGI_VERSIONED_WORKER="launch:$(VGI_VERSIONED_WORKER)" \
VGI_VERSIONED_TABLES_WORKER="launch:$(VGI_VERSIONED_TABLES_WORKER)" \
VGI_ATTACH_OPTIONS_WORKER="launch:$(VGI_ATTACH_OPTIONS_WORKER)" \
VGI_ATTACH_OPTIONS_REQUIRED_WORKER="launch:$(VGI_ATTACH_OPTIONS_REQUIRED_WORKER)" \
VGI_BAD_PROTOCOL_WORKER="launch:$(VGI_BAD_PROTOCOL_WORKER)" \
VGI_BAD_ENUM_WORKER="launch:$(VGI_BAD_ENUM_WORKER)" \
VGI_SIMPLE_WRITABLE_WORKER="launch:$(VGI_SIMPLE_WRITABLE_WORKER)" \
VGI_ROWID_CONSTRAINT_WORKER="launch:$(VGI_ROWID_CONSTRAINT_WORKER)" \
VGI_MALFORMED_BATCH_WORKER="launch:$(VGI_MALFORMED_BATCH_WORKER)" \
VGI_VISIBILITY_WORKER="launch:$(VGI_VISIBILITY_WORKER)" \
VGI_WRITE_CONTRACT_WORKER="launch:$(VGI_WRITE_CONTRACT_WORKER)" \
VGI_NO_REFLECTION_WORKER="launch:$(VGI_NO_REFLECTION_WORKER)" \
VGI_REQUIRE_LAUNCHER_TRANSPORT=1 \
VGI_SCHEMA_RECONCILE_DB="$$(mktemp -d)/vgi_schema_reconcile.sqlite" \
python3 scripts/run_tests.py --build debug --isolate-launcher "test/*" \
"~test/sql/integration/writable/*" \
"~test/sql/vgi_worker_pool.test"
# Same test suite as test_launcher but with the fixture worker configured
# to use the Cloudflare Durable Object storage backend
# (VGI_WORKER_SHARED_STORAGE=cloudflare-do) instead of the default SQLite.
# Exercises the production path against the deployed sharded DO at
# vgi-cloudflare-durable-object-storage.<account>.workers.dev.
#
# Credentials live in .cloudflare-do.env (gitignored) — see that file's
# header for the format and rotation steps.
#
# Routes through scripts/run_tests.py so per-test cold-start latency
# (~600 ms to spin up a fresh CF DO per attach) overlaps across N
# concurrent unittest processes instead of serializing. Override the
# parallelism with VGI_RUN_TESTS_JOBS=N (default 8).
test_launcher_cloudflare_do:
@if [ ! -f .cloudflare-do.env ]; then \
echo "ERROR: .cloudflare-do.env not found in $(PROJ_DIR)" >&2; \
echo "Create it with the format described in its header." >&2; \
exit 1; \
fi
set -a && . ./.cloudflare-do.env && set +a && \
VGI_TRANSACTOR_DB_DIR="$$(mktemp -d)" \
VGI_TEST_WORKER="launch:$(VGI_TEST_WORKER)" \
VGI_VERSIONED_WORKER="launch:$(VGI_VERSIONED_WORKER)" \
VGI_VERSIONED_TABLES_WORKER="launch:$(VGI_VERSIONED_TABLES_WORKER)" \
VGI_ATTACH_OPTIONS_WORKER="launch:$(VGI_ATTACH_OPTIONS_WORKER)" \
VGI_ATTACH_OPTIONS_REQUIRED_WORKER="launch:$(VGI_ATTACH_OPTIONS_REQUIRED_WORKER)" \
VGI_BAD_PROTOCOL_WORKER="launch:$(VGI_BAD_PROTOCOL_WORKER)" \
VGI_BAD_ENUM_WORKER="launch:$(VGI_BAD_ENUM_WORKER)" \
VGI_SIMPLE_WRITABLE_WORKER="launch:$(VGI_SIMPLE_WRITABLE_WORKER)" \
VGI_ROWID_CONSTRAINT_WORKER="launch:$(VGI_ROWID_CONSTRAINT_WORKER)" \
VGI_MALFORMED_BATCH_WORKER="launch:$(VGI_MALFORMED_BATCH_WORKER)" \
VGI_VISIBILITY_WORKER="launch:$(VGI_VISIBILITY_WORKER)" \
VGI_WRITE_CONTRACT_WORKER="launch:$(VGI_WRITE_CONTRACT_WORKER)" \
VGI_NO_REFLECTION_WORKER="launch:$(VGI_NO_REFLECTION_WORKER)" \
VGI_REQUIRE_LAUNCHER_TRANSPORT=1 \
VGI_SCHEMA_RECONCILE_DB="$$(mktemp -d)/vgi_schema_reconcile.sqlite" \
VGI_WORKER_SHARED_STORAGE=cloudflare-do \
python3 scripts/run_tests.py --build release "test/*" \
"~test/sql/integration/writable/*" \
"~test/sql/vgi_worker_pool.test"
test_launcher_cloudflare_do_debug:
@if [ ! -f .cloudflare-do.env ]; then \
echo "ERROR: .cloudflare-do.env not found in $(PROJ_DIR)" >&2; \
echo "Create it with the format described in its header." >&2; \
exit 1; \
fi
set -a && . ./.cloudflare-do.env && set +a && \
VGI_TRANSACTOR_DB_DIR="$$(mktemp -d)" \
VGI_TEST_WORKER="launch:$(VGI_TEST_WORKER)" \
VGI_VERSIONED_WORKER="launch:$(VGI_VERSIONED_WORKER)" \
VGI_VERSIONED_TABLES_WORKER="launch:$(VGI_VERSIONED_TABLES_WORKER)" \
VGI_ATTACH_OPTIONS_WORKER="launch:$(VGI_ATTACH_OPTIONS_WORKER)" \
VGI_ATTACH_OPTIONS_REQUIRED_WORKER="launch:$(VGI_ATTACH_OPTIONS_REQUIRED_WORKER)" \
VGI_BAD_PROTOCOL_WORKER="launch:$(VGI_BAD_PROTOCOL_WORKER)" \
VGI_BAD_ENUM_WORKER="launch:$(VGI_BAD_ENUM_WORKER)" \
VGI_SIMPLE_WRITABLE_WORKER="launch:$(VGI_SIMPLE_WRITABLE_WORKER)" \
VGI_ROWID_CONSTRAINT_WORKER="launch:$(VGI_ROWID_CONSTRAINT_WORKER)" \
VGI_MALFORMED_BATCH_WORKER="launch:$(VGI_MALFORMED_BATCH_WORKER)" \
VGI_VISIBILITY_WORKER="launch:$(VGI_VISIBILITY_WORKER)" \
VGI_WRITE_CONTRACT_WORKER="launch:$(VGI_WRITE_CONTRACT_WORKER)" \
VGI_NO_REFLECTION_WORKER="launch:$(VGI_NO_REFLECTION_WORKER)" \
VGI_REQUIRE_LAUNCHER_TRANSPORT=1 \
VGI_SCHEMA_RECONCILE_DB="$$(mktemp -d)/vgi_schema_reconcile.sqlite" \
VGI_WORKER_SHARED_STORAGE=cloudflare-do \
python3 scripts/run_tests.py --build debug "test/*" \
"~test/sql/integration/writable/*" \
"~test/sql/vgi_worker_pool.test"
# Shared Unix-socket transport tests. This is deliberately the same suite and
# exclusions as test_http so transport parity is meaningful.
test_unix:
PYTHONPATH="$(VGI_TRANSPORT_PYTHONPATH)" \
./test/run_unix_integration.sh "test/sql/integration/*" \
"test/sql/engine_features/*" \
"~test/sql/integration/writable/*" \
"~test/sql/integration/projection_pushdown_repro.test"
test_unix_debug:
PYTHONPATH="$(VGI_TRANSPORT_PYTHONPATH)" \
BUILD_DIR=debug ./test/run_unix_integration.sh "test/sql/integration/*" \
"test/sql/engine_features/*" \
"~test/sql/integration/writable/*" \
"~test/sql/integration/projection_pushdown_repro.test"
# HTTP transport tests (uses test/run_http_integration.sh)
#
# projection_pushdown_repro.test is excluded: its fixtures use chunk=2 to
# emit one tiny batch per process() tick, which over HTTP becomes one POST
# round-trip per pair of rows. The test is checking projection-id → wire
# column mapping in the C++ extension — that's transport-agnostic, fully
# covered by the subprocess run, and HTTP transport adds no signal here
# while inflating the test by 50× in round-trips.
test_http:
PYTHONPATH="$(VGI_TRANSPORT_PYTHONPATH)" \
./test/run_http_integration.sh "test/sql/integration/*" \
"test/sql/engine_features/*" \
"~test/sql/integration/writable/*" \
"~test/sql/integration/projection_pushdown_repro.test"
test_http_debug:
PYTHONPATH="$(VGI_TRANSPORT_PYTHONPATH)" \
BUILD_DIR=debug ./test/run_http_integration.sh "test/sql/integration/*" \
"test/sql/engine_features/*" \
"~test/sql/integration/writable/*" \
"~test/sql/integration/projection_pushdown_repro.test"
# Local OAuth discovery fixture: refresh/session reuse without a real login.
.PHONY: test_catalog_discovery_auth
test_catalog_discovery_auth:
VGI_PYTHON_DIR="$(VGI_PYTHON_DIR)" python3 test/catalog_discovery_auth.py
# HTTP bearer auth tests
test_http_bearer:
./test/run_http_bearer_integration.sh "test/sql/integration/bearer_auth/*"
test_http_bearer_debug:
BUILD_DIR=debug ./test/run_http_bearer_integration.sh "test/sql/integration/bearer_auth/*"
# Attach tickets (vgi.attach_tickets.v1 + sealed grants): two HTTP fixture
# workers with signing and grant keys. See test/sql/integration/attach_ticket/.
test_http_attach_ticket:
VGI_PYTHON_DIR="$(VGI_PYTHON_DIR)" ./test/run_http_attach_ticket_integration.sh "test/sql/integration/attach_ticket/*"
test_http_attach_ticket_debug:
VGI_PYTHON_DIR="$(VGI_PYTHON_DIR)" BUILD_DIR=debug ./test/run_http_attach_ticket_integration.sh "test/sql/integration/attach_ticket/*"
# HTTP versioned-tables tests (runs against the vgi-fixture-versioned-tables-worker
# in HTTP mode). Separate from test_http because it needs its own server.
test_http_versioned_tables:
./test/run_http_versioned_tables_integration.sh
test_http_versioned_tables_debug:
BUILD_DIR=debug ./test/run_http_versioned_tables_integration.sh
# HTTP attach-options tests (runs against the vgi-fixture-attach-options-worker
# in HTTP mode). Separate from test_http because it needs its own server.
test_http_attach_options:
./test/run_http_attach_options_integration.sh
test_http_attach_options_debug:
BUILD_DIR=debug ./test/run_http_attach_options_integration.sh
# HTTP tests against a compression-DISABLED server (make_wsgi_app with
# compression_level=None), which advertises an EMPTY VGI-Supported-Encodings.
# Needs its own server because the standard fixture always enables compression.
test_http_no_compression:
./test/run_http_no_compression_integration.sh
test_http_no_compression_debug:
BUILD_DIR=debug ./test/run_http_no_compression_integration.sh
# Launcher suite against the fixture worker externalizing every result (unary,
# stream header, data) over the byte transport -- externalization is a server
# setting, not an HTTP feature. See test/support/external_storage_worker.py.
test_launcher_external_storage:
PYTHONPATH="$(VGI_TRANSPORT_PYTHONPATH)" $(MAKE) test_launcher VGI_TEST_WORKER="$(VGI_EXTERNAL_STORAGE_WORKER)"
# HTTP suite against a server that externalizes every response (threshold
# 1 byte) to its demo object store, so each result -- catalog RPCs included --
# arrives as a vgi_rpc.location pointer the client fetches. The only lane that
# reaches the externalized fetch from VgiTransaction::Start, where a secret
# lookup self-deadlocks (duckdb#22258); run_tests.py's per-file timeout turns a
# hang into a failure with thread stacks.
test_http_demo_storage:
PYTHONPATH="$(VGI_TRANSPORT_PYTHONPATH)" VGI_DEMO_STORAGE=1 \
./test/run_http_integration.sh "test/sql/integration/*" \
"test/sql/engine_features/*" \
"~test/sql/integration/writable/*" \
"~test/sql/integration/projection_pushdown_repro.test"
test_http_demo_storage_debug:
PYTHONPATH="$(VGI_TRANSPORT_PYTHONPATH)" VGI_DEMO_STORAGE=1 BUILD_DIR=debug \
./test/run_http_integration.sh "test/sql/integration/*" \
"test/sql/engine_features/*" \
"~test/sql/integration/writable/*" \
"~test/sql/integration/projection_pushdown_repro.test"
# Container (OCI/Docker) transport tests (uses test/run_docker_integration.sh).
# Skips cleanly when no container runtime is present, so it's safe to run
# anywhere. Override VGI_DOCKER_IMAGE / CONTAINER_RUNTIME to target a different
# image or runtime (e.g. CONTAINER_RUNTIME=podman).
test_docker:
./test/run_docker_integration.sh "test/sql/integration/container/*"
test_docker_debug:
BUILD_DIR=debug ./test/run_docker_integration.sh "test/sql/integration/container/*"
# Companion-catalog (lakehouse federation) integration tests (uses
# test/run_companion_integration.sh). Seeds a DuckLake, points the companion
# fixture worker at it, and runs the companion .test files. Skips cleanly when
# ducklake / sqlite_scanner are unavailable.
test_companion:
./test/run_companion_integration.sh "test/sql/integration/catalog/companion_catalogs.test"
test_companion_debug:
BUILD_DIR=debug ./test/run_companion_integration.sh "test/sql/integration/catalog/companion_catalogs.test"
# Iceberg function-branch integration tests (uses test/run_iceberg_integration.sh).
# Installs the iceberg community extension and runs multi_branch_iceberg.test,
# which scans a COPY-TO-iceberg table as a native cold-tier branch of a VGI
# multi-branch table. Skips cleanly when iceberg is unavailable.
test_iceberg:
./test/run_iceberg_integration.sh "test/sql/integration/catalog/multi_branch_iceberg.test"
test_iceberg_debug:
BUILD_DIR=debug ./test/run_iceberg_integration.sh "test/sql/integration/catalog/multi_branch_iceberg.test"
# Writable catalog tests (subprocess transport) — opt-in, require a worker
# with writable-catalog support.
test_writable:
VGI_TRANSACTOR_DB_DIR="$$(mktemp -d)" VGI_TEST_WORKER="$(VGI_TEST_WORKER)" python3 scripts/run_tests.py --build release "test/sql/integration/writable/*"
test_writable_debug:
VGI_TRANSACTOR_DB_DIR="$$(mktemp -d)" VGI_TEST_WORKER="$(VGI_TEST_WORKER)" python3 scripts/run_tests.py --build debug "test/sql/integration/writable/*"
# Minimal-writable tests run by default through test_spawn (the env var is
# already wired there); this target is for running just the simple-writable
# sqllogictests in isolation.
test_simple_writable:
VGI_SIMPLE_WRITABLE_WORKER="$(VGI_SIMPLE_WRITABLE_WORKER)" python3 scripts/run_tests.py --build release "test/sql/integration/simple_writable/*"
test_simple_writable_debug:
VGI_SIMPLE_WRITABLE_WORKER="$(VGI_SIMPLE_WRITABLE_WORKER)" python3 scripts/run_tests.py --build debug "test/sql/integration/simple_writable/*"
# The production shared-transport parity gate: identical SQLLogicTests over a
# local Unix socket and HTTP.
test_transport_matrix: test_unix test_http
test_transport_matrix_debug: test_unix_debug test_http_debug
# Run all transports
test_all: test_spawn test_shm test_unix test_http test_http_bearer test_http_attach_ticket test_http_versioned_tables test_http_attach_options test_http_no_compression
test_all_debug: test_spawn_debug test_shm_debug test_unix_debug test_http_debug test_http_bearer_debug test_http_attach_ticket_debug test_http_versioned_tables_debug test_http_attach_options_debug test_http_no_compression_debug
# ---------------------------------------------------------------------------
# Per-language integration runs
#
# The VGI_*_WORKER vars above default to the vgi-python fixtures, so the
# transport targets (test_spawn / test_launcher / ...) already exercise
# the Python implementation. These convenience targets run the SAME
# test/sql/integration suite against the Go / TypeScript / Java / C# worker
# implementations by delegating to each SDK repo's own gated test target
# (`make test` for go/typescript/java, `make test_integration_gated` for C#,
# whose bare `test` is its xUnit unit suite instead), which builds that
# language's worker(s) and applies the exclusions for fixtures it doesn't
# implement. Each SDK Makefile points its UNITTEST back at this repo's build,
# so all five run identical .test files — only the worker differs.
#
# Override an SDK location with VGI_GO_DIR / VGI_TS_DIR / VGI_JAVA_DIR / VGI_CSHARP_DIR.
#
# Storage backend: each run defaults to the local SQLite tier. The worker
# inherits VGI_WORKER_SHARED_STORAGE from the environment, so
# `VGI_WORKER_SHARED_STORAGE=memory make test_go` runs the in-process tier.
# (Reliable on the subprocess transport, where every test spawns a fresh
# worker. Under the launcher transport — TypeScript/Java — a warm worker
# cached from a prior run is reused regardless of env, so kill stale workers
# first if switching tiers mid-session.)
# ---------------------------------------------------------------------------
# ---------------------------------------------------------------------------
# The integration suite does NOT run from `make test_<build_type>`.
#
# It used to try: a `ci_fixtures` prerequisite on the inherited target, so the
# distribution pipeline's test step would install the vgi-python fixture
# workers first. That could never work. The reusable workflow exposes no hook
# that runs a command before testing, and its Linux leg runs the tests inside
# `docker run ... make test_release` — a fresh container the install never
# reached. Worse than a no-op: VGI_TEST_WORKER was set from `test_env_variables`
# while the worker it named did not exist, so ~300 tests FAILED rather than
# skipping.
#
# scripts/ci_install_fixtures.sh is still the installer; it is now invoked by
# .github/workflows/integration.yml, which owns its own steps and can run a
# command before the suite. Locally, `make test_launcher` already points at a
# worker directly.
# ---------------------------------------------------------------------------
VGI_GO_DIR ?= $(HOME)/Development/vgi-go
VGI_TS_DIR ?= $(HOME)/Development/vgi-typescript
VGI_JAVA_DIR ?= $(HOME)/Development/vgi-java
VGI_RUST_DIR ?= $(HOME)/Development/vgi-rust
VGI_CSHARP_DIR ?= $(HOME)/Development/vgi-csharp
.PHONY: test_python test_column_paths test_dependencies test_semantic_alter test_queries test_go test_typescript test_java test_rust test_csharp test_languages \
build_database_workers test_database_workers test_database_worker_restart
# Successor protocol preparation: run real 1.5 SQL against the durable DDL
# reference without requiring the older transactor's fork-only subcursor API.
test_column_paths:
VGI_PYTHON_DIR="$(VGI_PYTHON_DIR)" python3 test/run_column_paths.py
test_dependencies:
VGI_PYTHON_DIR="$(VGI_PYTHON_DIR)" python3 test/run_dependencies.py
test_default_schema:
VGI_PYTHON_DIR="$(VGI_PYTHON_DIR)" python3 test/run_default_schema.py
# Semantic column/object dependency closures against the durable metadata reference.
test_semantic_alter:
python3 test/run_semantic_alter.py --python "$(VGI_PYTHON_DIR)"
# Explicit prepared queries against the finite durable reference on DuckDB 1.5.
test_queries:
VGI_PYTHON_DIR="$(VGI_PYTHON_DIR)" python3 test/run_queries.py
# Real database-package demonstrations. These are intentionally separate from
# the fast default suite: PyInstaller and Bun each produce a ~100 MiB native
# executable, and Rust compiles the full example worker. The resulting tests do
# not delegate to VGI_TEST_WORKER; the BLOB restored from DuckDB is the worker.
VGI_DATABASE_WORKER_FIXTURE_DIR ?= $(PROJ_DIR)build/database-worker-fixtures
VGI_DATABASE_PYTHON_DIR ?= $(VGI_PYTHON_DIR)
VGI_DATABASE_RUST_DIR ?= $(HOME)/Development/vgi-rust
VGI_DATABASE_OPEN_METEO_DIR ?= $(HOME)/Development/vgi-open-meteo
build_database_workers:
VGI_DATABASE_WORKER_FIXTURE_DIR="$(VGI_DATABASE_WORKER_FIXTURE_DIR)" \
VGI_DATABASE_PYTHON_DIR="$(VGI_DATABASE_PYTHON_DIR)" \
VGI_DATABASE_RUST_DIR="$(VGI_DATABASE_RUST_DIR)" \
VGI_DATABASE_OPEN_METEO_DIR="$(VGI_DATABASE_OPEN_METEO_DIR)" \
./scripts/build_database_worker_fixtures.sh
test_database_workers: build_database_workers
database_worker_cache="$$(mktemp -d)"; \
trap 'rm -rf "$$database_worker_cache"' 0; \
XDG_CACHE_HOME="$$database_worker_cache" \
VGI_DATABASE_PYTHON_WORKER="$(VGI_DATABASE_WORKER_FIXTURE_DIR)/vgi-python-worker" \
VGI_DATABASE_BUN_WORKER="$(VGI_DATABASE_WORKER_FIXTURE_DIR)/vgi-open-meteo" \
VGI_DATABASE_RUST_WORKER="$(VGI_DATABASE_WORKER_FIXTURE_DIR)/vgi-rust-worker.tar.gz" \
python3 scripts/run_tests.py --build release "test/sql/integration/database_worker/real_*"
VGI_DATABASE_PYTHON_WORKER="$(VGI_DATABASE_WORKER_FIXTURE_DIR)/vgi-python-worker" \
VGI_DATABASE_BUN_WORKER="$(VGI_DATABASE_WORKER_FIXTURE_DIR)/vgi-open-meteo" \
VGI_DATABASE_RUST_WORKER="$(VGI_DATABASE_WORKER_FIXTURE_DIR)/vgi-rust-worker.tar.gz" \
./scripts/test_database_worker_restart.sh
test_database_worker_restart: build_database_workers
VGI_DATABASE_PYTHON_WORKER="$(VGI_DATABASE_WORKER_FIXTURE_DIR)/vgi-python-worker" \
VGI_DATABASE_BUN_WORKER="$(VGI_DATABASE_WORKER_FIXTURE_DIR)/vgi-open-meteo" \
VGI_DATABASE_RUST_WORKER="$(VGI_DATABASE_WORKER_FIXTURE_DIR)/vgi-rust-worker.tar.gz" \
./scripts/test_database_worker_restart.sh
# Python uses this repo's default worker set. It does NOT just chain to
# test_launcher, which invokes `unittest` bare: a lane that stops running tests
# reports GREEN under that (fewer results, all passing), which is exactly what
# the coverage gate exists to catch. test_launcher stays ungated because it is
# the everyday dev lane and a floor there is friction; test_python is the
# conformance lane, so it gets the same two gates the rust/go/java/typescript
# lanes have.
#
# Python runs 304 today.
#
VGI_PYTHON_MIN_EXECUTED ?= 300
test_python:
VGI_TRANSACTOR_DB_DIR="$$(mktemp -d)" \
VGI_TEST_WORKER="launch:$(VGI_TEST_WORKER)" \
VGI_VERSIONED_WORKER="launch:$(VGI_VERSIONED_WORKER)" \
VGI_VERSIONED_TABLES_WORKER="launch:$(VGI_VERSIONED_TABLES_WORKER)" \
VGI_ATTACH_OPTIONS_WORKER="launch:$(VGI_ATTACH_OPTIONS_WORKER)" \
VGI_ATTACH_OPTIONS_REQUIRED_WORKER="launch:$(VGI_ATTACH_OPTIONS_REQUIRED_WORKER)" \
VGI_BAD_PROTOCOL_WORKER="launch:$(VGI_BAD_PROTOCOL_WORKER)" \
VGI_BAD_ENUM_WORKER="launch:$(VGI_BAD_ENUM_WORKER)" \
VGI_SIMPLE_WRITABLE_WORKER="launch:$(VGI_SIMPLE_WRITABLE_WORKER)" \
VGI_ROWID_CONSTRAINT_WORKER="launch:$(VGI_ROWID_CONSTRAINT_WORKER)" \
VGI_MALFORMED_BATCH_WORKER="launch:$(VGI_MALFORMED_BATCH_WORKER)" \
VGI_VISIBILITY_WORKER="launch:$(VGI_VISIBILITY_WORKER)" \
VGI_WRITE_CONTRACT_WORKER="launch:$(VGI_WRITE_CONTRACT_WORKER)" \
VGI_NO_REFLECTION_WORKER="launch:$(VGI_NO_REFLECTION_WORKER)" \
VGI_REQUIRE_LAUNCHER_TRANSPORT=1 \
VGI_SCHEMA_RECONCILE_DB="$$(mktemp -d)/vgi_schema_reconcile.sqlite" \
python3 scripts/run_tests.py -j 6 --isolate-launcher \
--min-executed $$(( $(VGI_PYTHON_MIN_EXECUTED) - $(VGI_ENGINE_FLOOR_SLACK) )) $(VGI_EXPECTED_SKIPS) \
"test/*" \
"~test/sql/duckdb2/column_paths.test" \
"~test/sql/duckdb2/required_filter_paths.test" \
"~test/sql/duckdb2/view_alias_metadata.test" \
"~test/sql/duckdb2/schema_dependencies.test" \
"~test/sql/duckdb2/default_schema.test" \
"~test/sql/integration/writable/*" \
"~test/sql/vgi_worker_pool.test"
# Pass VGI_DIR: each SDK Makefile defaults it to ../vgi, which is wrong for an SDK
# checkout that is not a sibling of this one.
test_go:
$(MAKE) -C $(VGI_GO_DIR) test VGI_DIR=$(CURDIR)
test_typescript:
$(MAKE) -C $(VGI_TS_DIR) test VGI_DIR=$(CURDIR)
test_java:
$(MAKE) -C $(VGI_JAVA_DIR) test VGI_DIR=$(CURDIR)
# C# has no Makefile-embedded coverage gate of its own to delegate to bare `test` for (its
# `test` target is the xUnit unit suite) — its `test_integration_gated` target is the
# gated conformance lane, built to match this one. Full fixture coverage (versioned/
# versioned_tables/attach_options/attach_options_required/bad_enum) as of the version-resolution
# + attach-options + bad-enum work — see that Makefile for the gate detail.
test_csharp:
$(MAKE) -C $(VGI_CSHARP_DIR) test_integration_gated VGI_DIR=$(CURDIR)
# Rust has no Makefile of its own — build the example worker and point the
# suite at it directly. Same .test files, only the worker differs.
#
# The auxiliary fixture workers come from vgi-rust's own ci/wrappers/, which
# route the single example binary into the versioned / versioned_tables /
# attach_options / bad_protocol catalogs via VGI_WORKER_CATALOG_NAME. They were
# CI-only, so this lane ran 282 of the suite's cases where CI ran 292 — the
# expensive lane finding MORE than the cheap one is the wrong way round.
#
# Bare subprocess transport, not launch:, deliberately. `cargo build` rewrites
# the binary in place at a stable path, and a launcher keys its shared worker on
# that path — so a launch: lane happily serves the PREVIOUS build's code after a
# rebuild unless you remember to pkill first. A dev lane must not have that
# footgun. The cost is VGI_REQUIRE_LAUNCHER_TRANSPORT staying unset, so the one
# launcher-specific file still skips here; vgi-rust's CI covers it.
# Coverage gates for the SDK lanes.
#
# A lane that stops running tests reports green — it has fewer results, and
# every one of them passes. That is how a fixture worker silently dropping out
# of the environment went unnoticed for months, and it is why both gates below
# exist rather than just the skip REPORTING:
#
# --min-executed a floor on tests that actually ran. Set just under the
# lane's current count; if the drop is intentional, lower it
# in the same commit that causes it.
# --allow-skip the skip reasons this lane expects. An UNLISTED reason
# fails the run, so a newly-gated test cannot quietly leave
# the lane. Mirrors vgi-java's EXPECTED_SKIP_REASONS, which
# is where this idea comes from.
#
# The reasons here are the ones no launcher lane can satisfy: an external
# runtime (docker, iceberg, spatial, network), an HTTP-transport-only file, or
# a capability this worker genuinely lacks (dynamic code, writable tables).
VGI_EXPECTED_SKIPS := \
--allow-skip 'require spatial' \
--allow-skip 'require-env VGI_DOCKER_IMAGE' \
--allow-skip 'require-env VGI_DOCKER_TCP_IMAGE' \
--allow-skip 'require-env VGI_DOCKER_TX_IMAGE' \
--allow-skip 'require-env VGI_DATABASE_BUN_WORKER' \
--allow-skip 'require-env VGI_DATABASE_PYTHON_WORKER' \
--allow-skip 'require-env VGI_DATABASE_RUST_WORKER' \
--allow-skip 'require-env VGI_GITHUB_NETWORK_TESTS' \
--allow-skip 'require-env VGI_TEST_ICEBERG' \
--allow-skip 'require-env VGI_TEST_COMPANION_TARGET' \
--allow-skip 'require-env VGI_TEST_BEARER_TOKEN' \
--allow-skip 'require-env VGI_HTTP_TRANSPORT' \
--allow-skip 'require-env VGI_HTTP_DISABLE_ZSTD' \
--allow-skip 'require-env VGI_HTTP_NO_COMPRESSION' \
--allow-skip 'require-env VGI_VERSIONED_HTTP_WORKER' \
--allow-skip 'require-env VGI_VERSIONED_TABLES_HTTP_WORKER' \
--allow-skip 'require-env VGI_WORKER_SUPPORTS_DYNAMIC_CODE' \
--allow-skip 'require-env VGI_SIMPLE_WRITABLE_WORKER' \
--allow-skip 'require-env VGI_WRITABLE_TX_FIXTURES' \
--allow-skip 'require-env VGI_WRITABLE_TX_WORKER' \
--allow-skip 'require-env VGI_ROWID_CONSTRAINT_WORKER' \
--allow-skip 'require-env VGI_VISIBILITY_WORKER' \
--allow-skip 'require-env VGI_WRITE_CONTRACT_WORKER' \
--allow-skip 'require-env VGI_MALFORMED_BATCH_WORKER' \
--allow-skip 'require-env VGI_NO_REFLECTION_WORKER' \
--allow-skip 'require-env VGI_SCHEMA_RECONCILE_DB' \
--allow-skip 'require-env VGI_RULES_WORKER' \
--allow-skip 'require-env VGI_REQUIRE_LAUNCHER_TRANSPORT' \
$(VGI_ENGINE_EXPECTED_SKIPS)
# Rust's lane runs 291 today. The floor sits a little under so an unrelated
# environment wobble doesn't fail the build, while a fixture dropping out does.
VGI_RUST_MIN_EXECUTED ?= 288
VGI_COVERAGE_GATE = --min-executed $$(( $(VGI_RUST_MIN_EXECUTED) - $(VGI_ENGINE_FLOOR_SLACK) )) $(VGI_EXPECTED_SKIPS)
VGI_RUST_WORKER := $(VGI_RUST_DIR)/target/debug/vgi-example-worker
VGI_RUST_WRAPPERS := $(VGI_RUST_DIR)/ci/wrappers
test_rust:
cd $(VGI_RUST_DIR) && cargo build -p vgi-example-worker
VGI_WORKER_BIN="$(VGI_RUST_WORKER)" \
VGI_TEST_WORKER="$(VGI_RUST_WORKER)" \
VGI_VERSIONED_WORKER="$(VGI_RUST_WRAPPERS)/vgi-worker-versioned" \
VGI_VERSIONED_TABLES_WORKER="$(VGI_RUST_WRAPPERS)/vgi-worker-versioned-tables" \
VGI_ATTACH_OPTIONS_WORKER="$(VGI_RUST_WRAPPERS)/vgi-worker-attach-options" \
VGI_ATTACH_OPTIONS_REQUIRED_WORKER="$(VGI_RUST_WRAPPERS)/vgi-worker-attach-options" \
VGI_BAD_PROTOCOL_WORKER="$(VGI_RUST_WRAPPERS)/vgi-worker-bad-protocol" \
VGI_BAD_ENUM_WORKER="$(VGI_RUST_WRAPPERS)/vgi-worker-bad-enum" \
python3 scripts/run_tests.py -j 6 $(VGI_COVERAGE_GATE) "test/sql/integration/*"
# Run dedicated native references, then the six SDK targets wired below.
# The C++ SDK integration lane currently runs separately from this aggregate.
# Keep going on failure so one language's result does not mask the others.
test_languages: test_column_paths test_dependencies test_default_schema
@rc=0; \
for t in test_python test_go test_rust test_typescript test_java test_csharp; do \
echo "==================== $$t ===================="; \
$(MAKE) $$t || rc=$$?; \
done; \
exit $$rc
# ---------------------------------------------------------------------------
# Schema parity.
#
# The protocol's Arrow record shapes are declared once in vgi-python and
# reproduced in seven places (five SDK codegen outputs, vgi-python's own
# hand-written records, and this client's hand-built request builders). Each
# reproduction drifts on its own, and drift is invisible from inside the drifted
# peer — every implementation is self-consistent right up until it talks to
# another one. This runs all three layers of check in one command.
#
# make schema_parity # codegen drift + hand-built records + C++ client
# make schema_parity_cpp # just the C++ client leg (no pytest, fast)
#
# The C++ leg needs the unit-test target, which is guarded by an env var read at
# CONFIGURE time — so if you have never built it (see unit_test_rust_libs below):
# make unit_test_rust_libs
# BUILD_VGI_UNIT_TESTS=1 GEN=ninja make release
.PHONY: schema_parity schema_parity_cpp test_filter_v2 unit_test_rust_libs
schema_parity:
./scripts/check_schema_parity.sh
schema_parity_cpp:
./scripts/check_schema_parity.sh --cpp-only
# vgi_unit_tests links two Rust staticlibs that CMake does not build:
# test/support/sabffi (a bare vgi-rpc server) and test/support/sabtable (a vgi-rust
# table-function worker), for the native [sab-e2e] / [sab-conn] cases. Build them
# BEFORE configuring with BUILD_VGI_UNIT_TESTS: that puts vgi_unit_tests in the
# default target, so `make release` itself fails to link without them. Both
# resolve from crates.io against their committed lockfiles, never a sibling
# checkout, and --locked means a build can neither re-resolve nor rewrite them.
# The lock check first refuses a pair that would link two different vgi-rpcs
# (sabffi pins it directly; sabtable gets it through vgi).
unit_test_rust_libs:
./scripts/check_rust_fixture_locks.sh
cd test/support/sabffi && cargo build --release --locked
cd test/support/sabtable && cargo build --release --locked
# Configure with BUILD_VGI_FILTER_V2_TESTS=1, then run the real C++ producer
# tests independently of the launcher/SAB unit-test target.
test_filter_v2:
cmake --build build/release --target vgi_filter_v2_tests
./build/release/extension/vgi/vgi_filter_v2_tests
# Uses the same independent C++ test configuration as test_filter_v2.
.PHONY: test_settings
test_settings:
python3 scripts/generate_settings.py --check
cmake --build build/release --target vgi_settings_tests
./build/release/extension/vgi/vgi_settings_tests
# Configure with BUILD_VGI_CANCEL_DISPATCHER_TESTS=1 (or BUILD_VGI_UNIT_TESTS),
# then run the cancel dispatcher's worker-start and shutdown tests.
test_cancel_dispatcher:
cmake --build build/release --target vgi_cancel_dispatcher_tests
./build/release/extension/vgi/vgi_cancel_dispatcher_tests
# Configure with BUILD_VGI_HTTP_INTERRUPT_TESTS=1 (or BUILD_VGI_UNIT_TESTS),
# then check that an interrupt aborts an in-flight VGI HTTP request.
test_http_interrupt:
cmake --build build/release --target vgi_http_interrupt_tests
./build/release/extension/vgi/vgi_http_interrupt_tests
# Interactive DuckDB shell with the vgi extension loaded and the example
# python worker pre-attached as the `example` catalog. Use `make shell`
# (release) or `make shell_debug` for the debug build. Override the worker
# with VGI_TEST_WORKER=... or the attached catalog name with VGI_SHELL_CATALOG=...
VGI_SHELL_CATALOG ?= example
VGI_SHELL_ATTACH = ATTACH 'example' AS $(VGI_SHELL_CATALOG) (TYPE vgi, LOCATION '$(VGI_TEST_WORKER)');
.PHONY: shell shell_debug
shell:
./build/release/duckdb -cmd "$(VGI_SHELL_ATTACH)"
shell_debug:
./build/debug/duckdb -cmd "$(VGI_SHELL_ATTACH)"