[sanitizer_common] Fix SanitizerCommon.ChainedOriginDepotStats test
This test was failing with the following error message if to run the test binary directly, w/o using lit: $ Sanitizer-x86_64-Test --gtest_filter=SanitizerCommon.ChainedOriginDepot* ... [ RUN ] SanitizerCommon.ChainedOriginDepotStats compiler-rt/lib/sanitizer_common/tests/sanitizer_chained_origin_depot_test.cpp:77: Failure Expected: (stats1.allocated) > (stats0.allocated), actual: 196608 vs 196608 [ FAILED ] SanitizerCommon.ChainedOriginDepotStats (867 ms) Since the ChainedOriginDepot* tests are not doing any cleanup, by the time SanitizerCommon.ChainedOriginDepotStats test starts executing the depot may not be empty, so there will be no allocation for the test. This patch introduces ChainedOriginDepot::TestOnlyUnmap() API that deallocates memory when requested. This makes sure underlying TwoLevelMap initiates the expected allocation during the test. Reviewed By: eugenis Differential Revision: https://reviews.llvm.org/D127621
Loading
Please sign in to comment