Skip to content

Commit e3f3e93

Browse files
authored
[test] Fix target-based reflection tests for real (#19098)
- Hard-link %target-swift-reflection-test into %t/ for %target-run implementations that copy executables, like remote-run. - Use DYLD_LIBRARY_PATH to undo that for %target-run implementations that run the executable in place (host and simulators) rdar://problem/43809613
1 parent 161819b commit e3f3e93

32 files changed

+41
-218
lines changed

validation-test/Reflection/existentials.swift

+1-8
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,11 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/existentials
33
// RUN: %target-codesign %t/existentials
4-
5-
// Link %target-swift-reflection-test into %t to convince %target-run to copy
6-
// it.
7-
// RUN: ln -s %target-swift-reflection-test %t/swift-reflection-test
8-
// RUN: %target-run %t/swift-reflection-test %t/existentials | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
4+
// RUN: %target-run-reflection-test %t/existentials | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
95

106
// REQUIRES: objc_interop
117
// REQUIRES: executable_test
128

13-
// FIXME: Handle different forms of %target-run more robustly
14-
// REQUIRES: OS=macosx
15-
169
/*
1710
This file pokes at the swift_reflection_projectExistential API
1811
of the SwiftRemoteMirror library.

validation-test/Reflection/functions.swift

+1-7
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,14 @@
22
// RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/functions
33
// RUN: %target-codesign %t/functions
44

5-
// Link %target-swift-reflection-test into %t to convince %target-run to copy
6-
// it.
7-
// RUN: ln -s %target-swift-reflection-test %t/swift-reflection-test
8-
// RUN: %target-run %t/swift-reflection-test %t/functions | %FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-ptrsize
5+
// RUN: %target-run-reflection-test %t/functions | %FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-ptrsize
96

107
// FIXME: Should not require objc_interop -- please put Objective-C-specific
118
// testcases in functions_objc.swift
129

1310
// REQUIRES: objc_interop
1411
// REQUIRES: executable_test
1512

16-
// FIXME: Handle different forms of %target-run more robustly
17-
// REQUIRES: OS=macosx
18-
1913
/*
2014
This file pokes at the swift_reflection_infoForInstance() API
2115
of the SwiftRemoteMirror library.

validation-test/Reflection/functions_objc.swift

+1-7
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,11 @@
33
// RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/functions
44
// RUN: %target-codesign %t/functions
55

6-
// Link %target-swift-reflection-test into %t to convince %target-run to copy
7-
// it.
8-
// RUN: ln -s %target-swift-reflection-test %t/swift-reflection-test
9-
// RUN: %target-run %t/swift-reflection-test %t/functions | %FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-ptrsize
6+
// RUN: %target-run-reflection-test %t/functions | %FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-ptrsize
107

118
// REQUIRES: objc_interop
129
// REQUIRES: executable_test
1310

14-
// FIXME: Handle different forms of %target-run more robustly
15-
// REQUIRES: OS=macosx
16-
1711
import SwiftReflectionTest
1812
import Foundation
1913
import CoreGraphics

validation-test/Reflection/inherits_NSObject.swift

+1-7
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,11 @@
22
// RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/inherits_NSObject
33
// RUN: %target-codesign %t/inherits_NSObject
44

5-
// Link %target-swift-reflection-test into %t to convince %target-run to copy
6-
// it.
7-
// RUN: ln -s %target-swift-reflection-test %t/swift-reflection-test
8-
// RUN: %target-run %t/swift-reflection-test %t/inherits_NSObject | %FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-ptrsize
5+
// RUN: %target-run-reflection-test %t/inherits_NSObject | %FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-ptrsize
96

107
// REQUIRES: objc_interop
118
// REQUIRES: executable_test
129

13-
// FIXME: Handle different forms of %target-run more robustly
14-
// REQUIRES: OS=macosx
15-
1610
import Foundation
1711
import simd
1812

validation-test/Reflection/inherits_ObjCClasses.swift

+1-7
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,12 @@
44
// RUN: %target-build-swift -I %S/Inputs/ObjCClasses/ -lswiftSwiftReflectionTest %t/ObjCClasses.o %s -o %t/inherits_ObjCClasses
55
// RUN: %target-codesign %t/inherits_ObjCClasses
66

7-
// Link %target-swift-reflection-test into %t to convince %target-run to copy
8-
// it.
9-
// RUN: ln -s %target-swift-reflection-test %t/swift-reflection-test
10-
// RUN: %target-run %t/swift-reflection-test %t/inherits_ObjCClasses | %FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-ptrsize
7+
// RUN: %target-run-reflection-test %t/inherits_ObjCClasses | %FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-ptrsize
118

129

1310
// REQUIRES: objc_interop
1411
// REQUIRES: executable_test
1512

16-
// FIXME: Handle different forms of %target-run more robustly
17-
// REQUIRES: OS=macosx
18-
1913
import simd
2014
import ObjCClasses
2115
import SwiftReflectionTest

validation-test/Reflection/inherits_Swift.swift

+1-7
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,12 @@
22
// RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/inherits_Swift
33
// RUN: %target-codesign %t/inherits_Swift
44

5-
// Link %target-swift-reflection-test into %t to convince %target-run to copy
6-
// it.
7-
// RUN: ln -s %target-swift-reflection-test %t/swift-reflection-test
8-
// RUN: %target-run %t/swift-reflection-test %t/inherits_Swift | %FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-ptrsize
5+
// RUN: %target-run-reflection-test %t/inherits_Swift | %FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-ptrsize
96

107

118
// REQUIRES: objc_interop
129
// REQUIRES: executable_test
1310

14-
// FIXME: Handle different forms of %target-run more robustly
15-
// REQUIRES: OS=macosx
16-
1711
import SwiftReflectionTest
1812

1913
class BaseClass {
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Make a local copy of the substitutions.
2+
config.substitutions = list(config.substitutions)
3+
4+
config.substitutions.insert(0, ("%target-run-reflection-test",
5+
# Link %target-swift-reflection-test into %t to convince %target-run to copy
6+
# it, then use DYLD_LIBRARY_PATH to make sure it can find SwiftRemoteMirrors
7+
# from its new location when /not/ run remotely.
8+
("ln %target-swift-reflection-test %t/swift-reflection-test && "
9+
"env %env-DYLD_LIBRARY_PATH=%platform-module-dir/../ %target-run "
10+
" %t/swift-reflection-test")))

validation-test/Reflection/reflect_Array.swift

+1-7
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,11 @@
22
// RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/reflect_Array
33
// RUN: %target-codesign %t/reflect_Array
44

5-
// Link %target-swift-reflection-test into %t to convince %target-run to copy
6-
// it.
7-
// RUN: ln -s %target-swift-reflection-test %t/swift-reflection-test
8-
// RUN: %target-run %t/swift-reflection-test %t/reflect_Array | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
5+
// RUN: %target-run-reflection-test %t/reflect_Array | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
96

107
// REQUIRES: objc_interop
118
// REQUIRES: executable_test
129

13-
// FIXME: Handle different forms of %target-run more robustly
14-
// REQUIRES: OS=macosx
15-
1610
import SwiftReflectionTest
1711

1812
class TestClass {

validation-test/Reflection/reflect_Bool.swift

+1-7
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,11 @@
22
// RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/reflect_Bool
33
// RUN: %target-codesign %t/reflect_Bool
44

5-
// Link %target-swift-reflection-test into %t to convince %target-run to copy
6-
// it.
7-
// RUN: ln -s %target-swift-reflection-test %t/swift-reflection-test
8-
// RUN: %target-run %t/swift-reflection-test %t/reflect_Bool | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
5+
// RUN: %target-run-reflection-test %t/reflect_Bool | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
96

107
// REQUIRES: objc_interop
118
// REQUIRES: executable_test
129

13-
// FIXME: Handle different forms of %target-run more robustly
14-
// REQUIRES: OS=macosx
15-
1610
import SwiftReflectionTest
1711

1812
class TestClass {

validation-test/Reflection/reflect_Character.swift

+1-7
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,11 @@
22
// RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/reflect_Character
33
// RUN: %target-codesign %t/reflect_Character
44

5-
// Link %target-swift-reflection-test into %t to convince %target-run to copy
6-
// it.
7-
// RUN: ln -s %target-swift-reflection-test %t/swift-reflection-test
8-
// RUN: %target-run %t/swift-reflection-test %t/reflect_Character | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
5+
// RUN: %target-run-reflection-test %t/reflect_Character | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
96

107
// REQUIRES: objc_interop
118
// REQUIRES: executable_test
129

13-
// FIXME: Handle different forms of %target-run more robustly
14-
// REQUIRES: OS=macosx
15-
1610
import SwiftReflectionTest
1711

1812
class TestClass {

validation-test/Reflection/reflect_Dictionary.swift

+1-7
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,11 @@
22
// RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/reflect_Dictionary
33
// RUN: %target-codesign %t/reflect_Dictionary
44

5-
// Link %target-swift-reflection-test into %t to convince %target-run to copy
6-
// it.
7-
// RUN: ln -s %target-swift-reflection-test %t/swift-reflection-test
8-
// RUN: %target-run %t/swift-reflection-test %t/reflect_Dictionary | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
5+
// RUN: %target-run-reflection-test %t/reflect_Dictionary | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
96

107
// REQUIRES: objc_interop
118
// REQUIRES: executable_test
129

13-
// FIXME: Handle different forms of %target-run more robustly
14-
// REQUIRES: OS=macosx
15-
1610
import SwiftReflectionTest
1711

1812
class TestClass {

validation-test/Reflection/reflect_Double.swift

+1-7
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,11 @@
22
// RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/reflect_Double
33
// RUN: %target-codesign %t/reflect_Double
44

5-
// Link %target-swift-reflection-test into %t to convince %target-run to copy
6-
// it.
7-
// RUN: ln -s %target-swift-reflection-test %t/swift-reflection-test
8-
// RUN: %target-run %t/swift-reflection-test %t/reflect_Double | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
5+
// RUN: %target-run-reflection-test %t/reflect_Double | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
96

107
// REQUIRES: objc_interop
118
// REQUIRES: executable_test
129

13-
// FIXME: Handle different forms of %target-run more robustly
14-
// REQUIRES: OS=macosx
15-
1610
import SwiftReflectionTest
1711

1812
class TestClass {

validation-test/Reflection/reflect_Float.swift

+1-7
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,11 @@
22
// RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/reflect_Float
33
// RUN: %target-codesign %t/reflect_Float
44

5-
// Link %target-swift-reflection-test into %t to convince %target-run to copy
6-
// it.
7-
// RUN: ln -s %target-swift-reflection-test %t/swift-reflection-test
8-
// RUN: %target-run %t/swift-reflection-test %t/reflect_Float | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
5+
// RUN: %target-run-reflection-test %t/reflect_Float | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
96

107
// REQUIRES: objc_interop
118
// REQUIRES: executable_test
129

13-
// FIXME: Handle different forms of %target-run more robustly
14-
// REQUIRES: OS=macosx
15-
1610
import SwiftReflectionTest
1711

1812
class TestClass {

validation-test/Reflection/reflect_Int.swift

+1-7
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,11 @@
22
// RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/reflect_Int
33
// RUN: %target-codesign %t/reflect_Int
44

5-
// Link %target-swift-reflection-test into %t to convince %target-run to copy
6-
// it.
7-
// RUN: ln -s %target-swift-reflection-test %t/swift-reflection-test
8-
// RUN: %target-run %t/swift-reflection-test %t/reflect_Int | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
5+
// RUN: %target-run-reflection-test %t/reflect_Int | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
96

107
// REQUIRES: objc_interop
118
// REQUIRES: executable_test
129

13-
// FIXME: Handle different forms of %target-run more robustly
14-
// REQUIRES: OS=macosx
15-
1610
import SwiftReflectionTest
1711

1812
class TestClass {

validation-test/Reflection/reflect_Int16.swift

+1-7
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,11 @@
22
// RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/reflect_Int16
33
// RUN: %target-codesign %t/reflect_Int16
44

5-
// Link %target-swift-reflection-test into %t to convince %target-run to copy
6-
// it.
7-
// RUN: ln -s %target-swift-reflection-test %t/swift-reflection-test
8-
// RUN: %target-run %t/swift-reflection-test %t/reflect_Int16 | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
5+
// RUN: %target-run-reflection-test %t/reflect_Int16 | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
96

107
// REQUIRES: objc_interop
118
// REQUIRES: executable_test
129

13-
// FIXME: Handle different forms of %target-run more robustly
14-
// REQUIRES: OS=macosx
15-
1610
import SwiftReflectionTest
1711

1812
class TestClass {

validation-test/Reflection/reflect_Int32.swift

+1-7
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,11 @@
22
// RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/reflect_Int32
33
// RUN: %target-codesign %t/reflect_Int32
44

5-
// Link %target-swift-reflection-test into %t to convince %target-run to copy
6-
// it.
7-
// RUN: ln -s %target-swift-reflection-test %t/swift-reflection-test
8-
// RUN: %target-run %t/swift-reflection-test %t/reflect_Int32 | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
5+
// RUN: %target-run-reflection-test %t/reflect_Int32 | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
96

107
// REQUIRES: objc_interop
118
// REQUIRES: executable_test
129

13-
// FIXME: Handle different forms of %target-run more robustly
14-
// REQUIRES: OS=macosx
15-
1610
import SwiftReflectionTest
1711

1812
class TestClass {

validation-test/Reflection/reflect_Int64.swift

+1-7
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,11 @@
22
// RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/reflect_Int64
33
// RUN: %target-codesign %t/reflect_Int64
44

5-
// Link %target-swift-reflection-test into %t to convince %target-run to copy
6-
// it.
7-
// RUN: ln -s %target-swift-reflection-test %t/swift-reflection-test
8-
// RUN: %target-run %t/swift-reflection-test %t/reflect_Int64 | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
5+
// RUN: %target-run-reflection-test %t/reflect_Int64 | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
96

107
// REQUIRES: objc_interop
118
// REQUIRES: executable_test
129

13-
// FIXME: Handle different forms of %target-run more robustly
14-
// REQUIRES: OS=macosx
15-
1610
import SwiftReflectionTest
1711

1812
class TestClass {

validation-test/Reflection/reflect_Int8.swift

+1-7
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,11 @@
22
// RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/reflect_Int8
33
// RUN: %target-codesign %t/reflect_Int8
44

5-
// Link %target-swift-reflection-test into %t to convince %target-run to copy
6-
// it.
7-
// RUN: ln -s %target-swift-reflection-test %t/swift-reflection-test
8-
// RUN: %target-run %t/swift-reflection-test %t/reflect_Int8 | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
5+
// RUN: %target-run-reflection-test %t/reflect_Int8 | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
96

107
// REQUIRES: objc_interop
118
// REQUIRES: executable_test
129

13-
// FIXME: Handle different forms of %target-run more robustly
14-
// REQUIRES: OS=macosx
15-
1610
import SwiftReflectionTest
1711

1812
class TestClass {

validation-test/Reflection/reflect_NSArray.swift

+1-7
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,11 @@
22
// RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/reflect_NSArray
33
// RUN: %target-codesign %t/reflect_NSArray
44

5-
// Link %target-swift-reflection-test into %t to convince %target-run to copy
6-
// it.
7-
// RUN: ln -s %target-swift-reflection-test %t/swift-reflection-test
8-
// RUN: %target-run %t/swift-reflection-test %t/reflect_NSArray | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
5+
// RUN: %target-run-reflection-test %t/reflect_NSArray | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
96

107
// REQUIRES: objc_interop
118
// REQUIRES: executable_test
129

13-
// FIXME: Handle different forms of %target-run more robustly
14-
// REQUIRES: OS=macosx
15-
1610
import SwiftReflectionTest
1711
import Foundation
1812

validation-test/Reflection/reflect_NSNumber.swift

+1-7
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,11 @@
22
// RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/reflect_NSNumber
33
// RUN: %target-codesign %t/reflect_NSNumber
44

5-
// Link %target-swift-reflection-test into %t to convince %target-run to copy
6-
// it.
7-
// RUN: ln -s %target-swift-reflection-test %t/swift-reflection-test
8-
// RUN: %target-run %t/swift-reflection-test %t/reflect_NSNumber | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
5+
// RUN: %target-run-reflection-test %t/reflect_NSNumber | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
96

107
// REQUIRES: objc_interop
118
// REQUIRES: executable_test
129

13-
// FIXME: Handle different forms of %target-run more robustly
14-
// REQUIRES: OS=macosx
15-
1610
import SwiftReflectionTest
1711
import Foundation
1812

validation-test/Reflection/reflect_NSSet.swift

+1-7
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,11 @@
22
// RUN: %target-build-swift -lswiftSwiftReflectionTest %s -o %t/reflect_NSSet
33
// RUN: %target-codesign %t/reflect_NSSet
44

5-
// Link %target-swift-reflection-test into %t to convince %target-run to copy
6-
// it.
7-
// RUN: ln -s %target-swift-reflection-test %t/swift-reflection-test
8-
// RUN: %target-run %t/swift-reflection-test %t/reflect_NSSet | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
5+
// RUN: %target-run-reflection-test %t/reflect_NSSet | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
96

107
// REQUIRES: objc_interop
118
// REQUIRES: executable_test
129

13-
// FIXME: Handle different forms of %target-run more robustly
14-
// REQUIRES: OS=macosx
15-
1610
import SwiftReflectionTest
1711
import Foundation
1812

0 commit comments

Comments
 (0)