| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- .PHONY: build test test-v test-cover bench clean fmt lint sqllogictest sqllogictest-basic sqllogictest-download build-sqllogictest
- # Build the project
- build:
- go build -o ./bin/pizzasql ./main.go
- build-linux-amd64:
- GOOS=linux GOARCH=amd64 go build -o ./bin/pizzasql-linux-amd64 ./main.go
- # Run all tests
- test:
- go test ./...
- # Run tests with verbose output
- test-v:
- go test -v ./...
- # Run tests with coverage
- test-cover:
- go test -coverprofile=coverage.out ./...
- go tool cover -html=coverage.out -o coverage.html
- @echo "Coverage report: coverage.html"
- # Run benchmarks
- bench:
- go test -bench=. -benchmem ./...
- # Run lexer tests only
- test-lexer:
- go test -v ./pkg/lexer/...
- # Run parser tests only
- test-parser:
- go test -v ./pkg/parser/...
- # Format code
- fmt:
- go fmt ./...
- # Run linter (requires golangci-lint)
- lint:
- golangci-lint run
- # Clean build artifacts
- clean:
- rm -f pizzasql coverage.out coverage.html
- # Run tests with race detection
- test-race:
- go test -race ./...
- # Quick test for development
- quick:
- go test -short ./...
- # ── sqllogictest ──────────────────────────────────────────────────────────────
- # Run the sqllogictest suite against a running PizzaSQL server (default: localhost:8080).
- # Set URL= to point at a different server, e.g. make sqllogictest URL=http://host:9090
- sqllogictest:
- go run ./cmd/sqllogictest -url $(or $(URL),http://localhost:8080) -dir testdata/sqllogictest -log sqllogictest-failures.log
- # Run only the built-in smoke test.
- sqllogictest-basic:
- go run ./cmd/sqllogictest -url $(or $(URL),http://localhost:8080) -file testdata/sqllogictest/basic.test
- # Download the official SQLite sqllogictest corpus into testdata/sqllogictest/.
- # Requires curl and tar. Files are not committed to the repo.
- sqllogictest-download:
- @echo "Downloading SQLite sqllogictest corpus..."
- mkdir -p testdata/sqllogictest
- mkdir -p /tmp/sqllogictest-dl
- curl -fsSL https://github.com/gregrahn/sqllogictest/archive/refs/heads/master.tar.gz \
- | tar xz -C /tmp/sqllogictest-dl
- find /tmp/sqllogictest-dl -name '*.test' | while read f; do \
- rel=$$(echo "$$f" | sed 's|.*/test/||'); \
- dir=testdata/sqllogictest/$$(dirname "$$rel"); \
- mkdir -p "$$dir"; \
- cp "$$f" "$$dir/"; \
- done
- rm -rf /tmp/sqllogictest-dl
- @echo "Done. $$(find testdata/sqllogictest -name '*.test' | wc -l | tr -d ' ') test files in testdata/sqllogictest/"
- # Build the sqllogictest runner binary.
- build-sqllogictest:
- go build -o ./bin/sqllogictest ./cmd/sqllogictest
|