Skip to content

Commit

Permalink
test-local-addresses: drop racy check
Browse files Browse the repository at this point in the history
The test would fail when addresses were being removed in parallel. In general,
the check is only valid when the machine configuration is static, which in
general isn't true.

CentOS CI (Arch Linux) fails in TEST-02-UNITTESTS test-local-addresses:

10:38:05 (gdb) #0  0x00007f86260a164c in ?? () from /usr/lib/libc.so.6
10:38:05 No symbol table info available.
10:38:05 #1  0x00007f8626051958 in raise () from /usr/lib/libc.so.6
10:38:05 No symbol table info available.
10:38:05 #2  0x00007f862603b53d in abort () from /usr/lib/libc.so.6
10:38:05 No symbol table info available.
10:38:05 #3  0x00007f862639a755 in log_assert_failed (
10:38:05     text=text@entry=0x56180e56c03b "n == n_ipv4 + n_ipv6",
10:38:05     file=file@entry=0x56180e56c0d1 "src/test/test-local-addresses.c",
10:38:05     line=line@entry=45,
10:38:05     func=func@entry=0x56180e56c360 <__PRETTY_FUNCTION__.6> "test_local_addresses") at ../build/src/basic/log.c:853
10:38:05 No locals.
10:38:05 #4  0x000056180e56b77e in test_local_addresses ()
10:38:05     at ../build/src/test/test-local-addresses.c:45
10:38:05         a = 0x0
10:38:05         n = 234
10:38:05         n_ipv4 = 236
10:38:05         n_ipv6 = 7
10:38:05         __PRETTY_FUNCTION__ = "test_local_addresses"
10:38:05         __func__ = "test_local_addresses"
10:38:05 #5  0x000056180e56ba67 in run_test_table () at ../build/src/shared/tests.h:106
10:38:05         r = 0
10:38:05         t = 0x56180e56e010 <__unique_prefix_static_test_table_entry10>
10:38:05         __PRETTY_FUNCTION__ = <optimized out>
10:38:05         __func__ = "run_test_table"
10:38:05 #6  0x000056180e56bb2f in main (argc=1, argv=0x7ffc3a814808)
10:38:05     at ../build/src/test/test-local-addresses.c:81
10:38:05         _intro = 0x0
10:38:05         _outro = 0x0
10:38:05         _r = 0
10:38:05         _q = 0
10:38:05 (gdb)

The logs show that there's a huge number of private addresses, probably from
some other test running in parallel.
  • Loading branch information
keszybz committed Oct 20, 2022
1 parent 3f861e8 commit 0ed08e5
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/test/test-local-addresses.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,49 +19,43 @@ static void print_local_addresses(struct local_address *a, unsigned n) {

TEST(local_addresses) {
struct local_address *a = NULL;
int n, n_ipv4, n_ipv6;
int n;

n = local_addresses(NULL, 0, AF_INET, &a);
assert_se(n >= 0);
log_debug("/* Local Addresses(ifindex:0, AF_INET) */");
print_local_addresses(a, (unsigned) n);
a = mfree(a);
n_ipv4 = n;

n = local_addresses(NULL, 0, AF_INET6, &a);
assert_se(n >= 0);
log_debug("/* Local Addresses(ifindex:0, AF_INET6) */");
print_local_addresses(a, (unsigned) n);
a = mfree(a);
n_ipv6 = n;

n = local_addresses(NULL, 0, AF_UNSPEC, &a);
assert_se(n >= 0);
log_debug("/* Local Addresses(ifindex:0, AF_UNSPEC) */");
print_local_addresses(a, (unsigned) n);
a = mfree(a);
assert_se(n == n_ipv4 + n_ipv6);

n = local_addresses(NULL, 1, AF_INET, &a);
assert_se(n >= 0);
log_debug("/* Local Addresses(ifindex:1, AF_INET) */");
print_local_addresses(a, (unsigned) n);
a = mfree(a);
n_ipv4 = n;

n = local_addresses(NULL, 1, AF_INET6, &a);
assert_se(n >= 0);
log_debug("/* Local Addresses(ifindex:1, AF_INET6) */");
print_local_addresses(a, (unsigned) n);
a = mfree(a);
n_ipv6 = n;

n = local_addresses(NULL, 1, AF_UNSPEC, &a);
assert_se(n >= 0);
log_debug("/* Local Addresses(ifindex:1, AF_UNSPEC) */");
print_local_addresses(a, (unsigned) n);
a = mfree(a);
assert_se(n == n_ipv4 + n_ipv6);

n = local_gateways(NULL, 0, AF_UNSPEC, &a);
assert_se(n >= 0);
Expand Down

0 comments on commit 0ed08e5

Please sign in to comment.