summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2020-05-19 21:53:58 -0600
committerJens Axboe <axboe@kernel.dk>2020-05-19 21:53:58 -0600
commit312ee7a1801410acd8b479b106aabbfdad0ddb73 (patch)
tree7e989772365761dd85ade01b396afc8e29b3d233 /test
parent9ab836439fdc520e9e24b4c3a2dadb4fc1f359cd (diff)
downloadliburing-312ee7a1801410acd8b479b106aabbfdad0ddb73.tar.gz
liburing-312ee7a1801410acd8b479b106aabbfdad0ddb73.tar.bz2
test/read-write: support configured test files
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'test')
-rw-r--r--test/read-write.c36
1 files changed, 21 insertions, 15 deletions
diff --git a/test/read-write.c b/test/read-write.c
index d3a8d35..3bea26f 100644
--- a/test/read-write.c
+++ b/test/read-write.c
@@ -672,14 +672,18 @@ err:
int main(int argc, char *argv[])
{
int i, ret, nr;
+ char *fname;
- if (argc > 1)
- return 0;
-
- if (create_file(".basic-rw")) {
- fprintf(stderr, "file creation failed\n");
- goto err;
+ if (argc > 1) {
+ fname = argv[1];
+ } else {
+ fname = ".basic-rw";
+ if (create_file(fname)) {
+ fprintf(stderr, "file creation failed\n");
+ goto err;
+ }
}
+
if (create_buffers()) {
fprintf(stderr, "file creation failed\n");
goto err;
@@ -700,7 +704,7 @@ int main(int argc, char *argv[])
v4 = (i & 8) != 0;
v5 = (i & 16) != 0;
v6 = (i & 32) != 0;
- ret = test_io(".basic-rw", v1, v2, v3, v4, v5, v6);
+ ret = test_io(fname, v1, v2, v3, v4, v5, v6);
if (ret) {
fprintf(stderr, "test_io failed %d/%d/%d/%d/%d/%d\n",
v1, v2, v3, v4, v5, v6);
@@ -708,25 +712,25 @@ int main(int argc, char *argv[])
}
}
- ret = test_buf_select(".basic-rw", 1);
+ ret = test_buf_select(fname, 1);
if (ret) {
fprintf(stderr, "test_buf_select nonvec failed\n");
goto err;
}
- ret = test_buf_select(".basic-rw", 0);
+ ret = test_buf_select(fname, 0);
if (ret) {
fprintf(stderr, "test_buf_select vec failed\n");
goto err;
}
- ret = test_buf_select_short(".basic-rw", 1);
+ ret = test_buf_select_short(fname, 1);
if (ret) {
fprintf(stderr, "test_buf_select_short nonvec failed\n");
goto err;
}
- ret = test_buf_select_short(".basic-rw", 0);
+ ret = test_buf_select_short(fname, 0);
if (ret) {
fprintf(stderr, "test_buf_select_short vec failed\n");
goto err;
@@ -738,13 +742,13 @@ int main(int argc, char *argv[])
goto err;
}
- ret = read_poll_link(".basic-rw");
+ ret = read_poll_link(fname);
if (ret) {
fprintf(stderr, "read_poll_link failed\n");
goto err;
}
- ret = test_io_link(".basic-rw");
+ ret = test_io_link(fname);
if (ret) {
fprintf(stderr, "test_io_link failed\n");
goto err;
@@ -756,9 +760,11 @@ int main(int argc, char *argv[])
goto err;
}
- unlink(".basic-rw");
+ if (fname != argv[1])
+ unlink(fname);
return 0;
err:
- unlink(".basic-rw");
+ if (fname != argv[1])
+ unlink(fname);
return 1;
}