qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v3 5/5] tests/unit: make test-io-channel-command work on win3


From: Marc-André Lureau
Subject: Re: [PATCH v3 5/5] tests/unit: make test-io-channel-command work on win32
Date: Thu, 6 Oct 2022 15:26:31 +0400

Hi

On Thu, Oct 6, 2022 at 2:14 PM Daniel P. Berrangé <berrange@redhat.com> wrote:
On Thu, Oct 06, 2022 at 12:46:17PM +0400, Marc-André Lureau wrote:
> Hi
>
> On Thu, Oct 6, 2022 at 12:42 PM Daniel P. Berrangé <berrange@redhat.com> wrote:
> >
> > On Thu, Oct 06, 2022 at 12:12:22PM +0400, marcandre.lureau@redhat.com wrote:
> > > From: Marc-André Lureau <marcandre.lureau@redhat.com>
> > >
> > > This has been tested under msys2 & windows 11. I haven't tried to make
> > > it work with other environments yet, but that should be enough to
> > > validate the channel-command implementation anyway.
> > >
> > > Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> > > ---
> > >  tests/unit/test-io-channel-command.c | 32 ++++++++++++----------------
> > >  tests/unit/meson.build               |  2 +-
> > >  2 files changed, 15 insertions(+), 19 deletions(-)
> > >
> > > diff --git a/tests/unit/test-io-channel-command.c b/tests/unit/test-io-channel-command.c
> > > index aa09c559cd..be98c3452a 100644
> > > --- a/tests/unit/test-io-channel-command.c
> > > +++ b/tests/unit/test-io-channel-command.c
> > > @@ -24,29 +24,27 @@
> > >  #include "qapi/error.h"
> > >  #include "qemu/module.h"
> > >
> > > -#ifndef WIN32
> > > +#define TEST_PATH "test-io-channel-command.fifo"
> > > +
> > > +#define SOCAT_SRC "PIPE:" TEST_PATH ",wronly"
> > > +#define SOCAT_DST "PIPE:" TEST_PATH ",rdonly"
> > > +
> > >  static void test_io_channel_command_fifo(bool async)
> > >  {
> > > -#define TEST_FIFO "tests/test-io-channel-command.fifo"
> > >      QIOChannel *src, *dst;
> > >      QIOChannelTest *test;
> > > -    const char *srcfifo = "PIPE:" TEST_FIFO ",wronly";
> > > -    const char *dstfifo = "PIPE:" TEST_FIFO ",rdonly";
> > >      const char *srcargv[] = {
> > > -        "/bin/socat", "-", srcfifo, NULL,
> > > +        g_getenv("SOCAT"), "-", SOCAT_SRC, NULL,
> >
> > Please don't rely on env variables, as it complicates the ability to
> > invoke the test directly, without the meson harness. Either pass the
> > path from meson at compile time in config-host.h, or make this code
> > use an unqualified path, so it honours $PATH at runtime.
>
> I tried to pass it through config-host.h, but I dont see a way to
> escape the \ is the paths.

This must be possible, as we have lots of strings in config-host.h
that are paths - eg many CONFIG_QEMU_xxxDIR variables

Those paths, generated by meson I believe, use /-dir separators. But find_program() returns \-seperated paths.. Maybe the solution is to replace \ with / ? (hopefully the path is not quoted already...)

There is a proposal for to_quoted(): https://github.com/mesonbuild/meson/issues/10417

I found another solution, using g_find_program_in_path(). See v3.

thanks

--
Marc-André Lureau

reply via email to

[Prev in Thread] Current Thread [Next in Thread]