Local Testing
This guide is for testing a local checkout of Graft.
Build Artifacts
Section titled “Build Artifacts”Build the CLI:
cargo build -p graft-tool --bin graft --releaseBuild the SQLite extension:
cargo build -p graft-ext --releaseCommon artifact paths:
target/release/grafttarget/release/libgraft_ext.dylib # macOStarget/release/libgraft_ext.so # LinuxVerify The CLI
Section titled “Verify The CLI”which graftgraft --helpgraft sql --helpRun a full workflow:
tmp=$(mktemp -d)cd "$tmp"
graft initgraft sql "CREATE TABLE users(id INTEGER PRIMARY KEY, name TEXT); INSERT INTO users(name) VALUES ('Alice');"graft add app.dbgraft commit -m "initial"
graft sql "INSERT INTO users(name) VALUES ('Bob');"graft statusgraft add app.dbgraft commit -m "add bob"
graft diff HEAD~1 HEAD app.dbExpected final diff shape:
modified: app.db from: 2 page(s), 1 range(s) to: 2 page(s), 1 range(s)Verify The Extension
Section titled “Verify The Extension”In the SQLite shell:
.load /absolute/path/to/target/release/libgraft_ext.open "file:/tmp/graft-ext-demo/app.db?vfs=graft"PRAGMA graft_init;CREATE TABLE users(id INTEGER PRIMARY KEY, name TEXT);INSERT INTO users(name) VALUES ('Alice');PRAGMA graft_status;If you edit the database with plain sqlite3 app.db without the Graft VFS, Graft will not observe those writes as VFS writes. For repository-mode testing, prefer graft sql or an SQLite connection opened with vfs=graft.
Run Test Suites
Section titled “Run Test Suites”cargo fmt --checkcargo check -p graft-sqlite -p graft-toolcargo test -p graft-toolcargo test -p graft-test --test sqlite -- --test-threads=1