public inbox for [email protected]
 help / color / mirror / Atom feed
From: Eli Schwartz <[email protected]>
To: [email protected]
Subject: [PATCH liburing 2/6] tests: handle some skips that used a goto to enter cleanup
Date: Tue,  5 Jul 2022 23:40:54 -0400	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>

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

Signed-off-by: Eli Schwartz <[email protected]>
---
 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



  parent reply	other threads:[~2022-07-06  3:41 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-06  3:40 [PATCH liburing 0/6] More wor on updating exit codes to use Eli Schwartz
2022-07-06  3:40 ` [PATCH liburing 1/6] tests: do not report an error message when return ret that might be a skip Eli Schwartz
2022-07-06  3:40 ` Eli Schwartz [this message]
2022-07-06  3:40 ` [PATCH liburing 3/6] tests: more work on updating exit codes to use enum-based status reporting Eli Schwartz
2022-07-06  3:40 ` [PATCH liburing 4/6] tests: mention in a status message that this is a skip Eli Schwartz
2022-07-06  3:40 ` [PATCH liburing 5/6] tests: migrate a skip that used a goto to enter cleanup Eli Schwartz
2022-07-06  3:40 ` [PATCH liburing 6/6] tests: correctly exit with failure in a looped test Eli Schwartz
2022-07-06 12:45 ` [PATCH liburing 0/6] More wor on updating exit codes to use 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 \
    [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