Skip to content

Commit d643b22

Browse files
authored
Merge pull request #61200 from hamishknight/regression-test
2 parents 009f65e + 372b7b0 commit d643b22

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

test/Profiler/issue-42929.swift

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: %target-build-swift %s -profile-generate -profile-coverage-mapping -o %t/main
3+
4+
// This unusual use of 'sh' allows the path of the profraw file to be
5+
// substituted by %target-run.
6+
// RUN: %target-codesign %t/main
7+
// RUN: %target-run sh -c 'env LLVM_PROFILE_FILE=$1 $2' -- %t/default.profraw %t/main
8+
9+
// RUN: %llvm-profdata merge %t/default.profraw -o %t/default.profdata
10+
// RUN: %llvm-cov export -summary-only %t/main -instr-profile=%t/default.profdata | %FileCheck %s
11+
12+
// REQUIRES: profile_runtime
13+
// REQUIRES: executable_test
14+
// REQUIRES: objc_interop
15+
// REQUIRES: OS=macosx
16+
17+
// https://github.com/apple/swift/issues/42929
18+
19+
// There are actually only 14 lines here, but llvm-cov doesn't handle closures
20+
// properly (rdar://90348983).
21+
// CHECK: "lines":{"count":18,"covered":18{{.*}}"functions":{"count":7,"covered":7
22+
23+
import Foundation
24+
25+
func foo(_ x: @autoclosure () -> Bool) { _ = x() }
26+
27+
func bar() {
28+
foo(.random())
29+
foo(.random())
30+
31+
class C : NSObject {
32+
class D : NSObject {
33+
}
34+
}
35+
36+
foo(.random())
37+
foo(.random())
38+
}
39+
bar()

0 commit comments

Comments
 (0)