summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2021-02-11 16:02:12 +0100
committerThomas Haller <thaller@redhat.com>2021-02-11 16:04:46 +0100
commit5ca018c0dbff461d1a92dbcf371b1521801be051 (patch)
tree110fd54b3db33c3c2c94beaf46a580da56bb589d
parenta21fdd42376233eee5ad2c75338322ad4641de11 (diff)
downloadNetworkManager-5ca018c0dbff461d1a92dbcf371b1521801be051.tar.gz
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.
-rw-r--r--src/core/devices/tests/test-lldp.c9
1 files changed, 8 insertions, 1 deletions
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);
}