From: Cyril Hrubis <chrubis@suse.cz>
To: Petr Vorel <pvorel@suse.cz>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH 2/2] syscalls: Add test for splicing to /dev/zero and /dev/null
Date: Thu, 11 Apr 2024 12:36:11 +0200 [thread overview]
Message-ID: <Zhe9G-gWk6MA2Az8@yuki> (raw)
In-Reply-To: <20240321093350.GB548078@pevik>
Hi!
> > +#define _GNU_SOURCE
> > +#include "tst_test.h"
> > +
> > +static const char *test_devices[] = {
> checkpatch.pl suggests:
> static const char * const test_devices[] = {
Will fix and push.
> > + "/dev/null",
> > + "/dev/zero",
> > +};
> > +
> > +static void verify_splice(unsigned int n)
> > +{
> > + char buf[1024];
> > + char dev_fd;
> > + int pipefd[2];
> > +
> > + memset(buf, 0xff, sizeof(buf));
> > +
> > + tst_res(TINFO, "Testing %s", test_devices[n]);
> > +
> > + dev_fd = SAFE_OPEN(test_devices[n], O_WRONLY);
> > +
> > + SAFE_PIPE(pipefd);
> > + SAFE_WRITE(1, pipefd[1], buf, sizeof(buf));
> I wonder if write() fails, we don't get SAFE_CLOSE() calls, right?
We do not care here since these are just pipes, the test will fail with
TBROK and kernel will destroy the pipes once the process exits.
We have to close real files in test temporary directory, because if we
do not do so, tst_rmdir() may fail on nfs. E.g. if you create a file on
nfs, open it and unlink it, the directory is not empty as one would
expect and cannot be removed.
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
prev parent reply other threads:[~2024-04-11 10:37 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-20 9:59 [LTP] [PATCH 0/2] Add splice tests fro /dev/{zero,null,full} Cyril Hrubis
2024-03-20 9:59 ` [LTP] [PATCH 1/2] syscalls: Add test for splicing from /dev/zero and /dev/full Cyril Hrubis
2024-03-20 13:26 ` Jan Stancek
2024-04-11 10:43 ` Cyril Hrubis
2024-04-11 11:08 ` Jan Stancek
2024-04-11 11:50 ` Cyril Hrubis
2024-03-21 9:29 ` Petr Vorel
2024-04-11 10:42 ` Cyril Hrubis
2024-03-20 9:59 ` [LTP] [PATCH 2/2] syscalls: Add test for splicing to /dev/zero and /dev/null Cyril Hrubis
2024-03-21 9:33 ` Petr Vorel
2024-04-11 10:36 ` Cyril Hrubis [this message]
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=Zhe9G-gWk6MA2Az8@yuki \
--to=chrubis@suse.cz \
--cc=ltp@lists.linux.it \
--cc=pvorel@suse.cz \
/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