summaryrefslogtreecommitdiffstats
path: root/tests/lib
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2024-06-19 21:36:17 +0200
committerDavid Lamparter <equinox@opensourcerouting.org>2024-06-20 11:02:19 +0200
commit8aeac1f005d5b462314c73db098878042fe6c444 (patch)
treec7e5b557b46c45c6cb2b091669b519423f7c24e0 /tests/lib
parentMerge pull request #16224 from donaldsharp/zebra_dplane_event_loop_starvation (diff)
downloadfrr-8aeac1f005d5b462314c73db098878042fe6c444.tar.xz
frr-8aeac1f005d5b462314c73db098878042fe6c444.zip
tests/lib: fix seqlock test
seqlock_bump() used to return the value before bumping, but that's unhelpful if you were to actually need it. I had changed it to return the value after, but the update to the test got lost at some point. The return value is not in fact used anywhere in FRR, so while it is a bug, it has zero impact. NB: yes, test_seqlock is not run, which sounds wrong. The problem here is that (a) the test itself uses sleeps and is timing sensitive, which would raise false positives. And (b), the test is meaningless if executed once. It needs to be run millions of times under various conditions (e.g. load) to catch rare races, and it needs to be run on machines with "odd" memory models (in this case I used BE ppc32 and ppc64 systems as test platforms.) Fixes: 6046b690b53 ("lib/seqlock: avoid syscalls in no-waiter cases") Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'tests/lib')
-rw-r--r--tests/lib/test_seqlock.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/lib/test_seqlock.c b/tests/lib/test_seqlock.c
index 288d4a8c2..35501cbd4 100644
--- a/tests/lib/test_seqlock.c
+++ b/tests/lib/test_seqlock.c
@@ -82,11 +82,11 @@ int main(int argc, char **argv)
assert(seqlock_held(&sqlo));
assert(seqlock_cur(&sqlo) == 1);
- assert(seqlock_bump(&sqlo) == 1);
- assert(seqlock_cur(&sqlo) == 5);
assert(seqlock_bump(&sqlo) == 5);
+ assert(seqlock_cur(&sqlo) == 5);
assert(seqlock_bump(&sqlo) == 9);
assert(seqlock_bump(&sqlo) == 13);
+ assert(seqlock_bump(&sqlo) == 17);
assert(seqlock_cur(&sqlo) == 17);
assert(seqlock_held(&sqlo));