[test] Enable some profiler tests on non-macOS

This commit is contained in:
Hamish Knight
2024-07-30 22:44:57 +01:00
parent 8b7a75c8f3
commit 3325296401
19 changed files with 29 additions and 84 deletions

View File

@@ -1,17 +1,14 @@
// RUN: %empty-directory(%t)
// RUN: %target-build-swift %s -profile-generate -profile-coverage-mapping -o %t/main
// This unusual use of 'sh' allows the path of the profraw file to be
// substituted by %target-run.
// RUN: %target-codesign %t/main
// RUN: %target-run sh -c 'env LLVM_PROFILE_FILE=$1 $2' -- %t/default.profraw %t/main
// RUN: env %env-LLVM_PROFILE_FILE=%t/default.profraw %target-run %t/main
// RUN: %llvm-profdata merge %t/default.profraw -o %t/default.profdata
// RUN: %llvm-cov show %t/main -instr-profile=%t/default.profdata | %FileCheck %s
// REQUIRES: profile_runtime
// REQUIRES: executable_test
// REQUIRES: OS=macosx
struct Err: Error {}

View File

@@ -2,17 +2,14 @@
// RUN: %target-build-swift %s -profile-generate -profile-coverage-mapping -O -o %t/main
// This unusual use of 'sh' allows the path of the profraw file to be
// substituted by %target-run.
// RUN: %target-codesign %t/main
// RUN: %target-run sh -c 'env LLVM_PROFILE_FILE=$1 $2' -- %t/default.profraw %t/main
// RUN: env %env-LLVM_PROFILE_FILE=%t/default.profraw %target-run %t/main
// RUN: %llvm-profdata merge %t/default.profraw -o %t/default.profdata
// RUN: %llvm-cov export -summary-only %t/main -instr-profile=%t/default.profdata | %FileCheck %s
// REQUIRES: profile_runtime
// REQUIRES: executable_test
// REQUIRES: OS=macosx
// CHECK: "lines":{"count":9,"covered":5{{.*}}"functions":{"count":5,"covered":3

View File

@@ -2,10 +2,8 @@
// RUN: %target-build-swift %s -profile-generate -profile-coverage-mapping -o %t/main
// This unusual use of 'sh' allows the path of the profraw file to be
// substituted by %target-run.
// RUN: %target-codesign %t/main
// RUN: %target-run sh -c 'env LLVM_PROFILE_FILE=$1 $2' -- %t/default.profraw %t/main
// RUN: env %env-LLVM_PROFILE_FILE=%t/default.profraw %target-run %t/main
// RUN: %llvm-profdata merge %t/default.profraw -o %t/default.profdata
// RUN: %llvm-cov export -summary-only %t/main -instr-profile=%t/default.profdata | %FileCheck --check-prefix SUMMARY %s
@@ -13,7 +11,6 @@
// REQUIRES: profile_runtime
// REQUIRES: executable_test
// REQUIRES: OS=macosx
// The line count here excludes the inactive regions.
// SUMMARY: "lines":{"count":41,"covered":0

View File

@@ -1,6 +1,5 @@
// REQUIRES: profile_runtime
// REQUIRES: executable_test
// REQUIRES: OS=macosx
// This test is to make sure llvm-cov can deal with a coverage-prefix-map.
@@ -14,10 +13,8 @@
// RUN: %target-build-swift -profile-generate -profile-coverage-mapping -Xfrontend -coverage-prefix-map -Xfrontend %t/root=. -Xfrontend -disable-incremental-llvm-codegen -o %t/main %t/root/nested/coverage_relative_path.swift
// This unusual use of 'sh' allows the path of the profraw file to be
// substituted by %target-run.
// RUN: %target-codesign %t/main
// RUN: %target-run sh -c 'env LLVM_PROFILE_FILE=$1 $2' -- %t/default.profraw %t/main
// RUN: env %env-LLVM_PROFILE_FILE=%t/default.profraw %target-run %t/main
// RUN: %llvm-profdata merge %t/default.profraw -o %t/default.profdata
// RUN: %llvm-cov show %t/main -instr-profile=%t/default.profdata | %FileCheck --check-prefix SHOW %s

View File

@@ -1,10 +1,8 @@
// RUN: %empty-directory(%t)
// RUN: %target-build-swift %s -profile-generate -profile-coverage-mapping -Xfrontend -disable-incremental-llvm-codegen -o %t/main
// This unusual use of 'sh' allows the path of the profraw file to be
// substituted by %target-run.
// RUN: %target-codesign %t/main
// RUN: %target-run sh -c 'env LLVM_PROFILE_FILE=$1 $2' -- %t/default.profraw %t/main
// RUN: env %env-LLVM_PROFILE_FILE=%t/default.profraw %target-run %t/main
// RUN: %llvm-profdata merge %t/default.profraw -o %t/default.profdata
// RUN: %llvm-profdata show %t/default.profdata -function=f_internal | %FileCheck %s --check-prefix=CHECK-INTERNAL
@@ -16,7 +14,6 @@
// REQUIRES: profile_runtime
// REQUIRES: executable_test
// REQUIRES: OS=macosx
// CHECK-INTERNAL: Functions shown: 1
// CHECK-COV: {{ *}}[[@LINE+1]]|{{ *}}1{{.*}}func f_internal

View File

@@ -1,7 +1,5 @@
// RUN: %target-swift-frontend %s -profile-generate -profile-coverage-mapping -sanitize=address -emit-ir -o - | %FileCheck %s
// RUN: %target-swift-frontend -profile-generate -profile-coverage-mapping -emit-ir %s
// REQUIRES: OS=macosx
// CHECK: main
func main() {}

View File

@@ -1,10 +1,8 @@
// RUN: %empty-directory(%t)
// RUN: %target-build-swift %s -profile-generate -profile-coverage-mapping -o %t/main
// This unusual use of 'sh' allows the path of the profraw file to be
// substituted by %target-run.
// RUN: %target-codesign %t/main
// RUN: %target-run sh -c 'env LLVM_PROFILE_FILE=$1 $2' -- %t/default.profraw %t/main
// RUN: env %env-LLVM_PROFILE_FILE=%t/default.profraw %target-run %t/main
// RUN: %llvm-profdata merge %t/default.profraw -o %t/default.profdata
// RUN: %llvm-cov export -summary-only %t/main -instr-profile=%t/default.profdata | %FileCheck %s

View File

@@ -2,10 +2,8 @@
// RUN: %empty-directory(%t)
// RUN: %target-build-swift %s -profile-generate -Xfrontend -disable-incremental-llvm-codegen -module-name pgo_checked_cast -o %t/main
// This unusual use of 'sh' allows the path of the profraw file to be
// substituted by %target-run.
// RUN: %target-codesign %t/main
// RUN: %target-run sh -c 'env LLVM_PROFILE_FILE=$1 $2' -- %t/default.profraw %t/main
// RUN: env %env-LLVM_PROFILE_FILE=%t/default.profraw %target-run %t/main
// RUN: %llvm-profdata merge %t/default.profraw -o %t/default.profdata
// RUN: %target-swift-frontend %s -Xllvm -sil-full-demangle -profile-use=%t/default.profdata -emit-sorted-sil -emit-sil -module-name pgo_checked_cast -o - | %FileCheck %s --check-prefix=SIL
@@ -17,7 +15,6 @@
// REQUIRES: profile_runtime
// REQUIRES: executable_test
// REQUIRES: OS=macosx
// SIL-LABEL: // pgo_checked_cast.check1<A>(Any, A) -> A
// SIL-LABEL: sil @$s16pgo_checked_cast6check1yxyp_xtlF : $@convention(thin) <T> (@in_guaranteed Any, @in_guaranteed T) -> @out T !function_entry_count(5001) {

View File

@@ -1,10 +1,8 @@
// RUN: %empty-directory(%t)
// RUN: %target-build-swift %s -profile-generate -Xfrontend -disable-incremental-llvm-codegen -module-name pgo_foreach -o %t/main
// This unusual use of 'sh' allows the path of the profraw file to be
// substituted by %target-run.
// RUN: %target-codesign %t/main
// RUN: %target-run sh -c 'env LLVM_PROFILE_FILE=$1 $2' -- %t/default.profraw %t/main
// RUN: env %env-LLVM_PROFILE_FILE=%t/default.profraw %target-run %t/main
// RUN: %llvm-profdata merge %t/default.profraw -o %t/default.profdata
// need to move counts attached to expr for this
@@ -18,7 +16,6 @@
// REQUIRES: profile_runtime
// REQUIRES: executable_test
// REQUIRES: OS=macosx
// UNSUPPORTED: swift_test_mode_optimize_none_with_implicit_dynamic

View File

@@ -1,10 +1,8 @@
// RUN: %empty-directory(%t)
// RUN: %target-build-swift %s -profile-generate -Xfrontend -disable-incremental-llvm-codegen -module-name pgo_guard -o %t/main
// This unusual use of 'sh' allows the path of the profraw file to be
// substituted by %target-run.
// RUN: %target-codesign %t/main
// RUN: %target-run sh -c 'env LLVM_PROFILE_FILE=$1 $2' -- %t/default.profraw %t/main
// RUN: env %env-LLVM_PROFILE_FILE=%t/default.profraw %target-run %t/main
// RUN: %llvm-profdata merge %t/default.profraw -o %t/default.profdata
// RUN: %target-swift-frontend %s -Xllvm -sil-full-demangle -profile-use=%t/default.profdata -emit-sorted-sil -emit-sil -module-name pgo_guard -o - | %FileCheck %s --check-prefix=SIL
@@ -14,12 +12,11 @@
// REQUIRES: profile_runtime
// REQUIRES: executable_test
// REQUIRES: OS=macosx
// SIL-LABEL: // pgo_guard.guess1
// SIL-LABEL: sil @$s9pgo_guard6guess11xs5Int32VAE_tF : $@convention(thin) (Int32) -> Int32 !function_entry_count(5002) {
// IR-LABEL: define swiftcc i32 @"$s9pgo_guard6guess11xs5Int32VAE_tF"
// IR-OPT-LABEL: define swiftcc{{.*}} i32 @"$s9pgo_guard6guess11xs5Int32VAE_tF"
// IR-LABEL: define {{.*}} i32 @"$s9pgo_guard6guess11xs5Int32VAE_tF"
// IR-OPT-LABEL: define {{.*}} i32 @"$s9pgo_guard6guess11xs5Int32VAE_tF"
public func guess1(x: Int32) -> Int32 {
// SIL: cond_br {{.*}} !true_count(5000) !false_count(2)

View File

@@ -1,10 +1,8 @@
// RUN: %empty-directory(%t)
// RUN: %target-build-swift %s -profile-generate -Xfrontend -disable-incremental-llvm-codegen -module-name pgo_if -o %t/main
// This unusual use of 'sh' allows the path of the profraw file to be
// substituted by %target-run.
// RUN: %target-codesign %t/main
// RUN: %target-run sh -c 'env LLVM_PROFILE_FILE=$1 $2' -- %t/default.profraw %t/main
// RUN: env %env-LLVM_PROFILE_FILE=%t/default.profraw %target-run %t/main
// RUN: %llvm-profdata merge %t/default.profraw -o %t/default.profdata
// RUN: %target-swift-frontend %s -Xllvm -sil-full-demangle -profile-use=%t/default.profdata -emit-sorted-sil -emit-sil -module-name pgo_if -o - | %FileCheck %s --check-prefix=SIL
@@ -13,13 +11,12 @@
// RUN: %target-swift-frontend %s -Xllvm -sil-full-demangle -profile-use=%t/default.profdata -O -emit-ir -module-name pgo_if -o - | %FileCheck %s --check-prefix=IR-OPT
// REQUIRES: profile_runtime
// REQUIRES: OS=macosx
// REQUIRES: executable_test
// SIL-LABEL: // pgo_if.guess1
// SIL-LABEL: sil @$s6pgo_if6guess11xs5Int32VAE_tF : $@convention(thin) (Int32) -> Int32 !function_entry_count(5001) {
// IR-LABEL: define swiftcc i32 @"$s6pgo_if6guess11xs5Int32VAE_tF"
// IR-OPT-LABEL: define swiftcc{{.*}} i32 @"$s6pgo_if6guess11xs5Int32VAE_tF"
// IR-LABEL: define {{.*}} i32 @"$s6pgo_if6guess11xs5Int32VAE_tF"
// IR-OPT-LABEL: define {{.*}} i32 @"$s6pgo_if6guess11xs5Int32VAE_tF"
public func guess1(x: Int32) -> Int32 {
// SIL: cond_br {{.*}} !true_count(5000) !false_count(1)
// SIL-OPT: cond_br {{.*}} !true_count(5000) !false_count(1)
@@ -34,8 +31,8 @@ public func guess1(x: Int32) -> Int32 {
// SIL-LABEL: // pgo_if.guess2
// SIL-LABEL: sil @$s6pgo_if6guess21xs5Int32VAE_tF : $@convention(thin) (Int32) -> Int32 !function_entry_count(5001) {
// IR-LABEL: define swiftcc i32 @"$s6pgo_if6guess21xs5Int32VAE_tF"
// IR-OPT-LABEL: define swiftcc{{.*}} i32 @"$s6pgo_if6guess21xs5Int32VAE_tF"
// IR-LABEL: define {{.*}} i32 @"$s6pgo_if6guess21xs5Int32VAE_tF"
// IR-OPT-LABEL: define {{.*}} i32 @"$s6pgo_if6guess21xs5Int32VAE_tF"
public func guess2(x: Int32) -> Int32 {
// SIL: cond_br {{.*}} !true_count(5000) !false_count(1)
// SIL-OPT: cond_br {{.*}} !true_count(5000) !false_count(1)

View File

@@ -1,10 +1,8 @@
// RUN: %empty-directory(%t)
// RUN: %target-build-swift %s -profile-generate -Xfrontend -disable-incremental-llvm-codegen -module-name pgo_lazy -o %t/main
// This unusual use of 'sh' allows the path of the profraw file to be
// substituted by %target-run.
// RUN: %target-codesign %t/main
// RUN: %target-run sh -c 'env LLVM_PROFILE_FILE=$1 $2' -- %t/default.profraw %t/main
// RUN: env %env-LLVM_PROFILE_FILE=%t/default.profraw %target-run %t/main
// RUN: %llvm-profdata merge %t/default.profraw -o %t/default.profdata
@@ -15,7 +13,6 @@
// REQUIRES: profile_runtime
// REQUIRES: executable_test
// REQUIRES: OS=macosx
var cond = true

View File

@@ -1,10 +1,8 @@
// RUN: %empty-directory(%t)
// RUN: %target-build-swift %s -profile-generate -Xfrontend -disable-incremental-llvm-codegen -module-name pgo_repeatwhile -o %t/main
// This unusual use of 'sh' allows the path of the profraw file to be
// substituted by %target-run.
// RUN: %target-codesign %t/main
// RUN: %target-run sh -c 'env LLVM_PROFILE_FILE=$1 $2' -- %t/default.profraw %t/main
// RUN: env %env-LLVM_PROFILE_FILE=%t/default.profraw %target-run %t/main
// RUN: %llvm-profdata merge %t/default.profraw -o %t/default.profdata
// RUN: %target-swift-frontend %s -Xllvm -sil-full-demangle -profile-use=%t/default.profdata -emit-sorted-sil -emit-sil -module-name pgo_repeatwhile -o - | %FileCheck %s --check-prefix=SIL
@@ -15,12 +13,11 @@
// REQUIRES: profile_runtime
// REQUIRES: executable_test
// REQUIRES: OS=macosx
// SIL-LABEL: // pgo_repeatwhile.guessWhile
// SIL-LABEL: sil @$s15pgo_repeatwhile10guessWhile1xs5Int32VAE_tF : $@convention(thin) (Int32) -> Int32 !function_entry_count(42) {
// IR-LABEL: define swiftcc i32 @"$s15pgo_repeatwhile10guessWhile1xs5Int32VAE_tF"
// IR-OPT-LABEL: define swiftcc i32 @"$s15pgo_repeatwhile10guessWhile1xs5Int32VAE_tF"
// IR-LABEL: define {{.*}} i32 @"$s15pgo_repeatwhile10guessWhile1xs5Int32VAE_tF"
// IR-OPT-LABEL: define {{.*}} i32 @"$s15pgo_repeatwhile10guessWhile1xs5Int32VAE_tF"
public func guessWhile(x: Int32) -> Int32 {
// SIL: cond_br {{.*}} !true_count(176400) !false_count(420)

View File

@@ -2,10 +2,8 @@
// RUN: %empty-directory(%t)
// RUN: %target-build-swift %s -profile-generate -Xfrontend -disable-incremental-llvm-codegen -module-name pgo_switchenum -o %t/main
// This unusual use of 'sh' allows the path of the profraw file to be
// substituted by %target-run.
// RUN: %target-codesign %t/main
// RUN: %target-run sh -c 'env LLVM_PROFILE_FILE=$1 $2' -- %t/default.profraw %t/main
// RUN: env %env-LLVM_PROFILE_FILE=%t/default.profraw %target-run %t/main
// RUN: %llvm-profdata merge %t/default.profraw -o %t/default.profdata
// need to move counts attached to expr for this
@@ -19,7 +17,6 @@
// REQUIRES: profile_runtime
// REQUIRES: executable_test
// REQUIRES: OS=macosx
public enum MaybePair {
case Neither

View File

@@ -1,10 +1,8 @@
// RUN: %empty-directory(%t)
// RUN: %target-build-swift %s -profile-generate -Xfrontend -disable-incremental-llvm-codegen -module-name pgo_while -o %t/main
// This unusual use of 'sh' allows the path of the profraw file to be
// substituted by %target-run.
// RUN: %target-codesign %t/main
// RUN: %target-run sh -c 'env LLVM_PROFILE_FILE=$1 $2' -- %t/default.profraw %t/main
// RUN: env %env-LLVM_PROFILE_FILE=%t/default.profraw %target-run %t/main
// RUN: %llvm-profdata merge %t/default.profraw -o %t/default.profdata
// RUN: %target-swift-frontend %s -Xllvm -sil-full-demangle -profile-use=%t/default.profdata -emit-sorted-sil -emit-sil -module-name pgo_while -o - | %FileCheck %s --check-prefix=SIL
@@ -15,12 +13,11 @@
// REQUIRES: profile_runtime
// REQUIRES: executable_test
// REQUIRES: OS=macosx
// SIL-LABEL: // pgo_while.guessWhile
// SIL-LABEL: sil @$s9pgo_while10guessWhile1xs5Int32VAE_tF : $@convention(thin) (Int32) -> Int32 !function_entry_count(42) {
// IR-LABEL: define swiftcc i32 @"$s9pgo_while10guessWhile1xs5Int32VAE_tF"
// IR-OPT-LABEL: define swiftcc i32 @"$s9pgo_while10guessWhile1xs5Int32VAE_tF"
// IR-LABEL: define {{.*}} i32 @"$s9pgo_while10guessWhile1xs5Int32VAE_tF"
// IR-OPT-LABEL: define {{.*}} i32 @"$s9pgo_while10guessWhile1xs5Int32VAE_tF"
public func guessWhile(x: Int32) -> Int32 {
// SIL: cond_br {{.*}} !true_count(420) !false_count(42)

View File

@@ -1,10 +1,8 @@
// RUN: %empty-directory(%t)
// RUN: %target-build-swift %s -profile-generate -Xfrontend -disable-incremental-llvm-codegen -module-name pgo_with_coverage -o %t/main
// This unusual use of 'sh' allows the path of the profraw file to be
// substituted by %target-run.
// RUN: %target-codesign %t/main
// RUN: %target-run sh -c 'env LLVM_PROFILE_FILE=$1 $2' -- %t/default.profraw %t/main
// RUN: env %env-LLVM_PROFILE_FILE=%t/default.profraw %target-run %t/main
// RUN: %llvm-profdata merge %t/default.profraw -o %t/default.profdata
@@ -13,7 +11,6 @@
// REQUIRES: profile_runtime
// REQUIRES: executable_test
// REQUIRES: OS=macosx
// Make sure we don't try and profile implicit decls during PGO.
// IR-NOT: no profile data available

View File

@@ -10,12 +10,10 @@
// RUN: %target-build-swift %s -profile-generate -profile-coverage-mapping -O -Xfrontend -disable-sil-perf-optzns -Xfrontend -disable-new-llvm-pass-manager -o %t/main1
// RUN: %target-build-swift %s -profile-generate -profile-coverage-mapping -O -Xfrontend -disable-sil-perf-optzns -Xfrontend -enable-new-llvm-pass-manager -o %t/main2
// This unusual use of 'sh' allows the path of the profraw file to be
// substituted by %target-run.
// RUN: %target-codesign %t/main1
// RUN: %target-codesign %t/main2
// RUN: %target-run sh -c 'env LLVM_PROFILE_FILE=$1 $2' -- %t/default1.profraw %t/main1
// RUN: %target-run sh -c 'env LLVM_PROFILE_FILE=$1 $2' -- %t/default2.profraw %t/main2
// RUN: env %env-LLVM_PROFILE_FILE=%t/default1.profraw %target-run %t/main1
// RUN: env %env-LLVM_PROFILE_FILE=%t/default2.profraw %target-run %t/main2
// RUN: %llvm-profdata merge %t/default1.profraw -o %t/default1.profdata
// RUN: %llvm-profdata merge %t/default2.profraw -o %t/default2.profdata
@@ -25,7 +23,6 @@
// REQUIRES: profile_runtime
// REQUIRES: executable_test
// REQUIRES: OS=macosx
sil_stage canonical

View File

@@ -1,10 +1,8 @@
// RUN: %empty-directory(%t)
// RUN: %target-build-swift %s -profile-generate -Xfrontend -disable-incremental-llvm-codegen -module-name pgo_si_inlinelarge -o %t/main
// This unusual use of 'sh' allows the path of the profraw file to be
// substituted by %target-run.
// RUN: %target-codesign %t/main
// RUN: %target-run sh -c 'env LLVM_PROFILE_FILE=$1 $2' -- %t/default.profraw %t/main
// RUN: env %env-LLVM_PROFILE_FILE=%t/default.profraw %target-run %t/main
// RUN: %llvm-profdata merge %t/default.profraw -o %t/default.profdata
// RUN: %target-swift-frontend %s -profile-use=%t/default.profdata -emit-sorted-sil -emit-sil -module-name pgo_si_inlinelarge -o - | %FileCheck %s --check-prefix=SIL
@@ -12,7 +10,6 @@
// REQUIRES: profile_runtime
// REQUIRES: executable_test
// REQUIRES: OS=macosx
public func bar(_ x: Int64) -> Int64 {
if (x == 0) {

View File

@@ -1,10 +1,8 @@
// RUN: %empty-directory(%t)
// RUN: %target-build-swift %s -profile-generate -Xfrontend -disable-incremental-llvm-codegen -module-name pgo_si_reduce -o %t/main
// This unusual use of 'sh' allows the path of the profraw file to be
// substituted by %target-run.
// RUN: %target-codesign %t/main
// RUN: %target-run sh -c 'env LLVM_PROFILE_FILE=$1 $2' -- %t/default.profraw %t/main
// RUN: env %env-LLVM_PROFILE_FILE=%t/default.profraw %target-run %t/main
// RUN: %llvm-profdata merge %t/default.profraw -o %t/default.profdata
// RUN: %target-swift-frontend %s -profile-use=%t/default.profdata -emit-sorted-sil -emit-sil -module-name pgo_si_reduce -o - | %FileCheck %s --check-prefix=SIL
@@ -12,7 +10,6 @@
// REQUIRES: profile_runtime
// REQUIRES: executable_test
// REQUIRES: OS=macosx
public func bar(_ x: Int32) -> Int32 {
if (x == 0) {