summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2020-07-03 19:27:13 +0200
committerThomas Haller <thaller@redhat.com>2020-07-03 19:29:46 +0200
commitb2f03544a7947c3157f987f630e6c473cacbb53a (patch)
tree2b5273cf86cfc4898f9ad1686e355752ab92c3ff
parent4af93f848d60220cd5dff88da6d1398366668d6e (diff)
downloadNetworkManager-b2f03544a7947c3157f987f630e6c473cacbb53a.tar.gz
ndisc/tests: fix assertion in "test-ndisc-fake.c"
First I wanted to fix test:ERROR:../src/ndisc/tests/test-ndisc-fake.c:373:test_preference_changed_cb: assertion failed (_a->timestamp == (data->timestamp1 + 3)): (9 == 10) but that leads to a different failure: test:ERROR:../src/ndisc/tests/test-ndisc-fake.c:375:test_preference_changed_cb: assertion failed (_a->lifetime == (9)): (10 == 9) Instead, the start and end times must match exact (in their duration), we only allow them to be shifted by up to one second. Fixes: 8209095ee1c4 ('ndisc/tests: relax the assertion in "test-ndisc-fake.c"')
-rw-r--r--src/ndisc/tests/test-ndisc-fake.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/ndisc/tests/test-ndisc-fake.c b/src/ndisc/tests/test-ndisc-fake.c
index f02e5d3ff7..b65511e01e 100644
--- a/src/ndisc/tests/test-ndisc-fake.c
+++ b/src/ndisc/tests/test-ndisc-fake.c
@@ -63,8 +63,8 @@ match_gateway (const NMNDiscData *rdata, guint idx, const char *addr, guint32 ts
nmtst_assert_ip6_address (&_a->address, (addr)); \
g_assert_cmpint (_a->timestamp, >=, _ts); \
g_assert_cmpint (_a->timestamp, <=, _ts + 1); \
- g_assert_cmpint (_a->lifetime, ==, (lt)); \
- g_assert_cmpint (_a->preferred, ==, (pref)); \
+ g_assert_cmpint (_a->timestamp + _a->lifetime, ==, _ts + (lt)); \
+ g_assert_cmpint (_a->timestamp + _a->preferred, ==, _ts + (pref)); \
} G_STMT_END
#define match_route(rdata, idx, nw, pl, gw, ts, lt, pref) \
@@ -372,7 +372,7 @@ test_preference_changed_cb (NMNDisc *ndisc, const NMNDiscData *rdata, guint chan
match_gateway (rdata, 0, "fe80::1", data->timestamp1 + 2, 10, NM_ICMPV6_ROUTER_PREF_HIGH);
match_gateway (rdata, 1, "fe80::2", data->timestamp1 + 1, 10, NM_ICMPV6_ROUTER_PREF_MEDIUM);
g_assert_cmpint (rdata->addresses_n, ==, 2);
- match_address (rdata, 0, "2001:db8:a:a::1", data->timestamp1 + 2, 9, 9);
+ match_address (rdata, 0, "2001:db8:a:a::1", data->timestamp1 + 3, 9, 9);
match_address (rdata, 1, "2001:db8:a:b::1", data->timestamp1 + 1, 10, 10);
g_assert_cmpint (rdata->routes_n, ==, 2);
match_route (rdata, 0, "2001:db8:a:a::", 64, "fe80::1", data->timestamp1 + 2, 10, 15);