mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
tests: Allow multiple mock libraries
Make virtTestMain take variable number of libraries to mock.
This commit is contained in:
committed by
John Ferlan
parent
97868a2b85
commit
f0469c61e3
@@ -24,6 +24,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
@@ -842,9 +843,11 @@ virTestSetEnvPath(void)
|
||||
|
||||
int virtTestMain(int argc,
|
||||
char **argv,
|
||||
const char *lib,
|
||||
int (*func)(void))
|
||||
int (*func)(void),
|
||||
...)
|
||||
{
|
||||
const char *lib;
|
||||
va_list ap;
|
||||
int ret;
|
||||
char *testRange = NULL;
|
||||
#ifdef TEST_OOM
|
||||
@@ -854,8 +857,10 @@ int virtTestMain(int argc,
|
||||
if (getenv("VIR_TEST_FILE_ACCESS"))
|
||||
VIRT_TEST_PRELOAD(TEST_MOCK);
|
||||
|
||||
if (lib)
|
||||
va_start(ap, func);
|
||||
while ((lib = va_arg(ap, const char *)))
|
||||
VIRT_TEST_PRELOAD(lib);
|
||||
va_end(ap);
|
||||
|
||||
progname = last_component(argv[0]);
|
||||
if (STRPREFIX(progname, "lt-"))
|
||||
|
||||
Reference in New Issue
Block a user