[libvirt] [PATCH v5 15/20] tests: Extend command test to transfer large data to process on multiple fds
Daniel P. Berrangé
berrange at redhat.com
Thu Jul 25 09:51:19 UTC 2019
On Fri, Jul 12, 2019 at 12:23:49PM -0400, Stefan Berger wrote:
> Add a test case to commandtest.c to test the transfer of data to a
> process who received the read-end of pipes' file descriptors. Transfer
> large (128 kb) byte streams.
>
> Extend the commandhelper.c with support for --readfd <fd> command line
> parameter and convert the data receive loop to use poll and receive data
> on multiple file descriptors (up to 3) and read data into distinct buffers
> that we grow while adding more (string) data.
>
> Signed-off-by: Stefan Berger <stefanb at linux.ibm.com>
> ---
> tests/commandhelper.c | 70 +++++++++++++++++++++++---
> tests/commandtest.c | 113 ++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 177 insertions(+), 6 deletions(-)
Reviewed-by: Daniel P. Berrangé <berrange at redhat.com>
> @@ -62,13 +63,27 @@ int main(int argc, char **argv) {
> char *cwd;
> FILE *log = fopen(abs_builddir "/commandhelper.log", "w");
> int ret = EXIT_FAILURE;
> + int readfds[3] = { STDIN_FILENO, };
> + int numreadfds = 1;
> + struct pollfd fds[3];
> + int numpollfds = 0;
s/int/size_t/ for array sizes
> + char *buffers[3] = {NULL, NULL, NULL};
> + size_t buflen[3] = {0, 0, 0};
> + char c;
Reviewed-by: Daniel P. Berrangé <berrange at redhat.com>
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
More information about the libvir-list
mailing list