diff options
author | Derek Bruening <bruening@google.com> | 2016-05-25 02:04:04 +0000 |
---|---|---|
committer | Derek Bruening <bruening@google.com> | 2016-05-25 02:04:04 +0000 |
commit | 9dfeca2386c28762468cddb4c9e16bfa8f25a15e (patch) | |
tree | 528f86e1eb45776197bf5caf38ce4358bf99be78 /test/esan | |
parent | 916e15d6c3509ca54d23dd2e7b8af39814649206 (diff) |
Add working set base runtime library
Summary:
Adds the base runtime library for the working set tool.
Adds slowpath code for updating the shadow memory.
To be added in the future:
+ Scan memory and report the total size.
+ Take samples for intermediate values.
Reviewers: aizatsky
Subscribers: kubabrecka, vitalybuka, zhaoqin, kcc, eugenis, llvm-commits
Differential Revision: http://reviews.llvm.org/D20485
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@270650 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/esan')
-rw-r--r-- | test/esan/TestCases/workingset-memset.cpp | 21 | ||||
-rw-r--r-- | test/esan/lit.cfg | 3 |
2 files changed, 24 insertions, 0 deletions
diff --git a/test/esan/TestCases/workingset-memset.cpp b/test/esan/TestCases/workingset-memset.cpp new file mode 100644 index 000000000..a0c36e3ae --- /dev/null +++ b/test/esan/TestCases/workingset-memset.cpp @@ -0,0 +1,21 @@ +// RUN: %clang_esan_wset -O0 %s -o %t 2>&1 +// RUN: %run %t 2>&1 | FileCheck %s + +#include <stdlib.h> +#include <string.h> +#include <sys/mman.h> +#include <assert.h> +#include <string.h> + +int main(int argc, char **argv) { + const int size = 128*1024*1024; + char *p = (char *)mmap(0, size, PROT_READ | PROT_WRITE, + MAP_ANON | MAP_PRIVATE, -1, 0); + // Test the slowpath at different cache line boundaries. + for (int i = 0; i < 630; i++) + memset((char *)p + 63*i, i, 63*i); + munmap(p, size); + return 0; + // FIXME: once the memory scan and size report is in place add it here. + // CHECK: {{.*}}EfficiencySanitizer is not finished: nothing yet to report +} diff --git a/test/esan/lit.cfg b/test/esan/lit.cfg index 99e93561a..cc7492c88 100644 --- a/test/esan/lit.cfg +++ b/test/esan/lit.cfg @@ -13,12 +13,15 @@ base_cflags = ([config.target_cflags] + config.debug_info_flags) base_cxxflags = config.cxx_mode_flags + base_cflags frag_cflags = (["-fsanitize=efficiency-cache-frag"] + base_cflags) +wset_cflags = (["-fsanitize=efficiency-working-set"] + base_cflags) def build_invocation(compile_flags): return " " + " ".join([config.clang] + compile_flags) + " " config.substitutions.append( ("%clang_esan_frag ", build_invocation(frag_cflags)) ) +config.substitutions.append( ("%clang_esan_wset ", + build_invocation(wset_cflags)) ) default_esan_opts = '' config.substitutions.append(('%env_esan_opts=', |