summaryrefslogtreecommitdiff
path: root/test/esan
diff options
context:
space:
mode:
authorDerek Bruening <bruening@google.com>2016-07-06 20:27:44 +0000
committerDerek Bruening <bruening@google.com>2016-07-06 20:27:44 +0000
commitf9c7797fea12123fa2a0b3d90f0977b6ccf1f987 (patch)
tree68f68c2e0095029868eaa2a46583115f1a517356 /test/esan
parent36c88f5770dff4421061e8327a96be5cd245bc49 (diff)
[esan|wset] Further reduce flakiness of sampling test
Enhances the sampling test to try and reduce flakiness further by increasing the workload to ensure a few samples are gathered. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@274669 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/esan')
-rw-r--r--test/esan/TestCases/workingset-samples.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/test/esan/TestCases/workingset-samples.cpp b/test/esan/TestCases/workingset-samples.cpp
index 98a9bc8a4..09efcd44f 100644
--- a/test/esan/TestCases/workingset-samples.cpp
+++ b/test/esan/TestCases/workingset-samples.cpp
@@ -7,6 +7,7 @@
#include <sys/mman.h>
const int size = 0x1 << 25; // 523288 cache lines
+const int iters = 6;
int main(int argc, char **argv) {
char *buf = (char *)mmap(0, size, PROT_READ | PROT_WRITE,
@@ -15,9 +16,12 @@ int main(int argc, char **argv) {
// scheduled. Unfortunately we can't do proper synchronization
// without some form of annotation or something.
sched_yield();
- // Do enough work to get at least 2 samples.
- for (int i = 0; i < size; ++i)
- buf[i] = i;
+ // Do enough work to get at least 4 samples.
+ for (int j = 0; j < iters; ++j) {
+ for (int i = 0; i < size; ++i)
+ buf[i] = i;
+ sched_yield();
+ }
munmap(buf, size);
// We only check for a few samples here to reduce the chance of flakiness.
// CHECK: =={{[0-9]+}}== Total number of samples: {{[0-9]+}}