diff options
author | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2016-12-22 21:16:04 +0000 |
---|---|---|
committer | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2016-12-22 21:16:04 +0000 |
commit | bb24d0dd21ac008d51a129fe833ff0f68a3c412e (patch) | |
tree | 460ddb9689fe16584213866588829dbdff6d752e /lib/asan/tests | |
parent | f93b425abc688b059a82425d5caf86bb7f81e6ac (diff) |
Improve ThreadedQuarantineTest heap memory measurements.
Summary:
Warm up ASAN caches in ThreadedQuarantineTest to get more predictable
incremental heap memory usage measurements.
Reviewers: eugenis
Patch by Alex Shlyapnikov.
Subscribers: aemerson, kubabrecka, llvm-commits
Differential Revision: https://reviews.llvm.org/D28061
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@290371 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/asan/tests')
-rw-r--r-- | lib/asan/tests/asan_noinst_test.cc | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/asan/tests/asan_noinst_test.cc b/lib/asan/tests/asan_noinst_test.cc index 1ccaa76ea..65acb2839 100644 --- a/lib/asan/tests/asan_noinst_test.cc +++ b/lib/asan/tests/asan_noinst_test.cc @@ -170,6 +170,12 @@ void *ThreadedQuarantineTestWorker(void *unused) { // Check that the thread local allocators are flushed when threads are // destroyed. TEST(AddressSanitizer, ThreadedQuarantineTest) { + // Run the routine once to warm up ASAN internal structures to get more + // predictable incremental memory changes. + pthread_t t; + PTHREAD_CREATE(&t, NULL, ThreadedQuarantineTestWorker, 0); + PTHREAD_JOIN(t, 0); + const int n_threads = 3000; size_t mmaped1 = __sanitizer_get_heap_size(); for (int i = 0; i < n_threads; i++) { @@ -178,7 +184,7 @@ TEST(AddressSanitizer, ThreadedQuarantineTest) { PTHREAD_JOIN(t, 0); size_t mmaped2 = __sanitizer_get_heap_size(); // Figure out why this much memory is required. - EXPECT_LT(mmaped2 - mmaped1, 352U * (1 << 20)); + EXPECT_LT(mmaped2 - mmaped1, 320U * (1 << 20)); } } |