mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-04 09:30:31 +01:00
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.
This commit is contained in:
parent
a21fdd4237
commit
5ca018c0db
1 changed files with 8 additions and 1 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue