git: 77f0c44e49ba - stable/13 - aio_md_test: fix cleanup
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 02 Mar 2022 21:57:18 UTC
The branch stable/13 has been updated by vangyzen:
URL: https://cgit.FreeBSD.org/src/commit/?id=77f0c44e49ba8aec89b65d095122c47d93930d0f
commit 77f0c44e49ba8aec89b65d095122c47d93930d0f
Author: Eric van Gyzen <vangyzen@FreeBSD.org>
AuthorDate: 2021-07-23 13:24:52 +0000
Commit: Eric van Gyzen <vangyzen@FreeBSD.org>
CommitDate: 2022-03-02 21:56:30 +0000
aio_md_test: fix cleanup
ATF cleanup functions cannot use functions such as ATF_REQUIRE
and atf_tc_fail. These functions assert that a test case is
currently running, which is not true during cleanup, so the
process aborts. Change the cleanup function to simply print
to stderr and return.
MFC after: 1 week
Sponsored by: Dell EMC Isilon
(cherry picked from commit c6f92e64b6140f9e095b41687ff09ff973c28e14)
---
tests/sys/aio/aio_test.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/tests/sys/aio/aio_test.c b/tests/sys/aio/aio_test.c
index 86c41fa469ea..af2e3823d1ff 100644
--- a/tests/sys/aio/aio_test.c
+++ b/tests/sys/aio/aio_test.c
@@ -758,11 +758,15 @@ static void
aio_md_cleanup(void)
{
struct md_ioctl mdio;
- int mdctl_fd, error, n, unit;
+ int mdctl_fd, n, unit;
char buf[80];
mdctl_fd = open("/dev/" MDCTL_NAME, O_RDWR, 0);
- ATF_REQUIRE(mdctl_fd >= 0);
+ if (mdctl_fd < 0) {
+ fprintf(stderr, "opening /dev/%s failed: %s\n", MDCTL_NAME,
+ strerror(errno));
+ return;
+ }
n = readlink(MDUNIT_LINK, buf, sizeof(buf));
if (n > 0) {
if (sscanf(buf, "%d", &unit) == 1 && unit >= 0) {
@@ -770,11 +774,9 @@ aio_md_cleanup(void)
mdio.md_version = MDIOVERSION;
mdio.md_unit = unit;
if (ioctl(mdctl_fd, MDIOCDETACH, &mdio) == -1) {
- error = errno;
- close(mdctl_fd);
- errno = error;
- atf_tc_fail("ioctl MDIOCDETACH failed: %s",
- strerror(errno));
+ fprintf(stderr,
+ "ioctl MDIOCDETACH unit %d failed: %s\n",
+ unit, strerror(errno));
}
}
}