test: add comprehensive testing infrastructure (fuzzing, proptest, mutation)

Implements dagx-11: Add comprehensive testing infrastructure including
fuzzing, property-based testing, and mutation testing configuration.

**Fuzzing Infrastructure:**
- Created fuzz/ directory with cargo-fuzz setup
- 4 fuzz targets covering different scenarios:
  - fuzz_dag_execution: Basic DAG execution with various patterns
  - fuzz_dependencies: Dependency management (linear, diamond, complex)
  - fuzz_type_safety: Type-safe output retrieval
  - fuzz_concurrent: Concurrent execution and thread safety
- Comprehensive README with usage instructions
- Integrated with justfile (fuzz, fuzz-all, fuzz-extended, fuzz-build)

**Property-Based Testing:**
- Added proptest dependency to Cargo.toml
- Created tests/property_tests.rs with 14 property tests:
  - Value preservation through DAG
  - Linear chain correctness
  - Fan-out pattern verification
  - Diamond pattern correctness
  - String, Vec, Option, Result handling
  - HashMap and custom struct preservation
  - DAG isolation
  - Concurrent execution scaling
- Integrated with justfile (proptest recipe)

**Mutation Testing:**
- Created .cargo-mutants.toml configuration
- Focused on critical functions:
  - DagRunner::run and ::get
  - TaskBuilder::depends_on
  - ExecutableNode::execute_with_listeners
  - ExtractFromListeners::extract
  - DepsTuple::to_node_ids
- Excluded low-value mutations (fmt, clone, default)
- Configured for nextest and parallel execution
- Already integrated via existing justfile mutants recipe

**Justfile Updates:**
- Added fuzzing section with 5 new recipes
- Added proptest recipe for property-based tests
- All recipes follow existing patterns and naming conventions

Similar setup to ../announcement project but tailored for DAG-specific testing.
This commit is contained in:
swaits committed 2025-10-14 10:44:30 -06:00
1 parent 10af81ade7
commit 5839b35979
20 files changed
+6545

No files matched your search

+45
View File
@@ -161,6 +161,51 @@ bench-compare:
bench-suite suite:
cargo bench --bench {{suite}}
# =============================================================================
# Fuzzing
# =============================================================================
# Run a single fuzz target for 60 seconds
fuzz target:
@echo "Fuzzing {{target}} for 60 seconds..."
cargo +nightly fuzz run {{target}} -- -max_total_time=60
# Run all fuzz targets sequentially for quick smoke test
fuzz-all:
#!/usr/bin/env bash
set -e
echo "🔬 Running all fuzz targets..."
for target in fuzz_dag_execution fuzz_dependencies fuzz_type_safety fuzz_concurrent; do
echo ""
echo "Running $target..."
cargo +nightly fuzz run $target -- -max_total_time=30 -runs=10000
done
echo ""
echo "✅ All fuzz targets completed"
# Run extended fuzzing session (for deeper testing)
fuzz-extended target:
@echo "Running extended fuzzing session for {{target}}..."
@echo "⚠️ This will run for 1 hour. Press Ctrl+C to stop early."
cargo +nightly fuzz run {{target}} -- -max_total_time=3600
# Build all fuzz targets
fuzz-build:
@echo "Building fuzz targets..."
cargo +nightly fuzz build
@echo "✅ All fuzz targets built"
# Minimize corpus for a fuzz target
fuzz-cmin target:
@echo "Minimizing corpus for {{target}}..."
cargo +nightly fuzz cmin {{target}}
# Run property-based tests
proptest:
@echo "Running property-based tests..."
cargo nextest run property_tests --all-features
@echo "✅ Property tests passed"
# =============================================================================
# Documentation & Utilities
# =============================================================================