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>
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)
{
struct virFDStreamData *fdst = stream->privateData;
goto error;
}
- cmd = virCommandNewArgList(LIBEXECDIR "/libvirt_iohelper",
+ cmd = virCommandNewArgList(iohelper_path,
path,
NULL);
virCommandAddArgFormat(cmd, "%llu", length);
typedef void (*virFDStreamInternalCloseCbFreeOpaque)(void *opaque);
+/* Only for use by test suite */
+void virFDStreamSetIOHelper(const char *path);
+
int virFDStreamOpen(virStreamPtr st,
int fd);
virFDStreamCreateFile;
virFDStreamOpen;
virFDStreamOpenFile;
+virFDStreamSetIOHelper;
# libvirt_internal.h