Kostya Serebryany | 7c5ae7c | 2016-08-26 00:06:03 +0000 | [diff] [blame] | 1 | // RUN: %clang_scudo %s -o %t |
| 2 | // RUN: rm -rf %T/random_shuffle_tmp_dir |
| 3 | // RUN: mkdir %T/random_shuffle_tmp_dir |
| 4 | // RUN: %run %t 100 > %T/random_shuffle_tmp_dir/out1 |
| 5 | // RUN: %run %t 100 > %T/random_shuffle_tmp_dir/out2 |
| 6 | // RUN: %run %t 10000 > %T/random_shuffle_tmp_dir/out1 |
| 7 | // RUN: %run %t 10000 > %T/random_shuffle_tmp_dir/out2 |
| 8 | // RUN: not diff %T/random_shuffle_tmp_dir/out? |
| 9 | // RUN: rm -rf %T/random_shuffle_tmp_dir |
Sagar Thakur | 6478d14 | 2017-06-19 11:28:59 +0000 | [diff] [blame] | 10 | // UNSUPPORTED: i386-linux,i686-linux,arm-linux,armhf-linux,aarch64-linux,mips-linux,mipsel-linux,mips64-linux,mips64el-linux |
Kostya Serebryany | 7c5ae7c | 2016-08-26 00:06:03 +0000 | [diff] [blame] | 11 | |
| 12 | // Tests that the allocator shuffles the chunks before returning to the user. |
| 13 | |
| 14 | #include <stdlib.h> |
| 15 | #include <stdio.h> |
| 16 | |
| 17 | int main(int argc, char **argv) { |
| 18 | int alloc_size = argc == 2 ? atoi(argv[1]) : 100; |
| 19 | char *base = new char[alloc_size]; |
| 20 | for (int i = 0; i < 20; i++) { |
| 21 | char *p = new char[alloc_size]; |
| 22 | printf("%zd\n", base - p); |
| 23 | } |
| 24 | } |