Skip to content

Commit 720167f

Browse files
committed
[Coverage] Improve end-to-end test
1 parent 2a49d82 commit 720167f

File tree

1 file changed

+40
-4
lines changed

1 file changed

+40
-4
lines changed

test/SILGen/coverage_smoke.swift

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,56 @@
11
// 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
33
// RUN: env LLVM_PROFILE_FILE=%t/default.profraw %target-run %t/main
44
// 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
69
// RUN: %llvm-cov show %t/main -instr-profile=%t/default.profdata | FileCheck %s --check-prefix=CHECK-COV
710
// RUN: rm -rf %t
811

912
// REQUIRES: profile_runtime
1013
// REQUIRES: OS=macosx
1114
// XFAIL: asan
1215

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
1339
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+
1643
// CHECK-COV: 1|{{.*}}[[@LINE+1]]|{{.*}}if (true)
1744
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()
1854
}
1955

2056
main()

0 commit comments

Comments
 (0)