On Thu, May 12, 2016 at 14:33:19 +0200, Michal Privoznik wrote:
On 11.05.2016 16:50, Peter Krempa wrote:
On Tue, May 10, 2016 at 17:24:12 +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@redhat.com> --- cfg.mk | 2 +- tests/Makefile.am | 13 +++- tests/testutils.c | 9 +++ tests/testutils.h | 10 +-- tests/vircgroupmock.c | 6 +- tests/virpcimock.c | 6 +- tests/virtestmock.c | 180 ++++++++++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 215 insertions(+), 11 deletions(-) create mode 100644 tests/virtestmock.c
[...]
I'll have to look whether this is really necessary.
diff --git a/tests/vircgroupmock.c b/tests/vircgroupmock.c index cfc51e8..395254b 100644 --- a/tests/vircgroupmock.c +++ b/tests/vircgroupmock.c @@ -416,8 +416,10 @@ static void init_syms(void)
LOAD_SYM(fopen); LOAD_SYM(access); - LOAD_SYM_ALT(lstat, __lxstat); - LOAD_SYM_ALT(stat, __xstat); + LOAD_SYM(lstat); + LOAD_SYM(__lxstat); + LOAD_SYM(stat); + LOAD_SYM(__xstat); LOAD_SYM(mkdir); LOAD_SYM(open); }
LOAD_SYM_ALT is unused after this. Additionally this could be aggregated into a single header so that every mock library doesn't have to reimplement these helpers.
Yes I meant in a separate patch. All the tests using mocking reimplement those.
Oh, you mean that LOAD_SYM macro should go somewhere into a header file? Well I can do that, but I'd rather do that in a separate patch, since that would be touching more files than there are in this patch. Morevoer, we have to think twice where to put it because as I was testing this approach, I've encountered the following deadlock:
I would opt for a totally separate header file just for the mocking helper code.a Peter