ORACLE_DIR := tools/python-oracle
FIXTURES_DIR := fixtures
CARGO ?= cargo
.DEFAULT_GOAL := help
.PHONY: help \
oracle-sync oracle-test oracle-test-stage oracle-test-fast oracle-clean \
oracle-fixtures \
crate-fmt crate-fmt-check crate-clippy crate-check crate-test crate-bench crate-doc crate-clean \
test sync clean
help:
@awk 'BEGIN { FS = ":.*##"; printf "\n%-22s %s\n", "Target", "Description"; printf "%-22s %s\n", "------", "-----------" } \
/^[a-zA-Z_-]+:.*##/ { printf "%-22s %s\n", $$1, $$2 }' $(MAKEFILE_LIST)
@printf "\nExamples:\n"
@printf " make oracle-test @printf " make oracle-test-stage STAGE=params @printf " make crate-check @printf " make crate-test
sync: oracle-sync
test: oracle-test crate-test
clean: oracle-clean crate-clean
oracle-sync:
cd $(ORACLE_DIR) && uv sync
oracle-test: oracle-sync
cd $(ORACLE_DIR) && uv run pytest -v
oracle-test-fast: oracle-sync
cd $(ORACLE_DIR) && uv run pytest -q
oracle-test-stage: oracle-sync ## Run one stage's tests; usage: make oracle-test-stage STAGE=<name>
@if [ -z "$(STAGE)" ]; then \
echo "Usage: make oracle-test-stage STAGE=<name>"; \
echo "Available stages:"; \
ls $(ORACLE_DIR)/tests/test_*.py 2>/dev/null | sed 's|.*/test_||;s|\.py$$||' | awk '{ printf " - %s\n", $$0 }'; \
exit 1; \
fi
cd $(ORACLE_DIR) && uv run pytest -v tests/test_$(STAGE).py
oracle-fixtures: oracle-sync
cd $(ORACLE_DIR) && uv run python scripts/generate_fixtures.py --output ../../$(FIXTURES_DIR)
oracle-clean:
rm -rf $(ORACLE_DIR)/.pytest_cache $(ORACLE_DIR)/.hypothesis
find $(ORACLE_DIR) -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
find $(ORACLE_DIR) -type d -name '*.egg-info' -exec rm -rf {} + 2>/dev/null || true
crate-fmt:
$(CARGO) fmt --all
crate-fmt-check:
$(CARGO) fmt --all -- --check
crate-clippy:
$(CARGO) clippy --all-targets --all-features -- -D warnings
crate-check:
$(CARGO) check --all-targets --all-features
crate-test:
$(CARGO) test --all-features
crate-bench:
$(CARGO) bench
crate-doc:
$(CARGO) doc --no-deps --open
crate-clean:
$(CARGO) clean