[docs] Fix build-docs.sh
[llvm-project.git] / compiler-rt / test / scudo / random_shuffle.cpp
blobd48f2c960a16f63d4e7072affc58ce2d9dc7ed90
1 // RUN: %clangxx_scudo %s -o %t
2 // RUN: rm -rf %t-dir/random_shuffle_tmp_dir
3 // RUN: mkdir -p %t-dir/random_shuffle_tmp_dir
4 // RUN: %run %t 100 > %t-dir/random_shuffle_tmp_dir/out1
5 // RUN: %run %t 100 > %t-dir/random_shuffle_tmp_dir/out2
6 // RUN: %run %t 10000 > %t-dir/random_shuffle_tmp_dir/out1
7 // RUN: %run %t 10000 > %t-dir/random_shuffle_tmp_dir/out2
8 // RUN: not diff %t-dir/random_shuffle_tmp_dir/out?
9 // RUN: rm -rf %t-dir/random_shuffle_tmp_dir
11 // Tests that the allocator shuffles the chunks before returning to the user.
13 #include <stdio.h>
14 #include <stdlib.h>
16 int main(int argc, char **argv) {
17 int alloc_size = argc == 2 ? atoi(argv[1]) : 100;
18 char *base = new char[alloc_size];
19 for (int i = 0; i < 20; i++) {
20 char *p = new char[alloc_size];
21 printf("%zd\n", base - p);