[all-commits] [llvm/llvm-project] 5cfbfa: [sanitizer_common] Fix SanitizerCommon.ChainedOrig...

chbessonova via All-commits all-commits at lists.llvm.org
Thu Jun 16 03:02:04 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5cfbfa035fc18b0c94dcae62d1a643269af17219
      https://github.com/llvm/llvm-project/commit/5cfbfa035fc18b0c94dcae62d1a643269af17219
  Author: Kristina Bessonova <kbessonova at accesssoftek.com>
  Date:   2022-06-16 (Thu, 16 Jun 2022)

  Changed paths:
    M compiler-rt/lib/sanitizer_common/sanitizer_chained_origin_depot.cpp
    M compiler-rt/lib/sanitizer_common/sanitizer_chained_origin_depot.h
    M compiler-rt/lib/sanitizer_common/tests/sanitizer_chained_origin_depot_test.cpp

  Log Message:
  -----------
  [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




More information about the All-commits mailing list