1 | // Tests the default implementation of callbacks for |
2 | // -fsanitize-coverage=inline-8bit-counters,pc-table |
3 | |
4 | // REQUIRES: has_sancovcc,stable-runtime,linux,x86_64-target-arch |
5 | |
6 | /// In glibc 2.39+, fprintf has a nonnull attribute. Disable nonnull-attribute, |
7 | /// which would increase counters for ubsan. |
8 | // RUN: %clangxx -O0 %s -fsanitize-coverage=inline-8bit-counters,pc-table -fno-sanitize=nonnull-attribute -o %t |
9 | // RUN: rm -f %t-counters %t-pcs |
10 | // RUN: env %tool_options="cov_8bit_counters_out=%t-counters cov_pcs_out=%t-pcs verbosity=1" %run %t 2>&1 | FileCheck %s |
11 | |
12 | // Check the file sizes |
13 | // RUN: wc -c %t-counters | grep "^2 " |
14 | // RUN: wc -c %t-pcs | grep "^32 " |
15 | |
16 | #include <stdio.h> |
17 | |
18 | __attribute__((noinline)) void foo() {} |
19 | int main() { |
20 | foo(); |
21 | foo(); |
22 | fprintf(stderr, format: "PASS\n" ); |
23 | // CHECK: PASS |
24 | // CHECK: cov_8bit_counters_out: written {{.*}} bytes to {{.*}}-counter |
25 | // CHECK: cov_pcs_out: written {{.*}} bytes to {{.*}}-pcs |
26 | } |
27 | |