[PATCH liburing 1/2] tests: create new files for rw testing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <asml.silence@xxxxxxxxx>
---
 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




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux