From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Laurent Vivier <lvivier@redhat.com>
Cc: qemu-devel@nongnu.org,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Thomas Huth" <thuth@redhat.com>,
"Jason Wang" <jasowang@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Michael S . Tsirkin" <mst@redhat.com>
Subject: Re: [PATCH] tests/qtest: netdev: test stream and dgram backends
Date: Fri, 4 Nov 2022 11:13:02 +0000 [thread overview]
Message-ID: <Y2Tzvp5Z+bSBdTBj@redhat.com> (raw)
In-Reply-To: <680deee3-ccf7-b32c-2dfe-189ab02463d4@redhat.com>
On Fri, Nov 04, 2022 at 11:58:29AM +0100, Laurent Vivier wrote:
> On 11/4/22 10:41, Daniel P. Berrangé wrote:
> ...
> > > +static void test_stream_unix(void)
> > > +{
> > > + QTestState *qts0, *qts1;
> > > + char *expect;
> > > + gchar *path;
> > > + int ret;
> > > +
> > > + ret = g_file_open_tmp("netdev-XXXXXX", &path, NULL);
> > > + g_assert_true(ret >= 0);
> > > + close(ret);
> >
> > This is creating a zero length plain file, and then paassing
> > that as a path for the UNIX socket.
> >
> > This is pretty dubious and only works because the code will
> > be doing 'unlink' on the path. Just delete this as there's
> > no reason to pre-create anything on disk for UNIX sockets.
> >
>
> The idea here is to generate a path for the socket and to be sure this path
> is actually not already in use.
Create a temporary directory, and let it create a socket inside
that dir ?
> The same for the abstract one, how to be sure we are not running the same
> test concurrently and select a different unix name?
I guess creating the temp file gives you an indirect guarantee, because
we know the tempfile path will be transformed to an abstract socket path
by twiddling byte 0 to NUL.
With 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 :|
next prev parent reply other threads:[~2022-11-04 11:14 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-04 9:22 [PATCH] tests/qtest: netdev: test stream and dgram backends Laurent Vivier
2022-11-04 9:41 ` Daniel P. Berrangé
2022-11-04 10:58 ` Laurent Vivier
2022-11-04 11:13 ` Daniel P. Berrangé [this message]
2022-11-04 12:15 ` Michael S. Tsirkin
2022-11-04 13:24 ` Laurent Vivier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y2Tzvp5Z+bSBdTBj@redhat.com \
--to=berrange@redhat.com \
--cc=jasowang@redhat.com \
--cc=lvivier@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).