Skip to content

Commit 385ab37

Browse files
JakobDegenfacebook-github-bot
authored andcommitted
tests: Fix allocative test in starlark CI
Summary: This test is failing in the OSS jobs - I expect that's probably the result of some version mismatch or other difference in the environment/optimizations causing slight changes in how much unused capacity `String`s allocate by default. Just adjust the test to not depend on that value Also adjust the filegroup so that updating the test fixtures works from buck Reviewed By: rajneesh Differential Revision: D77272283 fbshipit-source-id: b07987997bb4f9ce63bb7300628e7119f10cb53d
1 parent 15c8110 commit 385ab37

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

allocative/allocative/src/impls/hashbrown.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@ mod tests {
6161
fn test_hash_table() {
6262
let mut table = HashTable::with_capacity(100);
6363
for i in 0..100 {
64-
table.insert_unique(hash(&i.to_string()), i.to_string(), hash);
64+
let mut s = i.to_string();
65+
s.shrink_to_fit(); // Make the string deterministically sized
66+
table.insert_unique(hash(&s), s, hash);
6567
}
6668

6769
golden_test!(&table);

allocative/allocative/src/impls/hashbrown_test_hash_table.src

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,3 @@ hashbrown::table::HashTable<alloc::string::String>;data;capacity 800
99
hashbrown::table::HashTable<alloc::string::String>;data;capacity;alloc::string::String 1600
1010
hashbrown::table::HashTable<alloc::string::String>;data;capacity;alloc::string::String;ptr 800
1111
hashbrown::table::HashTable<alloc::string::String>;data;capacity;alloc::string::String;ptr;capacity;u8 190
12-
hashbrown::table::HashTable<alloc::string::String>;data;capacity;alloc::string::String;ptr;capacity;unused_capacity 610

0 commit comments

Comments
 (0)