Skip to content

Commit 6a5423c

Browse files
committed
Run the NIO tests only, with debugging output for new failing async test
1 parent b24a7bb commit 6a5423c

File tree

2 files changed

+98
-169
lines changed

2 files changed

+98
-169
lines changed

.github/workflows/sdks.yml

+1-169
Original file line numberDiff line numberDiff line change
@@ -303,31 +303,6 @@ jobs:
303303
echo "SWIFTPM_X_FLAGS=${XFLAGS}" >> $GITHUB_ENV
304304
AFLAGS="--swift-sdk armv7-unknown-linux-androideabi${ANDROID_API_LEVEL} ${FLAGS}"
305305
echo "SWIFTPM_ARM_FLAGS=${AFLAGS}" >> $GITHUB_ENV
306-
- name: Get Swift Argument Parser package
307-
uses: actions/checkout@v4
308-
with:
309-
repository: apple/swift-argument-parser
310-
path: swift-argument-parser
311-
- name: Build Swift Argument Parser package
312-
run: |
313-
cd swift-argument-parser
314-
rm Examples/count-lines/CountLines.swift Tools/changelog-authors/*.swift
315-
${TOOLCHAIN}/bin/swift build --build-tests ${SWIFTPM_AARCH_FLAGS}
316-
${TOOLCHAIN}/bin/swift build --build-tests ${SWIFTPM_X_FLAGS}
317-
${TOOLCHAIN}/bin/swift build --build-tests ${SWIFTPM_ARM_FLAGS}
318-
- name: Get Swift crypto package
319-
uses: actions/checkout@v4
320-
with:
321-
repository: apple/swift-crypto
322-
path: swift-crypto
323-
- name: Build Swift crypto package
324-
run: |
325-
cd swift-crypto
326-
perl -pi -e 's%\\\\(testsDirectory)/.*Vectors%/data/local/tmp/pack/crypto-vectors%' Tests/{Crypto,_CryptoExtras}Tests/Utils/{RFCVector,Wycheproof}.swift
327-
perl -pi -e 's%#file%"/data/local/tmp/pack/crypto-vectors"%;s%../_CryptoExtrasVectors/%%' Tests/_CryptoExtrasTests/TestRSABlindSigning.swift
328-
${TOOLCHAIN}/bin/swift build --build-tests ${SWIFTPM_AARCH_FLAGS}
329-
${TOOLCHAIN}/bin/swift build --build-tests ${SWIFTPM_X_FLAGS}
330-
${TOOLCHAIN}/bin/swift build --build-tests ${SWIFTPM_ARM_FLAGS}
331306
- name: Get Swift NIO package
332307
uses: actions/checkout@v4
333308
with:
@@ -336,109 +311,7 @@ jobs:
336311
- name: Build Swift NIO package
337312
run: |
338313
cd swift-nio
339-
git apply ../sdk-config/swift-nio-disable-ecn-tests.patch ../sdk-config/swift-nio-filesystem.patch
340-
if ${{ startsWith(matrix.os, 'macos') }}; then
341-
git apply -R ../sdk-config/swift-nio-revert-async.patch
342-
fi
343-
${TOOLCHAIN}/bin/swift build --build-tests ${SWIFTPM_AARCH_FLAGS}
344-
${TOOLCHAIN}/bin/swift build --build-tests ${SWIFTPM_X_FLAGS}
345-
${TOOLCHAIN}/bin/swift build --build-tests ${SWIFTPM_ARM_FLAGS}
346-
- name: Get Swift Numerics package
347-
uses: actions/checkout@v4
348-
with:
349-
repository: apple/swift-numerics
350-
path: swift-numerics
351-
- name: Build Swift Numerics package
352-
run: |
353-
cd swift-numerics
354-
${TOOLCHAIN}/bin/swift build --build-tests ${SWIFTPM_AARCH_FLAGS}
355-
${TOOLCHAIN}/bin/swift build --build-tests ${SWIFTPM_X_FLAGS}
356-
${TOOLCHAIN}/bin/swift build --build-tests ${SWIFTPM_ARM_FLAGS}
357-
- name: Get Swift System package
358-
uses: actions/checkout@v4
359-
with:
360-
repository: apple/swift-system
361-
path: swift-system
362-
- name: Build Swift System package
363-
run: |
364-
git apply sdk-config/swift-system-tests.patch
365-
cd swift-system
366-
${TOOLCHAIN}/bin/swift build --build-tests ${SWIFTPM_AARCH_FLAGS}
367-
${TOOLCHAIN}/bin/swift build --build-tests ${SWIFTPM_X_FLAGS}
368-
${TOOLCHAIN}/bin/swift build --build-tests ${SWIFTPM_ARM_FLAGS}
369-
- name: Get Swift Collections package
370-
uses: actions/checkout@v4
371-
with:
372-
repository: apple/swift-collections
373-
path: swift-collections
374-
- name: Build Swift Collections package
375-
run: |
376-
cd swift-collections
377-
${TOOLCHAIN}/bin/swift build --build-tests ${SWIFTPM_AARCH_FLAGS}
378-
${TOOLCHAIN}/bin/swift build --build-tests ${SWIFTPM_X_FLAGS}
379-
${TOOLCHAIN}/bin/swift build --build-tests ${SWIFTPM_ARM_FLAGS}
380-
- name: Get Swift Atomics package
381-
uses: actions/checkout@v4
382-
with:
383-
repository: apple/swift-atomics
384-
path: swift-atomics
385-
ref: 1.2.0
386-
- name: Get Swift NIO SSH package
387-
uses: actions/checkout@v4
388-
with:
389-
repository: apple/swift-nio-ssh
390-
path: sns
391-
- name: Build Swift NIO SSH package
392-
run: |
393-
cd sns
394-
perl -pi -e 's%url: .*swift-([a-z]*)\.git.*$%path: \"../swift-\1\"),%g' Package.swift
395-
${TOOLCHAIN}/bin/swift build --build-tests ${SWIFTPM_AARCH_FLAGS}
396-
${TOOLCHAIN}/bin/swift build --build-tests ${SWIFTPM_X_FLAGS}
397-
${TOOLCHAIN}/bin/swift build --build-tests ${SWIFTPM_ARM_FLAGS}
398-
- name: Get Swift NIO SSL package
399-
uses: actions/checkout@v4
400-
with:
401-
repository: apple/swift-nio-ssl
402-
path: snl
403-
- name: Build Swift NIO SSL package
404-
run: |
405-
cd snl
406-
git apply ../sdk-config/swift-nio-ssl-test.patch
407-
SWIFTCI_USE_LOCAL_DEPS=1 ${TOOLCHAIN}/bin/swift build --build-tests ${SWIFTPM_AARCH_FLAGS}
408-
SWIFTCI_USE_LOCAL_DEPS=1 ${TOOLCHAIN}/bin/swift build --build-tests ${SWIFTPM_X_FLAGS}
409-
SWIFTCI_USE_LOCAL_DEPS=1 ${TOOLCHAIN}/bin/swift build --build-tests ${SWIFTPM_ARM_FLAGS}
410-
- name: Get Yams package
411-
uses: actions/checkout@v4
412-
with:
413-
repository: jpsim/Yams
414-
path: yams
415-
- name: Build Yams package
416-
run: |
417-
cd yams
418-
perl -pi -e 's% fixturesDirectory + \"/SourceKitten#289% \"/data/local/tmp/pack%' Tests/YamsTests/PerformanceTests.swift
419-
${TOOLCHAIN}/bin/swift build --build-tests ${SWIFTPM_AARCH_FLAGS}
420-
${TOOLCHAIN}/bin/swift build --build-tests ${SWIFTPM_X_FLAGS}
421-
${TOOLCHAIN}/bin/swift build --build-tests ${SWIFTPM_ARM_FLAGS}
422-
- name: Get Swift NIO HTTP/2 package
423-
uses: actions/checkout@v4
424-
with:
425-
repository: apple/swift-nio-http2
426-
path: snh
427-
- name: Build Swift NIO HTTP/2 package
428-
run: |
429-
cd snh
430-
perl -pi -e 's%url: .*swift-([a-z]*)\.git.*$%path: \"../swift-\1\"),%g' Package.swift
431-
${TOOLCHAIN}/bin/swift build --build-tests ${SWIFTPM_AARCH_FLAGS}
432-
${TOOLCHAIN}/bin/swift build --build-tests ${SWIFTPM_X_FLAGS}
433-
- name: Get Swift Algorithms package
434-
uses: actions/checkout@v4
435-
with:
436-
repository: apple/swift-algorithms
437-
path: sa
438-
- name: Build Swift Algorithms package
439-
run: |
440-
cd sa
441-
perl -pi -e 's%url: .*$%path: \"../swift-numerics\"),%' Package.swift
314+
git apply ../sdk-config/swift-nio-disable-ecn-tests.patch ../sdk-config/swift-nio-filesystem.patch ../sdk-config/swift-nio-debug-async.patch
442315
${TOOLCHAIN}/bin/swift build --build-tests ${SWIFTPM_AARCH_FLAGS}
443316
${TOOLCHAIN}/bin/swift build --build-tests ${SWIFTPM_X_FLAGS}
444317
${TOOLCHAIN}/bin/swift build --build-tests ${SWIFTPM_ARM_FLAGS}
@@ -464,56 +337,15 @@ jobs:
464337
adb shell "run-as com.termux ln -s README.md /data/data/com.termux/pack/Test\ Data/README.md.symlink"
465338
adb shell "run-as com.termux ln -s Foo /data/data/com.termux/pack/Test\ Data/Foo.symlink"
466339
adb shell "run-as com.termux sh -c 'TMPDIR=/data/data/com.termux /data/data/com.termux/pack/swift-nioPackageTests.xctest'"
467-
adb shell "TMPDIR=/data/local/tmp /data/local/tmp/pack/swift-systemPackageTests.xctest"
468340
EOF
469341
470342
mkdir pack
471343
TARGET="x86_64-unknown-linux-android$ANDROID_API_LEVEL"
472344
473-
cp swift-argument-parser/.build/$TARGET/debug/{generate-manual,math,repeat,roll,swift-argument-parserPackageTests.xctest} pack
474-
echo 'adb shell /data/local/tmp/pack/swift-argument-parserPackageTests.xctest' >> ~/test-toolchain.sh
475-
476-
wget -q https://raw.githubusercontent.com/termux/termux-elf-cleaner/v2.1.1/elf-cleaner.cpp
477-
wget -q https://raw.githubusercontent.com/termux/termux-elf-cleaner/v2.1.1/elf.h
478-
wget -q https://raw.githubusercontent.com/termux/termux-elf-cleaner/v2.1.1/arghandling.h
479-
wget -q https://raw.githubusercontent.com/termux/termux-elf-cleaner/v2.1.1/arghandling.c
480-
clang -c arghandling.c
481-
clang -o elf-cleaner arghandling.o elf-cleaner.cpp -DCOPYRIGHT=\"foo\" -DPACKAGE_NAME=\"termux-elf-cleaner\" -DPACKAGE_VERSION=\"2.2.1\"
482-
./elf-cleaner --api-level $ANDROID_API_LEVEL pack/{generate-manual,math,repeat,roll} || true
483-
484-
cp swift-crypto/.build/$TARGET/debug/swift-cryptoPackageTests.xctest pack
485-
echo 'adb shell /data/local/tmp/pack/swift-cryptoPackageTests.xctest' >> ~/test-toolchain.sh
486-
487345
cp swift-nio/.build/$TARGET/debug/swift-nioPackageTests.xctest pack
488346
489-
cp swift-numerics/.build/$TARGET/debug/swift-numericsPackageTests.xctest pack
490-
echo 'adb shell /data/local/tmp/pack/swift-numericsPackageTests.xctest' >> ~/test-toolchain.sh
491-
492-
cp swift-system/.build/$TARGET/debug/swift-systemPackageTests.xctest pack
493-
cp swift-collections/.build/$TARGET/debug/swift-collectionsPackageTests.xctest pack
494-
echo 'adb shell /data/local/tmp/pack/swift-collectionsPackageTests.xctest' >> ~/test-toolchain.sh
495-
496-
cp sns/.build/$TARGET/debug/swift-nio-sshPackageTests.xctest pack
497-
echo 'adb shell /data/local/tmp/pack/swift-nio-sshPackageTests.xctest' >> ~/test-toolchain.sh
498-
499-
cp snl/.build/$TARGET/debug/swift-nio-sslPackageTests.xctest pack
500-
echo 'adb shell /data/local/tmp/pack/swift-nio-sslPackageTests.xctest' >> ~/test-toolchain.sh
501-
502-
cp snh/.build/$TARGET/debug/swift-nio-http2PackageTests.xctest pack
503-
echo 'adb shell /data/local/tmp/pack/swift-nio-http2PackageTests.xctest' >> ~/test-toolchain.sh
504-
505-
cp yams/.build/$TARGET/debug/YamsPackageTests.xctest pack
506-
echo 'adb shell /data/local/tmp/pack/YamsPackageTests.xctest' >> ~/test-toolchain.sh
507-
508-
cp sa/.build/$TARGET/debug/swift-algorithmsPackageTests.xctest pack
509-
echo 'adb shell /data/local/tmp/pack/swift-algorithmsPackageTests.xctest' >> ~/test-toolchain.sh
510-
511-
mkdir pack/crypto-vectors pack/swift-crypto_CryptoTests.resources
512-
cp swift-crypto/Tests/Test\ Vectors/* swift-crypto/Tests/_CryptoExtrasVectors/* pack/crypto-vectors
513-
cp swift-crypto/Tests/CryptoTests/HPKE/hpke-test-vectors.json pack/swift-crypto_CryptoTests.resources
514347
rm swift-nio/Tests/NIOFileSystemIntegrationTests/Test\ Data/*symlink
515348
cp -r swift-nio/Tests/NIOFileSystemIntegrationTests/Test\ Data/ swift-nio/Tests/NIOFileSystemIntegrationTests/FileHandleTests.swift pack
516-
cp yams/Tests/YamsTests/Fixtures/SourceKitten#289/debug.yaml pack
517349
cp ~/.${{ startsWith(matrix.os, 'ubuntu') && 'config/' || '' }}swiftpm/swift-sdks/${{ steps.version.outputs.tag }}-android-${ANDROID_API_LEVEL}-*.artifactbundle/swift*sdk/android*sysroot/usr/lib/x86_64-linux-android/lib*so pack
518350
519351
# need to free up some space or else the emulator fails to launch:

swift-nio-debug-async.patch

+97
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
diff --git a/Tests/NIOCoreTests/AsyncSequences/NIOAsyncWriterTests.swift b/Tests/NIOCoreTests/AsyncSequences/NIOAsyncWriterTests.swift
2+
index 848c65f8..768e24f1 100644
3+
--- a/Tests/NIOCoreTests/AsyncSequences/NIOAsyncWriterTests.swift
4+
+++ b/Tests/NIOCoreTests/AsyncSequences/NIOAsyncWriterTests.swift
5+
@@ -120,7 +120,7 @@ final class NIOAsyncWriterTests: XCTestCase {
6+
)
7+
}
8+
9+
- func testMultipleConcurrentWrites() async throws {
10+
+/* func testMultipleConcurrentWrites() async throws {
11+
var elements = 0
12+
self.delegate.didYieldHandler = { elements += $0.count }
13+
let task1 = Task { [writer] in
14+
@@ -605,51 +605,72 @@ final class NIOAsyncWriterTests: XCTestCase {
15+
16+
self.assert(suspendCallCount: 1, yieldCallCount: 1, terminateCallCount: 1)
17+
}
18+
-
19+
+*/
20+
func testSuspendingBufferedYield_whenWriterFinished() async throws {
21+
self.sink.setWritability(to: false)
22+
23+
let bothSuspended = expectation(description: "suspended on both yields")
24+
let suspendedAgain = ConditionLock(value: false)
25+
self.delegate.didSuspendHandler = {
26+
+print("inside suspendHandler: \(ContinuousClock.now)\n")
27+
if self.delegate.didSuspendCallCount == 2 {
28+
+print("inside suspendHandler before fulfil: \(ContinuousClock.now)\n")
29+
bothSuspended.fulfill()
30+
} else if self.delegate.didSuspendCallCount > 2 {
31+
+print("inside suspendHandler before lock: \(ContinuousClock.now)\n")
32+
suspendedAgain.lock()
33+
suspendedAgain.unlock(withValue: true)
34+
+print("inside suspendHandler after unlock: \(ContinuousClock.now)\n")
35+
}
36+
}
37+
38+
self.delegate.didYieldHandler = { _ in
39+
+print("inside yieldHandler: \(ContinuousClock.now)\n")
40+
if self.delegate.didYieldCallCount == 1 {
41+
+print("inside yieldHandler before lock: \(ContinuousClock.now)\n")
42+
// Delay this yield until the other yield is suspended again.
43+
suspendedAgain.lock(whenValue: true)
44+
suspendedAgain.unlock()
45+
+print("inside yieldHandler after unlock: \(ContinuousClock.now)\n")
46+
}
47+
}
48+
49+
+print("before running tasks: \(ContinuousClock.now)\n")
50+
let task1 = Task { [writer] in
51+
+print("inside task1: \(ContinuousClock.now)\n")
52+
try await writer!.yield("message1")
53+
+print("inside task1 after yield: \(ContinuousClock.now)\n")
54+
}
55+
+print("before running task2: \(ContinuousClock.now)\n")
56+
let task2 = Task { [writer] in
57+
+print("inside task2: \(ContinuousClock.now)\n")
58+
try await writer!.yield("message2")
59+
+print("inside task2 after yield: \(ContinuousClock.now)\n")
60+
}
61+
62+
+print("after running tasks: \(ContinuousClock.now)\n")
63+
await fulfillment(of: [bothSuspended], timeout: 1)
64+
+print("after awaiting fulfillment: \(ContinuousClock.now)\n")
65+
self.writer.finish()
66+
67+
+print("before assert on both suspended: \(ContinuousClock.now)\n")
68+
self.assert(suspendCallCount: 2, yieldCallCount: 0, terminateCallCount: 0)
69+
70+
+print("before setting write to true: \(ContinuousClock.now)\n")
71+
// We have to become writable again to unbuffer the yields
72+
// The first call to didYield will pause, so that the other yield will be suspended again.
73+
self.sink.setWritability(to: true)
74+
75+
+print("before awaiting tasks: \(ContinuousClock.now)\n")
76+
await XCTAssertNoThrow(try await task1.value)
77+
+print("before awaiting task2: \(ContinuousClock.now)\n")
78+
await XCTAssertNoThrow(try await task2.value)
79+
80+
+print("after awaiting tasks: \(ContinuousClock.now)\n")
81+
self.assert(suspendCallCount: 3, yieldCallCount: 2, terminateCallCount: 1)
82+
+print("after final assert: \(ContinuousClock.now)\n")
83+
}
84+
-
85+
+/*
86+
func testWriterFinish_whenFinished() {
87+
// This tests just checks that finishing again is a no-op
88+
self.writer.finish()
89+
@@ -707,7 +728,7 @@ final class NIOAsyncWriterTests: XCTestCase {
90+
91+
self.assert(suspendCallCount: 0, yieldCallCount: 0, terminateCallCount: 1)
92+
}
93+
-}
94+
+*/}
95+
96+
#if !canImport(Darwin) && swift(<5.9.2)
97+
extension XCTestCase {

0 commit comments

Comments
 (0)