From: Christian Schoenebeck <qemu_oss@crudebyte.com>
To: qemu-devel@nongnu.org
Cc: Greg Kurz <groug@kaod.org>, Peter Maydell <peter.maydell@linaro.org>
Subject: Re: [PULL v3 3/6] tests/9pfs: introduce local tests
Date: Thu, 29 Oct 2020 19:16:40 +0100 [thread overview]
Message-ID: <2639493.ej0QF1Rjni@silver> (raw)
In-Reply-To: <20201029190234.76bb51f4@bahia.lan>
On Donnerstag, 29. Oktober 2020 19:02:34 CET Greg Kurz wrote:
> On Thu, 8 Oct 2020 20:34:56 +0200
>
> Christian Schoenebeck <qemu_oss@crudebyte.com> wrote:
> > This patch introduces 9pfs test cases using the 9pfs 'local'
> > filesystem driver which reads/writes/creates/deletes real files
> > and directories.
> >
> > In this initial version, there is only one local test which actually
> > only checks if the 9pfs 'local' device was created successfully.
> >
> > Before the 9pfs 'local' tests are run, a test directory 'qtest-9p-local'
> > is created (with world rwx permissions) under the current working
> > directory. At this point that test directory is not auto deleted yet.
> >
> > Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
> > Message-Id:
> > <81fc4b3b6b6c9bf7999e79f5e7cbc364a5f09ddb.1602182956.git.qemu_oss@crudeby
> > te.com> Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
> > ---
> >
> > tests/qtest/libqos/virtio-9p.c | 81 ++++++++++++++++++++++++++++++++++
> > tests/qtest/libqos/virtio-9p.h | 5 +++
> > tests/qtest/virtio-9p-test.c | 44 ++++++++++++------
> > 3 files changed, 116 insertions(+), 14 deletions(-)
> >
> > diff --git a/tests/qtest/libqos/virtio-9p.c
> > b/tests/qtest/libqos/virtio-9p.c index 2e300063e3..ee331166de 100644
> > --- a/tests/qtest/libqos/virtio-9p.c
> > +++ b/tests/qtest/libqos/virtio-9p.c
> > @@ -24,6 +24,34 @@
> >
> > #include "qgraph.h"
> >
> > static QGuestAllocator *alloc;
> >
> > +static char *local_test_path;
> > +
> > +/* Concatenates the passed 2 pathes. Returned result must be freed. */
> > +static char *concat_path(const char* a, const char* b)
> > +{
> > + return g_build_filename(a, b, NULL);
> > +}
> > +
> > +static void init_local_test_path(void)
> > +{
> > + char *pwd = g_get_current_dir();
> > + local_test_path = concat_path(pwd, "qtest-9p-local");
> > + g_free(pwd);
> > +}
> > +
> > +/* Creates the directory for the 9pfs 'local' filesystem driver to
> > access. */ +static void create_local_test_dir(void)
> > +{
> > + struct stat st;
> > +
> > + g_assert(local_test_path != NULL);
> > + mkdir(local_test_path, 0777);
> > +
>
> This makes coverity unhappy...
>
> *** CID 1435963: Error handling issues (CHECKED_RETURN)
> /qemu/tests/qtest/libqos/virtio-9p.c: 48 in create_local_test_dir()
> 42 /* Creates the directory for the 9pfs 'local' filesystem driver to
> access. */ 43 static void create_local_test_dir(void)
> 44 {
> 45 struct stat st;
> 46
> 47 g_assert(local_test_path != NULL);
>
> >>> CID 1435963: Error handling issues (CHECKED_RETURN)
> >>> Calling "mkdir(local_test_path, 511U)" without checking return
> >>> value. This library function may fail and return an error code.
> 48 mkdir(local_test_path, 0777);
> 49
> 50 /* ensure test directory exists now ... */
> 51 g_assert(stat(local_test_path, &st) == 0);
> 52 /* ... and is actually a directory */
> 53 g_assert((st.st_mode & S_IFMT) == S_IFDIR);
>
> > + /* ensure test directory exists now ... */
> > + g_assert(stat(local_test_path, &st) == 0);
> > + /* ... and is actually a directory */
> > + g_assert((st.st_mode & S_IFMT) == S_IFDIR);
> > +}
> >
Ok, I'll fix that with tomorrow's patch(es) as well.
Best regards,
Christian Schoenebeck
next prev parent reply other threads:[~2020-10-29 18:19 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-19 12:39 [PULL v3 0/6] 9p queue (previous 2020-10-17) Christian Schoenebeck
2020-10-08 18:34 ` [PULL v3 4/6] tests/9pfs: wipe local 9pfs test directory Christian Schoenebeck
2020-10-08 18:34 ` [PULL v3 2/6] tests/9pfs: change qtest name prefix to synth Christian Schoenebeck
2020-10-20 7:36 ` Philippe Mathieu-Daudé
2020-10-20 9:43 ` Christian Schoenebeck
2020-10-20 10:00 ` Greg Kurz
2020-10-20 11:54 ` Christian Schoenebeck
2020-10-21 6:15 ` Philippe Mathieu-Daudé
2020-10-21 10:45 ` Christian Schoenebeck
2020-10-08 18:34 ` [PULL v3 5/6] tests/9pfs: add virtio_9p_test_path() Christian Schoenebeck
2020-10-08 18:34 ` [PULL v3 6/6] tests/9pfs: add local Tmkdir test Christian Schoenebeck
2020-10-08 18:34 ` [PULL v3 3/6] tests/9pfs: introduce local tests Christian Schoenebeck
2020-10-29 18:02 ` Greg Kurz
2020-10-29 18:16 ` Christian Schoenebeck [this message]
2020-10-19 11:10 ` [PULL v3 1/6] 9pfs: suppress performance warnings on qtest runs Christian Schoenebeck
2020-10-19 15:00 ` [PULL v3 0/6] 9p queue (previous 2020-10-17) Peter Maydell
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=2639493.ej0QF1Rjni@silver \
--to=qemu_oss@crudebyte.com \
--cc=groug@kaod.org \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/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).