Skip to content

Commit bb059ea

Browse files
authored
Merge pull request #32443 from keith/ks/improve-coverage-test-naming
Improve coverage test naming
2 parents fcfacdd + 4b219f5 commit bb059ea

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed
Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
1-
// %s expands to an absolute path, so to test relative paths we need to create a
2-
// clean directory, put the source there, and cd into it.
1+
// To make sure this test is resilient to directory changes, we create nested directories inside of the
2+
// temporary test directory and assert those exist, or don't exist, in the emitted ir
3+
//
34
// RUN: rm -rf %t
4-
// RUN: mkdir -p %t/foo/bar/baz
5-
// RUN: echo "func coverage() {}" > %t/foo/bar/baz/coverage_relative_path.swift
6-
// RUN: cd %t/foo/bar
5+
// RUN: mkdir -p %t/root/nested
6+
// RUN: echo "func coverage() {}" > %t/root/nested/coverage_relative_path.swift
7+
// RUN: cd %t/root
78

8-
// RUN: %target-swift-frontend -profile-generate -profile-coverage-mapping -Xllvm -enable-name-compression=false -emit-ir %/t/foo/bar/baz/coverage_relative_path.swift | %FileCheck -check-prefix=ABSOLUTE %s
9+
// RUN: %target-swift-frontend -profile-generate -profile-coverage-mapping -Xllvm -enable-name-compression=false -emit-ir nested/coverage_relative_path.swift | %FileCheck -check-prefix=ABSOLUTE %s
910
//
10-
// ABSOLUTE: @__llvm_coverage_mapping = {{.*"\\01.*foo.*bar.*baz.*coverage_relative_path\.swift}}
11+
// ABSOLUTE: @__llvm_coverage_mapping = {{.*"\\01.*root.*nested.*coverage_relative_path\.swift}}
1112

12-
// RUN: %target-swift-frontend -profile-generate -profile-coverage-mapping -Xllvm -enable-name-compression=false -coverage-prefix-map %/t/foo/bar=. -emit-ir %/t/foo/bar/baz/coverage_relative_path.swift | %FileCheck -check-prefix=RELATIVE %s
13+
// RUN: %target-swift-frontend -profile-generate -profile-coverage-mapping -Xllvm -enable-name-compression=false -coverage-prefix-map %/t/root=. -emit-ir %/t/root/nested/coverage_relative_path.swift | %FileCheck -check-prefix=RELATIVE %s
1314
//
14-
// RELATIVE: @__llvm_coverage_mapping = {{.*"\\01[^/]*}}.{{/|\\}}baz{{.*coverage_relative_path\.swift}}
15-
16-
func coverage() {}
15+
// RELATIVE: @__llvm_coverage_mapping = {{.*"\\01[^/]*}}.{{/|\\}}nested{{.*coverage_relative_path\.swift}}

0 commit comments

Comments
 (0)