This is an archive of the discontinued LLVM Phabricator instance.

[sanitizer_common] Fix DenseMapCustomTest.DefaultMinReservedSizeTest on SPARC
ClosedPublic

Authored by ro on Feb 2 2022, 3:42 AM.

Details

Summary

As described in Issue 53523, the DenseMapCustomTest.DefaultMinReservedSizeTest test FAILs on Solaris/SPARC (both 32 and 64-bit):

/vol/llvm/src/llvm-project/local/compiler-rt/lib/sanitizer_common/tests/sanitizer_dense_map_test.cpp:399: Failure
Expected: (MemorySize) != (Map.getMemorySize()), actual: 8192 vs 8192

This happens because SPARC, unlike many other CPUs, uses an 8kB pagesize.

Fixed by incorporating the pagesize into calculation of ExpectedInitialBucketCount and derived values.

Tested on sparcv9-sun-solaris2.11, amd64-pc-solaris2.11, and x86_64-pc-linux-gnu.

Diff Detail

Event Timeline

ro created this revision.Feb 2 2022, 3:42 AM
ro requested review of this revision.Feb 2 2022, 3:42 AM
Herald added a subscriber: Restricted Project. · View Herald TranscriptFeb 2 2022, 3:42 AM
vitalybuka accepted this revision.Feb 8 2022, 1:08 PM
vitalybuka added inline comments.
compiler-rt/lib/sanitizer_common/tests/sanitizer_dense_map_test.cpp
413

Just two instances, so I'd rather hardcoded it here.
Either way is fine to me.

This revision is now accepted and ready to land.Feb 8 2022, 1:08 PM
ro added inline comments.Feb 9 2022, 12:10 AM
compiler-rt/lib/sanitizer_common/tests/sanitizer_dense_map_test.cpp
413

I've decided to keep the code as is: it avoids duplication and possible inconsistencies as well as an unexplained magical constant (8).