This document covers how to run SQL and C++ tests for the PAC extension.
From the repository root:
# Run all tests (release build)
make test
# Run all tests (debug build)
make test_debugSQL tests are located in test/sql/ and use DuckDB's SQLLogicTest format.
# From repository root
cd /path/to/pac
# Run all SQL tests
./build/release/test/unittest --test-dir . [sql]
# Run tests matching "pac"
./build/release/test/unittest --test-dir . [sql] -R pac
# Run a specific test file
./build/release/test/unittest --test-dir . [sql] test/sql/pac_parser.test
# Verbose output
./build/release/test/unittest --test-dir . [sql] -R pac -V| Argument | Description |
|---|---|
--test-dir . |
Set test directory to repo root |
[sql] |
Run only SQL tests |
-R <pattern> |
Filter tests by regex pattern |
-V |
Verbose output |
-e <pattern> |
Exclude tests matching pattern |
SQL tests use a simple format:
# name: test/sql/my_test.test
# description: Test description
# group: [sql]
require pac
statement ok
CREATE PU TABLE test (id INTEGER, PAC_KEY (id));
query I
SELECT COUNT(*) FROM test;
----
0
statement error
SELECT * FROM test;
----
Query does not contain any allowed aggregation| Directive | Description |
|---|---|
statement ok |
Statement should succeed |
statement error |
Statement should fail (can specify expected error) |
query <types> |
Query returning results (I=integer, R=real, T=text) |
---- |
Separator between query and expected result |
require pac |
Load the PAC extension |
C++ tests are located in src/test/ and use a custom test framework.
C++ tests are compiled into a standalone pac_test_runner executable:
# From repository root
cd /path/to/pac
# Build the test runner
make debug
# Run C++ tests
./build/debug/pac_test_runner| File | Description |
|---|---|
src/test/test_runner.cpp |
Main test runner |
src/test/test_pac_parser.cpp |
Parser tests |
src/test/test_schema_metadata.cpp |
Schema metadata tests |
src/test/test_plan_traversal.cpp |
Plan traversal tests |
src/test/test_compiler_functions.cpp |
Compiler function tests |
# Verbose mode shows full query output
./build/debug/test/unittest --test-dir . [sql] -R pac -V
# Show actual vs expected
./build/debug/test/unittest --test-dir . [sql] test/sql/failing_test.test -V# Start DuckDB shell
./build/debug/duckdb
# Manually run the failing SQL
D CREATE PU TABLE test (id INTEGER, PAC_KEY (id));
D SELECT COUNT(*) FROM test;For debugging with GDB/LLDB:
# Build debug version
make debug
# Run with debugger
gdb --args ./build/debug/test/unittest --test-dir . [sql] test/sql/failing_test.testtest/
└── sql/
├── pac_parser.test # Parser and syntax tests
├── pac_bitslice_compiler.test # Compiler tests
├── pac_sum.test # pac_sum aggregate tests
├── pac_count.test # pac_count aggregate tests
├── pac_min_max.test # pac_min/pac_max tests
└── ...
Tests run automatically on push via GitHub Actions. See .github/workflows/ for CI configuration.