Skip to content

Commit e28aa6a

Browse files
committed
Merge branch 'main' into jgrynspan/third-party-testing-library-discovery
2 parents ef03958 + bb8abff commit e28aa6a

File tree

161 files changed

+3694
-1739
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

161 files changed

+3694
-1739
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
#
22
# This source file is part of the Swift.org open source project
33
#
4-
# Copyright (c) 2023–2025 Apple Inc. and the Swift project authors
4+
# Copyright (c) 2023–2026 Apple Inc. and the Swift project authors
55
# Licensed under Apache License v2.0 with Runtime Library Exception
66
#
77
# See https://swift.org/LICENSE.txt for license information
88
# See https://swift.org/CONTRIBUTORS.txt for Swift project authors
99
#
1010

11-
* @stmontgomery @grynspan @briancroom @jerryjrchen
11+
* @stmontgomery @grynspan @briancroom @jerryjrchen @harlanhaskins

.github/workflows/automerge.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ on:
1818
jobs:
1919
create_merge_pr:
2020
name: Create PR to merge main into release branch
21-
uses: swiftlang/github-workflows/.github/workflows/create_automerge_pr.yml@0.0.3
21+
uses: swiftlang/github-workflows/.github/workflows/create_automerge_pr.yml@0.0.7
2222
with:
2323
head_branch: main
2424
base_branch: release/6.3

.github/workflows/main_using_main.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,13 @@ concurrency:
1515
jobs:
1616
tests:
1717
name: Test
18-
uses: swiftlang/github-workflows/.github/workflows/swift_package_test.yml@0.0.2
18+
uses: swiftlang/github-workflows/.github/workflows/swift_package_test.yml@0.0.7
1919
with:
2020
linux_swift_versions: '["nightly-main"]'
2121
linux_os_versions: '["amazonlinux2", "jammy"]'
22+
linux_static_sdk_versions: '["nightly-main"]'
2223
windows_swift_versions: '["nightly-main"]'
2324
enable_macos_checks: true
24-
macos_exclude_xcode_versions: '[{"xcode_version": "16.2"}, {"xcode_version": "16.3"}, {"xcode_version": "16.4"}]'
25+
macos_xcode_versions: '["26.2"]'
2526
enable_wasm_sdk_build: true
27+
wasm_sdk_versions: '["nightly-main"]'

.github/workflows/main_using_release.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: main branch, 6.2 toolchain
1+
name: main branch, 6.3 toolchain
22

33
permissions:
44
contents: read
@@ -15,11 +15,13 @@ concurrency:
1515
jobs:
1616
tests:
1717
name: Test
18-
uses: swiftlang/github-workflows/.github/workflows/swift_package_test.yml@0.0.2
18+
uses: swiftlang/github-workflows/.github/workflows/swift_package_test.yml@0.0.7
1919
with:
20-
linux_swift_versions: '["nightly-6.2"]'
20+
linux_swift_versions: '["nightly-6.3"]'
2121
linux_os_versions: '["amazonlinux2", "jammy"]'
22-
windows_swift_versions: '["nightly-6.2"]'
22+
linux_static_sdk_versions: '["nightly-6.3"]'
23+
windows_swift_versions: '["nightly-6.3"]'
2324
enable_macos_checks: true
24-
macos_exclude_xcode_versions: '[{"xcode_version": "16.2"}, {"xcode_version": "16.3"}, {"xcode_version": "16.4"}]'
25+
macos_xcode_versions: '["26.2"]'
2526
enable_wasm_sdk_build: true
27+
wasm_sdk_versions: '["nightly-6.3"]'
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Manual OpenBSD/amd64 build (7.8)
2+
3+
on:
4+
workflow_dispatch:
5+
6+
env:
7+
META_DATA_CONTENT: |
8+
{
9+
"instance-id": "iid-local01",
10+
"dsmode": "local"
11+
}
12+
USER_DATA_CONTENT: |
13+
#cloud-config
14+
timezone: UTC
15+
write_files:
16+
- content: |
17+
set -ex
18+
function atexit {
19+
echo 1 > /tmp/result
20+
tar cvf /dev/sd1c -C /tmp result
21+
halt -p;
22+
}
23+
trap atexit EXIT
24+
printf '\033\143'
25+
export PATH=/usr/local/bin:$PATH
26+
mount /dev/sd3c /mnt
27+
cp -r /mnt/repo /home/repo/
28+
cd /home/repo/
29+
swift test
30+
echo $? > /tmp/result
31+
tar cvf /dev/sd1c -C /tmp result
32+
halt -p
33+
path: /etc/rc.local
34+
permissions: '0755'
35+
36+
jobs:
37+
openbsd:
38+
name: OpenBSD
39+
runs-on: ubuntu-latest
40+
timeout-minutes: 30
41+
container:
42+
image: ghcr.io/3405691582/openbsd-swift-amd64:7.8
43+
env:
44+
CPU: "4"
45+
MEM: "16G"
46+
KVM: "-enable-kvm"
47+
options: --device /dev/kvm
48+
steps:
49+
- name: Checkout
50+
uses: actions/checkout@v6
51+
52+
- name: Write cloud-init files
53+
run: |
54+
echo "$META_DATA_CONTENT" > /usr/local/share/cidata/meta-data
55+
echo "$USER_DATA_CONTENT" > /usr/local/share/cidata/user-data
56+
57+
- name: Prepare cloud-init
58+
run: |
59+
cp -r $GITHUB_WORKSPACE /usr/local/share/cidata/repo/ && \
60+
cat /usr/local/share/cidata/meta-data && \
61+
cat /usr/local/share/cidata/user-data && \
62+
ls /usr/local/share/cidata
63+
64+
- name: Run
65+
run: /usr/local/bin/cmd.sh
66+
67+
- name: Report
68+
run: |
69+
ls -l /usr/local/share/tape && \
70+
exit $(cat /usr/local/share/tape/result)

.github/workflows/pull_request.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,22 @@ concurrency:
1414
jobs:
1515
tests:
1616
name: Test
17-
uses: swiftlang/github-workflows/.github/workflows/swift_package_test.yml@0.0.2
17+
uses: swiftlang/github-workflows/.github/workflows/swift_package_test.yml@0.0.7
1818
with:
19-
linux_swift_versions: '["nightly-main", "nightly-6.3", "nightly-6.2"]'
19+
linux_swift_versions: '["nightly-main", "nightly-6.3"]'
2020
linux_os_versions: '["amazonlinux2", "jammy"]'
21-
windows_swift_versions: '["nightly-main", "nightly-6.3", "nightly-6.2"]'
21+
linux_static_sdk_versions: '["nightly-main"]'
22+
windows_swift_versions: '["nightly-main", "nightly-6.3"]'
2223
enable_macos_checks: true
23-
macos_exclude_xcode_versions: '[{"xcode_version": "16.2"}, {"xcode_version": "16.3"}, {"xcode_version": "16.4"}]'
24+
macos_xcode_versions: '["26.2"]'
2425
enable_ios_checks: true
25-
ios_host_exclude_xcode_versions: '[{"xcode_version": "16.2"}, {"xcode_version": "16.3"}, {"xcode_version": "16.4"}]'
26+
ios_host_xcode_versions: '["26.2"]'
2627
enable_wasm_sdk_build: true
28+
wasm_sdk_versions: '["nightly-main", "nightly-6.3"]'
2729
enable_android_sdk_build: true
2830
soundness:
2931
name: Soundness
30-
uses: swiftlang/github-workflows/.github/workflows/soundness.yml@0.0.3
32+
uses: swiftlang/github-workflows/.github/workflows/soundness.yml@0.0.7
3133
with:
3234
license_header_check_project_name: "Swift"
3335
docs_check_enabled: false

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,4 @@ set(SwiftTesting_INSTALL_SWIFTMODULEDIR "${CMAKE_INSTALL_LIBDIR}/swift$<$<NOT:$<
5959
add_compile_options($<$<COMPILE_LANGUAGE:Swift>:-no-toolchain-stdlib-rpath>)
6060

6161
add_subdirectory(Sources)
62+
add_subdirectory(cmake/modules)

Documentation/ABI/JSON.md

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ array (also defined as in JSON) whose elements all follow rule `<T>`.
3939
<bool> ::= true | false ; as in JSON
4040
4141
<source-location> ::= {
42-
"fileID": <string>, ; the Swift file ID of the file
42+
["fileID": <string>,] ; the Swift file ID of the file if available, as per
43+
; SE-0274 § "Specification of the #file string format"
44+
"filePath": <string>, ; the compile-time path to the file
4345
"line": <number>,
4446
"column": <number>,
4547
}
@@ -49,7 +51,8 @@ array (also defined as in JSON) whose elements all follow rule `<T>`.
4951
"since1970": <number>, ; floating-point seconds since 1970-01-01 00:00:00 UT
5052
}
5153
52-
<version> ::= "version": 0 ; will be incremented as the format changes
54+
<version> ::= "version": <version-number>
55+
<version-number> ::= 0 | "<version core>" ; as per https://semver.org
5356
```
5457

5558
<!--
@@ -157,10 +160,21 @@ additional `"testCases"` field describing the individual test cases.
157160
["displayName": <string>,] ; the user-supplied custom display name
158161
"sourceLocation": <source-location>, ; where the test is defined
159162
"id": <test-id>,
160-
"isParameterized": <bool> ; is this a parameterized test function or not?
163+
"isParameterized": <bool>, ; is this a parameterized test function or not?
164+
["tags": <array:tag>,] ; the tags associated with this test function
165+
["bugs": <array:bug>,] ; the bugs associated with this test function
166+
["timeLimit": <number>] ; the time limit associated with this test function
161167
}
162168
163169
<test-id> ::= <string> ; an opaque string representing the test case
170+
171+
<tag> ::= <string> ; a string representation of a tag
172+
173+
<bug> ::= {
174+
["url": <string>,] ; the bug URL
175+
["id": <string>,] ; the bug id
176+
["title": <string>] ; the human readable bug title
177+
}
164178
```
165179

166180
<!--
@@ -195,7 +209,8 @@ sufficient information to display the event in a human-readable format.
195209
196210
<event-kind> ::= "runStarted" | "testStarted" | "testCaseStarted" |
197211
"issueRecorded" | "testCaseEnded" | "testEnded" | "testSkipped" |
198-
"runEnded" | "valueAttached"; additional event kinds may be added in the future
212+
"runEnded" | "valueAttached" | "testCancelled" | "testCaseCancelled"
213+
; additional event kinds may be added in the future
199214
200215
<issue> ::= {
201216
"isKnown": <bool>, ; is this a known issue or not?
@@ -219,3 +234,16 @@ sufficient information to display the event in a human-readable format.
219234
["testID": <test-id>,
220235
["testCase": <test-case>]]
221236
-->
237+
238+
## See Also
239+
240+
### Relevant Swift Evolution proposals
241+
242+
| Proposal Number | Summary | Swift Version | Schema Version |
243+
|:-|-|-:|-:|
244+
| [ST-0002](https://github.com/swiftlang/swift-evolution/blob/main/proposals/testing/0002-json-abi.md) | Introduced the initial version of this JSON schema. | 6.0 | `0` |
245+
| [ST-0009](https://github.com/swiftlang/swift-evolution/blob/main/proposals/testing/0009-attachments.md#integration-with-supporting-tools) | Added attachments. | 6.2 | `0` |
246+
| [ST-0013](https://github.com/swiftlang/swift-evolution/blob/main/proposals/testing/0013-issue-severity-warning.md#event-stream) | Added test issue severity. | 6.3 | `"6.3"` |
247+
| [ST-0016](https://github.com/swiftlang/swift-evolution/blob/main/proposals/testing/0016-test-cancellation.md#integration-with-supporting-tools) | Added test cancellation. | 6.3 | `"6.3"` |
248+
| [ST-0019](https://github.com/swiftlang/swift-evolution/blob/main/proposals/testing/0019-include-tags-bugs-and-timeline-in-event-stream.md#json-schema-changes) | Added `tags`, `bugs`, and `timeLimit`. | 6.4 | `"6.4"` |
249+
| [ST-0020](https://github.com/swiftlang/swift-evolution/blob/main/proposals/testing/0020-sourcelocation-filepath.md#detailed-design) | Added `filePath`. | 6.3 | `"6.3"` |

Documentation/ABI/TestContent.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,6 @@ See https://swift.org/CONTRIBUTORS.txt for Swift project authors
1313
This document describes the format and location of test content that the testing
1414
library emits at compile time and can discover at runtime.
1515

16-
> [!WARNING]
17-
> The content of this document is subject to change pending efforts to define a
18-
> Swift-wide standard mechanism for runtime metadata emission and discovery.
19-
> Treat the information in this document as experimental.
20-
2116
## Basic format
2217

2318
Swift Testing stores test content records in a dedicated platform-specific
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# Debugging Swift Testing on the Commandline using LLDB
2+
3+
<!--
4+
This source file is part of the Swift.org open source project
5+
6+
Copyright (c) 2026 Apple Inc. and the Swift project authors
7+
Licensed under Apache License v2.0 with Runtime Library Exception
8+
9+
See https://swift.org/LICENSE.txt for license information
10+
See https://swift.org/CONTRIBUTORS.txt for Swift project authors
11+
-->
12+
13+
For most cases, `swift test` is sufficient to build and run tests. The
14+
instructions below are for when you need to attach LLDB to debug test code
15+
directly. Doing this differs significantly between Darwin and non-Darwin
16+
platforms.
17+
18+
## Darwin Platforms
19+
20+
On Darwin, SwiftPM packages tests into xctest bundles. These bundles are not
21+
directly executable and must be run using the `swiftpm-testing-helper` tool.
22+
23+
### swiftpm-testing-helper
24+
25+
The helper is located within the toolchain:
26+
27+
```sh
28+
# Xcode toolchain
29+
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/libexec/swift/pm/swiftpm-testing-helper
30+
31+
# Custom toolchain
32+
/path/to/toolchain/usr/libexec/swift/pm/swiftpm-testing-helper
33+
```
34+
35+
Required arguments:
36+
37+
1. `--test-bundle-path`: Path to the test bundle executable (e.g.,
38+
`MyTests.xctest/Contents/MacOS/MyTests`)
39+
2. `--testing-library swift-testing`: Specifies that Swift Testing should be
40+
used.
41+
42+
Additional `swift test` arguments (such as `--filter`) can also be passed. Run
43+
`swift test --help` for the full list of available options.
44+
45+
### Example: Debugging with LLDB
46+
47+
```sh
48+
lldb -- /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/libexec/swift/pm/swiftpm-testing-helper \
49+
--test-bundle-path MyTests.xctest/Contents/MacOS/MyTests \
50+
--testing-library swift-testing
51+
```
52+
53+
This launches LLDB with the testing helper configured to run your test bundle.
54+
You can then set breakpoints and debug your tests normally.
55+
56+
### How Swift Testing Is Linked
57+
58+
Swift Testing ships in two forms: Testing.framework and libTesting.dylib. The
59+
compiler you use to build your test bundle determines which library it links
60+
against. At runtime, the dynamic linker must find the matching library. Problems
61+
occur when the build-time and runtime environments don't match—for example, if
62+
you build with a custom toolchain but run with system libraries, or vice versa.
63+
64+
If you encounter missing symbols or unexpected behavior, export the environment
65+
variables `DYLD_LIBRARY_PATH` or `DYLD_FRAMEWORK_PATH` as appropriate to point
66+
to the correct location.
67+
68+
## Non-Darwin Platforms
69+
70+
On non-Darwin platforms, SwiftPM builds test targets as standalone executables
71+
rather than bundles. You can debug them directly:
72+
73+
```sh
74+
lldb -- .build/debug/MyPackagePackageTests.xctest
75+
```
76+
77+
### Double-Invocation Gotcha
78+
79+
When using Swift Testing on non-Darwin, `swift test` invokes the test binary
80+
twice:
81+
82+
1. **First invocation**: Runs XCTest-based tests via `XCTestMain()`
83+
2. **Second invocation**: Runs Swift Testing tests by passing
84+
`--testing-library swift-testing`
85+
86+
This is an internal SwiftPM implementation detail. When debugging, you likely
87+
want to skip the XCTest invocation and run Swift Testing directly.
88+
89+
### Example: Debugging with LLDB
90+
91+
To debug only Swift Testing tests, pass `--testing-library` explicitly:
92+
93+
```sh
94+
lldb -- .build/debug/MyPackagePackageTests.xctest --testing-library swift-testing
95+
```
96+
97+
### Passing Arguments
98+
99+
Arguments such as `--filter` are passed through to Swift Testing directly. Run
100+
`swift test --help` for the full list of available options.

0 commit comments

Comments
 (0)