]> git.ipfire.org Git - thirdparty/libvirt.git/commit
tests: Add virfilewrapper -- the new super "mock"
authorMartin Kletzander <mkletzan@redhat.com>
Mon, 3 Apr 2017 12:29:45 +0000 (14:29 +0200)
committerMartin Kletzander <mkletzan@redhat.com>
Tue, 9 May 2017 11:12:40 +0000 (13:12 +0200)
commitae60ea48bc57e9a41b954e0d18886a95c366d521
treeb2473ce2a61758a4811c58087fa31ac685961d59
parent8fc72e1c72a930fb8e9fa11f18d8c38ec9b31a31
tests: Add virfilewrapper -- the new super "mock"

This mock (which is actually not mock at all, see later) can redirect
all accesses to a path into another path.  There is no need to
create mocks for particular directories, you just create a directory
with all the data a redirect the test there.

In the future, this should also be able to register callbacks for
calls/paths, e.g. when the test is going to write into anything under
"/sys/devices", call function fce();  Then in the open() call we would
add information about the fd into some structure and in write() we
would call fce() with parameters like @path to write to, @data to
be written and pointer to optional return value, so that fce() itself
could stop the call from happening or change its behaviour.  But
that's an idea for a latter day.

This is not a mock because it will not be preloaded, but compiled in
the test itself.  See future patches for usage.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
cfg.mk
tests/Makefile.am
tests/virfilewrapper.c [new file with mode: 0644]
tests/virfilewrapper.h [new file with mode: 0644]