summaryrefslogtreecommitdiffstats
path: root/src/test/test-local-addresses.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2022-10-20 12:54:44 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2022-10-20 12:58:16 +0200
commit0ed08e50dd975511d85ed3dcd8a1d583e5055611 (patch)
tree5beb71567318c625c225b19e0262661d333df1ce /src/test/test-local-addresses.c
parenttest-local-addresses: inline iterator variable (diff)
downloadsystemd-0ed08e50dd975511d85ed3dcd8a1d583e5055611.tar.xz
systemd-0ed08e50dd975511d85ed3dcd8a1d583e5055611.zip
test-local-addresses: drop racy check
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.
Diffstat (limited to 'src/test/test-local-addresses.c')
-rw-r--r--src/test/test-local-addresses.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/src/test/test-local-addresses.c b/src/test/test-local-addresses.c
index 449192f0e0..5a02465f23 100644
--- a/src/test/test-local-addresses.c
+++ b/src/test/test-local-addresses.c
@@ -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);