[libvirt] [PATCH v3 2/4] tests: Introduce global mock library
Michal Privoznik
mprivozn at redhat.com
Fri May 13 12:21:46 UTC 2016
On 13.05.2016 09:01, Peter Krempa wrote:
> On Thu, May 12, 2016 at 17:44:46 +0200, Michal Privoznik wrote:
>> On 12.05.2016 17:30, Michal Privoznik wrote:
>>> On 12.05.2016 16:34, Peter Krempa wrote:
>>>> On Thu, May 12, 2016 at 14:36:22 +0200, Michal Privoznik wrote:
>>>>> The intent is that this library is going to be called every time
>>>>> to check if we are not touching anything outside srcdir or
>>>>> builddir.
>>>>>
>>>>> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
>>>>> ---
>>>>> cfg.mk | 2 +-
>>>>> tests/Makefile.am | 13 +++-
>>>>> tests/testutils.c | 9 +++
>>>>> tests/testutils.h | 10 +--
>>>>> tests/vircgroupmock.c | 15 ++---
>>>>> tests/virpcimock.c | 14 ++--
>>>>> tests/virtestmock.c | 175 ++++++++++++++++++++++++++++++++++++++++++++++++++
>>>>> 7 files changed, 210 insertions(+), 28 deletions(-)
>>>>> create mode 100644 tests/virtestmock.c
>>>>>
>>>>
>>>> [...]
>>>>
>>>>> diff --git a/tests/testutils.c b/tests/testutils.c
>>>>> index 79d0763..595b64d 100644
>>>>> --- a/tests/testutils.c
>>>>> +++ b/tests/testutils.c
>>>>
>>>> [...]
>>>>
>>>>> @@ -842,6 +845,12 @@ int virtTestMain(int argc,
>>>>> char *oomstr;
>>>>> #endif
>>>>>
>>>>> +#ifdef __linux__
>
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
>>>>> + VIRT_TEST_PRELOAD(TEST_MOCK);
>
> [...]
>
>> I just realized, it's not going to be that easy. Problem is, my mock
>> lib, implements both lstat and __lxstat, and stat and __xstat. Now, due
>> to changes made to other mocks (i.e. virpcimock and vircgroupmock),
>> without my library linked tests using the other mocks will just crash as
>> soon as they try to stat(). So what I can do, is to suppress any output
>
> So basically all tests calling stat which use the mocked libaries are
> going to crash on non-linux platforms? That's a no-go then which needs
> to be addressed. After that's done it shouldn't be a problem to do it as
> you've said in the previous reply.
Let me respin with an alternative approach then.
Michal
More information about the libvir-list
mailing list