mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-07-11 04:15:49 +00:00
Allow the iohelper path to be customized by test programs
Currently the fdstream function hardcodes the location of the iohelper to LIBEXECDIR "/libvirt_iohelper". This is not convenient when trying to write test cases which use this code. Add a virFDStreamSetIOHelper method to allow the test cases to point to the location of the un-installed iohelper binary. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
parent
69c6a58a1d
commit
8ab7d8ee40
@ -74,6 +74,18 @@ struct virFDStreamData {
|
|||||||
virMutex lock;
|
virMutex lock;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
static const char *iohelper_path = LIBEXECDIR "/libvirt_iohelper";
|
||||||
|
|
||||||
|
void virFDStreamSetIOHelper(const char *path)
|
||||||
|
{
|
||||||
|
if (path == NULL)
|
||||||
|
iohelper_path = LIBEXECDIR "/libvirt_iohelper";
|
||||||
|
else
|
||||||
|
iohelper_path = path;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static int virFDStreamRemoveCallback(virStreamPtr stream)
|
static int virFDStreamRemoveCallback(virStreamPtr stream)
|
||||||
{
|
{
|
||||||
struct virFDStreamData *fdst = stream->privateData;
|
struct virFDStreamData *fdst = stream->privateData;
|
||||||
@ -634,7 +646,7 @@ virFDStreamOpenFileInternal(virStreamPtr st,
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd = virCommandNewArgList(LIBEXECDIR "/libvirt_iohelper",
|
cmd = virCommandNewArgList(iohelper_path,
|
||||||
path,
|
path,
|
||||||
NULL);
|
NULL);
|
||||||
virCommandAddArgFormat(cmd, "%llu", length);
|
virCommandAddArgFormat(cmd, "%llu", length);
|
||||||
|
@ -33,6 +33,9 @@ typedef void (*virFDStreamInternalCloseCb)(virStreamPtr st, void *opaque);
|
|||||||
typedef void (*virFDStreamInternalCloseCbFreeOpaque)(void *opaque);
|
typedef void (*virFDStreamInternalCloseCbFreeOpaque)(void *opaque);
|
||||||
|
|
||||||
|
|
||||||
|
/* Only for use by test suite */
|
||||||
|
void virFDStreamSetIOHelper(const char *path);
|
||||||
|
|
||||||
int virFDStreamOpen(virStreamPtr st,
|
int virFDStreamOpen(virStreamPtr st,
|
||||||
int fd);
|
int fd);
|
||||||
|
|
||||||
|
@ -699,6 +699,7 @@ virFDStreamConnectUNIX;
|
|||||||
virFDStreamCreateFile;
|
virFDStreamCreateFile;
|
||||||
virFDStreamOpen;
|
virFDStreamOpen;
|
||||||
virFDStreamOpenFile;
|
virFDStreamOpenFile;
|
||||||
|
virFDStreamSetIOHelper;
|
||||||
|
|
||||||
|
|
||||||
# libvirt_internal.h
|
# libvirt_internal.h
|
||||||
|
Loading…
Reference in New Issue
Block a user