From 5ca018c0dbff461d1a92dbcf371b1521801be051 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Thu, 11 Feb 2021 16:02:12 +0100 Subject: lldp/tests: try workaround failure with ioctl(TUNSETIFF) On copr build, it seems possible that the ioctl fails with ERROR: src/core/devices/tests/test-lldp - Bail out! NetworkManager:ERROR:src/core/devices/tests/test-lldp.c:823:_test_recv_fixture_setup: assertion failed (errno == 0): (1 == 0) (1 is EPERM). Unclear why this happens. But as it only affects the test setup, retry a few times. --- src/core/devices/tests/test-lldp.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/core/devices/tests/test-lldp.c b/src/core/devices/tests/test-lldp.c index 27f0b4be8f..ef0b154903 100644 --- a/src/core/devices/tests/test-lldp.c +++ b/src/core/devices/tests/test-lldp.c @@ -812,14 +812,21 @@ _test_recv_fixture_setup(TestRecvFixture *fixture, gconstpointer user_data) link = nmtstp_assert_wait_for_link(NM_PLATFORM_GET, TEST_IFNAME, NM_LINK_TYPE_TUN, 0); } else { int s; - struct ifreq ifr = {}; + struct ifreq ifr; int r; + int try_cnt = 0; +again: + memset(&ifr, 0, sizeof(ifr)); ifr.ifr_flags = IFF_TAP | IFF_NO_PI; nm_utils_ifname_cpy(ifr.ifr_name, TEST_IFNAME); r = ioctl(fd, TUNSETIFF, &ifr); if (r != 0) { + if (errno == EPERM && try_cnt++ < 10) { + g_usleep(2); + goto again; + } g_assert_cmpint(errno, ==, 0); g_assert_cmpint(r, ==, 0); } -- cgit v1.2.1