1 // Test for direct coverage writing with lots of data. 2 // Current implementation maps output file in chunks of 64K. This test overflows 3 // 1 chunk. 4 // RUN: %clangxx_asan -mllvm -asan-coverage=1 -O0 %s -o %t 5 6 // RUN: rm -rf %T/coverage-direct-large 7 8 // RUN: mkdir -p %T/coverage-direct-large/normal && cd %T/coverage-direct-large/normal 9 // RUN: ASAN_OPTIONS=coverage=1:coverage_direct=0:verbosity=1 %run %t 10 // RUN: %sancov print *.sancov >out.txt 11 // RUN: cd ../.. 12 13 // RUN: mkdir -p %T/coverage-direct-large/direct && cd %T/coverage-direct-large/direct 14 // RUN: ASAN_OPTIONS=coverage=1:coverage_direct=1:verbosity=1 %run %t 15 // RUN: %sancov rawunpack *.sancov.raw 16 // RUN: %sancov print *.sancov >out.txt 17 // RUN: cd ../.. 18 19 // RUN: diff -u coverage-direct-large/normal/out.txt coverage-direct-large/direct/out.txt 20 // 21 // XFAIL: android 22 23 #define F0(Q, x) Q(x) 24 #define F1(Q, x) \ 25 F0(Q, x##0) F0(Q, x##1) F0(Q, x##2) F0(Q, x##3) F0(Q, x##4) F0(Q, x##5) \ 26 F0(Q, x##6) F0(Q, x##7) F0(Q, x##8) F0(Q, x##9) 27 #define F2(Q, x) \ 28 F1(Q, x##0) F1(Q, x##1) F1(Q, x##2) F1(Q, x##3) F1(Q, x##4) F1(Q, x##5) \ 29 F1(Q, x##6) F1(Q, x##7) F1(Q, x##8) F1(Q, x##9) 30 #define F3(Q, x) \ 31 F2(Q, x##0) F2(Q, x##1) F2(Q, x##2) F2(Q, x##3) F2(Q, x##4) F2(Q, x##5) \ 32 F2(Q, x##6) F2(Q, x##7) F2(Q, x##8) F2(Q, x##9) 33 #define F4(Q, x) \ 34 F3(Q, x##0) F3(Q, x##1) F3(Q, x##2) F3(Q, x##3) F3(Q, x##4) F3(Q, x##5) \ 35 F3(Q, x##6) F3(Q, x##7) F3(Q, x##8) F3(Q, x##9) 36 37 #define DECL(x) __attribute__((noinline)) void x() {} 38 #define CALL(x) x(); 39 40 F4(DECL, f) 41 42 int main(void) { 43 F4(CALL, f) 44 return 0; 45 } 46