GithubHelp home page GithubHelp logo

faultinject's Introduction

This is a library that allows for fault injection testing by intercepting
system calls.

It will be configured by setting environment variables.

INSTALL:
To compile run:
autoreconf --install
./configure
make

# Ensure backtrace symbols are available in WiredTiger. I built with:
../configure CFLAGS="-ggdb -O0" LDFLAGS="-rdynamic" --enable-strict --enable-python --with-builtins=snappy,zlib

CHANGING THE CODE:

Most of the c-code is autogenerated from templates, since each intercepted
function shares a lot of code. The correct method for updating the source 
code is to edit src/faultinject.c.in or dist/gen_source.py, and run
``(cd dist && python gen_source.py)`` to auto-generate src/faultinject.c

TODO:
* Add python generator script to makefile
* Implement generic environment variable handling

* It is not obvious how to make this work without LD_PRELOAD. LD_PRELOAD
  causes difficulties if you only want to intercept (or alter) calls that come
  via one of several libraries. For example if using WiredTiger via the Python
  API, it isn't desirable to alter the behavior of the Python functions.
  It is possible to build WiredTiger against faultinject and have faultinject
  load when WiredTiger is dynamically loaded into Python, but by then the
  symbols aren't overridden. It may be possible to forcibly overide the
  symbols in the faultinject static initializer - but I suspect that would also
  override them for the Python executable as well.


To run a WiredTiger python test case with the faultinject library, the following
is a good starting template:

rm -rf ./res && mkdir -p ./res
for i in $(seq 1 100);
do
	env FAULTINJECT_FAIL_COUNT=$i FAULTINJECT_LIBRARY_NAME=__wt LD_LIBRARY_PATH=.libs LD_PRELOAD=~/work/faultinject/faultinject/.libs/libfaultinject.so PYTHONPATH=../lang/python:lang/python:../test/suite timeout python ../test/suite/run.py -v 2 test_cursor01 > res/t$i.out 2>&1
done

A description of the components of the above command:

FAULTINJECT_FAIL_COUNT -
   The number of operations to pass to the default implementation prior to failing
   subsequent operations.
FAULTINJECT_LIBRARY_NAME -
    A string that is used to filter out callers we are interested in. Must be
    present in the call stack of callers we want, and not in those we don't.
LD_PRELOAD -
    The faultinject library to be used during the execution
timeout -
    Some WiredTiger operations will go into infinite loops if operations
    continually fail. Use this to send kill signals to those processes.

faultinject's People

Contributors

sulabhm avatar agorrod avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.