|
1 | 1 | // RUN: rm -rf %t && mkdir %t
|
2 |
| -// RUN: %target-build-swift %s -profile-generate -profile-coverage-mapping -o %t/main |
| 2 | +// RUN: %target-build-swift %s -profile-generate -profile-coverage-mapping -Xfrontend -disable-incremental-llvm-codegen -o %t/main |
3 | 3 | // RUN: env LLVM_PROFILE_FILE=%t/default.profraw %target-run %t/main
|
4 | 4 | // RUN: %llvm-profdata merge %t/default.profraw -o %t/default.profdata
|
5 |
| -// RUN: %llvm-profdata show %t/default.profdata -function=main | FileCheck %s --check-prefix=CHECK-PROF |
| 5 | +// RUN: %llvm-profdata show %t/default.profdata -function=f_internal | FileCheck %s --check-prefix=CHECK-INTERNAL |
| 6 | +// RUN: %llvm-profdata show %t/default.profdata -function=f_private | FileCheck %s --check-prefix=CHECK-PRIVATE |
| 7 | +// RUN: %llvm-profdata show %t/default.profdata -function=f_public | FileCheck %s --check-prefix=CHECK-PUBLIC |
| 8 | +// RUN: %llvm-profdata show %t/default.profdata -function=main | FileCheck %s --check-prefix=CHECK-MAIN |
6 | 9 | // RUN: %llvm-cov show %t/main -instr-profile=%t/default.profdata | FileCheck %s --check-prefix=CHECK-COV
|
7 | 10 | // RUN: rm -rf %t
|
8 | 11 |
|
9 | 12 | // REQUIRES: profile_runtime
|
10 | 13 | // REQUIRES: OS=macosx
|
11 | 14 | // XFAIL: asan
|
12 | 15 |
|
| 16 | +// CHECK-INTERNAL: Functions shown: 1 |
| 17 | +// CHECK-COV: 1|{{.*}}[[@LINE+1]]|{{.*}}func f_internal |
| 18 | +internal func f_internal() {} |
| 19 | + |
| 20 | +// CHECK-PRIVATE: Functions shown: 1 |
| 21 | +// CHECK-COV: 1|{{.*}}[[@LINE+1]]|{{.*}}func f_private |
| 22 | +private func f_private() { f_internal() } |
| 23 | + |
| 24 | +// CHECK-PUBLIC: Functions shown: 1 |
| 25 | +// CHECK-COV: 1|{{.*}}[[@LINE+1]]|{{.*}}func f_public |
| 26 | +public func f_public() { f_private() } |
| 27 | + |
| 28 | +class Class1 { |
| 29 | + var Field1 = 0 |
| 30 | + |
| 31 | +// CHECK-COV: 1|{{.*}}[[@LINE+1]]|{{.*}}init |
| 32 | + init() {} |
| 33 | + |
| 34 | +// CHECK-COV: 1|{{.*}}[[@LINE+1]]|{{.*}}deinit |
| 35 | + deinit {} |
| 36 | +} |
| 37 | + |
| 38 | +// CHECK-MAIN: Maximum function count: 1 |
13 | 39 | func main() {
|
14 |
| -// CHECK-PROF: Counters: 2 |
15 |
| -// CHECK-PROF: Function count: 1 |
| 40 | +// CHECK-COV: 1|{{.*}}[[@LINE+1]]|{{.*}}f_public |
| 41 | + f_public() |
| 42 | + |
16 | 43 | // CHECK-COV: 1|{{.*}}[[@LINE+1]]|{{.*}}if (true)
|
17 | 44 | if (true) {}
|
| 45 | + |
| 46 | + var x : Int32 = 0 |
| 47 | + while (x < 10) { |
| 48 | +// CHECK-COV: 10|{{.*}}[[@LINE+1]]|{{.*}}x += 1 |
| 49 | + x += 1 |
| 50 | + } |
| 51 | + |
| 52 | +// CHECK-COV: 1|{{.*}}[[@LINE+1]]|{{.*}}Class1 |
| 53 | + let _ = Class1() |
18 | 54 | }
|
19 | 55 |
|
20 | 56 | main()
|
0 commit comments