.SUFFIXES:
.PHONY: help test coverage coverage-html coverage-clean mutants mutants-quick clean build release lint format check \
tier1 tier2 tier3 chaos-test chaos-full check-regression fuzz benchmark
help:
@echo "Renacer - Pure Rust strace alternative"
@echo ""
@echo "Available targets:"
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-20s\033[0m %s\n", $$1, $$2}'
test:
@echo "๐งช Running tests..."
@cargo test --quiet
coverage:
@echo "๐ Running comprehensive test coverage analysis..."
@echo "๐ Checking for cargo-llvm-cov..."
@which cargo-llvm-cov > /dev/null 2>&1 || (echo "๐ฆ Installing cargo-llvm-cov..." && cargo install cargo-llvm-cov --locked)
@if ! rustup component list --installed | grep -q llvm-tools-preview; then \
echo "๐ฆ Installing llvm-tools-preview..."; \
rustup component add llvm-tools-preview; \
fi
@echo "๐งน Cleaning old coverage data..."
@cargo llvm-cov clean --workspace
@mkdir -p target/coverage/html
@echo "โ๏ธ Temporarily disabling global cargo config (mold/custom linker breaks coverage)..."
@test -f ~/.cargo/config.toml && mv ~/.cargo/config.toml ~/.cargo/config.toml.cov-backup || true
@echo "๐งช Phase 1: Running tests with instrumentation (no report)..."
@cargo llvm-cov --no-report test --workspace --all-features || true
@echo "๐ Phase 2: Generating coverage reports..."
@cargo llvm-cov report --html --output-dir target/coverage/html || echo "โ ๏ธ No coverage data generated"
@cargo llvm-cov report --lcov --output-path target/coverage/lcov.info || echo "โ ๏ธ LCOV generation skipped"
@echo "โ๏ธ Restoring global cargo config..."
@test -f ~/.cargo/config.toml.cov-backup && mv ~/.cargo/config.toml.cov-backup ~/.cargo/config.toml || true
@echo ""
@echo "๐ Coverage Summary:"
@cargo llvm-cov report --summary-only || echo "Run 'cargo test' to generate coverage data first"
@echo ""
@echo "๐ Coverage reports generated:"
@echo "- HTML: target/coverage/html/index.html"
@echo "- LCOV: target/coverage/lcov.info"
@echo ""
@xdg-open target/coverage/html/index.html 2>/dev/null || \
open target/coverage/html/index.html 2>/dev/null || \
echo "โ
Open target/coverage/html/index.html in your browser"
coverage-html: coverage
coverage-clean:
@echo "๐งน Cleaning coverage artifacts..."
@if command -v cargo-llvm-cov >/dev/null 2>&1; then \
cargo llvm-cov clean --workspace; \
echo "โ
Coverage artifacts cleaned!"; \
else \
echo "โ ๏ธ cargo-llvm-cov not installed, skipping clean."; \
fi
build:
@echo "๐จ Building debug binary..."
@cargo build
release:
@echo "๐ Building release binary..."
@cargo build --release
@echo "โ
Release binary: target/release/renacer"
lint:
@echo "๐ Running clippy..."
@cargo clippy -- -D warnings
format:
@echo "๐ Formatting code..."
@cargo fmt
check:
@echo "โ
Type checking..."
@cargo check --all-targets --all-features
clean:
@echo "๐งน Cleaning build artifacts..."
@cargo clean
@rm -rf target/coverage
@echo "โ
Clean completed!"
benchmark:
@echo "๐ Running benchmarks..."
@cargo test --test benchmark_vs_strace -- --nocapture --test-threads=1
mutants:
@echo "๐งฌ Running mutation testing..."
@echo "๐ Checking for cargo-mutants..."
@which cargo-mutants > /dev/null 2>&1 || (echo "๐ฆ Installing cargo-mutants..." && cargo install cargo-mutants --locked)
@echo "๐งฌ Running cargo-mutants (this may take several minutes)..."
@cargo mutants --output target/mutants.out || echo "โ ๏ธ Some mutants survived"
@echo ""
@echo "๐ Mutation Testing Results:"
@cat target/mutants.out/mutants.out 2>/dev/null || echo "Check target/mutants.out/ for detailed results"
mutants-quick:
@echo "๐งฌ Running quick mutation testing..."
@echo "๐ Checking for cargo-mutants..."
@which cargo-mutants > /dev/null 2>&1 || (echo "๐ฆ Installing cargo-mutants..." && cargo install cargo-mutants --locked)
@echo "๐งฌ Running cargo-mutants on uncommitted changes..."
@cargo mutants --in-diff git:HEAD --output target/mutants-quick.out || echo "โ ๏ธ Some mutants survived"
@echo ""
@echo "๐ Quick Mutation Testing Results:"
@cat target/mutants-quick.out/mutants.out 2>/dev/null || echo "Check target/mutants-quick.out/ for detailed results"
tier1:
@echo "๐ Tier 1: Fast tests (<5 seconds)..."
@cargo fmt --check
@cargo clippy -- -D warnings
@cargo test --lib --quiet
@echo "โ
Tier 1 complete!"
tier2: tier1
@echo "๐ Tier 2: Integration tests (<30 seconds)..."
@cargo test --tests --quiet
@echo "โ
Tier 2 complete!"
tier3: tier2
@echo "๐ Tier 3: Full validation (<5 minutes)..."
@cargo test --all-targets --all-features --quiet
@echo "โ
Tier 3 complete!"
chaos-test:
@echo "๐ฅ Running chaos engineering tests..."
@cargo test --features chaos-basic --quiet
@echo "โ
Chaos basic tests complete!"
chaos-full:
@echo "๐ฅ Running full chaos engineering suite..."
@cargo test --features chaos-full --quiet
@echo "โ
Full chaos tests complete!"
check-regression:
@echo "๐ Checking for performance regressions..."
@ruchy scripts/check_regression.ruchy || echo "โ ๏ธ Regression check failed or ruchy not found"
fuzz:
@echo "๐ฒ Running fuzz tests..."
@echo "๐ Checking for cargo-fuzz..."
@which cargo-fuzz > /dev/null 2>&1 || (echo "๐ฆ Installing cargo-fuzz..." && cargo install cargo-fuzz --locked)
@cargo +nightly fuzz run filter_parser -- -max_total_time=60 || echo "โ ๏ธ Fuzz testing requires nightly toolchain"
diff-test:
@echo "๐ฌ Running differential tests (Renacer vs strace)..."
@cargo test --test differential_strace_tests --quiet || echo "โ ๏ธ Differential tests not yet implemented"