 .clang-format                      |   8 ++
 .gitlab-ci.yml                     |   2 +-
 Makefile                           |  23 +++---
 bindings/python/fiu.py             | 159 ++++++++++++++++++++-----------------
 bindings/python/fiu_ctrl.in.py     |  67 +++++++++-------
 bindings/python/fiu_ll.c           |  83 ++++++++-----------
 bindings/python/setup.py           |  64 +++++++--------
 libfiu/Makefile                    |   2 +-
 libfiu/backtrace.c                 |  18 ++---
 libfiu/fiu-control.h               |  49 ++++++------
 libfiu/fiu-local.h                 |   1 -
 libfiu/fiu-rc.c                    |  53 ++++++-------
 libfiu/fiu.c                       | 130 +++++++++++++++---------------
 libfiu/fiu.h                       |  16 ++--
 libfiu/hash.c                      |  56 ++++++-------
 libfiu/hash.h                      |   8 +-
 libfiu/internal.h                  |   1 -
 libfiu/wtable.c                    |  33 +++-----
 libfiu/wtable.h                    |   3 +-
 preload/posix/codegen.c            |  10 +--
 preload/run/fiu-run.in             |   6 +-
 preload/run/run.c                  |  20 +++--
 tests/collisions/binary.c          |   7 +-
 tests/collisions/libcoltest.c      |   5 +-
 tests/generated/tests/fprintf.conf |   6 ++
 tests/perf-fsck.py                 |  72 +++++++++--------
 tests/test-basic.py                |  26 +++---
 tests/test-cache_invalidation.py   |  21 +++--
 tests/test-enable_stack.c          |  12 ++-
 tests/test-enable_stack_by_name.c  |  12 ++-
 tests/test-failinfo_refcount.py    |   5 +-
 tests/test-ferror.c                |  24 +++---
 tests/test-fiu_ctrl.py             |  74 +++++++++--------
 tests/test-manyfps.py              |   1 -
 tests/test-onetime.py              |  12 ++-
 tests/test-parallel-wildcard.c     |  41 +++++-----
 tests/test-parallel.c              |  23 +++---
 tests/test-set_prng_seed-env.py    |   7 +-
 tests/test-set_prng_seed.py        |  12 +--
 tests/test-wildcards.py            |   2 +-
 tests/utils/test-basic_run.sh      |   6 +-
 tests/wrap-python                  |   7 +-
 42 files changed, 594 insertions(+), 593 deletions(-)

diff --git a/.clang-format b/.clang-format
new file mode 100644
index 0000000..e6724d7
--- /dev/null
+++ b/.clang-format
@@ -0,0 +1,8 @@
+BasedOnStyle: LLVM
+IndentWidth: 8
+UseTab: AlignWithSpaces
+BreakBeforeBraces: Linux
+AllowShortIfStatementsOnASingleLine: false
+AllowShortFunctionsOnASingleLine: false
+IndentCaseLabels: false
+
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 3446c3f..12b91bc 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -9,7 +9,7 @@ test:
   stage: test
   before_script:
     - apt update
-    - apt -y install make coreutils python3-dev
+    - apt -y install make coreutils python3-dev python3-setuptools
   script:
     - make all
     - make test
diff --git a/Makefile b/Makefile
index 4384b3b..a1577fd 100644
--- a/Makefile
+++ b/Makefile
@@ -67,12 +67,6 @@ bindings_install: python3_install
 
 bindings_clean: python_clean
 
-python2: libfiu
-	cd bindings/python && python2 setup.py build
-
-python2_install: python2
-	cd bindings/python && python2 setup.py install
-
 python3: libfiu
 	cd bindings/python && python3 setup.py build
 
@@ -86,12 +80,23 @@ python_clean:
 clean: python_clean preload_clean libfiu_clean utils_clean test_clean
 
 
+# Auto-format code with an uniform style.
+# Most preload/posix files are not auto-formatted because of the crazy code
+# generation macros.
+format:
+	clang-format -i \
+		`find bindings/ libfiu/ tests/ preload/run/ \
+			-iname '*.[ch]'` \
+		preload/posix/codegen.c
+	black -q -l 79 bindings/python/*.py tests/*.py
+
+
 .PHONY: default all clean install all_install uninstall all_uninstall \
 	libfiu libfiu_clean libfiu_install libfiu_uninstall \
-	python2 python2_install python3 python3_install python_clean \
+	python3 python3_install python_clean \
 	bindings bindings_install bindings_clean \
 	preload preload_clean preload_install preload_uninstall \
 	utils utils_clean utils_install utils_uninstall \
-	test tests test_clean
-
+	test tests test_clean \
+	format
 
diff --git a/bindings/python/fiu.py b/bindings/python/fiu.py
index 8d06dfa..56ba5a6 100644
--- a/bindings/python/fiu.py
+++ b/bindings/python/fiu.py
@@ -1,4 +1,3 @@
-
 """
 libfiu python wrapper
 
@@ -16,94 +15,104 @@ import fiu_ll as _ll
 
 
 def fail(name):
-	"Returns the failure status of the given point of failure."
-	return _ll.fail(name)
+    "Returns the failure status of the given point of failure."
+    return _ll.fail(name)
+
 
 def failinfo():
-	"""Returns the information associated with the last failure. Use with
-	care, can be fatal if the point of failure was not enabled via
-	Python."""
-	return _ll.failinfo()
+    """Returns the information associated with the last failure. Use with
+    care, can be fatal if the point of failure was not enabled via
+    Python."""
+    return _ll.failinfo()
+
 
 class Flags:
-	"""Contains the valid flag constants.
+    """Contains the valid flag constants.
 
-	ONETIME: This point of failure is disabled immediately after failing once.
-	"""
-	ONETIME = _ll.FIU_ONETIME
+    ONETIME: This point of failure is disabled immediately after failing once.
+    """
+
+    ONETIME = _ll.FIU_ONETIME
 
 
 # To be sure failinfo doesn't dissapear from under our feet, we keep a
 # name -> failinfo table. See fiu_ll's comments for more details.
 _fi_table = {}
 
-def enable(name, failnum = 1, failinfo = None, flags = 0):
-	"Enables the given point of failure."
-	_fi_table[name] = failinfo
-	r = _ll.enable(name, failnum, failinfo, flags)
-	if r != 0:
-		del _fi_table[name]
-		raise RuntimeError(r)
-
-def enable_random(name, probability, failnum = 1, failinfo = None, flags = 0):
-	"Enables the given point of failure, with the given probability."
-	_fi_table[name] = failinfo
-	r = _ll.enable_random(name, failnum, failinfo, flags, probability)
-	if r != 0:
-		del _fi_table[name]
-		raise RuntimeError(r)
-
-def enable_external(name, cb, failnum = 1, flags = 0):
-	"""Enables the given point of failure, leaving the decision whether to
-	fail or not to the given external function, which should return 0 if
-	it is not to fail, or 1 otherwise.
-
-	The cb parameter is a Python function that takes three parameters,
-	name, failnum and flags, with the same values that we receive.
-
-	For technical limitations, enable_external() cannot take
-	failinfo."""
-	# in this case, use the table to prevent the function from
-	# dissapearing
-	_fi_table[name] = cb
-	r = _ll.enable_external(name, failnum, flags, cb)
-	if r != 0:
-		del _fi_table[name]
-		raise RuntimeError(r)
-
-def enable_stack_by_name(name, func_name,
-		failnum = 1, failinfo = None, flags = 0,
-		pos_in_stack = -1):
-	"""Enables the given point of failure, but only if 'func_name' is in
-	the stack.
-
-	'func_name' is be the name of the C function to look for.
-	"""
-	_fi_table[name] = failinfo
-	r = _ll.enable_stack_by_name(name, failnum, failinfo, flags,
-			func_name, pos_in_stack)
-	if r != 0:
-		del _fi_table[name]
-		raise RuntimeError(r)
+
+def enable(name, failnum=1, failinfo=None, flags=0):
+    "Enables the given point of failure."
+    _fi_table[name] = failinfo
+    r = _ll.enable(name, failnum, failinfo, flags)
+    if r != 0:
+        del _fi_table[name]
+        raise RuntimeError(r)
+
+
+def enable_random(name, probability, failnum=1, failinfo=None, flags=0):
+    "Enables the given point of failure, with the given probability."
+    _fi_table[name] = failinfo
+    r = _ll.enable_random(name, failnum, failinfo, flags, probability)
+    if r != 0:
+        del _fi_table[name]
+        raise RuntimeError(r)
+
+
+def enable_external(name, cb, failnum=1, flags=0):
+    """Enables the given point of failure, leaving the decision whether to
+    fail or not to the given external function, which should return 0 if
+    it is not to fail, or 1 otherwise.
+
+    The cb parameter is a Python function that takes three parameters,
+    name, failnum and flags, with the same values that we receive.
+
+    For technical limitations, enable_external() cannot take
+    failinfo."""
+    # in this case, use the table to prevent the function from
+    # dissapearing
+    _fi_table[name] = cb
+    r = _ll.enable_external(name, failnum, flags, cb)
+    if r != 0:
+        del _fi_table[name]
+        raise RuntimeError(r)
+
+
+def enable_stack_by_name(
+    name, func_name, failnum=1, failinfo=None, flags=0, pos_in_stack=-1
+):
+    """Enables the given point of failure, but only if 'func_name' is in
+    the stack.
+
+    'func_name' is be the name of the C function to look for.
+    """
+    _fi_table[name] = failinfo
+    r = _ll.enable_stack_by_name(
+        name, failnum, failinfo, flags, func_name, pos_in_stack
+    )
+    if r != 0:
+        del _fi_table[name]
+        raise RuntimeError(r)
+
 
 def disable(name):
-	"""Disables the given point of failure, undoing the actions of the
-	enable*() functions."""
-	if name in _fi_table:
-		del _fi_table[name]
-	r = _ll.disable(name)
-	if r != 0:
-		raise RuntimeError(r)
+    """Disables the given point of failure, undoing the actions of the
+    enable*() functions."""
+    if name in _fi_table:
+        del _fi_table[name]
+    r = _ll.disable(name)
+    if r != 0:
+        raise RuntimeError(r)
+
 
 def set_prng_seed(seed):
-	"""Sets the PRNG seed. Don't use this unless you know what you're
-	doing."""
-	return _ll.set_prng_seed(seed)
+    """Sets the PRNG seed. Don't use this unless you know what you're
+    doing."""
+    return _ll.set_prng_seed(seed)
 
-def rc_fifo(basename):
-	"""Enables remote control over a named pipe that begins with the given
-	basename. The final path will be "basename-$PID"."""
-	r = _ll.rc_fifo(basename)
-	if r != 0:
-		raise RuntimeError(r)
 
+def rc_fifo(basename):
+    """Enables remote control over a named pipe that begins with the given
+    basename. The final path will be "basename-$PID"."""
+    r = _ll.rc_fifo(basename)
+    if r != 0:
+        raise RuntimeError(r)
diff --git a/bindings/python/fiu_ctrl.in.py b/bindings/python/fiu_ctrl.in.py
index f9b6d8d..7094084 100644
--- a/bindings/python/fiu_ctrl.in.py
+++ b/bindings/python/fiu_ctrl.in.py
@@ -21,20 +21,22 @@ import time
 PLIBPATH = "@@PLIBPATH@@"
 
 
-class CommandError (RuntimeError):
+class CommandError(RuntimeError):
     """There was an error running the command."""
+
     pass
 
 
 class Flags:
-	"""Contains the valid flag constants.
+    """Contains the valid flag constants.
+
+    ONETIME: This point of failure is disabled immediately after failing once.
+    """
 
-	ONETIME: This point of failure is disabled immediately after failing once.
-	"""
-	ONETIME = "onetime"
+    ONETIME = "onetime"
 
 
-class _ControlBase (object):
+class _ControlBase(object):
     """Base class for remote control objects."""
 
     def run_raw_cmd(self, cmd, args):
@@ -53,21 +55,28 @@ class _ControlBase (object):
 
         return args
 
-    def enable(self, name, failnum = 1, failinfo = None, flags = ()):
+    def enable(self, name, failnum=1, failinfo=None, flags=()):
         """Enables the given point of failure."""
         args = self._basic_args(name, failnum, failinfo, flags)
         self.run_raw_cmd("enable", args)
 
-    def enable_random(self, name, probability, failnum = 1,
-            failinfo = None, flags = ()):
+    def enable_random(
+        self, name, probability, failnum=1, failinfo=None, flags=()
+    ):
         "Enables the given point of failure, with the given probability."
         args = self._basic_args(name, failnum, failinfo, flags)
         args.append("probability=%f" % probability)
         self.run_raw_cmd("enable_random", args)
 
-    def enable_stack_by_name(self, name, func_name,
-            failnum = 1, failinfo = None, flags = (),
-            pos_in_stack = -1):
+    def enable_stack_by_name(
+        self,
+        name,
+        func_name,
+        failnum=1,
+        failinfo=None,
+        flags=(),
+        pos_in_stack=-1,
+    ):
         """Enables the given point of failure, but only if 'func_name' is in
         the stack.
 
@@ -84,7 +93,7 @@ class _ControlBase (object):
         self.run_raw_cmd("disable", ["name=%s" % name])
 
 
-def _open_with_timeout(path, mode, timeout = 3):
+def _open_with_timeout(path, mode, timeout=3):
     """Open a file, waiting if it doesn't exist yet."""
     deadline = time.time() + timeout
     while not os.path.exists(path):
@@ -95,8 +104,9 @@ def _open_with_timeout(path, mode, timeout = 3):
     return open(path, mode)
 
 
-class PipeControl (_ControlBase):
+class PipeControl(_ControlBase):
     """Control pipe used to control a libfiu-instrumented process."""
+
     def __init__(self, path_prefix):
         """Constructor.
 
@@ -119,7 +129,7 @@ class PipeControl (_ControlBase):
         # external intervention that can be used for debugging.
         fd_in, fd_out = self._open_pipes()
 
-        s = "%s %s\n" % (cmd, ','.join(args))
+        s = "%s %s\n" % (cmd, ",".join(args))
         fd_in.write(s)
         fd_in.flush()
 
@@ -128,17 +138,18 @@ class PipeControl (_ControlBase):
             raise CommandError
 
 
-class EnvironmentControl (_ControlBase):
+class EnvironmentControl(_ControlBase):
     """Pre-execution environment control."""
+
     def __init__(self):
         self.env = ""
 
     def run_raw_cmd(self, cmd, args):
         """Add a raw command to the environment."""
-        self.env += "%s %s\n" % (cmd, ','.join(args))
+        self.env += "%s %s\n" % (cmd, ",".join(args))
 
 
-class Subprocess (_ControlBase):
+class Subprocess(_ControlBase):
     """Wrapper for subprocess.Popen, but without immediate execution.
 
     This class provides a wrapper for subprocess.Popen, which can be used to
@@ -156,13 +167,14 @@ class Subprocess (_ControlBase):
     Note that using shell=True is not recommended, as it makes the pid of the
     controlled process to be unknown.
     """
+
     def __init__(self, *args, **kwargs):
         self.args = args
         self.kwargs = kwargs
 
         # Note this removes fiu_enable_posix from kwargs if it's there, that
         # way kwargs remains "clean" for passing to Popen.
-        self.fiu_enable_posix = kwargs.pop('fiu_enable_posix', False)
+        self.fiu_enable_posix = kwargs.pop("fiu_enable_posix", False)
 
         self._proc = None
         self.tmpdir = None
@@ -175,19 +187,19 @@ class Subprocess (_ControlBase):
         self.ctrl.run_raw_cmd(cmd, args)
 
     def start(self):
-        self.tmpdir = tempfile.mkdtemp(prefix = 'fiu_ctrl-')
+        self.tmpdir = tempfile.mkdtemp(prefix="fiu_ctrl-")
 
         env = os.environ
-        env['LD_PRELOAD'] = env.get('LD_PRELOAD', '')
+        env["LD_PRELOAD"] = env.get("LD_PRELOAD", "")
         if self.fiu_enable_posix:
-            env['LD_PRELOAD'] += ' ' + PLIBPATH + '/fiu_posix_preload.so'
-        env['LD_PRELOAD'] += ' ' + PLIBPATH + '/fiu_run_preload.so '
-        env['FIU_CTRL_FIFO'] = self.tmpdir + '/ctrl-fifo'
-        env['FIU_ENABLE'] = self.ctrl.env
+            env["LD_PRELOAD"] += " " + PLIBPATH + "/fiu_posix_preload.so"
+        env["LD_PRELOAD"] += " " + PLIBPATH + "/fiu_run_preload.so "
+        env["FIU_CTRL_FIFO"] = self.tmpdir + "/ctrl-fifo"
+        env["FIU_ENABLE"] = self.ctrl.env
 
         self._proc = subprocess.Popen(*self.args, **self.kwargs)
 
-        fifo_path = "%s-%d" % (env['FIU_CTRL_FIFO'], self._proc.pid)
+        fifo_path = "%s-%d" % (env["FIU_CTRL_FIFO"], self._proc.pid)
         self.ctrl = PipeControl(fifo_path)
 
         return self._proc
@@ -195,6 +207,5 @@ class Subprocess (_ControlBase):
     def __del__(self):
         # Remove the temporary directory.
         # The "'fiu_ctrl-' in self.tmpdir" check is just a safeguard.
-        if self.tmpdir and 'fiu_ctrl-' in self.tmpdir:
+        if self.tmpdir and "fiu_ctrl-" in self.tmpdir:
             shutil.rmtree(self.tmpdir)
-
diff --git a/bindings/python/fiu_ll.c b/bindings/python/fiu_ll.c
index 48a20e8..0df6521 100644
--- a/bindings/python/fiu_ll.c
+++ b/bindings/python/fiu_ll.c
@@ -1,11 +1,10 @@
 
 /*
- * Python 2/3 bindings for libfiu
+ * Python 3 bindings for libfiu
  * Alberto Bertogli (albertito@blitiri.com.ar)
  *
  * This is the low-level module, used by the python one to construct
- * friendlier objects. It support both Python 2 and 3, assuming the constants
- * PYTHON2 and PYTHON3 are defined accordingly.
+ * friendlier objects.
  */
 
 #include <Python.h>
@@ -13,9 +12,8 @@
 /* Unconditionally enable fiu, otherwise we get fake headers */
 #define FIU_ENABLE 1
 
-#include <fiu.h>
 #include <fiu-control.h>
-
+#include <fiu.h>
 
 static PyObject *fail(PyObject *self, PyObject *args)
 {
@@ -56,7 +54,7 @@ static PyObject *enable(PyObject *self, PyObject *args)
 	unsigned int flags;
 
 	if (!PyArg_ParseTuple(args, "siOI:enable", &name, &failnum, &failinfo,
-				&flags))
+	                      &flags))
 		return NULL;
 
 	/* The caller will guarantee that failinfo doesn't dissapear from under
@@ -73,18 +71,17 @@ static PyObject *enable_random(PyObject *self, PyObject *args)
 	double probability;
 
 	if (!PyArg_ParseTuple(args, "siOId:enable_random", &name, &failnum,
-				&failinfo, &flags, &probability))
+	                      &failinfo, &flags, &probability))
 		return NULL;
 
 	/* The caller will guarantee that failinfo doesn't dissapear from under
 	 * our feet. */
-	return PyLong_FromLong(fiu_enable_random(name, failnum, failinfo,
-				flags, probability));
+	return PyLong_FromLong(
+	    fiu_enable_random(name, failnum, failinfo, flags, probability));
 }
 
-
 static int external_callback(const char *name, int *failnum, void **failinfo,
-		unsigned int *flags)
+                             unsigned int *flags)
 {
 	int rv;
 	PyObject *cbrv;
@@ -114,7 +111,7 @@ static int external_callback(const char *name, int *failnum, void **failinfo,
 		return 0;
 	}
 
-	cbrv = PyEval_CallObject(*failinfo, args);
+	cbrv = PyObject_CallObject(*failinfo, args);
 	Py_DECREF(args);
 
 	if (cbrv == NULL) {
@@ -141,7 +138,7 @@ static PyObject *enable_external(PyObject *self, PyObject *args)
 	PyObject *py_external_cb;
 
 	if (!PyArg_ParseTuple(args, "siIO:enable_external", &name, &failnum,
-				&flags, &py_external_cb))
+	                      &flags, &py_external_cb))
 		return NULL;
 
 	if (!PyCallable_Check(py_external_cb)) {
@@ -156,8 +153,8 @@ static PyObject *enable_external(PyObject *self, PyObject *args)
 	 * Similar to the way failinfo is handled, we DO NOT TOUCH THE RC OF
 	 * THE EXTERNAL CALLBACK, assuming the caller will take care of making
 	 * sure it doesn't dissapear from beneath us. */
-	return PyLong_FromLong(fiu_enable_external(name, failnum,
-				py_external_cb, flags, external_callback));
+	return PyLong_FromLong(fiu_enable_external(
+	    name, failnum, py_external_cb, flags, external_callback));
 }
 
 static PyObject *enable_stack_by_name(PyObject *self, PyObject *args)
@@ -169,14 +166,13 @@ static PyObject *enable_stack_by_name(PyObject *self, PyObject *args)
 	char *func_name;
 	int pos_in_stack = -1;
 
-	if (!PyArg_ParseTuple(args, "siOIs|i:enable_stack_by_name",
-				&name, &failnum, &failinfo, &flags,
-				&func_name, &pos_in_stack))
+	if (!PyArg_ParseTuple(args, "siOIs|i:enable_stack_by_name", &name,
+	                      &failnum, &failinfo, &flags, &func_name,
+	                      &pos_in_stack))
 		return NULL;
 
-	return PyLong_FromLong(fiu_enable_stack_by_name(name, failnum,
-				failinfo, flags,
-				func_name, pos_in_stack));
+	return PyLong_FromLong(fiu_enable_stack_by_name(
+	    name, failnum, failinfo, flags, func_name, pos_in_stack));
 }
 
 static PyObject *disable(PyObject *self, PyObject *args)
@@ -211,49 +207,34 @@ static PyObject *rc_fifo(PyObject *self, PyObject *args)
 }
 
 static PyMethodDef fiu_methods[] = {
-	{ "fail", (PyCFunction) fail, METH_VARARGS, NULL },
-	{ "failinfo", (PyCFunction) failinfo, METH_VARARGS, NULL },
-	{ "enable", (PyCFunction) enable, METH_VARARGS, NULL },
-	{ "enable_random", (PyCFunction) enable_random, METH_VARARGS, NULL },
-	{ "enable_external", (PyCFunction) enable_external,
-		METH_VARARGS, NULL },
-	{ "enable_stack_by_name", (PyCFunction) enable_stack_by_name,
-		METH_VARARGS, NULL },
-	{ "disable", (PyCFunction) disable, METH_VARARGS, NULL },
-	{ "set_prng_seed", (PyCFunction) set_prng_seed, METH_VARARGS, NULL },
-	{ "rc_fifo", (PyCFunction) rc_fifo, METH_VARARGS, NULL },
-	{ NULL }
-};
+    {"fail", (PyCFunction)fail, METH_VARARGS, NULL},
+    {"failinfo", (PyCFunction)failinfo, METH_VARARGS, NULL},
+    {"enable", (PyCFunction)enable, METH_VARARGS, NULL},
+    {"enable_random", (PyCFunction)enable_random, METH_VARARGS, NULL},
+    {"enable_external", (PyCFunction)enable_external, METH_VARARGS, NULL},
+    {"enable_stack_by_name", (PyCFunction)enable_stack_by_name, METH_VARARGS,
+     NULL},
+    {"disable", (PyCFunction)disable, METH_VARARGS, NULL},
+    {"set_prng_seed", (PyCFunction)set_prng_seed, METH_VARARGS, NULL},
+    {"rc_fifo", (PyCFunction)rc_fifo, METH_VARARGS, NULL},
+    {NULL}};
 
-#ifdef PYTHON3
 static PyModuleDef fiu_module = {
-	PyModuleDef_HEAD_INIT,
-	.m_name = "libfiu",
-	.m_size = -1,
-	.m_methods = fiu_methods,
+    PyModuleDef_HEAD_INIT,
+    .m_name = "libfiu",
+    .m_size = -1,
+    .m_methods = fiu_methods,
 };
-#endif
 
-#ifdef PYTHON2
-PyMODINIT_FUNC initfiu_ll(void)
-#else
 PyMODINIT_FUNC PyInit_fiu_ll(void)
-#endif
 {
 	PyObject *m;
 
-#ifdef PYTHON2
-	m = Py_InitModule("fiu_ll", fiu_methods);
-#else
 	m = PyModule_Create(&fiu_module);
-#endif
 
 	PyModule_AddIntConstant(m, "FIU_ONETIME", FIU_ONETIME);
 
 	fiu_init(0);
 
-#ifdef PYTHON3
 	return m;
-#endif
 }
-
diff --git a/bindings/python/setup.py b/bindings/python/setup.py
index 963f613..1cebc49 100644
--- a/bindings/python/setup.py
+++ b/bindings/python/setup.py
@@ -1,60 +1,52 @@
-
 import os
 import sys
 import tempfile
-from distutils.core import setup, Extension
-from distutils.command.build_py import build_py
-
-if sys.version_info[0] == 2:
-	ver_define = ('PYTHON2', '1')
-elif sys.version_info[0] == 3:
-	ver_define = ('PYTHON3', '1')
+from setuptools import setup, Extension
+from setuptools.command.build_py import build_py
 
 
 # We need to generate the fiu_ctrl.py file from fiu_ctrl.in.py, replacing some
 # environment variables in its contents.
-class generate_and_build_py (build_py):
+class generate_and_build_py(build_py):
     def run(self):
         if not self.dry_run:
             self.generate_fiu_ctrl()
         build_py.run(self)
 
     def generate_fiu_ctrl(self):
-        prefix = os.environ.get('PREFIX', '/usr/local/')
-        plibpath = os.environ.get('PLIBPATH', prefix + '/lib/')
+        prefix = os.environ.get("PREFIX", "/usr/local/")
+        plibpath = os.environ.get("PLIBPATH", prefix + "/lib/")
 
-        contents = open('fiu_ctrl.in.py', 'rt').read()
-        contents = contents.replace('@@PLIBPATH@@', plibpath)
+        contents = open("fiu_ctrl.in.py", "rt").read()
+        contents = contents.replace("@@PLIBPATH@@", plibpath)
 
-        # Create/update the file atomically, as this could be invoked in
-        # parallel for python 2 and 3, and we don't want to accidentally use
+        # Create/update the file atomically, we don't want to accidentally use
         # partially written files.
         out = tempfile.NamedTemporaryFile(
-                mode = 'wt', delete = False,
-                dir = '.', prefix = 'tmp-fiu_ctrl.py')
+            mode="wt", delete=False, dir=".", prefix="tmp-fiu_ctrl.py"
+        )
         out.write(contents)
         out.close()
-        os.rename(out.name, 'fiu_ctrl.py')
-
+        os.rename(out.name, "fiu_ctrl.py")
 
-fiu_ll = Extension("fiu_ll",
-		sources = ['fiu_ll.c'],
-		define_macros = [ver_define],
-		libraries = ['fiu'],
 
-		# these two allow us to build without having libfiu installed,
-		# assuming we're in the libfiu source tree
-		include_dirs = ['../../libfiu/'],
-		library_dirs=['../../libfiu/'])
+fiu_ll = Extension(
+    "fiu_ll",
+    sources=["fiu_ll.c"],
+    libraries=["fiu"],
+    # These two allow us to build without having libfiu installed,
+    # assuming we're in the libfiu source tree
+    include_dirs=["../../libfiu/"],
+    library_dirs=["../../libfiu/"],
+)
 
 setup(
-	name = 'fiu',
-	description = "libfiu bindings",
-	author = "Alberto Bertogli",
-	author_email = "albertito@blitiri.com.ar",
-	url = "http://blitiri.com.ar/p/libfiu",
-	py_modules = ['fiu', 'fiu_ctrl'],
-	ext_modules = [fiu_ll],
-    cmdclass = {'build_py': generate_and_build_py},
+    name="fiu",
+    description="libfiu bindings",
+    author="Alberto Bertogli",
+    author_email="albertito@blitiri.com.ar",
+    url="http://blitiri.com.ar/p/libfiu",
+    py_modules=["fiu", "fiu_ctrl"],
+    ext_modules=[fiu_ll],
+    cmdclass={"build_py": generate_and_build_py},
 )
-
diff --git a/libfiu/Makefile b/libfiu/Makefile
index ef80cdb..58cd27d 100644
--- a/libfiu/Makefile
+++ b/libfiu/Makefile
@@ -39,7 +39,7 @@ else
 	NICE_CC = $(CC)
 endif
 
-LIB_VER=1.1
+LIB_VER=1.2
 LIB_SO_VER=0
 
 
diff --git a/libfiu/backtrace.c b/libfiu/backtrace.c
index c85da04..a20fb89 100644
--- a/libfiu/backtrace.c
+++ b/libfiu/backtrace.c
@@ -7,12 +7,11 @@
 /* This is needed for some of the functions below. */
 #define _GNU_SOURCE
 
-#include <stdlib.h>	/* NULL */
-#include <execinfo.h>
 #include <dlfcn.h>
-#include <sys/procfs.h>
+#include <execinfo.h>
 #include <link.h>
-
+#include <stdlib.h> /* NULL */
+#include <sys/procfs.h>
 
 int get_backtrace(void *buffer, int size)
 {
@@ -35,9 +34,9 @@ void *get_func_end(void *func)
 {
 	int r;
 	Dl_info dl_info;
-	ElfW(Sym) *elf_info;
+	ElfW(Sym) * elf_info;
 
-	r = dladdr1(func, &dl_info, (void **) &elf_info, RTLD_DL_SYMENT);
+	r = dladdr1(func, &dl_info, (void **)&elf_info, RTLD_DL_SYMENT);
 	if (r == 0)
 		return NULL;
 	if (elf_info == NULL)
@@ -45,7 +44,7 @@ void *get_func_end(void *func)
 	if (dl_info.dli_saddr == NULL)
 		return NULL;
 
-	return ((unsigned char *) func) + elf_info->st_size;
+	return ((unsigned char *)func) + elf_info->st_size;
 }
 
 void *get_func_addr(const char *func_name)
@@ -58,8 +57,7 @@ void *get_func_addr(const char *func_name)
 
 #warning Using dummy versions of backtrace
 
-#include <stddef.h>	/* for NULL */
-
+#include <stddef.h> /* for NULL */
 
 int get_backtrace(void *buffer, int size)
 {
@@ -89,7 +87,7 @@ void *get_func_addr(const char *func_name)
 static void *fp_to_voidp(void (*funcp)())
 {
 	unsigned char **p;
-	p = (unsigned char **) &funcp;
+	p = (unsigned char **)&funcp;
 	return *p;
 }
 
diff --git a/libfiu/fiu-control.h b/libfiu/fiu-control.h
index 88686cf..f359ec7 100644
--- a/libfiu/fiu-control.h
+++ b/libfiu/fiu-control.h
@@ -13,14 +13,12 @@
 extern "C" {
 #endif
 
-
 /* Flags for fiu_enable*() */
 
 /** Only fail once; the point of failure will be automatically disabled
  * afterwards. */
 #define FIU_ONETIME 1
 
-
 /** Enables the given point of failure unconditionally.
  *
  * @param name  Name of the point of failure to enable.
@@ -30,8 +28,7 @@ extern "C" {
  * @returns 0 if success, < 0 otherwise.
  */
 int fiu_enable(const char *name, int failnum, void *failinfo,
-		unsigned int flags);
-
+               unsigned int flags);
 
 /** Enables the given point of failure, with the given probability. That makes
  * it fail with the given probability.
@@ -46,15 +43,14 @@ int fiu_enable(const char *name, int failnum, void *failinfo,
  * @returns  0 if success, < 0 otherwise.
  */
 int fiu_enable_random(const char *name, int failnum, void *failinfo,
-		unsigned int flags, float probability);
-
+                      unsigned int flags, float probability);
 
 /** Type of external callback functions.
  * They must return 0 to indicate not to fail, != 0 to indicate otherwise. Can
  * modify failnum, failinfo and flags, in order to alter the values of the
  * point of failure. */
 typedef int external_cb_t(const char *name, int *failnum, void **failinfo,
-		unsigned int *flags);
+                          unsigned int *flags);
 
 /** Enables the given point of failure, leaving the decision whether to fail
  * or not to the given external function.
@@ -67,31 +63,36 @@ typedef int external_cb_t(const char *name, int *failnum, void **failinfo,
  * @returns  0 if success, < 0 otherwise.
  */
 int fiu_enable_external(const char *name, int failnum, void *failinfo,
-		unsigned int flags, external_cb_t *external_cb);
+                        unsigned int flags, external_cb_t *external_cb);
 
 /* Enables the given point of failure, but only if the given function is in
  * the stack at the given position.
  *
  * This function relies on GNU extensions such as backtrace() and dladdr(), so
- * it may not be available on your platform.
+ * it may not be available on your platform. It's also quite dependent on
+ * compiler behaviour; for example, inline functions may not show up on the
+ * backtrace.
  *
- * - name: point of failure name.
- * - failnum: what will fiu_fail() return, must be != 0.
- * - failinfo: what will fiu_failinfo() return.
- * - flags: flags.
- * - func: pointer to the function.
- * - func_pos: position where we expect the function to be; use -1 for "any".
- * 	Values other than -1 are not supported at the moment, but will be in
- * 	the future.
+ * @param name Name of the point of failure to enable.
+ * @param failnum  What will fiu_fail() return, must be != 0.
+ * @param failinfo  What will fiu_failinfo() return.
+ * @param flags  Flags.
+ * @param func  Pointer to the function.
+ * @param func_pos  Position where we expect the function to be; use -1 for
+ * 		"any".  Values other than -1 are not supported at the moment,
+ * 		but will be in the future.
+ * @returns  0 if success, < 0 otherwise (e.g. backtrace() is not functional).
  */
 int fiu_enable_stack(const char *name, int failnum, void *failinfo,
-		unsigned int flags, void *func, int func_pos_in_stack);
+                     unsigned int flags, void *func, int func_pos_in_stack);
 
 /** Enables the given point of failure, but only if 'func_name' is in
  * the stack at 'func_pos_in_stack'.
  *
  * This function relies on GNU extensions such as backtrace() and dladdr(), so
- * if your platform does not support them, it will always return failure.
+ * if your platform does not support them, it will always return failure. It's
+ * also quite dependent on compiler behaviour; for example, inline functions
+ * may not show up on the backtrace.
  *
  * It is exactly like fiu_enable_stack() but takes a function name, it will
  * ask the dynamic linker to find the corresponding function pointer.
@@ -104,11 +105,11 @@ int fiu_enable_stack(const char *name, int failnum, void *failinfo,
  * @param func_pos_in_stack  Position where we expect the function to be; use
  * 		-1 for "any". Values other than -1 are not supported at the
  * 		moment, but will be in the future.
- * @returns  0 if success, < 0 otherwise.
+ * @returns  0 if success, < 0 otherwise (e.g. backtrace() is not functional).
  */
 int fiu_enable_stack_by_name(const char *name, int failnum, void *failinfo,
-		unsigned int flags, const char *func_name,
-		int func_pos_in_stack);
+                             unsigned int flags, const char *func_name,
+                             int func_pos_in_stack);
 
 /** Disables the given point of failure. That makes it NOT fail.
  *
@@ -141,12 +142,10 @@ int fiu_rc_fifo(const char *basename);
  *			message.
  * @returns  0 if success, < 0 otherwise.
  */
-int fiu_rc_string(const char *cmd, char ** const error);
-
+int fiu_rc_string(const char *cmd, char **const error);
 
 #ifdef __cplusplus
 }
 #endif
 
 #endif // _FIU_CONTROL_H
-
diff --git a/libfiu/fiu-local.h b/libfiu/fiu-local.h
index b68327b..5287ed5 100644
--- a/libfiu/fiu-local.h
+++ b/libfiu/fiu-local.h
@@ -34,4 +34,3 @@
 #endif /* FIU_ENABLE */
 
 #endif /* _FIU_LOCAL_H */
-
diff --git a/libfiu/fiu-rc.c b/libfiu/fiu-rc.c
index c3e7012..0c201fd 100644
--- a/libfiu/fiu-rc.c
+++ b/libfiu/fiu-rc.c
@@ -3,15 +3,15 @@
  * libfiu remote control API
  */
 
-#include <stdio.h>		/* snprintf() */
-#include <string.h>		/* strncpy() */
-#include <stdlib.h>		/* malloc()/free() */
-#include <sys/types.h>		/* getpid(), mkfifo() */
-#include <unistd.h>		/* getpid() */
-#include <sys/stat.h>		/* mkfifo() */
-#include <fcntl.h>		/* open() and friends */
-#include <pthread.h>		/* pthread_create() and friends */
-#include <errno.h>		/* errno and friends */
+#include <errno.h>     /* errno and friends */
+#include <fcntl.h>     /* open() and friends */
+#include <pthread.h>   /* pthread_create() and friends */
+#include <stdio.h>     /* snprintf() */
+#include <stdlib.h>    /* malloc()/free() */
+#include <string.h>    /* strncpy() */
+#include <sys/stat.h>  /* mkfifo() */
+#include <sys/types.h> /* getpid(), mkfifo() */
+#include <unistd.h>    /* getpid() */
 
 /* Enable us, so we get the real prototypes from the headers */
 #define FIU_ENABLE 1
@@ -19,11 +19,9 @@
 #include "fiu-control.h"
 #include "internal.h"
 
-
 /* Max length of a line containing a control directive */
 #define MAX_LINE 512
 
-
 /*
  * Generic remote control
  */
@@ -78,7 +76,7 @@ static int read_line(int fd, char *buf)
  * This function is ugly, but we aim for simplicity and ease to extend for
  * future commands.
  */
-int fiu_rc_string(const char *cmd, char ** const error)
+int fiu_rc_string(const char *cmd, char **const error)
 {
 	char m_cmd[MAX_LINE] = {0};
 	char command[MAX_LINE] = {0};
@@ -130,16 +128,14 @@ int fiu_rc_string(const char *cmd, char ** const error)
 			OPT_POS_IN_STACK,
 			FLAG_ONETIME,
 		};
-		char * const token[] = {
-			[OPT_NAME] = "name",
-			[OPT_FAILNUM] = "failnum",
-			[OPT_FAILINFO] = "failinfo",
-			[OPT_PROBABILITY] = "probability",
-			[OPT_FUNC_NAME] = "func_name",
-			[OPT_POS_IN_STACK] = "pos_in_stack",
-			[FLAG_ONETIME] = "onetime",
-			NULL
-		};
+		char *const token[] = {[OPT_NAME] = "name",
+		                       [OPT_FAILNUM] = "failnum",
+		                       [OPT_FAILINFO] = "failinfo",
+		                       [OPT_PROBABILITY] = "probability",
+		                       [OPT_FUNC_NAME] = "func_name",
+		                       [OPT_POS_IN_STACK] = "pos_in_stack",
+		                       [FLAG_ONETIME] = "onetime",
+		                       NULL};
 
 		char *value;
 		char *opts = parameters;
@@ -152,7 +148,7 @@ int fiu_rc_string(const char *cmd, char ** const error)
 				failnum = atoi(value);
 				break;
 			case OPT_FAILINFO:
-				failinfo = (void *) strtoul(value, NULL, 10);
+				failinfo = (void *)strtoul(value, NULL, 10);
 				break;
 			case OPT_PROBABILITY:
 				probability = strtod(value, NULL);
@@ -182,12 +178,13 @@ int fiu_rc_string(const char *cmd, char ** const error)
 		return fiu_enable(fp_name, failnum, failinfo, flags);
 	} else if (strcmp(command, "enable_random") == 0) {
 		*error = "Error in enable_random";
-		return fiu_enable_random(fp_name, failnum, failinfo,
-				flags, probability);
+		return fiu_enable_random(fp_name, failnum, failinfo, flags,
+		                         probability);
 	} else if (strcmp(command, "enable_stack_by_name") == 0) {
 		*error = "Error in enable_stack_by_name";
 		return fiu_enable_stack_by_name(fp_name, failnum, failinfo,
-				flags, func_name, func_pos_in_stack);
+		                                flags, func_name,
+		                                func_pos_in_stack);
 	} else {
 		*error = "Unknown command";
 		return -1;
@@ -219,7 +216,6 @@ static int rc_do_command(int fdr, int fdw)
 	return len;
 }
 
-
 /*
  * Remote control via named pipes
  *
@@ -248,7 +244,7 @@ static void *rc_fifo_thread(void *unused)
 reopen:
 	if (errcount > 10) {
 		fprintf(stderr, "libfiu: Too many errors in remote control "
-				"thread, shutting down\n");
+		                "thread, shutting down\n");
 		return NULL;
 	}
 
@@ -348,4 +344,3 @@ int fiu_rc_fifo(const char *basename)
 
 	return r;
 }
-
diff --git a/libfiu/fiu.c b/libfiu/fiu.c
index df81669..1ab8b17 100644
--- a/libfiu/fiu.c
+++ b/libfiu/fiu.c
@@ -1,29 +1,33 @@
 
-#include <stdlib.h>		/* malloc() and friends */
-#include <string.h>		/* strcmp() and friends */
-#include <pthread.h>		/* mutexes */
-#include <sys/time.h>		/* gettimeofday() */
-#include <time.h>		/* gettimeofday() */
-#include <limits.h>		/* ULONG_MAX */
+#include <limits.h>   /* ULONG_MAX */
+#include <pthread.h>  /* mutexes */
+#include <stdlib.h>   /* malloc() and friends */
+#include <string.h>   /* strcmp() and friends */
+#include <sys/time.h> /* gettimeofday() */
+#include <time.h>     /* gettimeofday() */
 
 /* Enable us, so we get the real prototypes from the headers */
 #define FIU_ENABLE 1
 
-#include "fiu.h"
 #include "fiu-control.h"
+#include "fiu.h"
 #include "internal.h"
 #include "wtable.h"
 
 /* Tracing mode for debugging libfiu itself. */
 #ifdef FIU_TRACE
-  #include <stdio.h>
-  #define trace(...) \
-	do { fprintf(stderr, __VA_ARGS__); fflush(stderr); } while (0)
+#include <stdio.h>
+#define trace(...)                                                             \
+	do {                                                                   \
+		fprintf(stderr, __VA_ARGS__);                                  \
+		fflush(stderr);                                                \
+	} while (0)
 #else
-  #define trace(...) do { } while(0)
+#define trace(...)                                                             \
+	do {                                                                   \
+	} while (0)
 #endif
 
-
 /* Different methods to decide when a point of failure fails */
 enum pf_method {
 	PF_ALWAYS = 1,
@@ -66,8 +70,8 @@ struct pf_info {
 /* Creates a new pf_info.
  * Only the common fields are filled, the caller should take care of the
  * method-specific ones. For internal use only. */
-static struct pf_info *pf_create(const char *name, int failnum,
-		void *failinfo, unsigned int flags, enum pf_method method)
+static struct pf_info *pf_create(const char *name, int failnum, void *failinfo,
+                                 unsigned int flags, enum pf_method method)
 {
 	struct pf_info *pf;
 
@@ -99,23 +103,34 @@ exit:
 	return pf;
 }
 
-static void pf_free(struct pf_info *pf) {
+static void pf_free(struct pf_info *pf)
+{
 	free(pf->name);
 	pthread_mutex_destroy(&pf->lock);
 	free(pf);
 }
 
-
 /* Table used to keep the information about the enabled points of failure.
  * It is protected by enabled_fails_lock. */
 wtable_t *enabled_fails = NULL;
 static pthread_rwlock_t enabled_fails_lock = PTHREAD_RWLOCK_INITIALIZER;
 
-#define ef_rlock() do { pthread_rwlock_rdlock(&enabled_fails_lock); } while (0)
-#define ef_wlock() do { pthread_rwlock_wrlock(&enabled_fails_lock); } while (0)
-#define ef_runlock() do { pthread_rwlock_unlock(&enabled_fails_lock); } while (0)
-#define ef_wunlock() do { pthread_rwlock_unlock(&enabled_fails_lock); } while (0)
-
+#define ef_rlock()                                                             \
+	do {                                                                   \
+		pthread_rwlock_rdlock(&enabled_fails_lock);                    \
+	} while (0)
+#define ef_wlock()                                                             \
+	do {                                                                   \
+		pthread_rwlock_wrlock(&enabled_fails_lock);                    \
+	} while (0)
+#define ef_runlock()                                                           \
+	do {                                                                   \
+		pthread_rwlock_unlock(&enabled_fails_lock);                    \
+	} while (0)
+#define ef_wunlock()                                                           \
+	do {                                                                   \
+		pthread_rwlock_unlock(&enabled_fails_lock);                    \
+	} while (0)
 
 /* To prevent unwanted recursive calls that would deadlock, we use a
  * thread-local recursion count. Unwanted recursive calls can result from
@@ -132,11 +147,9 @@ static pthread_rwlock_t enabled_fails_lock = PTHREAD_RWLOCK_INITIALIZER;
  * almost everywhere. */
 __thread int rec_count = 0;
 
-
 /* Used to keep the last failinfo via TLS */
 static pthread_key_t last_failinfo_key;
 
-
 /*
  * Miscelaneous internal functions
  */
@@ -148,7 +161,7 @@ static int pc_in_func(struct pf_info *pf, void *pc)
 	 * so we use different methods depending on its availability. */
 	if (pf->minfo.stack.func_end) {
 		return (pc >= pf->minfo.stack.func_start &&
-				pc <= pf->minfo.stack.func_end);
+		        pc <= pf->minfo.stack.func_end);
 	} else {
 		return pf->minfo.stack.func_start == get_func_start(pc);
 	}
@@ -167,8 +180,8 @@ static int should_stack_fail(struct pf_info *pf)
 
 	for (i = 0; i < nptrs; i++) {
 		if (pc_in_func(pf, buffer[i]) &&
-				(pf->minfo.stack.func_pos_in_stack == -1 ||
-				 i == pf->minfo.stack.func_pos_in_stack)) {
+		    (pf->minfo.stack.func_pos_in_stack == -1 ||
+		     i == pf->minfo.stack.func_pos_in_stack)) {
 			return 1;
 		}
 	}
@@ -211,7 +224,7 @@ static double randd(void)
 {
 	randd_xn = 1103515245 * randd_xn + 12345;
 
-	return (double) randd_xn / UINT_MAX;
+	return (double)randd_xn / UINT_MAX;
 }
 
 /* Function that runs after the process has been forked, at the child. It's
@@ -221,7 +234,6 @@ static void atfork_child(void)
 	prng_seed();
 }
 
-
 /*
  * Core API
  */
@@ -246,7 +258,7 @@ int fiu_init(unsigned int flags)
 
 	pthread_key_create(&last_failinfo_key, NULL);
 
-	enabled_fails = wtable_create((void (*)(void *)) pf_free);
+	enabled_fails = wtable_create((void (*)(void *))pf_free);
 
 	if (pthread_atfork(NULL, NULL, atfork_child) != 0) {
 		ef_wunlock();
@@ -318,26 +330,24 @@ int fiu_fail(const char *name)
 	}
 
 	switch (pf->method) {
-		case PF_ALWAYS:
+	case PF_ALWAYS:
+		goto exit_fail;
+		break;
+	case PF_PROB:
+		if (pf->minfo.probability > randd())
+			goto exit_fail;
+		break;
+	case PF_EXTERNAL:
+		if (pf->minfo.external_cb(pf->name, &(pf->failnum),
+		                          &(pf->failinfo), &(pf->flags)))
+			goto exit_fail;
+		break;
+	case PF_STACK:
+		if (should_stack_fail(pf))
 			goto exit_fail;
-			break;
-		case PF_PROB:
-			if (pf->minfo.probability > randd())
-				goto exit_fail;
-			break;
-		case PF_EXTERNAL:
-			if (pf->minfo.external_cb(pf->name,
-					&(pf->failnum),
-					&(pf->failinfo),
-					&(pf->flags)))
-				goto exit_fail;
-			break;
-		case PF_STACK:
-			if (should_stack_fail(pf))
-				goto exit_fail;
-			break;
-		default:
-			break;
+		break;
+	default:
+		break;
 	}
 
 	if (pf->flags & FIU_ONETIME) {
@@ -354,8 +364,7 @@ exit:
 exit_fail:
 	trace("FIU  Failing %s on %s\n", name, pf->name);
 
-	pthread_setspecific(last_failinfo_key,
-			pf->failinfo);
+	pthread_setspecific(last_failinfo_key, pf->failinfo);
 	failnum = pf->failnum;
 
 	if (pf->flags & FIU_ONETIME) {
@@ -374,7 +383,6 @@ void *fiu_failinfo(void)
 	return pthread_getspecific(last_failinfo_key);
 }
 
-
 /*
  * Control API
  */
@@ -397,7 +405,7 @@ static int insert_pf(struct pf_info *pf)
 
 /* Makes the given name fail. */
 int fiu_enable(const char *name, int failnum, void *failinfo,
-		unsigned int flags)
+               unsigned int flags)
 {
 	struct pf_info *pf;
 
@@ -410,7 +418,7 @@ int fiu_enable(const char *name, int failnum, void *failinfo,
 
 /* Makes the given name fail with the given probability. */
 int fiu_enable_random(const char *name, int failnum, void *failinfo,
-		unsigned int flags, float probability)
+                      unsigned int flags, float probability)
 {
 	struct pf_info *pf;
 
@@ -424,7 +432,7 @@ int fiu_enable_random(const char *name, int failnum, void *failinfo,
 
 /* Makes the given name fail when the external function returns != 0. */
 int fiu_enable_external(const char *name, int failnum, void *failinfo,
-		unsigned int flags, external_cb_t *external_cb)
+                        unsigned int flags, external_cb_t *external_cb)
 {
 	struct pf_info *pf;
 
@@ -439,7 +447,7 @@ int fiu_enable_external(const char *name, int failnum, void *failinfo,
 /* Makes the given name fail when func is in the stack at func_pos.
  * If func_pos is -1, then any position will match. */
 int fiu_enable_stack(const char *name, int failnum, void *failinfo,
-		unsigned int flags, void *func, int func_pos_in_stack)
+                     unsigned int flags, void *func, int func_pos_in_stack)
 {
 	struct pf_info *pf;
 
@@ -447,7 +455,7 @@ int fiu_enable_stack(const char *name, int failnum, void *failinfo,
 	if (func_pos_in_stack != -1)
 		return -1;
 
-	if (backtrace_works((void (*)()) fiu_enable_stack) == 0)
+	if (backtrace_works((void (*)())fiu_enable_stack) == 0)
 		return -1;
 
 	// We need either get_func_end() or get_func_start() to work, see
@@ -467,15 +475,15 @@ int fiu_enable_stack(const char *name, int failnum, void *failinfo,
 
 /* Same as fiu_enable_stack(), but takes a function name. */
 int fiu_enable_stack_by_name(const char *name, int failnum, void *failinfo,
-		unsigned int flags, const char *func_name,
-		int func_pos_in_stack)
+                             unsigned int flags, const char *func_name,
+                             int func_pos_in_stack)
 {
 	void *fp;
 
 	/* We need to check this here instead of relying on the test within
 	 * fiu_enable_stack() in case it is inlined; that would fail the check
 	 * because fiu_enable_stack() would not be in the stack. */
-	if (backtrace_works((void (*)()) fiu_enable_stack_by_name) == 0)
+	if (backtrace_works((void (*)())fiu_enable_stack_by_name) == 0)
 		return -1;
 
 	fp = get_func_addr(func_name);
@@ -483,7 +491,7 @@ int fiu_enable_stack_by_name(const char *name, int failnum, void *failinfo,
 		return -1;
 
 	return fiu_enable_stack(name, failnum, failinfo, flags, fp,
-			func_pos_in_stack);
+	                        func_pos_in_stack);
 }
 
 /* Makes the given name NOT fail. */
@@ -501,5 +509,3 @@ int fiu_disable(const char *name)
 	rec_count--;
 	return success ? 0 : -1;
 }
-
-
diff --git a/libfiu/fiu.h b/libfiu/fiu.h
index 8dd6bb7..ce57726 100644
--- a/libfiu/fiu.h
+++ b/libfiu/fiu.h
@@ -11,7 +11,6 @@
 #ifndef _FIU_H
 #define _FIU_H
 
-
 /* Controls whether the external code enables libfiu or not. */
 #ifdef FIU_ENABLE
 
@@ -19,7 +18,6 @@
 extern "C" {
 #endif
 
-
 /** Initializes the library.
  *
  * Must be called before any other library function. It is safe to invoke it
@@ -64,12 +62,12 @@ void *fiu_failinfo(void);
 
 /** Performs the given action when the given point of failure fails. Mostly
  * used in the following macros. */
-#define fiu_do_on(name, action) \
-        do { \
-                if (fiu_fail(name)) { \
-                        action; \
-                } \
-        } while (0)
+#define fiu_do_on(name, action)                                                \
+	do {                                                                   \
+		if (fiu_fail(name)) {                                          \
+			action;                                                \
+		}                                                              \
+	} while (0)
 
 /** Exits the program when the given point of failure fails. */
 #define fiu_exit_on(name) fiu_do_on(name, exit(EXIT_FAILURE))
@@ -78,7 +76,6 @@ void *fiu_failinfo(void);
  * fails. */
 #define fiu_return_on(name, retval) fiu_do_on(name, return retval)
 
-
 #ifdef __cplusplus
 }
 #endif
@@ -98,4 +95,3 @@ void *fiu_failinfo(void);
 #endif /* FIU_ENABLE */
 
 #endif /* _FIU_H */
-
diff --git a/libfiu/hash.c b/libfiu/hash.c
index 45a9b9b..dd2e4c7 100644
--- a/libfiu/hash.c
+++ b/libfiu/hash.c
@@ -8,14 +8,14 @@
  * It is NOT thread-safe.
  */
 
-#include <sys/types.h>		/* for size_t */
-#include <stdint.h>		/* for [u]int*_t */
-#include <stdbool.h>		/* for bool */
-#include <stdlib.h>		/* for malloc() */
-#include <string.h>		/* for memcpy()/memcmp() */
-#include <stdio.h>		/* snprintf() */
-#include <pthread.h>		/* read-write locks */
 #include "hash.h"
+#include <pthread.h>   /* read-write locks */
+#include <stdbool.h>   /* for bool */
+#include <stdint.h>    /* for [u]int*_t */
+#include <stdio.h>     /* snprintf() */
+#include <stdlib.h>    /* for malloc() */
+#include <string.h>    /* for memcpy()/memcmp() */
+#include <sys/types.h> /* for size_t */
 
 /* MurmurHash2, by Austin Appleby. The one we use.
  * It has been modify to fit into the coding style, to work on uint32_t
@@ -34,7 +34,7 @@ static uint32_t murmurhash2(const char *key, size_t len)
 
 	// Mix 4 bytes at a time into the hash
 	while (len >= 4) {
-		uint32_t k = *(uint32_t *) key;
+		uint32_t k = *(uint32_t *)key;
 
 		k *= m;
 		k ^= k >> r;
@@ -49,10 +49,13 @@ static uint32_t murmurhash2(const char *key, size_t len)
 
 	// Handle the last few bytes of the input array
 	switch (len) {
-		case 3: h ^= key[2] << 16;
-		case 2: h ^= key[1] << 8;
-		case 1: h ^= key[0];
-			h *= m;
+	case 3:
+		h ^= key[2] << 16;
+	case 2:
+		h ^= key[1] << 8;
+	case 1:
+		h ^= key[0];
+		h *= m;
 	}
 
 	// Do a few final mixes of the hash to ensure the last few
@@ -84,7 +87,6 @@ struct hash {
 	void (*destructor)(void *);
 };
 
-
 /* Minimum table size. */
 #define MIN_SIZE 10
 
@@ -150,12 +152,13 @@ void *hash_get(struct hash *h, const char *key)
 			/* We got to a entry never used, no match. */
 			return NULL;
 		} else if (entry->in_use == IN_USE &&
-				strcmp(key, entry->key) == 0) {
+		           strcmp(key, entry->key) == 0) {
 			/* The key matches. */
 			return entry->value;
 		}
 
-		/* The key doesn't match this entry, continue with linear probing. */
+		/* The key doesn't match this entry, continue with linear
+		 * probing. */
 		pos = (pos + 1) % h->table_size;
 	}
 
@@ -188,14 +191,15 @@ static bool _hash_set(struct hash *h, char *key, void *value)
 			h->nentries++;
 			return true;
 		} else if (entry->in_use == IN_USE &&
-				strcmp(key, entry->key) == 0) {
+		           strcmp(key, entry->key) == 0) {
 			/* The key matches, override the value. */
 			h->destructor(entry->value);
 			entry->value = value;
 			return true;
 		}
 
-		/* The key doesn't match this entry, continue with linear probing. */
+		/* The key doesn't match this entry, continue with linear
+		 * probing. */
 		pos = (pos + 1) % h->table_size;
 	}
 
@@ -243,7 +247,8 @@ static bool resize_table(struct hash *h, size_t new_size)
 	return true;
 }
 
-static bool auto_resize_table(hash_t *h) {
+static bool auto_resize_table(hash_t *h)
+{
 	/* Slots in the table is taken by valid and removed entries.
 	 * Since we don't reuse removed slots, we need to also take them into
 	 * consideration and shrink if we are accumulating too many.
@@ -254,14 +259,14 @@ static bool auto_resize_table(hash_t *h) {
 	 */
 
 	/* Maintain at least 30% usable entries. */
-	float usable_ratio = (float) (h->table_size - h->nentries - h->nremoved)
-		/ h->table_size;
+	float usable_ratio =
+	    (float)(h->table_size - h->nentries - h->nremoved) / h->table_size;
 	if (usable_ratio < 0.3) {
 		return resize_table(h, h->nentries * 2);
 	}
 
 	/* If we have less than 30% used (by valid entries), compact. */
-	float entries_ratio = (float) h->nentries / h->table_size;
+	float entries_ratio = (float)h->nentries / h->table_size;
 	if (h->table_size > MIN_SIZE && entries_ratio < 0.3) {
 		return resize_table(h, h->nentries * 2);
 	}
@@ -269,7 +274,6 @@ static bool auto_resize_table(hash_t *h) {
 	return true;
 }
 
-
 bool hash_set(struct hash *h, const char *key, void *value)
 {
 	bool r = _hash_set(h, strdup(key), value);
@@ -295,13 +299,14 @@ bool hash_del(struct hash *h, const char *key)
 			/* We got to a never used key, not found. */
 			return false;
 		} else if (entry->in_use == IN_USE &&
-				strcmp(key, entry->key) == 0) {
+		           strcmp(key, entry->key) == 0) {
 			/* The key matches, remove it. */
 			found = true;
 			break;
 		}
 
-		/* The key doesn't match this entry, continue with linear probing. */
+		/* The key doesn't match this entry, continue with linear
+		 * probing. */
 		pos = (pos + 1) % h->table_size;
 	}
 
@@ -324,7 +329,6 @@ bool hash_del(struct hash *h, const char *key)
 	return true;
 }
 
-
 /* Generic, simple cache.
  *
  * It is implemented using a hash table and manipulating it directly when
@@ -457,7 +461,6 @@ miss:
 	return false;
 }
 
-
 bool cache_set(struct cache *c, const char *key, void *value)
 {
 	pthread_rwlock_wrlock(&c->lock);
@@ -492,4 +495,3 @@ bool cache_del(struct cache *c, const char *key)
 	pthread_rwlock_unlock(&c->lock);
 	return false;
 }
-
diff --git a/libfiu/hash.h b/libfiu/hash.h
index fb88c03..93163a1 100644
--- a/libfiu/hash.h
+++ b/libfiu/hash.h
@@ -4,9 +4,9 @@
 
 /* Generic hash table. See hash.c for more information. */
 
-#include <sys/types.h>		/* for size_t */
-#include <stdbool.h>		/* for bool */
-#include <stdint.h>		/* for int64_t */
+#include <stdbool.h>   /* for bool */
+#include <stdint.h>    /* for int64_t */
+#include <sys/types.h> /* for size_t */
 
 typedef struct hash hash_t;
 
@@ -17,7 +17,6 @@ void *hash_get(hash_t *h, const char *key);
 bool hash_set(hash_t *h, const char *key, void *value);
 bool hash_del(hash_t *h, const char *key);
 
-
 /* Generic cache. */
 
 typedef struct cache cache_t;
@@ -32,4 +31,3 @@ bool cache_del(cache_t *c, const char *key);
 bool cache_invalidate(cache_t *c);
 
 #endif
-
diff --git a/libfiu/internal.h b/libfiu/internal.h
index 6e25554..f872117 100644
--- a/libfiu/internal.h
+++ b/libfiu/internal.h
@@ -27,4 +27,3 @@ void *get_func_addr(const char *func_name);
 int backtrace_works(void (*caller)());
 
 #endif
-
diff --git a/libfiu/wtable.c b/libfiu/wtable.c
index 7e271fa..ac345a1 100644
--- a/libfiu/wtable.c
+++ b/libfiu/wtable.c
@@ -16,17 +16,16 @@
  * this may change in the future.
  */
 
-#include <sys/types.h>		/* for size_t */
-#include <stdint.h>		/* for [u]int*_t */
-#include <stdbool.h>		/* for bool */
-#include <stdlib.h>		/* for malloc() */
-#include <string.h>		/* for memcpy()/memcmp() */
-#include <stdio.h>		/* snprintf() */
+#include <stdbool.h>   /* for bool */
+#include <stdint.h>    /* for [u]int*_t */
+#include <stdio.h>     /* snprintf() */
+#include <stdlib.h>    /* for malloc() */
+#include <string.h>    /* for memcpy()/memcmp() */
+#include <sys/types.h> /* for size_t */
 
 #include "hash.h"
 #include "wtable.h"
 
-
 /* Entry of the wildcard array. */
 struct wentry {
 	char *key;
@@ -51,11 +50,9 @@ struct wtable {
 	void (*destructor)(void *);
 };
 
-
 /* Minimum table size. */
 #define MIN_SIZE 10
 
-
 struct wtable *wtable_create(void (*destructor)(void *))
 {
 	struct wtable *t = malloc(sizeof(struct wtable));
@@ -129,7 +126,6 @@ static unsigned int strlast(const char *s1, const char *s2)
 	return i;
 }
 
-
 /* True if s is a wildcarded string, False otherwise. */
 static bool is_wildcard(const char *s, size_t len)
 {
@@ -142,10 +138,8 @@ static bool is_wildcard(const char *s, size_t len)
  * ws is a "wildcard string", which can end in a '*', in which case we compare
  * only up to that position, to do a wildcard matching.
  */
-static bool ws_matches_s(
-		const char *ws, size_t ws_len,
-		const char *s, size_t s_len,
-		bool exact)
+static bool ws_matches_s(const char *ws, size_t ws_len, const char *s,
+                         size_t s_len, bool exact)
 {
 	if (ws == NULL || s == NULL)
 		return false;
@@ -170,7 +164,8 @@ static bool ws_matches_s(
  * Returns a pointer to the entry, or NULL if not found.
  */
 static struct wentry *wildcards_find_entry(struct wtable *t, const char *key,
-		bool exact, struct wentry **first_free)
+                                           bool exact,
+                                           struct wentry **first_free)
 {
 	size_t key_len;
 	size_t pos;
@@ -188,8 +183,8 @@ static struct wentry *wildcards_find_entry(struct wtable *t, const char *key,
 			}
 			continue;
 
-		} else if (ws_matches_s(entry->key, entry->key_len,
-				key, key_len, exact)) {
+		} else if (ws_matches_s(entry->key, entry->key_len, key,
+		                        key_len, exact)) {
 			/* The key matches. */
 			return entry;
 		}
@@ -320,7 +315,6 @@ bool wtable_set(struct wtable *t, const char *key, void *value)
 	}
 }
 
-
 bool wtable_del(struct wtable *t, const char *key)
 {
 	struct wentry *entry;
@@ -345,7 +339,7 @@ bool wtable_del(struct wtable *t, const char *key)
 
 		/* Shrink if the table is less than 60% occupied. */
 		if (t->ws_size > MIN_SIZE &&
-				(float) t->ws_used_count / t->ws_size < 0.6) {
+		    (float)t->ws_used_count / t->ws_size < 0.6) {
 			if (!resize_table(t, t->ws_used_count + 3))
 				return false;
 		}
@@ -360,4 +354,3 @@ bool wtable_del(struct wtable *t, const char *key)
 		return hash_del(t->finals, key);
 	}
 }
-
diff --git a/libfiu/wtable.h b/libfiu/wtable.h
index e39f6c5..7310958 100644
--- a/libfiu/wtable.h
+++ b/libfiu/wtable.h
@@ -9,7 +9,7 @@
 #ifndef _WTABLE_H
 #define _WTABLE_H
 
-#include <stdbool.h>		/* for bool */
+#include <stdbool.h> /* for bool */
 
 typedef struct wtable wtable_t;
 
@@ -21,4 +21,3 @@ bool wtable_set(wtable_t *t, const char *key, void *value);
 bool wtable_del(wtable_t *t, const char *key);
 
 #endif
-
diff --git a/preload/posix/codegen.c b/preload/posix/codegen.c
index 691d6f0..7fbdb33 100644
--- a/preload/posix/codegen.c
+++ b/preload/posix/codegen.c
@@ -1,10 +1,10 @@
 
-#include <stdio.h>
-#include <dlfcn.h>
-#include <sys/time.h>
-#include <stdlib.h>
 #include "codegen.h"
 #include "build-env.h"
+#include <dlfcn.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/time.h>
 
 /* Recursion counter, per-thread */
 int __thread _fiu_called = 0;
@@ -40,7 +40,6 @@ void *libc_symbol(const char *symbol)
 #endif
 }
 
-
 /* this runs after all function-specific constructors */
 static void constructor_attr(250) _fiu_init_final(void)
 {
@@ -56,4 +55,3 @@ static void constructor_attr(250) _fiu_init_final(void)
 
 	rec_dec();
 }
-
diff --git a/preload/run/fiu-run.in b/preload/run/fiu-run.in
index 8926094..ecd69f2 100644
--- a/preload/run/fiu-run.in
+++ b/preload/run/fiu-run.in
@@ -83,13 +83,13 @@ function opts_reset() {
 }
 
 function add_deprecated_enable() {
-	if [ "$NAME" == "" ]; then
+	if [ "$DEP_NAME" == "" ]; then
 		return
 	fi;
 
 	PARAMS="name=$DEP_NAME,failnum=$DEP_FAILNUM,failinfo=$DEP_FAILINFO"
-	if [ $PROB -ge 0 ]; then
-		C="enable_random $PARAMS,probability=$PROB"
+	if [ "$DEP_PROB" -ge 0 ]; then
+		C="enable_random $PARAMS,probability=$DEP_PROB"
 	else
 		C="enable $PARAMS"
 	fi
diff --git a/preload/run/run.c b/preload/run/run.c
index 51685fb..eff5171 100644
--- a/preload/run/run.c
+++ b/preload/run/run.c
@@ -1,13 +1,12 @@
 
-#include <stdio.h>		/* printf() */
-#include <unistd.h>		/* execve() */
-#include <string.h>		/* strtok(), memset(), strncpy() */
-#include <stdlib.h>		/* atoi(), atol() */
-#include <getopt.h>		/* getopt() */
+#include <getopt.h> /* getopt() */
+#include <stdio.h>  /* printf() */
+#include <stdlib.h> /* atoi(), atol() */
+#include <string.h> /* strtok(), memset(), strncpy() */
+#include <unistd.h> /* execve() */
 
-#include <fiu.h>
 #include <fiu-control.h>
-
+#include <fiu.h>
 
 static void __attribute__((constructor)) fiu_run_init(void)
 {
@@ -41,13 +40,12 @@ static void __attribute__((constructor)) fiu_run_init(void)
 		while (tok) {
 			if (fiu_rc_string(tok, &rc_error) != 0) {
 				fprintf(stderr,
-					"fiu_run_preload: Error applying "
-						"FIU_ENABLE commands: %s\n",
-						rc_error);
+				        "fiu_run_preload: Error applying "
+				        "FIU_ENABLE commands: %s\n",
+				        rc_error);
 				return;
 			}
 			tok = strtok_r(NULL, "\n", &state);
 		}
 	}
 }
-
diff --git a/tests/collisions/binary.c b/tests/collisions/binary.c
index 7fb825d..4d799cf 100644
--- a/tests/collisions/binary.c
+++ b/tests/collisions/binary.c
@@ -1,8 +1,8 @@
 // A binary that uses some of the same function names as libfiu.
 // We use this to test function name collissions.
 
-#include <stdio.h> // printf()
 #include "libcoltest.h"
+#include <stdio.h> // printf()
 
 #define ASSERT_CALLED(NAME, N)                                                 \
 	if (called_##NAME != N) {                                              \
@@ -18,7 +18,10 @@
 
 int called_wtable_set = 0;
 
-void wtable_set(void) { called_wtable_set++; }
+void wtable_set(void)
+{
+	called_wtable_set++;
+}
 
 int main(void)
 {
diff --git a/tests/collisions/libcoltest.c b/tests/collisions/libcoltest.c
index 765d6d0..c210db9 100644
--- a/tests/collisions/libcoltest.c
+++ b/tests/collisions/libcoltest.c
@@ -3,4 +3,7 @@
 
 int called_wtable_get = 0;
 
-void wtable_get(void) { called_wtable_get++; }
+void wtable_get(void)
+{
+	called_wtable_get++;
+}
diff --git a/tests/generated/tests/fprintf.conf b/tests/generated/tests/fprintf.conf
index c5f082b..28b2d73 100644
--- a/tests/generated/tests/fprintf.conf
+++ b/tests/generated/tests/fprintf.conf
@@ -2,6 +2,12 @@
 [fprintf]
 fp: posix/stdio/sp/fprintf
 include: stdio.h
+
+# In some situations/environments, fprintf can be a macro instead of a
+# function. And when _FORTIFY_SOURCE is set, it is forced inline and defined
+# in the headers, which prevents it from being wrapped.
+if: (!defined fprintf) && (!defined _FORTIFY_SOURCE)
+
 prep: int r; FILE *fp = fopen("/dev/null", "w");
 call: r = fprintf(fp, "%%d\n", 1234);
 
diff --git a/tests/perf-fsck.py b/tests/perf-fsck.py
index 3e8a536..50cd98c 100644
--- a/tests/perf-fsck.py
+++ b/tests/perf-fsck.py
@@ -19,31 +19,34 @@ import sys
 import subprocess
 import time
 
-test_file = os.environ.get('TEST_FILE', '.test_fs')
+test_file = os.environ.get("TEST_FILE", ".test_fs")
 
-test_file_size = int(os.environ.get('TEST_FILE_SIZE_MB', 10))
+test_file_size = int(os.environ.get("TEST_FILE_SIZE_MB", 10))
 
-ld_library_path = os.environ.get('LD_LIBRARY_PATH',
-        os.path.abspath(
-            os.path.abspath(os.path.dirname(sys.argv[0]))
-            + '/../libfiu/'))
+ld_library_path = os.environ.get(
+    "LD_LIBRARY_PATH",
+    os.path.abspath(
+        os.path.abspath(os.path.dirname(sys.argv[0])) + "/../libfiu/"
+    ),
+)
 
-verbose = int(os.environ.get('VERBOSE', 0))
+verbose = int(os.environ.get("VERBOSE", 0))
 
-dev_null = open('/dev/null', 'w')
+dev_null = open("/dev/null", "w")
 
-def run_child(name, args, stdout = dev_null, stderr = dev_null):
+
+def run_child(name, args, stdout=dev_null, stderr=dev_null):
     """Runs the subprocess, returns the Popen object."""
     env = dict(os.environ)
-    env['LD_LIBRARY_PATH'] = ld_library_path
+    env["LD_LIBRARY_PATH"] = ld_library_path
 
     if verbose and stdout == stderr == dev_null:
         stdout = stderr = None
 
-    child = subprocess.Popen(args, env = env,
-            stdout = stdout, stderr = stderr)
+    child = subprocess.Popen(args, env=env, stdout=stdout, stderr=stderr)
     return child
 
+
 def run_and_time(name, args):
     """Run the given arguments, print the times."""
     start = time.time()
@@ -52,27 +55,33 @@ def run_and_time(name, args):
     end = time.time()
 
     if verbose == 2:
-        print('Ran %s -> %d' % (args, status))
+        print("Ran %s -> %d" % (args, status))
 
     if status != 0:
-        print('Error running %s: %s' % (args[0], status))
+        print("Error running %s: %s" % (args[0], status))
         raise RuntimeError
 
-    print('%-10s u:%.3f  s:%.3f  r:%.3f' % (
-            name, rusage.ru_utime, rusage.ru_stime, end - start))
+    print(
+        "%-10s u:%.3f  s:%.3f  r:%.3f"
+        % (name, rusage.ru_utime, rusage.ru_stime, end - start)
+    )
 
 
 def run_fsck(name, fiu_args):
     """Runs an fsck with the given fiu arguments."""
-    child = run_child(name,
-            ["fiu-run", "-x"] + fiu_args
-                + "fsck.ext2 -n -t -f".split() + [test_file],
-                stdout = subprocess.PIPE,
-                stderr = subprocess.PIPE)
+    child = run_child(
+        name,
+        ["fiu-run", "-x"]
+        + fiu_args
+        + "fsck.ext2 -n -t -f".split()
+        + [test_file],
+        stdout=subprocess.PIPE,
+        stderr=subprocess.PIPE,
+    )
     stdout, stderr = child.communicate()
 
     if child.returncode != 0:
-        print('Error running fsck: %s' % child.returncode)
+        print("Error running fsck: %s" % child.returncode)
         raise RuntimeError
 
     # Find the times reported by fsck.
@@ -81,11 +90,11 @@ def run_fsck(name, fiu_args):
     # The line looks like:
     #   Memory used: 560k/0k (387k/174k), time:  2.18/ 2.17/ 0.00
     user_time = sys_time = real_time = -1
-    for l in stdout.split('\n'):
+    for l in stdout.split("\n"):
         if not l.startswith("Memory used"):
             continue
 
-        times = l.split(':')[-1].split('/')
+        times = l.split(":")[-1].split("/")
         times = [s.strip() for s in times]
         if len(times) != 3:
             continue
@@ -95,26 +104,27 @@ def run_fsck(name, fiu_args):
         sys_time = float(times[2])
         break
 
-    print('%-10s u:%.3f  s:%.3f  r:%.3f' % (
-            name, user_time, sys_time, real_time))
+    print(
+        "%-10s u:%.3f  s:%.3f  r:%.3f" % (name, user_time, sys_time, real_time)
+    )
 
 
 def check_test_file():
     if os.path.exists(test_file):
         return
 
-    with open(test_file, 'w') as fd:
+    with open(test_file, "w") as fd:
         fd.truncate(test_file_size * 1024 * 1024)
 
     retcode = subprocess.call(
-            ["mkfs.ext2", "-F", test_file],
-            stdout = open('/dev/null', 'w'))
+        ["mkfs.ext2", "-F", test_file], stdout=open("/dev/null", "w")
+    )
     if retcode != 0:
-        print('Error running mkfs.ext2:', retcode)
+        print("Error running mkfs.ext2:", retcode)
         return
 
 
-if __name__ == '__main__':
+if __name__ == "__main__":
     check_test_file()
 
     run_and_time("base", "fsck.ext2 -n -f".split() + [test_file])
diff --git a/tests/test-basic.py b/tests/test-basic.py
index 8a9f0d7..85c7fc3 100644
--- a/tests/test-basic.py
+++ b/tests/test-basic.py
@@ -5,26 +5,26 @@ Basic tests for general functionality.
 import fiu
 
 # Test unknown failure point.
-assert not fiu.fail('unknown')
+assert not fiu.fail("unknown")
 
 # Test enable/disable.
-fiu.enable('p1')
-assert fiu.fail('p1')
-fiu.disable('p1')
-assert not fiu.fail('p1')
+fiu.enable("p1")
+assert fiu.fail("p1")
+fiu.disable("p1")
+assert not fiu.fail("p1")
 
 # Test enable_random.
-fiu.enable_random('p1', probability = 0.5)
-result = { True: 0, False: 0 }
+fiu.enable_random("p1", probability=0.5)
+result = {True: 0, False: 0}
 for i in range(1000):
-    result[fiu.fail('p1')] += 1
+    result[fiu.fail("p1")] += 1
 
 assert 400 < result[True] < 600, result
 assert 400 < result[False] < 600, result
 
 # Test repeated enabling/disabling.
-fiu.enable('p1')
-fiu.enable('p1')
-assert fiu.fail('p1')
-fiu.disable('p1')
-assert not fiu.fail('p1')
+fiu.enable("p1")
+fiu.enable("p1")
+assert fiu.fail("p1")
+fiu.disable("p1")
+assert not fiu.fail("p1")
diff --git a/tests/test-cache_invalidation.py b/tests/test-cache_invalidation.py
index ad2954a..d5a1e11 100644
--- a/tests/test-cache_invalidation.py
+++ b/tests/test-cache_invalidation.py
@@ -7,16 +7,15 @@ import fiu
 # Unknown - add - fail - remove - not fail.
 # The initial unknown is relevant because it places a negative match in the
 # cache.
-assert not fiu.fail('p1')
-fiu.enable('p1')
-assert fiu.fail('p1')
-fiu.disable('p1')
-assert not fiu.fail('p1')
+assert not fiu.fail("p1")
+fiu.enable("p1")
+assert fiu.fail("p1")
+fiu.disable("p1")
+assert not fiu.fail("p1")
 
 # Same as above, but with wildcards.
-assert not fiu.fail('p2/x')
-fiu.enable('p2/*')
-assert fiu.fail('p2/x')
-fiu.disable('p2/*')
-assert not fiu.fail('p2/x')
-
+assert not fiu.fail("p2/x")
+fiu.enable("p2/*")
+assert fiu.fail("p2/x")
+fiu.disable("p2/*")
+assert not fiu.fail("p2/x")
diff --git a/tests/test-enable_stack.c b/tests/test-enable_stack.c
index a5d2c54..b68dce1 100644
--- a/tests/test-enable_stack.c
+++ b/tests/test-enable_stack.c
@@ -1,12 +1,12 @@
 
+#include <assert.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include <assert.h>
 
-#include <fiu.h>
 #include <fiu-control.h>
+#include <fiu.h>
 
-int func1()
+int __attribute__((noinline)) func1()
 {
 	/*
 	int nptrs;
@@ -18,18 +18,17 @@ int func1()
 	return fiu_fail("fp-1") != 0;
 }
 
-int func2()
+int __attribute__((noinline)) func2()
 {
 	return func1();
 }
 
-
 int main(void)
 {
 	int r;
 
 	fiu_init(0);
-	r = fiu_enable_stack("fp-1", 1, NULL, 0, (void *) &func2, -1);
+	r = fiu_enable_stack("fp-1", 1, NULL, 0, (void *)&func2, -1);
 	if (r != 0) {
 		printf("NOTE: fiu_enable_stack() failed, skipping test\n");
 		return 0;
@@ -45,4 +44,3 @@ int main(void)
 
 	return 0;
 }
-
diff --git a/tests/test-enable_stack_by_name.c b/tests/test-enable_stack_by_name.c
index d769728..c6cc051 100644
--- a/tests/test-enable_stack_by_name.c
+++ b/tests/test-enable_stack_by_name.c
@@ -1,12 +1,12 @@
 
+#include <assert.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include <assert.h>
 
-#include <fiu.h>
 #include <fiu-control.h>
+#include <fiu.h>
 
-int func1()
+int __attribute__((noinline)) func1()
 {
 	/*
 	int nptrs;
@@ -18,12 +18,11 @@ int func1()
 	return fiu_fail("fp-1") != 0;
 }
 
-int func2()
+int __attribute__((noinline)) func2()
 {
 	return func1();
 }
 
-
 int main(void)
 {
 	int r;
@@ -32,7 +31,7 @@ int main(void)
 	r = fiu_enable_stack_by_name("fp-1", 1, NULL, 0, "func2", -1);
 	if (r != 0) {
 		printf("NOTE: fiu_enable_stack_by_name() failed, "
-				"skipping test\n");
+		       "skipping test\n");
 		return 0;
 	}
 
@@ -46,4 +45,3 @@ int main(void)
 
 	return 0;
 }
-
diff --git a/tests/test-failinfo_refcount.py b/tests/test-failinfo_refcount.py
index a2c0e86..3d9eb49 100644
--- a/tests/test-failinfo_refcount.py
+++ b/tests/test-failinfo_refcount.py
@@ -1,4 +1,3 @@
-
 """
 Test that we keep references to failinfo as needed.
 """
@@ -8,9 +7,9 @@ import fiu
 # Object we'll use for failinfo
 finfo = [1, 2, 3]
 
-fiu.enable('p1', failinfo = finfo)
+fiu.enable("p1", failinfo=finfo)
 
-assert fiu.fail('p1')
+assert fiu.fail("p1")
 assert fiu.failinfo() is finfo
 
 finfo_id = id(finfo)
diff --git a/tests/test-ferror.c b/tests/test-ferror.c
index ab1e079..0f02fc4 100644
--- a/tests/test-ferror.c
+++ b/tests/test-ferror.c
@@ -1,20 +1,19 @@
 /* Test the handling of FILE * errors. */
 
-#include <fiu.h>
-#include <fiu-control.h>
-#include <stdio.h>
 #include <errno.h>
+#include <fiu-control.h>
+#include <fiu.h>
 #include <stdio.h>
 #include <string.h>
 
-
-int test(const char *prefix) {
+int test(const char *prefix)
+{
 	FILE *fp = fopen("/dev/zero", "r");
 
 	unsigned char buf[1024];
 	ssize_t r;
 
-	fiu_enable("posix/stdio/rw/fread", 1, (void *) EIO, 0);
+	fiu_enable("posix/stdio/rw/fread", 1, (void *)EIO, 0);
 
 	r = fread(buf, 1, 1024, fp);
 
@@ -27,13 +26,15 @@ int test(const char *prefix) {
 
 	if (errno != EIO) {
 		printf("%s: errno not set appropriately: ", prefix);
-		printf("errno = %d / %s, expected EIO\n", errno, strerror(errno));
+		printf("errno = %d / %s, expected EIO\n", errno,
+		       strerror(errno));
 		return -1;
 	}
 
 	if (ferror(fp) == 0) {
-		printf("%s: ferror() said there was no failure, but there was\n",
-				prefix);
+		printf(
+		    "%s: ferror() said there was no failure, but there was\n",
+		    prefix);
 		return -1;
 	}
 
@@ -41,7 +42,7 @@ int test(const char *prefix) {
 
 	if (ferror(fp) != 0) {
 		printf("%s: clearerr(), ferror() said there were failures\n",
-				prefix);
+		       prefix);
 		return -1;
 	}
 
@@ -55,7 +56,8 @@ int test(const char *prefix) {
 	return 0;
 }
 
-int main(void) {
+int main(void)
+{
 	// Run the test many times, to stress structure reuse a bit. This is
 	// not as thorough but does exercise some bugs we've had, such as
 	// forgetting to decrement the recursion counter.
diff --git a/tests/test-fiu_ctrl.py b/tests/test-fiu_ctrl.py
index 4fe84e7..d98bf2f 100644
--- a/tests/test-fiu_ctrl.py
+++ b/tests/test-fiu_ctrl.py
@@ -12,73 +12,77 @@ import time
 
 fiu_ctrl.PLIBPATH = "./libs/"
 
+
 def run_cat(**kwargs):
-    return fiu_ctrl.Subprocess(["./small-cat"],
-        universal_newlines = True,
-        stdin = subprocess.PIPE, stdout = subprocess.PIPE,
-        stderr = subprocess.PIPE, **kwargs)
+    return fiu_ctrl.Subprocess(
+        ["./small-cat"],
+        universal_newlines=True,
+        stdin=subprocess.PIPE,
+        stdout=subprocess.PIPE,
+        stderr=subprocess.PIPE,
+        **kwargs
+    )
+
 
 # Run without any failure point being enabled.
 cmd = run_cat()
 p = cmd.start()
-out, err = p.communicate('test\n')
-assert out == 'test\n', out
-assert err == '', err
+out, err = p.communicate("test\n")
+assert out == "test\n", out
+assert err == "", err
 
 # Enable before starting.
-cmd = run_cat(fiu_enable_posix = True)
-cmd.enable('posix/io/rw/*', failinfo = errno.ENOSPC)
+cmd = run_cat(fiu_enable_posix=True)
+cmd.enable("posix/io/rw/*", failinfo=errno.ENOSPC)
 p = cmd.start()
-out, err = p.communicate('test\n')
-assert out == '', out
-assert 'space' in err, err
+out, err = p.communicate("test\n")
+assert out == "", out
+assert "space" in err, err
 
 # Enable after starting.
-cmd = run_cat(fiu_enable_posix = True)
+cmd = run_cat(fiu_enable_posix=True)
 p = cmd.start()
-cmd.enable('posix/io/rw/*', failinfo = errno.ENOSPC)
-out, err = p.communicate('test\n')
-assert out == '', out
-assert 'space' in err, err
+cmd.enable("posix/io/rw/*", failinfo=errno.ENOSPC)
+out, err = p.communicate("test\n")
+assert out == "", out
+assert "space" in err, err
 
 # Enable-disable.
-cmd = run_cat(fiu_enable_posix = True)
+cmd = run_cat(fiu_enable_posix=True)
 p = cmd.start()
-cmd.enable('posix/io/rw/*', failinfo = errno.ENOSPC)
-cmd.disable('posix/io/rw/*')
-out, err = p.communicate('test\n')
-assert out == 'test\n', (out, err)
+cmd.enable("posix/io/rw/*", failinfo=errno.ENOSPC)
+cmd.disable("posix/io/rw/*")
+out, err = p.communicate("test\n")
+assert out == "test\n", (out, err)
 
 # Bad command.
-cmd = run_cat(fiu_enable_posix = True)
+cmd = run_cat(fiu_enable_posix=True)
 p = cmd.start()
 exc = None
 try:
-    cmd.run_raw_cmd('badcommand', ["name=a"])
+    cmd.run_raw_cmd("badcommand", ["name=a"])
 except Exception as e:
     exc = e
 assert isinstance(exc, fiu_ctrl.CommandError), "got exception: %r" % exc
-out, err = p.communicate('test\n')
-assert out == 'test\n', out
-assert err == 'libfiu: rc parsing error: Unknown command\n', err
+out, err = p.communicate("test\n")
+assert out == "test\n", out
+assert err == "libfiu: rc parsing error: Unknown command\n", err
 
 # Enable random.
 # This relies on cat doing a reasonably small number of read and writes, which
 # our small-cat does.
-result = { True: 0, False: 0 }
+result = {True: 0, False: 0}
 for i in range(50):
-    cmd = run_cat(fiu_enable_posix = True)
+    cmd = run_cat(fiu_enable_posix=True)
     p = cmd.start()
-    cmd.enable_random('posix/io/rw/*', failinfo = errno.ENOSPC,
-            probability = 0.5)
-    out, err = p.communicate('test\n')
-    if 'space' in err:
+    cmd.enable_random("posix/io/rw/*", failinfo=errno.ENOSPC, probability=0.5)
+    out, err = p.communicate("test\n")
+    if "space" in err:
         result[False] += 1
-    elif out == 'test\n':
+    elif out == "test\n":
         result[True] += 1
     else:
         assert False, (out, err)
 
 assert 10 < result[True] < 40, result
 assert 10 < result[False] < 40, result
-
diff --git a/tests/test-manyfps.py b/tests/test-manyfps.py
index b2de4e5..a6a6b3e 100644
--- a/tests/test-manyfps.py
+++ b/tests/test-manyfps.py
@@ -1,4 +1,3 @@
-
 """
 Test the creation of many failure points.
 """
diff --git a/tests/test-onetime.py b/tests/test-onetime.py
index 182a4a8..b3938c4 100644
--- a/tests/test-onetime.py
+++ b/tests/test-onetime.py
@@ -1,17 +1,15 @@
-
 """
 Test that we fail ONETIME points only one time.
 """
 
 import fiu
 
-fiu.enable('p1', flags = fiu.Flags.ONETIME)
-fiu.enable('p2')
+fiu.enable("p1", flags=fiu.Flags.ONETIME)
+fiu.enable("p2")
 
-assert fiu.fail('p1')
+assert fiu.fail("p1")
 for i in range(100):
-    assert not fiu.fail('p1')
+    assert not fiu.fail("p1")
 
 for i in range(100):
-    assert fiu.fail('p2')
-
+    assert fiu.fail("p2")
diff --git a/tests/test-parallel-wildcard.c b/tests/test-parallel-wildcard.c
index 3aaa136..57cfb0b 100644
--- a/tests/test-parallel-wildcard.c
+++ b/tests/test-parallel-wildcard.c
@@ -11,20 +11,20 @@
  *
  * Please note this is a non-deterministic test. */
 
+#include <assert.h>
+#include <pthread.h>
+#include <stdbool.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include <stdbool.h>
 #include <unistd.h>
-#include <pthread.h>
-#include <assert.h>
 
-#include <fiu.h>
 #include <fiu-control.h>
+#include <fiu.h>
 
 /* Be careful with increasing these numbers, as the memory usage is directly
  * related to them. */
 #define NHIGH 1000
-#define NLOW  1000
+#define NLOW 1000
 
 /* Maximum number of a failure point's name */
 #define MAX_FPNAME 32
@@ -73,7 +73,8 @@ void *no_check_caller(void *unused)
 	return NULL;
 }
 
-bool rand_bool(void) {
+bool rand_bool(void)
+{
 	return (rand() % 2) == 0;
 }
 
@@ -81,7 +82,6 @@ bool rand_bool(void) {
 bool enabled[NHIGH];
 pthread_rwlock_t enabled_lock;
 
-
 /* Calls all the *enabled* points all the time. */
 unsigned long long checking_caller_count = 0;
 void *checking_caller(void *unused)
@@ -98,11 +98,11 @@ void *checking_caller(void *unused)
 			}
 
 			for (low = 0; low < NLOW; low++) {
-				failed = fiu_fail(
-					final_point_name[high][low]) != 0;
+				failed =
+				    fiu_fail(final_point_name[high][low]) != 0;
 				if (!failed) {
 					printf("ERROR: %d:%d did not fail\n",
-							high, low);
+					       high, low);
 					assert(false);
 				}
 				checking_caller_count++;
@@ -131,14 +131,12 @@ void *enabler(void *unused)
 
 			pthread_rwlock_wrlock(&enabled_lock);
 			if (enabled[high]) {
-				assert(fiu_disable(wildcard_point_name[high])
-						== 0);
+				assert(fiu_disable(wildcard_point_name[high]) ==
+				       0);
 				enabled[high] = false;
 			} else {
-				assert(
-					fiu_enable(
-						wildcard_point_name[high],
-						1, NULL, 0) == 0);
+				assert(fiu_enable(wildcard_point_name[high], 1,
+				                  NULL, 0) == 0);
 				enabled[high] = true;
 			}
 			pthread_rwlock_unlock(&enabled_lock);
@@ -177,8 +175,8 @@ int main(void)
 		make_wildcard_point_name(wildcard_point_name[high], high);
 
 		for (low = 0; low < NLOW; low++) {
-			make_final_point_name(final_point_name[high][low],
-					high, low);
+			make_final_point_name(final_point_name[high][low], high,
+			                      low);
 		}
 	}
 
@@ -201,11 +199,8 @@ int main(void)
 	pthread_rwlock_destroy(&enabled_lock);
 
 	printf("wildcard nc: %-8llu  c: %-8llu  e: %-8llu  t: %llu\n",
-			no_check_caller_count, checking_caller_count,
-			enabler_count,
-			no_check_caller_count + checking_caller_count
-				+ enabler_count);
+	       no_check_caller_count, checking_caller_count, enabler_count,
+	       no_check_caller_count + checking_caller_count + enabler_count);
 
 	return 0;
 }
-
diff --git a/tests/test-parallel.c b/tests/test-parallel.c
index 59cb315..a0e3c8b 100644
--- a/tests/test-parallel.c
+++ b/tests/test-parallel.c
@@ -4,15 +4,15 @@
  *
  * Please note this is a non-deterministic test. */
 
+#include <assert.h>
+#include <pthread.h>
+#include <stdbool.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include <stdbool.h>
 #include <unistd.h>
-#include <pthread.h>
-#include <assert.h>
 
-#include <fiu.h>
 #include <fiu-control.h>
+#include <fiu.h>
 
 #define NPOINTS 10000
 
@@ -51,7 +51,8 @@ void *no_check_caller(void *unused)
 	return NULL;
 }
 
-bool rand_bool(void) {
+bool rand_bool(void)
+{
 	return (rand() % 2) == 0;
 }
 
@@ -59,7 +60,6 @@ bool rand_bool(void) {
 bool enabled[NPOINTS];
 pthread_rwlock_t enabled_lock;
 
-
 /* Calls all the *enabled* points all the time. */
 unsigned long long checking_caller_count = 0;
 void *checking_caller(void *unused)
@@ -105,8 +105,8 @@ void *enabler(void *unused)
 				assert(fiu_disable(point_name[i]) == 0);
 				enabled[i] = false;
 			} else {
-				assert(fiu_enable(point_name[i], 1, NULL, 0)
-						== 0);
+				assert(fiu_enable(point_name[i], 1, NULL, 0) ==
+				       0);
 				enabled[i] = true;
 			}
 			pthread_rwlock_unlock(&enabled_lock);
@@ -166,11 +166,8 @@ int main(void)
 	pthread_rwlock_destroy(&enabled_lock);
 
 	printf("parallel nc: %-8llu  c: %-8llu  e: %-8llu  t: %llu\n",
-			no_check_caller_count, checking_caller_count,
-			enabler_count,
-			no_check_caller_count + checking_caller_count
-				+ enabler_count);
+	       no_check_caller_count, checking_caller_count, enabler_count,
+	       no_check_caller_count + checking_caller_count + enabler_count);
 
 	return 0;
 }
-
diff --git a/tests/test-set_prng_seed-env.py b/tests/test-set_prng_seed-env.py
index 78d4412..be8df8a 100644
--- a/tests/test-set_prng_seed-env.py
+++ b/tests/test-set_prng_seed-env.py
@@ -5,13 +5,14 @@ environment.
 
 # Set the environment variable _before_ initializing the library.
 import os
+
 os.environ["FIU_PRNG_SEED"] = "1234"
 
 import fiu
 
-fiu.enable_random('p1', probability = 0.5)
-result = { True: 0, False: 0 }
+fiu.enable_random("p1", probability=0.5)
+result = {True: 0, False: 0}
 for i in range(1000):
-    result[fiu.fail('p1')] += 1
+    result[fiu.fail("p1")] += 1
 
 assert result == {False: 516, True: 484}, result
diff --git a/tests/test-set_prng_seed.py b/tests/test-set_prng_seed.py
index f1f3f5c..b605637 100644
--- a/tests/test-set_prng_seed.py
+++ b/tests/test-set_prng_seed.py
@@ -6,18 +6,18 @@ import fiu
 
 
 fiu.set_prng_seed(1234)
-fiu.enable_random('p1', probability = 0.5)
-result = { True: 0, False: 0 }
+fiu.enable_random("p1", probability=0.5)
+result = {True: 0, False: 0}
 for i in range(1000):
-    result[fiu.fail('p1')] += 1
+    result[fiu.fail("p1")] += 1
 
 assert result == {False: 516, True: 484}, result
 
 
 fiu.set_prng_seed(4321)
-fiu.enable_random('p1', probability = 0.5)
-result = { True: 0, False: 0 }
+fiu.enable_random("p1", probability=0.5)
+result = {True: 0, False: 0}
 for i in range(1000):
-    result[fiu.fail('p1')] += 1
+    result[fiu.fail("p1")] += 1
 
 assert result == {False: 495, True: 505}, result
diff --git a/tests/test-wildcards.py b/tests/test-wildcards.py
index abfcd7d..46861a7 100644
--- a/tests/test-wildcards.py
+++ b/tests/test-wildcards.py
@@ -36,7 +36,7 @@ for i in range(200):
 
 s = "x"
 for i in range(200):
-    assert fiu.fail(s + '/asdf')
+    assert fiu.fail(s + "/asdf")
     fiu.disable(s + "/*")
     s += "/x"
 
diff --git a/tests/utils/test-basic_run.sh b/tests/utils/test-basic_run.sh
index 4d2ba60..75e3075 100755
--- a/tests/utils/test-basic_run.sh
+++ b/tests/utils/test-basic_run.sh
@@ -12,6 +12,10 @@ set -ex
 ./wrap fiu-run -c "enable name=p1" true
 
 # open() failure.
-! ./wrap fiu-run -x -c "enable name=posix/io/oc/open" cat /dev/null
+( ! ./wrap fiu-run -x -c "enable name=posix/io/oc/open" cat /dev/null )
 
+# Deprecated option: -e.
+( ! ./wrap fiu-run -x -e "posix/io/oc/open" cat /dev/null )
 
+# Deprecated option: -p.
+( ! ./wrap fiu-run -x -e "posix/io/oc/open" -p 1 cat /dev/null )
diff --git a/tests/wrap-python b/tests/wrap-python
index 3ae833d..107123a 100755
--- a/tests/wrap-python
+++ b/tests/wrap-python
@@ -38,16 +38,15 @@ os.environ["LD_LIBRARY_PATH"] = ":".join([lib_path, \
 # Find out the corresponding module path for the desired python version. The
 # path must be absolute
 mod_bins = glob.glob(os.path.dirname(sys.argv[0]) +
-			"/../bindings/python/build/lib*-%s.*/fiu.py" \
-				% py_ver)
+            "/../bindings/python/build/lib*/fiu.py")
 if not mod_bins:
 	sys.stderr.write(("Can't find python%s bindings, run " +
 				"make python%s\n") % (py_ver, py_ver))
 	sys.exit(1)
 
 if len(mod_bins) > 1:
-	sys.stderr.write("Found too many matching python%s bindings" \
-				% py_ver)
+	sys.stderr.write("Found too many matching python bindings")
+	sys.stderr.write("Run this and try again: make clean; make python3")
 	sys.exit(1)
 
 mod_path = os.path.dirname(os.path.abspath(mod_bins[0]))
