Skip to content

Commit ee86a80

Browse files
authored
Merge pull request #82419 from swiftlang/egorzhdan/6.2-old-runtime-tests
🍒[cxx-interop] Disable test with an older runtime
2 parents 1d1f9b0 + 45b8045 commit ee86a80

File tree

5 files changed

+95
-68
lines changed

5 files changed

+95
-68
lines changed

test/Interop/Cxx/class/Inputs/simple-structs.h

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -52,38 +52,4 @@ struct Outer {
5252
Outer() : privStruct(1, 2, 3, 4, 5, 6), publStruct(7, 8, 9, 10, 11, 12) {}
5353
};
5454

55-
struct ImmortalFRT {
56-
private:
57-
int priv = 1;
58-
59-
public:
60-
int publ = 2;
61-
} __attribute__((swift_attr("import_reference")))
62-
__attribute__((swift_attr("retain:immortal")))
63-
__attribute__((swift_attr("release:immortal")));
64-
65-
struct FRTCustomStringConvertible {
66-
public:
67-
private:
68-
int priv = 1;
69-
70-
public:
71-
int publ = 2;
72-
} __attribute__((swift_attr("import_reference")))
73-
__attribute__((swift_attr("retain:immortal")))
74-
__attribute__((swift_attr("release:immortal")));
75-
76-
struct FRType {
77-
private:
78-
int priv = 1;
79-
80-
public:
81-
int publ = 2;
82-
} __attribute__((swift_attr("import_reference")))
83-
__attribute__((swift_attr("retain:retain")))
84-
__attribute__((swift_attr("release:release")));
85-
86-
void retain(FRType *v) {};
87-
void release(FRType *v) {};
88-
8955
#endif
Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
// RUN: %target-run-simple-swift(-cxx-interoperability-mode=default -Xfrontend -disable-availability-checking -I %S/Inputs) | %FileCheck %s
1+
// RUN: %target-run-simple-swift(-cxx-interoperability-mode=default -I %S/Inputs) | %FileCheck %s
22

33
// REQUIRES: executable_test
4-
// Metadata for foreign reference types is not supported on Windows.
5-
// UNSUPPORTED: OS=windows-msvc
64

75
import SimpleStructs
86

@@ -26,28 +24,6 @@ func printCxxStructNested() {
2624
print(s)
2725
}
2826

29-
func printCxxImmortalFRT() {
30-
let s = ImmortalFRT()
31-
print(s)
32-
}
33-
34-
extension FRTCustomStringConvertible : CustomStringConvertible {
35-
public var description: String {
36-
return "FRTCustomStringConvertible(publ: \(publ))"
37-
}
38-
}
39-
40-
func printCxxFRTCustomStringConvertible() {
41-
let s = FRTCustomStringConvertible()
42-
print(s)
43-
}
44-
45-
func printCxxFRType() {
46-
let s = FRType()
47-
print(s)
48-
}
49-
50-
5127
printCxxStructPrivateFields()
5228
// CHECK: HasPrivateFieldsOnly()
5329

@@ -59,12 +35,3 @@ printCxxStructPrivatePublicProtectedFields()
5935

6036
printCxxStructNested()
6137
// CHECK: Outer(publStruct: {{.*}}.HasPrivatePublicProtectedFields(publ1: 8, publ2: 12))
62-
63-
printCxxImmortalFRT()
64-
// CHECK: ImmortalFRT()
65-
66-
printCxxFRTCustomStringConvertible()
67-
// CHECK: FRTCustomStringConvertible(publ: 2)
68-
69-
printCxxFRType()
70-
// CHECK: FRType()

test/Interop/Cxx/foreign-reference/Inputs/module.modulemap

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,8 @@ module FunctionsAndMethodsReturningFRT {
6363
header "cxx-functions-and-methods-returning-frt.h"
6464
requires cplusplus
6565
}
66+
67+
module Printed {
68+
header "printed.h"
69+
requires cplusplus
70+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
struct ImmortalFRT {
2+
private:
3+
int priv = 1;
4+
5+
public:
6+
int publ = 2;
7+
} __attribute__((swift_attr("import_reference")))
8+
__attribute__((swift_attr("retain:immortal")))
9+
__attribute__((swift_attr("release:immortal")));
10+
11+
struct FRTCustomStringConvertible {
12+
public:
13+
private:
14+
int priv = 1;
15+
16+
public:
17+
int publ = 2;
18+
} __attribute__((swift_attr("import_reference")))
19+
__attribute__((swift_attr("retain:immortal")))
20+
__attribute__((swift_attr("release:immortal")));
21+
22+
struct FRType {
23+
private:
24+
int priv = 1;
25+
26+
public:
27+
int publ = 2;
28+
} __attribute__((swift_attr("import_reference")))
29+
__attribute__((swift_attr("retain:retain")))
30+
__attribute__((swift_attr("release:release")));
31+
32+
void retain(FRType *v) {};
33+
void release(FRType *v) {};
34+
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
// RUN: %target-run-simple-swift(-cxx-interoperability-mode=default -I %S/Inputs) | %FileCheck %s
2+
3+
// REQUIRES: executable_test
4+
5+
// Metadata for foreign reference types is not supported on Windows.
6+
// UNSUPPORTED: OS=windows-msvc
7+
8+
// Temporarily disable when running with an older runtime (rdar://153205860)
9+
// UNSUPPORTED: use_os_stdlib
10+
// UNSUPPORTED: back_deployment_runtime
11+
12+
import Printed
13+
14+
func printCxxImmortalFRT() {
15+
if #available(SwiftStdlib 6.2, *) {
16+
let s = ImmortalFRT()
17+
print(s)
18+
} else {
19+
print("runtime too old")
20+
}
21+
}
22+
23+
@available(SwiftStdlib 5.9, *)
24+
extension FRTCustomStringConvertible : CustomStringConvertible {
25+
public var description: String {
26+
return "FRTCustomStringConvertible(publ: \(publ))"
27+
}
28+
}
29+
30+
func printCxxFRTCustomStringConvertible() {
31+
if #available(SwiftStdlib 5.9, *) {
32+
let s = FRTCustomStringConvertible()
33+
print(s)
34+
} else {
35+
print("runtime too old")
36+
}
37+
}
38+
39+
func printCxxFRType() {
40+
if #available(SwiftStdlib 6.2, *) {
41+
let s = FRType()
42+
print(s)
43+
} else {
44+
print("runtime too old")
45+
}
46+
}
47+
48+
printCxxImmortalFRT()
49+
// CHECK: {{ImmortalFRT()|runtime too old}}
50+
51+
printCxxFRTCustomStringConvertible()
52+
// CHECK: FRTCustomStringConvertible(publ: 2)
53+
54+
printCxxFRType()
55+
// CHECK: {{FRType()|runtime too old}}

0 commit comments

Comments
 (0)