-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Open
Description
Daily Test Coverage Improver: Research and Plan
Repository Summary
Z3 is a theorem prover from Microsoft Research, written in C++ and using C++20 features. The repository provides:
- Core theorem proving functionality
- Multiple language bindings (C++, C, Python, Java, .NET, OCaml, Julia, WebAssembly/TypeScript/JavaScript, Smalltalk)
- Multiple build systems (CMake, Make, Visual Studio, Bazel, vcpkg)
- SMT solver capabilities with SMTLIB2 as the default input format
Current Testing Infrastructure
Test Organization
- Primary test location:
src/test/
directory with extensive unit tests - Test runner: CMake-based test system with
test-z3
executable - Test categories:
- Unit tests for core components (algebraic, API, arithmetic, AST, etc.)
- Fuzzing tests in
src/test/fuzzing/
- Linear programming tests in
src/test/lp/
- Integration tests via external z3test repository
Coverage Infrastructure
- Existing coverage setup:
.github/workflows/coverage.yml.disabled
(currently disabled) - Coverage tools: gcovr with llvm-cov for detailed HTML reports
- Build configuration: Uses CMake with coverage flags (
--coverage
,-lgcov
) - Coverage tests: Dedicated coverage test suite via
z3test/scripts/test_coverage_tests.py
Build Commands
- CMake build:
cmake -B build -DCMAKE_BUILD_TYPE=Debug cmake --build build --target install cmake --build build --target test-z3
- Coverage build:
CFLAGS="--coverage" CXXFLAGS="--coverage" LDFLAGS="-lgcov" cmake -B build -DCMAKE_BUILD_TYPE=Debug
Test Coverage Improvement Strategy
High-Priority Areas for Coverage Improvement
- Core solver algorithms - Complex logic in theorem proving components
- API bindings - Ensure all language bindings are thoroughly tested
- Edge cases in arithmetic operations - Critical for theorem prover correctness
- Error handling paths - Improve robustness testing
- Configuration and parameter handling - Test various solver configurations
Testing Approach
- Unit test expansion - Add missing unit tests for uncovered functions
- Property-based testing - Generate test cases for mathematical properties
- Integration testing - Test end-to-end solver workflows
- Regression testing - Ensure fixes don't break existing functionality
Coverage Report Generation
# Build with coverage
cmake -B build -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="--coverage" -DCMAKE_C_FLAGS="--coverage" -DCMAKE_EXE_LINKER_FLAGS="-lgcov"
cmake --build build --target install
cmake --build build --target test-z3
# Run tests
cd build && ./test-z3 -a && cd ..
# Generate coverage report
gcovr --html coverage.html --gcov-ignore-parse-errors --gcov-executable "llvm-cov gcov" .
gcovr --html-details coverage-details/ --gcov-ignore-parse-errors --gcov-executable "llvm-cov gcov" -r src --object-directory build
New Ways to Greatly Increase Test Coverage
- Automated fuzz testing integration - Expand the existing fuzzing infrastructure
- SMT-LIB benchmark testing - Use standard benchmarks to test more code paths
- Cross-language binding tests - Ensure parity across different API bindings
- Performance regression tests - Test that optimizations don't break functionality
- Parameterized testing - Test various solver configurations and heuristics
Questions for Maintainers
- Coverage targets: What are acceptable coverage percentage goals for this project?
- Performance vs coverage: Are there performance-critical paths where extensive testing might be counterproductive?
- External dependencies: Should tests for external integrations (z3test) be included in coverage?
- Regression policy: What is the policy for fixing issues discovered during coverage improvement?
- CI integration: Would you like coverage reporting to be re-enabled in CI?
Implementation Plan
Phase 1: Infrastructure Setup
- Configure coverage collection system
- Establish baseline coverage metrics
- Set up automated coverage reporting
Phase 2: Core Component Testing
- Focus on critical theorem proving algorithms
- Add tests for arithmetic and logical operations
- Improve error handling coverage
Phase 3: API and Integration Testing
- Expand language binding test coverage
- Add end-to-end integration tests
- Test configuration and parameter handling
Phase 4: Edge Cases and Robustness
- Add boundary condition tests
- Improve exception handling coverage
- Test resource exhaustion scenarios
This plan will systematically improve test coverage while maintaining the high quality and performance standards expected of a theorem prover.
> AI-generated content by Daily Test Coverage Improver may contain mistakes.
Generated by Agentic Workflow Run
Copilot
Metadata
Metadata
Assignees
Labels
No labels