[profile][test] Improve coverage-linkage.cpp
authorFangrui Song <i@maskray.me>
Mon, 5 Jul 2021 19:46:06 +0000 (12:46 -0700)
committerFangrui Song <i@maskray.me>
Mon, 5 Jul 2021 19:46:06 +0000 (12:46 -0700)
compiler-rt/test/profile/Linux/coverage-linkage.cpp

index 32a63fb..df0674e 100644 (file)
@@ -1,9 +1,32 @@
 /// Test instrumentation can handle various linkages.
 // RUN: %clang_profgen -fcoverage-mapping %s -o %t
 // RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t
+// RUN: llvm-profdata show %t.profraw --all-functions | FileCheck %s
 
 // RUN: %clang_profgen -fcoverage-mapping -ffunction-sections -Wl,--gc-sections %s -o %t
 // RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t
+// RUN: llvm-profdata show %t.profraw --all-functions | FileCheck %s
+
+// CHECK:      {{.*}}external{{.*}}:
+// CHECK-NEXT:    Hash:
+// CHECK-NEXT:    Counters: 1
+// CHECK-NEXT:    Function count: 1
+// CHECK:      {{.*}}weak{{.*}}:
+// CHECK-NEXT:    Hash:
+// CHECK-NEXT:    Counters: 1
+// CHECK-NEXT:    Function count: 1
+// CHECK:      main:
+// CHECK-NEXT:    Hash:
+// CHECK-NEXT:    Counters: 1
+// CHECK-NEXT:    Function count: 1
+// CHECK:      {{.*}}internal{{.*}}:
+// CHECK-NEXT:    Hash:
+// CHECK-NEXT:    Counters: 1
+// CHECK-NEXT:    Function count: 1
+// CHECK:      {{.*}}linkonce_odr{{.*}}:
+// CHECK-NEXT:    Hash:
+// CHECK-NEXT:    Counters: 1
+// CHECK-NEXT:    Function count: 1
 
 #include <stdio.h>