[PATCH liburing 2/6] tests: handle some skips that used a goto to enter cleanup

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

 



We cannot use the general cleanup-and-succeed here. These were
improperly ported to the exitcode reporting.

Signed-off-by: Eli Schwartz <eschwartz93@xxxxxxxxx>
---
 test/accept-test.c             |  7 +++++--
 test/fallocate.c               | 10 ++++++----
 test/files-exit-hang-poll.c    |  6 ++++--
 test/files-exit-hang-timeout.c |  6 ++++--
 test/hardlink.c                |  9 ++++++---
 5 files changed, 25 insertions(+), 13 deletions(-)

diff --git a/test/accept-test.c b/test/accept-test.c
index a898360..99f6080 100644
--- a/test/accept-test.c
+++ b/test/accept-test.c
@@ -61,7 +61,7 @@ int main(int argc, char *argv[])
 	if (!ret) {
 		if (cqe->res == -EBADF || cqe->res == -EINVAL) {
 			fprintf(stdout, "Accept not supported, skipping\n");
-			goto out;
+			goto skip;
 		} else if (cqe->res < 0) {
 			fprintf(stderr, "cqe error %d\n", cqe->res);
 			goto err;
@@ -71,9 +71,12 @@ int main(int argc, char *argv[])
 		return T_EXIT_FAIL;
 	}
 
-out:
 	io_uring_queue_exit(&ring);
 	return T_EXIT_PASS;
+
+skip:
+	io_uring_queue_exit(&ring);
+	return T_EXIT_SKIP;
 err:
 	io_uring_queue_exit(&ring);
 	return T_EXIT_FAIL;
diff --git a/test/fallocate.c b/test/fallocate.c
index a9bf6fd..e804ca5 100644
--- a/test/fallocate.c
+++ b/test/fallocate.c
@@ -67,14 +67,15 @@ static int test_fallocate_rlimit(struct io_uring *ring)
 	if (cqe->res == -EINVAL) {
 		fprintf(stdout, "Fallocate not supported, skipping\n");
 		no_fallocate = 1;
-		goto out;
+		goto skip;
 	} else if (cqe->res != -EFBIG) {
 		fprintf(stderr, "Expected -EFBIG: %d\n", cqe->res);
 		goto err;
 	}
 	io_uring_cqe_seen(ring, cqe);
-out:
 	return 0;
+skip:
+	return T_EXIT_SKIP;
 err:
 	return 1;
 }
@@ -117,7 +118,7 @@ static int test_fallocate(struct io_uring *ring)
 	if (cqe->res == -EINVAL) {
 		fprintf(stdout, "Fallocate not supported, skipping\n");
 		no_fallocate = 1;
-		goto out;
+		goto skip;
 	}
 	if (cqe->res) {
 		fprintf(stderr, "cqe->res=%d\n", cqe->res);
@@ -136,8 +137,9 @@ static int test_fallocate(struct io_uring *ring)
 		goto err;
 	}
 
-out:
 	return 0;
+skip:
+	return T_EXIT_SKIP;
 err:
 	return 1;
 }
diff --git a/test/files-exit-hang-poll.c b/test/files-exit-hang-poll.c
index 432d89f..0c609f1 100644
--- a/test/files-exit-hang-poll.c
+++ b/test/files-exit-hang-poll.c
@@ -93,7 +93,7 @@ int main(int argc, char *argv[])
 		}
 		if (i == 99) {
 			printf("Gave up on finding a port, skipping\n");
-			goto out;
+			goto skip;
 		}
 	}
 
@@ -123,7 +123,9 @@ int main(int argc, char *argv[])
 		return T_EXIT_FAIL;
 	}
 
-out:
 	io_uring_queue_exit(&ring);
 	return T_EXIT_PASS;
+skip:
+	io_uring_queue_exit(&ring);
+	return T_EXIT_SKIP;
 }
diff --git a/test/files-exit-hang-timeout.c b/test/files-exit-hang-timeout.c
index a19afc6..318f0e1 100644
--- a/test/files-exit-hang-timeout.c
+++ b/test/files-exit-hang-timeout.c
@@ -99,7 +99,7 @@ int main(int argc, char *argv[])
 		}
 		if (i == 99) {
 			printf("Gave up on finding a port, skipping\n");
-			goto out;
+			goto skip;
 		}
 	}
 
@@ -129,7 +129,9 @@ int main(int argc, char *argv[])
 		return T_EXIT_FAIL;
 	}
 
-out:
 	io_uring_queue_exit(&ring);
 	return T_EXIT_PASS;
+skip:
+	io_uring_queue_exit(&ring);
+	return T_EXIT_SKIP;
 }
diff --git a/test/hardlink.c b/test/hardlink.c
index f2b8182..29395c3 100644
--- a/test/hardlink.c
+++ b/test/hardlink.c
@@ -98,7 +98,7 @@ int main(int argc, char *argv[])
 	if (ret < 0) {
 		if (ret == -EBADF || ret == -EINVAL) {
 			fprintf(stdout, "linkat not supported, skipping\n");
-			goto out;
+			goto skip;
 		}
 		fprintf(stderr, "linkat: %s\n", strerror(-ret));
 		goto err1;
@@ -121,7 +121,11 @@ int main(int argc, char *argv[])
 		goto err2;
 	}
 
-out:
+	unlinkat(AT_FDCWD, linkname, 0);
+	unlinkat(AT_FDCWD, target, 0);
+	io_uring_queue_exit(&ring);
+	return T_EXIT_SKIP;
+skip:
 	unlinkat(AT_FDCWD, linkname, 0);
 	unlinkat(AT_FDCWD, target, 0);
 	io_uring_queue_exit(&ring);
@@ -134,4 +138,3 @@ err:
 	io_uring_queue_exit(&ring);
 	return T_EXIT_FAIL;
 }
-
-- 
2.35.1




[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