Commit 900bf8c
authored
Add a
We access the test content record section directly instead of using some
(non-existent) type-safe Swift API. On some platforms (Darwin in
particular), it is possible for two copies of the testing library to be
loaded at runtime, and for them to have incompatible definitions of
types like `Test`. That means one library's `@Test` macro could produce
a test content record that is then read by the other library's discovery
logic, resulting in a stack smash or worse.
We can resolve this issue by adding a `type` argument to the accessor
function we define for test content records; the body of the accessor
can then compare the value of this argument against the expected Swift
type of its result and, if they don't match, bail early.
The new argument is defined as a pointer _to_ a Swift type rather than
as a Swift type directly because `@convention(c)` functions cannot
directly reference Swift types. The value of the new argument can be
safely ignored if the type of the test content record's value is and
always has been `@frozen`.
### Checklist:
- [x] Code and documentation should follow the style of the [Style
Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md).
- [x] If public symbols are renamed or modified, DocC references should
be updated.type argument to the ABI accessor function signature. (swiftlang#939)1 parent f4abd7a commit 900bf8c
File tree
4 files changed
+103
-28
lines changed- Documentation/ABI
- Sources/Testing
- Tests/TestingTests
4 files changed
+103
-28
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
44 | 50 | | |
45 | 51 | | |
46 | 52 | | |
47 | | - | |
| 53 | + | |
48 | 54 | | |
49 | 55 | | |
50 | 56 | | |
| |||
54 | 60 | | |
55 | 61 | | |
56 | 62 | | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
57 | 69 | | |
58 | 70 | | |
59 | 71 | | |
60 | | - | |
| 72 | + | |
61 | 73 | | |
62 | 74 | | |
63 | 75 | | |
| |||
105 | 117 | | |
106 | 118 | | |
107 | 119 | | |
108 | | - | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
109 | 137 | | |
110 | 138 | | |
111 | 139 | | |
112 | 140 | | |
113 | 141 | | |
114 | | - | |
115 | | - | |
| 142 | + | |
| 143 | + | |
116 | 144 | | |
117 | 145 | | |
118 | | - | |
| 146 | + | |
| 147 | + | |
119 | 148 | | |
120 | 149 | | |
121 | 150 | | |
122 | 151 | | |
123 | 152 | | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
128 | 157 | | |
129 | 158 | | |
130 | 159 | | |
131 | 160 | | |
132 | 161 | | |
133 | | - | |
| 162 | + | |
134 | 163 | | |
135 | | - | |
| 164 | + | |
136 | 165 | | |
137 | 166 | | |
138 | 167 | | |
139 | 168 | | |
140 | 169 | | |
141 | | - | |
142 | | - | |
143 | | - | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
144 | 173 | | |
145 | 174 | | |
146 | 175 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
13 | 33 | | |
14 | 34 | | |
15 | 35 | | |
| |||
24 | 44 | | |
25 | 45 | | |
26 | 46 | | |
27 | | - | |
| 47 | + | |
28 | 48 | | |
29 | 49 | | |
30 | 50 | | |
| |||
54 | 74 | | |
55 | 75 | | |
56 | 76 | | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
57 | 91 | | |
58 | 92 | | |
59 | 93 | | |
| |||
108 | 142 | | |
109 | 143 | | |
110 | 144 | | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
115 | 153 | | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
121 | 158 | | |
122 | | - | |
123 | 159 | | |
124 | 160 | | |
125 | 161 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
31 | 38 | | |
32 | | - | |
| 39 | + | |
33 | 40 | | |
34 | 41 | | |
35 | 42 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
615 | 615 | | |
616 | 616 | | |
617 | 617 | | |
618 | | - | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
619 | 622 | | |
620 | 623 | | |
621 | 624 | | |
| |||
0 commit comments