summaryrefslogtreecommitdiffstats
path: root/compiler-rt/test
diff options
context:
space:
mode:
Diffstat (limited to 'compiler-rt/test')
-rw-r--r--compiler-rt/test/esan/TestCases/workingset-memset.cpp21
-rw-r--r--compiler-rt/test/esan/lit.cfg3
2 files changed, 24 insertions, 0 deletions
diff --git a/compiler-rt/test/esan/TestCases/workingset-memset.cpp b/compiler-rt/test/esan/TestCases/workingset-memset.cpp
new file mode 100644
index 00000000000..a0c36e3aebc
--- /dev/null
+++ b/compiler-rt/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/compiler-rt/test/esan/lit.cfg b/compiler-rt/test/esan/lit.cfg
index 99e93561aaf..cc7492c887b 100644
--- a/compiler-rt/test/esan/lit.cfg
+++ b/compiler-rt/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=',
OpenPOWER on IntegriCloud