mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
s3/torture: local_rbtree: avoid birthday collisions
We insert 999 keys, but if two of them happen to be the same, we don't find 1000 nodes, and that is upsetting for CI: [130(1421)/303 at 4m46s] samba3.smbtorture_s3.LOCAL-RBTREE UNEXPECTED(failure): samba3.smbtorture_s3.LOCAL-RBTREE.smbtorture(none) REASON: Exception: Exception: using seed 1716333987 host=foo share=bar user= myname=runner-jlguopmm-project-6378020-concurrent-0 Running LOCAL-RBTREE run_local_rbtree: read1: 999 999, NT_STATUS_OK run_local_rbtree: delete: 999 999, NT_STATUS_OK run_local_rbtree: read2: 0 0, NT_STATUS_OK TEST LOCAL-RBTREE FAILED! LOCAL-RBTREE took 0.002706 secs This has been flapping very occasionally for a long time: https://lists.samba.org/archive/samba-technical/2016-March/112861.html Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
This commit is contained in:
parent
3a7dbf8b77
commit
267f307689
@ -13634,17 +13634,17 @@ static bool run_local_rbtree(int dummy)
|
||||
}
|
||||
|
||||
for (i = 0; i < 999; i++) {
|
||||
char key[sizeof("key-9223372036854775807")];
|
||||
char value[sizeof("value-9223372036854775807")];
|
||||
char key[sizeof("key-9223372036854775807-1234")];
|
||||
char value[sizeof("value-9223372036854775807-1234")];
|
||||
|
||||
snprintf(key, sizeof(key), "key%ld", random());
|
||||
snprintf(value, sizeof(value) ,"value%ld", random());
|
||||
snprintf(key, sizeof(key), "key%ld-%d", random(), i);
|
||||
snprintf(value, sizeof(value) ,"value%ld-%d", random(), i);
|
||||
|
||||
if (!rbt_testval(db, key, value)) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
snprintf(value, sizeof(value) ,"value%ld", random());
|
||||
snprintf(value, sizeof(value) ,"value%ld-%d", random(), i + 1);
|
||||
|
||||
if (!rbt_testval(db, key, value)) {
|
||||
goto done;
|
||||
|
Loading…
Reference in New Issue
Block a user