Testing & Benchmarking

Guide for running tests and benchmarks for the Metal shim implementation.

Prerequisites

Code Quality

Before running tests, ensure code quality standards are met:

pre-commit run --all-files

Quality Checks

CheckGitHub ActionsCircleCI
Code Formatting
Linting
YAML Validation
Security Analysis
Container Scanning

Running Tests

Unit Tests

mkdir -p build && cd build
cmake .. -DBUILD_TESTS=ON
make
ctest --output-on-failure

Performance Benchmarks

cd build
./bin/benchmark_metal_shim --benchmark_min_time=1s

Test Coverage

mkdir -p build_coverage && cd build_coverage
cmake .. -DCMAKE_BUILD_TYPE=Debug -DENABLE_COVERAGE=ON
make
test_metal_shim
lcov --capture --directory . --output-file coverage.info
genhtml coverage.info --output-directory coverage

Writing Tests

Unit Tests: Place in tests/unit/, use Google Test framework, name files test_*.cpp

Benchmark Tests: Place in tests/performance/, use Google Benchmark framework, name files benchmark_*.cpp

Best Practices