public inbox for [email protected]
 help / color / mirror / Atom feed
From: Pavel Begunkov <[email protected]>
To: Jens Axboe <[email protected]>, [email protected]
Subject: [PATCH liburing 1/2] tests: create new files for rw testing
Date: Thu, 19 Aug 2021 14:42:21 +0100	[thread overview]
Message-ID: <470033f83e6ee15af154fd1a464ba3118f2bf2eb.1629380408.git.asml.silence@gmail.com> (raw)
In-Reply-To: <[email protected]>

Currently rw/iopoll tests use a fixed name file, so several instances of
the same test can't run in parallel. Use unique names instead.

Signed-off-by: Pavel Begunkov <[email protected]>
---
 test/iopoll.c     | 6 +++++-
 test/read-write.c | 6 +++++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/test/iopoll.c b/test/iopoll.c
index 3d94dfe..1adee7f 100644
--- a/test/iopoll.c
+++ b/test/iopoll.c
@@ -325,6 +325,7 @@ static int probe_buf_select(void)
 int main(int argc, char *argv[])
 {
 	int i, ret, nr;
+	char buf[256];
 	char *fname;
 
 	if (probe_buf_select())
@@ -333,7 +334,10 @@ int main(int argc, char *argv[])
 	if (argc > 1) {
 		fname = argv[1];
 	} else {
-		fname = ".iopoll-rw";
+		srand((unsigned)time(NULL));
+		snprintf(buf, sizeof(buf), ".basic-rw-%u-%u",
+			(unsigned)rand(), (unsigned)getpid());
+		fname = buf;
 		t_create_file(fname, FILE_SIZE);
 	}
 
diff --git a/test/read-write.c b/test/read-write.c
index d0a77fa..b0a2bde 100644
--- a/test/read-write.c
+++ b/test/read-write.c
@@ -746,12 +746,16 @@ err:
 int main(int argc, char *argv[])
 {
 	int i, ret, nr;
+	char buf[256];
 	char *fname;
 
 	if (argc > 1) {
 		fname = argv[1];
 	} else {
-		fname = ".basic-rw";
+		srand((unsigned)time(NULL));
+		snprintf(buf, sizeof(buf), ".basic-rw-%u-%u",
+			(unsigned)rand(), (unsigned)getpid());
+		fname = buf;
 		t_create_file(fname, FILE_SIZE);
 	}
 
-- 
2.32.0


  reply	other threads:[~2021-08-19 13:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-19 13:42 [PATCH liburing 0/2] rw tests improvements Pavel Begunkov
2021-08-19 13:42 ` Pavel Begunkov [this message]
2021-08-19 13:42 ` [PATCH liburing 2/2] tests: rename iopoll test variables Pavel Begunkov
2021-08-19 14:48 ` [PATCH liburing 0/2] rw tests improvements Jens Axboe

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=470033f83e6ee15af154fd1a464ba3118f2bf2eb.1629380408.git.asml.silence@gmail.com \
    [email protected] \
    [email protected] \
    [email protected] \
    /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