tree: 7c4fc655def8c630a5f5729c8bb2af25fd5a76f9 [path history] [tgz]
  1. build/
  2. doc/
  3. include/
  4. src/
  5. tests/
  6. third_party/
  7. .default-version
  8. .gitignore
  9. .travis.yml
  10. AUTHORS
  11. CHANGES
  12. CONTRIBUTING.md
  13. LICENSE
  14. Makefile-bootstrap
  15. Makefile.am
  16. Makefile.in
  17. README.md
  18. aclocal.m4
  19. bootstrap
  20. bootstrap-configure
  21. configure
  22. configure.ac
  23. repos.conf
README.md

Build Status Coverage Status

Nest Labs Fault Injection

Introduction

Nest Labs Fault Injection (nlfaultinjection) is designed to provide a simple, portable fault injection framework.

It should be capable of running on just about any system, no matter how constrained and depends only on the C Standard Library.

This is a simple framework that helps implement fault injection APIs. Fault injection APIs simplify the testing (manual or automated) of the error handling logic of individual components and whole systems; as a testing tool, a fault injection API is not as powerful as an extensive set of mock objects, but has the advantage of being able to run on a live system.

This is not an official Google product.

Getting Started

A SW module implements a fault-injection API by doing the following:

  1. Instantiate a FaultInjection::Manager object and define a list fault IDs; the Manager needs a name, storage for the configuration of the faults and the name of each fault; the Manager instance is the public API, through which another module of the system can configure faults (for example a test harness can turn on a fault by calling the FailAtFault() method). The module should also provide a public function that returns a C++ reference to the Manager and initializes the Manager the first time it is called.
  2. At the location in which the fault is to be injected, the nlFAULT_INJECT macro is used to inline code that if executed triggers a fault in the system; the macro queries the Manager object calling the CheckFault() method and executes the extra code if it returns true. The invocations of CheckFault are counted per faultID, which allows a test harness to automatically loop over different valid configurations.

Interact

There are numerous avenues for nlfaultinjection support: