public inbox for [email protected]
 help / color / mirror / Atom feed
* [PATCH liburing 0/2] rw tests improvements
@ 2021-08-19 13:42 Pavel Begunkov
  2021-08-19 13:42 ` [PATCH liburing 1/2] tests: create new files for rw testing Pavel Begunkov
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Pavel Begunkov @ 2021-08-19 13:42 UTC (permalink / raw)
  To: Jens Axboe, io-uring

Two small patches for read-write.c and iopoll.c tests.

Pavel Begunkov (2):
  tests: create new files for rw testing
  tests: rename iopoll test variables

 test/iopoll.c     | 20 ++++++++++++--------
 test/read-write.c |  6 +++++-
 2 files changed, 17 insertions(+), 9 deletions(-)

-- 
2.32.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH liburing 1/2] tests: create new files for rw testing
  2021-08-19 13:42 [PATCH liburing 0/2] rw tests improvements Pavel Begunkov
@ 2021-08-19 13:42 ` Pavel Begunkov
  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
  2 siblings, 0 replies; 4+ messages in thread
From: Pavel Begunkov @ 2021-08-19 13:42 UTC (permalink / raw)
  To: Jens Axboe, io-uring

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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH liburing 2/2] tests: rename iopoll test variables
  2021-08-19 13:42 [PATCH liburing 0/2] rw tests improvements Pavel Begunkov
  2021-08-19 13:42 ` [PATCH liburing 1/2] tests: create new files for rw testing Pavel Begunkov
@ 2021-08-19 13:42 ` Pavel Begunkov
  2021-08-19 14:48 ` [PATCH liburing 0/2] rw tests improvements Jens Axboe
  2 siblings, 0 replies; 4+ messages in thread
From: Pavel Begunkov @ 2021-08-19 13:42 UTC (permalink / raw)
  To: Jens Axboe, io-uring

Rename v1-v4 variables into something more descriptive, makes debugging
easier.

Signed-off-by: Pavel Begunkov <[email protected]>
---
 test/iopoll.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/test/iopoll.c b/test/iopoll.c
index 1adee7f..b450618 100644
--- a/test/iopoll.c
+++ b/test/iopoll.c
@@ -347,15 +347,15 @@ int main(int argc, char *argv[])
 	if (no_buf_select)
 		nr = 8;
 	for (i = 0; i < nr; i++) {
-		int v1, v2, v3, v4;
+		int write = (i & 1) != 0;
+		int sqthread = (i & 2) != 0;
+		int fixed = (i & 4) != 0;
+		int buf_select = (i & 8) != 0;
 
-		v1 = (i & 1) != 0;
-		v2 = (i & 2) != 0;
-		v3 = (i & 4) != 0;
-		v4 = (i & 8) != 0;
-		ret = test_io(fname, v1, v2, v3, v4);
+		ret = test_io(fname, write, sqthread, fixed, buf_select);
 		if (ret) {
-			fprintf(stderr, "test_io failed %d/%d/%d/%d\n", v1, v2, v3, v4);
+			fprintf(stderr, "test_io failed %d/%d/%d/%d\n",
+				write, sqthread, fixed, buf_select);
 			goto err;
 		}
 		if (no_iopoll)
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH liburing 0/2] rw tests improvements
  2021-08-19 13:42 [PATCH liburing 0/2] rw tests improvements Pavel Begunkov
  2021-08-19 13:42 ` [PATCH liburing 1/2] tests: create new files for rw testing Pavel Begunkov
  2021-08-19 13:42 ` [PATCH liburing 2/2] tests: rename iopoll test variables Pavel Begunkov
@ 2021-08-19 14:48 ` Jens Axboe
  2 siblings, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2021-08-19 14:48 UTC (permalink / raw)
  To: Pavel Begunkov, io-uring

On 8/19/21 7:42 AM, Pavel Begunkov wrote:
> Two small patches for read-write.c and iopoll.c tests.
> 
> Pavel Begunkov (2):
>   tests: create new files for rw testing
>   tests: rename iopoll test variables
> 
>  test/iopoll.c     | 20 ++++++++++++--------
>  test/read-write.c |  6 +++++-
>  2 files changed, 17 insertions(+), 9 deletions(-)

Applied, thanks.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-08-19 14:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-08-19 13:42 [PATCH liburing 0/2] rw tests improvements Pavel Begunkov
2021-08-19 13:42 ` [PATCH liburing 1/2] tests: create new files for rw testing Pavel Begunkov
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox