Before writing any code, read:
- CODING_GUIDELINES.md — C++ and Python style rules
- CLAUDE.md — project architecture, build setup, constraints
- caveats.txt — known limitations and gotchas
mkdir build && cd build
cmake /path/to/LLTFI -DLLVM_GXX_BIN_DIR /usr/lib/llvm-15/bin
# On Ubuntu with apt-installed LLVM, use -DLLVM_GXX_BIN_DIR /usr/lib/llvm-15/bin
../setup- Target C++14; compile against LLVM 15 APIs
- Use
nullptr,#ifndefinclude guards, RAII memory management - LLVM 15 API:
arg_size()(notgetNumArgOperands()),#include "llvm/IR/CFG.h"(notllvm/Support/CFG.h) runOnModulemust returnbool
- Python 3 only; follow PEP 8
- Always use
with open(...)for file I/O - Never use
shell=Truein subprocess calls - Use
sys.exit(), notexit() - Use
yaml.safe_load(), notyaml.load() - Minimum
except Exception:— never bareexcept:
- Edit
tools/FIDL/config/default_failures.yaml - Regenerate selectors:
python3 tools/FIDL/FIDL-Algorithm.py -a default - Do not commit the generated
llvm_passes/software_failures/_*_*Selector.cppfiles — they are regenerated by./setup - Update
test_suite/SCRIPTS/test_fidl_generation.pyifexpected_countchanges
If you modify tools/FIDL/config/Target*Template.cpp, re-run:
python3 tools/FIDL/FIDL-Algorithm.py -a defaultFrom the build directory:
# All core tests (must pass before any PR)
./test_suite/SCRIPTS/llfi_test --all
# Specific subsets
./test_suite/SCRIPTS/llfi_test --all_hardware_faults
./test_suite/SCRIPTS/llfi_test --all_software_faults
./test_suite/SCRIPTS/llfi_test --all_trace_tools_tests
./test_suite/SCRIPTS/llfi_test --all_fidl
# Single test case
./test_suite/SCRIPTS/llfi_test --test_cases <TestName>./test_suite/SCRIPTS/llfi_test --all_mlThese are not part of --all because they require optional dependencies.
Tests with missing deps report SKIP, not FAIL, and don't affect the pass/fail count.
| Group | Requirements |
|---|---|
SoftwareFailureAutoScan |
LLTFI build only |
| ML tool unit tests | pip install onnx pygraphviz pydot |
| TensorFlow → ONNX | pip install tensorflow tf2onnx onnx |
| PyTorch → ONNX | pip install torch onnx |
| ONNX → LLVM IR | onnx-mlir binary (ONNX_MLIR_BUILD env var) |
| Fault injection (ML) | LLTFI build + model.ll from sample_programs/.../mnist/compile.sh |
All core tests (--all) must pass before submitting a pull request. ML tests (--all_ml) should pass for any change that touches ML-related code.
- All tests pass (
llfi_test --all) - Code follows CODING_GUIDELINES.md
- FIDL-generated
_*_*Selector.cppfiles are NOT included in the commit - If adding a fault mode:
expected_countintest_fidl_generation.pyis updated - If changing a public API or behavior: README.md is updated
- New functionality has a corresponding test case