renacer 0.5.0

Pure Rust system call tracer with source-aware correlation for Rust binaries
Documentation
# Renacer Makefile
# Following bashrs and paiml-mcp-agent-toolkit patterns

.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: ## Show this help message
	@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: ## Run tests (fast, no coverage)
	@echo "๐Ÿงช Running tests..."
	@cargo test --quiet

coverage: ## Generate HTML coverage report and open in browser
	@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 ## Alias for coverage

coverage-clean: ## Clean coverage artifacts
	@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: ## Build debug binary
	@echo "๐Ÿ”จ Building debug binary..."
	@cargo build

release: ## Build optimized release binary
	@echo "๐Ÿš€ Building release binary..."
	@cargo build --release
	@echo "โœ… Release binary: target/release/renacer"

lint: ## Run clippy linter
	@echo "๐Ÿ” Running clippy..."
	@cargo clippy -- -D warnings

format: ## Format code with rustfmt
	@echo "๐Ÿ“ Formatting code..."
	@cargo fmt

check: ## Type check without building
	@echo "โœ… Type checking..."
	@cargo check --all-targets --all-features

clean: ## Clean build artifacts
	@echo "๐Ÿงน Cleaning build artifacts..."
	@cargo clean
	@rm -rf target/coverage
	@echo "โœ… Clean completed!"

benchmark: ## Run performance benchmarks
	@echo "๐Ÿ“Š Running benchmarks..."
	@cargo test --test benchmark_vs_strace -- --nocapture --test-threads=1

mutants: ## Run mutation testing (full analysis)
	@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: ## Run mutation testing (quick check on changed files only)
	@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"

# =============================================================================
# Tiered TDD Workflow (from trueno patterns)
# =============================================================================

tier1: ## Tier 1: Fast tests (<5s) - unit tests, clippy, format
	@echo "๐Ÿƒ Tier 1: Fast tests (<5 seconds)..."
	@cargo fmt --check
	@cargo clippy -- -D warnings
	@cargo test --lib --quiet
	@echo "โœ… Tier 1 complete!"

tier2: tier1 ## Tier 2: Integration tests (<30s) - includes tier1
	@echo "๐Ÿƒ Tier 2: Integration tests (<30 seconds)..."
	@cargo test --tests --quiet
	@echo "โœ… Tier 2 complete!"

tier3: tier2 ## Tier 3: Full validation (<5m) - includes tier1+2, property tests
	@echo "๐Ÿƒ Tier 3: Full validation (<5 minutes)..."
	@cargo test --all-targets --all-features --quiet
	@echo "โœ… Tier 3 complete!"

# =============================================================================
# Chaos Engineering (Sprint 29 - Red-Team Profile)
# =============================================================================

chaos-test: ## Run chaos engineering tests (basic tier)
	@echo "๐Ÿ”ฅ Running chaos engineering tests..."
	@cargo test --features chaos-basic --quiet
	@echo "โœ… Chaos basic tests complete!"

chaos-full: ## Run full chaos engineering suite (requires chaos-full feature)
	@echo "๐Ÿ”ฅ Running full chaos engineering suite..."
	@cargo test --features chaos-full --quiet
	@echo "โœ… Full chaos tests complete!"

check-regression: ## Check for performance regressions (>5% threshold)
	@echo "๐Ÿ“Š Checking for performance regressions..."
	@ruchy scripts/check_regression.ruchy || echo "โš ๏ธ  Regression check failed or ruchy not found"

fuzz: ## Run fuzz testing targets
	@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"

# =============================================================================
# Differential Testing (Oracle Problem)
# =============================================================================

diff-test: ## Run differential tests against strace
	@echo "๐Ÿ”ฌ Running differential tests (Renacer vs strace)..."
	@cargo test --test differential_strace_tests --quiet || echo "โš ๏ธ  Differential tests not yet implemented"