All of lore.kernel.org
 help / color / mirror / Atom feed
From: John Fastabend <john.fastabend@gmail.com>
To: Martin Lau <kafai@fb.com>, Lorenz Bauer <lmb@cloudflare.com>,
	John Fastabend <john.fastabend@gmail.com>
Cc: Shuah Khan <shuah@kernel.org>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Song Liu <songliubraving@fb.com>, Yonghong Song <yhs@fb.com>,
	Andrii Nakryiko <andriin@fb.com>,
	"linux-kselftest@vger.kernel.org"
	<linux-kselftest@vger.kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"bpf@vger.kernel.org" <bpf@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH bpf 1/4] selftests: bpf: use a temporary file in test_sockmap
Date: Fri, 24 Jan 2020 11:50:54 -0800	[thread overview]
Message-ID: <5e2b4a9e2028_551b2aaf5fbda5b8e1@john-XPS-13-9370.notmuch> (raw)
In-Reply-To: <20200123183427.wsmwuheq3wcw3usm@kafai-mbp.dhcp.thefacebook.com>

Martin Lau wrote:
> On Thu, Jan 23, 2020 at 04:59:30PM +0000, Lorenz Bauer wrote:
> > Use a proper temporary file for sendpage tests. This means that running
> > the tests doesn't clutter the working directory, and allows running the
> > test on read-only filesystems.
> > 
> > Signed-off-by: Lorenz Bauer <lmb@cloudflare.com>
> > ---
> >  tools/testing/selftests/bpf/test_sockmap.c | 15 +++++----------
> >  1 file changed, 5 insertions(+), 10 deletions(-)
> > 
> > diff --git a/tools/testing/selftests/bpf/test_sockmap.c b/tools/testing/selftests/bpf/test_sockmap.c
> > index 4a851513c842..779e11da979c 100644
> > --- a/tools/testing/selftests/bpf/test_sockmap.c
> > +++ b/tools/testing/selftests/bpf/test_sockmap.c
> > @@ -331,7 +331,7 @@ static int msg_loop_sendpage(int fd, int iov_length, int cnt,
> >  	FILE *file;
> >  	int i, fp;
> >  
> > -	file = fopen(".sendpage_tst.tmp", "w+");
> > +	file = tmpfile();
> >  	if (!file) {
> >  		perror("create file for sendpage");
> >  		return 1;
> > @@ -340,13 +340,8 @@ static int msg_loop_sendpage(int fd, int iov_length, int cnt,
> >  		fwrite(&k, sizeof(char), 1, file);
> >  	fflush(file);
> >  	fseek(file, 0, SEEK_SET);
> > -	fclose(file);
> >  
> > -	fp = open(".sendpage_tst.tmp", O_RDONLY);
> > -	if (fp < 0) {
> > -		perror("reopen file for sendpage");
> > -		return 1;
> > -	}
> > +	fp = fileno(file);
> It may be better to keep fp == -1 check here.
> It is not clear to me the original intention of reopen.
> I would defer to John for comment.
> 

Seeing fileno shouldn't fail seems OK to me.

> >  
> >  	clock_gettime(CLOCK_MONOTONIC, &s->start);
> >  	for (i = 0; i < cnt; i++) {




  reply	other threads:[~2020-01-24 19:51 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-23 16:59 [PATCH bpf 0/4] Various fixes for sockmap and reuseport tests Lorenz Bauer
2020-01-23 16:59 ` [PATCH bpf 1/4] selftests: bpf: use a temporary file in test_sockmap Lorenz Bauer
2020-01-23 18:34   ` Martin Lau
2020-01-24 19:50     ` John Fastabend [this message]
2020-01-24  9:20   ` Jakub Sitnicki
2020-01-24 19:43   ` John Fastabend
2020-01-23 16:59 ` [PATCH bpf 2/4] selftests: bpf: ignore RST packets for reuseport tests Lorenz Bauer
2020-01-23 17:16   ` Martin Lau
2020-01-23 17:18     ` Lorenz Bauer
2020-01-23 21:53   ` Martin Lau
2020-01-24  9:00     ` Lorenz Bauer
2020-01-24  9:32       ` Daniel Borkmann
2020-01-24 19:45   ` John Fastabend
2020-01-23 16:59 ` [PATCH bpf 3/4] selftests: bpf: make reuseport test output more legible Lorenz Bauer
2020-01-23 17:26   ` Martin Lau
2020-01-24 19:46   ` John Fastabend
2020-01-23 16:59 ` [PATCH bpf 4/4] selftests: bpf: reset global state between reuseport test runs Lorenz Bauer
2020-01-23 17:56   ` Martin Lau
2020-01-24 11:27 ` [PATCH bpf-next v2 0/4] Various fixes for sockmap and reuseport tests Lorenz Bauer
2020-01-24 11:27   ` [PATCH bpf-next v2 1/4] selftests: bpf: use a temporary file in test_sockmap Lorenz Bauer
2020-01-24 11:27   ` [PATCH bpf-next v2 2/4] selftests: bpf: ignore FIN packets for reuseport tests Lorenz Bauer
2020-01-24 11:27   ` [PATCH bpf-next v2 3/4] selftests: bpf: make reuseport test output more legible Lorenz Bauer
2020-01-24 11:27   ` [PATCH bpf-next v2 4/4] selftests: bpf: reset global state between reuseport test runs Lorenz Bauer
2020-01-24 12:45   ` [PATCH bpf-next v2 0/4] Various fixes for sockmap and reuseport tests Jakub Sitnicki
2020-01-24 15:45   ` Martin Lau
2020-01-24 21:14     ` Daniel Borkmann

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=5e2b4a9e2028_551b2aaf5fbda5b8e1@john-XPS-13-9370.notmuch \
    --to=john.fastabend@gmail.com \
    --cc=andriin@fb.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=kafai@fb.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=lmb@cloudflare.com \
    --cc=netdev@vger.kernel.org \
    --cc=shuah@kernel.org \
    --cc=songliubraving@fb.com \
    --cc=yhs@fb.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.