1 // Test various levels of coverage 2 // 3 // RUN: %clangxx_asan -O1 -fsanitize-coverage=func %s -o %t 4 // RUN: %env_asan_opts=coverage=1:coverage_bitset=1:verbosity=1 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK1 5 // RUN: %clangxx_asan -O1 -fsanitize-coverage=bb %s -o %t 6 // RUN: %env_asan_opts=coverage=1:coverage_bitset=1:verbosity=1 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK2 7 // RUN: %clangxx_asan -O1 -fsanitize-coverage=edge %s -o %t 8 // RUN: %env_asan_opts=coverage=1:coverage_bitset=1:verbosity=1 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK3 9 // RUN: %clangxx_asan -O1 -fsanitize-coverage=edge -mllvm -sanitizer-coverage-block-threshold=0 %s -o %t 10 // RUN: %env_asan_opts=coverage=1:coverage_bitset=1:verbosity=1 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK3 11 // RUN: %clangxx_asan -O1 -fsanitize-coverage=edge,8bit-counters %s -o %t 12 // RUN: %env_asan_opts=coverage=1:coverage_counters=1:verbosity=1 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK_COUNTERS 13 14 // RUN: %env_asan_opts=coverage=1:coverage_bitset=0:verbosity=1 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK3_NOBITSET 15 // RUN: %env_asan_opts=coverage=1:verbosity=1 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK3_NOBITSET 16 // RUN: %env_asan_opts=coverage=1:coverage_pcs=0:verbosity=1 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK3_NOPCS 17 // 18 // REQUIRES: asan-64-bits 19 // UNSUPPORTED: android 20 volatile int sink; 21 int main(int argc, char **argv) { 22 if (argc == 0) 23 sink = 0; 24 } 25 26 // CHECK1: CovDump: bitset of 1 bits written for '{{.*}}', 1 bits are set 27 // CHECK1: 1 PCs written 28 // CHECK2: CovDump: bitset of 3 bits written for '{{.*}}', 2 bits are set 29 // CHECK2: 2 PCs written 30 // CHECK3: CovDump: bitset of 4 bits written for '{{.*}}', 3 bits are set 31 // CHECK3: 3 PCs written 32 // CHECK3_NOBITSET-NOT: bitset of 33 // CHECK3_NOPCS-NOT: PCs written 34 // CHECK_COUNTERS: CovDump: 4 counters written for 35