mirror of
https://github.com/wolfcw/libfaketime.git
synced 2026-05-17 00:26:16 +03:00
We want to make it easier to test a bunch of different functions that might be invoked in constructors of other libraries. It seems conceivable that with these snippets, we could design other tests that also work across a wide range of intercepted functions.
33 lines
1.2 KiB
Plaintext
33 lines
1.2 KiB
Plaintext
Bulk testing of function interception
|
|
=====================================
|
|
|
|
Faketime intercepts some C library functions. We want to make it
|
|
easier to apply certain generic tests across many different functions.
|
|
|
|
Including a new function
|
|
------------------------
|
|
|
|
To test a function FOO, supply a C snippet in this directory named
|
|
<FOO.c>. This should be a small bit of code that exercises the
|
|
function FOO. It should be self-contained, and it should produce some
|
|
kind of description of what happened to stdout. Take a look at
|
|
getpid.c for a simple example.
|
|
|
|
The data sent to stdout should include the const char* "where" value
|
|
(which is an indication of which test framework is using the snippet).
|
|
And it should ideally be stable when the associated variable
|
|
(e.g. FAKETIME, FAKETIME_FAKEPID, or FAKERANDOM_SEED) is set, and
|
|
likely to vary otherwise, especially across a delay of a second or
|
|
more.
|
|
|
|
If the snippet needs to additional #include headers, please add them
|
|
in include_headers.h. These #includes will be used by every snippet,
|
|
so try to keep it minimal.
|
|
|
|
Testing across functions
|
|
------------------------
|
|
|
|
If you want to test something systemically, autogenerate code that
|
|
uses each snippet. See test_library_constructors in ../Makefile for
|
|
an example.
|