The branch main has been updated by vangyzen:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=c6f92e64b6140f9e095b41687ff09ff973c28e14

commit c6f92e64b6140f9e095b41687ff09ff973c28e14
Author:     Eric van Gyzen <vangy...@freebsd.org>
AuthorDate: 2021-07-23 13:24:52 +0000
Commit:     Eric van Gyzen <vangy...@freebsd.org>
CommitDate: 2021-07-23 14:19:28 +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
---
 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 b34e7c13f5a4..4b0fb5f7892b 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));
                        }
                }
        }
_______________________________________________
dev-commits-src-main@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "dev-commits-src-main-unsubscr...@freebsd.org"

Reply via email to