Skip to content

Support Windows URL paths in FoundationEssentials #602

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 13, 2024

Conversation

jrflat
Copy link
Contributor

@jrflat jrflat commented May 9, 2024

Supports initializing file URLs with Windows paths. Allow "\" as the path separator, allow UNC paths ("\\") with host, and allow/standardize drive letter paths ("C:"). However, we always store the URL with forward slashes to stay consistent for path parsing operations. I think String.withNTPathRepresentation(_:) should then be used to convert any "/" back to "\" before consulting the file system on Windows. @compnerd thoughts on this approach?

The file URL initializers also now resolve against the base URL (or current directory) for checking if the file is a directory.

@jrflat jrflat requested review from compnerd and jmschonfeld May 9, 2024 23:17
@jrflat
Copy link
Contributor Author

jrflat commented May 9, 2024

@swift-ci please test

@jrflat
Copy link
Contributor Author

jrflat commented May 9, 2024

@swift-ci please test Windows platform

@jrflat jrflat changed the title (127768091) Support Windows URL paths in FoundationEssentials Support Windows URL paths in FoundationEssentials May 9, 2024
Copy link
Contributor

@jmschonfeld jmschonfeld left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks fine overall to me, but I'll let @compnerd validate the Windows behavior 🙂

@jrflat
Copy link
Contributor Author

jrflat commented May 9, 2024

Oops, fixing the Windows build failures now.

@jrflat jrflat force-pushed the windows-url-paths branch from 62e9b83 to e8831ca Compare May 10, 2024 02:29
@jrflat
Copy link
Contributor Author

jrflat commented May 10, 2024

@swift-ci please test Windows platform

@jrflat
Copy link
Contributor Author

jrflat commented May 10, 2024

@swift-ci please test

@compnerd
Copy link
Member

@jrflat - as to your point about withNTPathRepresentation, that is already doing the canonicalization of the arc separator. There is a small tweak to it in #603 that fixes a few edge cases by doing it more aggressively.

Copy link
Member

@compnerd compnerd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This definitely seems to help! Thank you for doing this.

@compnerd
Copy link
Member

One thing that shows up with this:

Test Suite 'Selected tests' started at 2024-05-10 09:12:08.214
Test Suite 'JSONEncoderTests' started at 2024-05-10 09:12:08.214
Test Case 'JSONEncoderTests.test_JSONPassTests' started at 2024-05-10 09:12:08.214
FoundationEssentials/URLComponents.swift:896: Fatal error: Attempting to set percentEncodedPath with invalid characters
Current stack trace:
0    (null)                             0x00007ff997c45870 swift_stdlib_reportFatalErrorInFile + 132

Test Suite 'Selected tests' started at 2024-05-10 09:12:08.214
Test Suite 'JSONEncoderTests' started at 2024-05-10 09:12:08.214
Test Case 'JSONEncoderTests.test_JSONFailTests' started at 2024-05-10 09:12:08.214
FoundationEssentials/URLComponents.swift:896: Fatal error: Attempting to set percentEncodedPath with invalid characters
Current stack trace:
0    (null)                             0x00007ff997c45870 swift_stdlib_reportFatalErrorInFile + 132

Test Suite 'Selected tests' started at 2024-05-10 09:12:09.335
Test Suite 'JSONEncoderTests' started at 2024-05-10 09:12:09.335
Test Case 'JSONEncoderTests.test_json5Spec' started at 2024-05-10 09:12:09.335
FoundationEssentials/URLComponents.swift:896: Fatal error: Attempting to set percentEncodedPath with invalid characters
Current stack trace:
0    (null)                             0x00007ff997c45870 swift_stdlib_reportFatalErrorInFile + 132

Test Suite 'Selected tests' started at 2024-05-10 09:12:09.335
Test Suite 'JSONEncoderTests' started at 2024-05-10 09:12:09.335
Test Case 'JSONEncoderTests.test_json5PassJSONFiles' started at 2024-05-10 09:12:09.335
FoundationEssentials/URLComponents.swift:896: Fatal error: Attempting to set percentEncodedPath with invalid characters
Current stack trace:
0    (null)                             0x00007ff997c45870 swift_stdlib_reportFatalErrorInFile + 132

Test Suite 'Selected tests' started at 2024-05-10 09:12:11.565
Test Suite 'TestPropertyListEncoder' started at 2024-05-10 09:12:11.566
Test Case 'TestPropertyListEncoder.test_5616259' started at 2024-05-10 09:12:11.566
FoundationEssentials/URLComponents.swift:896: Fatal error: Attempting to set percentEncodedPath with invalid characters
Current stack trace:
0    (null)                             0x00007ff997c45870 swift_stdlib_reportFatalErrorInFile + 132

Test Suite 'Selected tests' started at 2024-05-10 09:12:11.460
Test Suite 'TestPropertyListEncoder' started at 2024-05-10 09:12:11.460
Test Case 'TestPropertyListEncoder.test_5877417' started at 2024-05-10 09:12:11.460
FoundationEssentials/URLComponents.swift:896: Fatal error: Attempting to set percentEncodedPath with invalid characters
Current stack trace:
0    (null)                             0x00007ff997c45870 swift_stdlib_reportFatalErrorInFile + 132

Test Suite 'Selected tests' started at 2024-05-10 09:12:11.619
Test Suite 'TestPropertyListEncoder' started at 2024-05-10 09:12:11.619
Test Case 'TestPropertyListEncoder.test_invalidNSDataKey_82142612' started at 2024-05-10 09:12:11.619
FoundationEssentials/URLComponents.swift:896: Fatal error: Attempting to set percentEncodedPath with invalid characters
Current stack trace:
0    (null)                             0x00007ff997c45870 swift_stdlib_reportFatalErrorInFile + 132

Test Suite 'Selected tests' started at 2024-05-10 09:12:11.619
Test Suite 'TestPropertyListEncoder' started at 2024-05-10 09:12:11.619
Test Case 'TestPropertyListEncoder.test_genericProperties_binary' started at 2024-05-10 09:12:11.619
FoundationEssentials/URLComponents.swift:896: Fatal error: Attempting to set percentEncodedPath with invalid characters
Current stack trace:
0    (null)                             0x00007ff997c45870 swift_stdlib_reportFatalErrorInFile + 132

Test Suite 'Selected tests' started at 2024-05-10 09:12:11.623
Test Suite 'TestPropertyListEncoder' started at 2024-05-10 09:12:11.623
Test Case 'TestPropertyListEncoder.test_genericProperties_XML' started at 2024-05-10 09:12:11.623
FoundationEssentials/URLComponents.swift:896: Fatal error: Attempting to set percentEncodedPath with invalid characters
Current stack trace:
0    (null)                             0x00007ff997c45870 swift_stdlib_reportFatalErrorInFile + 132

Test Suite 'Selected tests' started at 2024-05-10 09:12:13.445
Test Suite 'URLTests' started at 2024-05-10 09:12:13.445
Test Case 'URLTests.testURLFilePathInitializer' started at 2024-05-10 09:12:13.445
S:\SourceCache\swift-project\swift-foundation\Tests\FoundationEssentialsTests\URLTests.swift:329: error: URLTests.testURLFilePathInitializer : XCTAssertTrue failed -
Test Case 'URLTests.testURLFilePathInitializer' failed (0.0 seconds)
Test Suite 'URLTests' failed at 2024-05-10 09:12:13.445
         Executed 1 test, with 1 failure (0 unexpected) in 0.0 (0.0) seconds
Test Suite 'Selected tests' failed at 2024-05-10 09:12:13.445
         Executed 1 test, with 1 failure (0 unexpected) in 0.0 (0.0) seconds

Test Suite 'Selected tests' started at 2024-05-10 09:12:13.332
Test Suite 'TestPropertyListEncoder' started at 2024-05-10 09:12:13.334
Test Case 'TestPropertyListEncoder.test_xmlErrors' started at 2024-05-10 09:12:13.334
FoundationEssentials/URLComponents.swift:896: Fatal error: Attempting to set percentEncodedPath with invalid characters
Current stack trace:
0    (null)                             0x00007ff997c45870 swift_stdlib_reportFatalErrorInFile + 132

Test Suite 'Selected tests' started at 2024-05-10 09:12:13.257
Test Suite 'TestPropertyListEncoder' started at 2024-05-10 09:12:13.257
Test Case 'TestPropertyListEncoder.test_plistWithBadUTF8' started at 2024-05-10 09:12:13.257
FoundationEssentials/URLComponents.swift:896: Fatal error: Attempting to set percentEncodedPath with invalid characters
Current stack trace:
0    (null)                             0x00007ff997c45870 swift_stdlib_reportFatalErrorInFile + 132

@compnerd
Copy link
Member

compnerd commented May 10, 2024

I think that this is due to the path containing : and \, which are not permitted. We do not always convert the path to the URL representation. This is likely happening in URL.deletingLastPathComponent.

@jrflat jrflat force-pushed the windows-url-paths branch from e8831ca to 83aca5c Compare May 10, 2024 20:18
@jrflat
Copy link
Contributor Author

jrflat commented May 10, 2024

I think that this is due to the path containing : and \, which are not permitted. We do not always convert the path to the URL representation. This is likely happening in URL.deletingLastPathComponent.

Thanks for pointing this out! I think the last two commits might help address this. I also opted to keep server/share as part of the path to let the Windows APIs handle it, since I think setting ? as the host from \\?\ may have also caused issues.

@jrflat
Copy link
Contributor Author

jrflat commented May 10, 2024

@swift-ci please test

@jrflat
Copy link
Contributor Author

jrflat commented May 10, 2024

@swift-ci please test Windows platform

@jrflat
Copy link
Contributor Author

jrflat commented May 10, 2024

@swift-ci please test Windows platform

@jrflat
Copy link
Contributor Author

jrflat commented May 10, 2024

@swift-ci please test

@compnerd
Copy link
Member

This is definitely doing way better! There are a few hangs that need to be diagnosed still, but this is the state after this change:

Test Suite 'Selected tests' started at 2024-05-10 14:58:06.667
Test Suite 'DateTests' started at 2024-05-10 14:58:06.668
Test Case 'DateTests.testDescriptionDistantPast' started at 2024-05-10 14:58:06.668
S:\SourceCache\swift-project\swift-foundation\Tests\FoundationEssentialsTests\DateTests.swift:97: error: DateTests.testDescriptionDistantPast : XCTAssertEqual failed: ("0000-12-30 00:00:00 +0000") is not equal to ("<description unavailable>") -
Test Case 'DateTests.testDescriptionDistantPast' failed (0.001 seconds)
Test Suite 'DateTests' failed at 2024-05-10 14:58:06.669
         Executed 1 test, with 1 failure (0 unexpected) in 0.001 (0.001) seconds
Test Suite 'Selected tests' failed at 2024-05-10 14:58:06.669
         Executed 1 test, with 1 failure (0 unexpected) in 0.001 (0.001) seconds

Test Suite 'Selected tests' started at 2024-05-10 14:58:06.663
Test Suite 'DateTests' started at 2024-05-10 14:58:06.667
Test Case 'DateTests.testDescriptionDistantFuture' started at 2024-05-10 14:58:06.667
S:\SourceCache\swift-project\swift-foundation\Tests\FoundationEssentialsTests\DateTests.swift:102: error: DateTests.testDescriptionDistantFuture : XCTAssertEqual failed: ("4001-01-01 00:00:00 +0000") is not equal to ("<description unavailable>") -
Test Case 'DateTests.testDescriptionDistantFuture' failed (0.001 seconds)
Test Suite 'DateTests' failed at 2024-05-10 14:58:06.668
         Executed 1 test, with 1 failure (0 unexpected) in 0.001 (0.001) seconds
Test Suite 'Selected tests' failed at 2024-05-10 14:58:06.668
         Executed 1 test, with 1 failure (0 unexpected) in 0.001 (0.001) seconds

Test Suite 'Selected tests' started at 2024-05-10 14:58:06.749
Test Suite 'FileManagerTests' started at 2024-05-10 14:58:06.750
Test Case 'FileManagerTests.testContentsEqualAtPaths' started at 2024-05-10 14:58:06.750
<EXPR>:0: error: FileManagerTests.testContentsEqualAtPaths : threw error "CocoaError(code: FoundationEssentials.CocoaError.Code(rawValue: 512), userInfo: [:])"
Test Case 'FileManagerTests.testContentsEqualAtPaths' failed (0.022 seconds)
Test Suite 'FileManagerTests' failed at 2024-05-10 14:58:06.772
         Executed 1 test, with 1 failure (1 unexpected) in 0.022 (0.022) seconds
Test Suite 'Selected tests' failed at 2024-05-10 14:58:06.772
         Executed 1 test, with 1 failure (1 unexpected) in 0.022 (0.022) seconds

Test Suite 'Selected tests' started at 2024-05-10 14:58:06.749
Test Suite 'FileManagerTests' started at 2024-05-10 14:58:06.750
Test Case 'FileManagerTests.testContentsAtPath' started at 2024-05-10 14:58:06.750
<EXPR>:0: error: FileManagerTests.testContentsAtPath : threw error "CocoaError(code: FoundationEssentials.CocoaError.Code(rawValue: 512), userInfo: [:])"
Test Case 'FileManagerTests.testContentsAtPath' failed (0.021 seconds)
Test Suite 'FileManagerTests' failed at 2024-05-10 14:58:06.771
         Executed 1 test, with 1 failure (1 unexpected) in 0.021 (0.021) seconds
Test Suite 'Selected tests' failed at 2024-05-10 14:58:06.771
         Executed 1 test, with 1 failure (1 unexpected) in 0.021 (0.021) seconds

Test Suite 'Selected tests' started at 2024-05-10 14:58:06.788
Test Suite 'FileManagerTests' started at 2024-05-10 14:58:06.794
Test Case 'FileManagerTests.testCopyItemAtPathToPath' started at 2024-05-10 14:58:06.794
<EXPR>:0: error: FileManagerTests.testCopyItemAtPathToPath : threw error "CocoaError(code: FoundationEssentials.CocoaError.Code(rawValue: 512), userInfo: [:])"
Test Case 'FileManagerTests.testCopyItemAtPathToPath' failed (0.023 seconds)
Test Suite 'FileManagerTests' failed at 2024-05-10 14:58:06.818
         Executed 1 test, with 1 failure (1 unexpected) in 0.023 (0.023) seconds
Test Suite 'Selected tests' failed at 2024-05-10 14:58:06.818
         Executed 1 test, with 1 failure (1 unexpected) in 0.023 (0.023) seconds

Test Suite 'Selected tests' started at 2024-05-10 14:58:06.788
Test Suite 'FileManagerTests' started at 2024-05-10 14:58:06.788
Test Case 'FileManagerTests.testCopyFileAtPathToPath' started at 2024-05-10 14:58:06.788
<EXPR>:0: error: FileManagerTests.testCopyFileAtPathToPath : threw error "CocoaError(code: FoundationEssentials.CocoaError.Code(rawValue: 512), userInfo: [:])"
Test Case 'FileManagerTests.testCopyFileAtPathToPath' failed (0.006 seconds)
Test Suite 'FileManagerTests' failed at 2024-05-10 14:58:06.794
         Executed 1 test, with 1 failure (1 unexpected) in 0.006 (0.006) seconds
Test Suite 'Selected tests' failed at 2024-05-10 14:58:06.794
         Executed 1 test, with 1 failure (1 unexpected) in 0.006 (0.006) seconds

Test Suite 'Selected tests' started at 2024-05-10 14:58:06.834
Test Suite 'FileManagerTests' started at 2024-05-10 14:58:06.836
Test Case 'FileManagerTests.testCreateDirectoryAtPath' started at 2024-05-10 14:58:06.836
<EXPR>:0: error: FileManagerTests.testCreateDirectoryAtPath : threw error "CocoaError(code: FoundationEssentials.CocoaError.Code(rawValue: 512), userInfo: [:])"
Test Case 'FileManagerTests.testCreateDirectoryAtPath' failed (0.002 seconds)
Test Suite 'FileManagerTests' failed at 2024-05-10 14:58:06.838
         Executed 1 test, with 1 failure (1 unexpected) in 0.002 (0.002) seconds
Test Suite 'Selected tests' failed at 2024-05-10 14:58:06.838
         Executed 1 test, with 1 failure (1 unexpected) in 0.002 (0.002) seconds

Test Suite 'Selected tests' started at 2024-05-10 14:58:06.834
Test Suite 'FileManagerTests' started at 2024-05-10 14:58:06.835
Test Case 'FileManagerTests.testCreateSymbolicLinkAtPath' started at 2024-05-10 14:58:06.835
<EXPR>:0: error: FileManagerTests.testCreateSymbolicLinkAtPath : threw error "CocoaError(code: FoundationEssentials.CocoaError.Code(rawValue: 512), userInfo: [:])"
Test Case 'FileManagerTests.testCreateSymbolicLinkAtPath' failed (0.003 seconds)
Test Suite 'FileManagerTests' failed at 2024-05-10 14:58:06.838
         Executed 1 test, with 1 failure (1 unexpected) in 0.003 (0.003) seconds
Test Suite 'Selected tests' failed at 2024-05-10 14:58:06.838
         Executed 1 test, with 1 failure (1 unexpected) in 0.003 (0.003) seconds

Test Suite 'Selected tests' started at 2024-05-10 14:58:06.859
Test Suite 'FileManagerTests' started at 2024-05-10 14:58:06.860
Test Case 'FileManagerTests.testDirectoryContentsAtPath' started at 2024-05-10 14:58:06.860
<EXPR>:0: error: FileManagerTests.testDirectoryContentsAtPath : threw error "CocoaError(code: FoundationEssentials.CocoaError.Code(rawValue: 512), userInfo: [:])"
Test Case 'FileManagerTests.testDirectoryContentsAtPath' failed (0.003 seconds)
Test Suite 'FileManagerTests' failed at 2024-05-10 14:58:06.863
         Executed 1 test, with 1 failure (1 unexpected) in 0.003 (0.003) seconds
Test Suite 'Selected tests' failed at 2024-05-10 14:58:06.863
         Executed 1 test, with 1 failure (1 unexpected) in 0.003 (0.003) seconds

Test Suite 'Selected tests' started at 2024-05-10 14:58:06.852
Test Suite 'FileManagerTests' started at 2024-05-10 14:58:06.857
Test Case 'FileManagerTests.testCurrentWorkingDirectory' started at 2024-05-10 14:58:06.857
<EXPR>:0: error: FileManagerTests.testCurrentWorkingDirectory : threw error "CocoaError(code: FoundationEssentials.CocoaError.Code(rawValue: 512), userInfo: [:])"
Test Case 'FileManagerTests.testCurrentWorkingDirectory' failed (0.003 seconds)
Test Suite 'FileManagerTests' failed at 2024-05-10 14:58:06.860
         Executed 1 test, with 1 failure (1 unexpected) in 0.003 (0.003) seconds
Test Suite 'Selected tests' failed at 2024-05-10 14:58:06.860
         Executed 1 test, with 1 failure (1 unexpected) in 0.003 (0.003) seconds

Test Suite 'Selected tests' started at 2024-05-10 14:58:06.875
Test Suite 'FileManagerTests' started at 2024-05-10 14:58:06.875
Test Case 'FileManagerTests.testFileExistsAtPath' started at 2024-05-10 14:58:06.875
<EXPR>:0: error: FileManagerTests.testFileExistsAtPath : threw error "CocoaError(code: FoundationEssentials.CocoaError.Code(rawValue: 512), userInfo: [:])"
Test Case 'FileManagerTests.testFileExistsAtPath' failed (0.007 seconds)
Test Suite 'FileManagerTests' failed at 2024-05-10 14:58:06.882
         Executed 1 test, with 1 failure (1 unexpected) in 0.007 (0.007) seconds
Test Suite 'Selected tests' failed at 2024-05-10 14:58:06.882
         Executed 1 test, with 1 failure (1 unexpected) in 0.007 (0.007) seconds

Test Suite 'Selected tests' started at 2024-05-10 14:58:06.901
Test Suite 'FileManagerTests' started at 2024-05-10 14:58:06.901
Test Case 'FileManagerTests.testImplicitlyConvertibleFileAttributes' started at 2024-05-10 14:58:06.901
<EXPR>:0: error: FileManagerTests.testImplicitlyConvertibleFileAttributes : threw error "CocoaError(code: FoundationEssentials.CocoaError.Code(rawValue: 512), userInfo: [:])"
Test Case 'FileManagerTests.testImplicitlyConvertibleFileAttributes' failed (0.006 seconds)
Test Suite 'FileManagerTests' failed at 2024-05-10 14:58:06.907
         Executed 1 test, with 1 failure (1 unexpected) in 0.006 (0.006) seconds
Test Suite 'Selected tests' failed at 2024-05-10 14:58:06.907
         Executed 1 test, with 1 failure (1 unexpected) in 0.006 (0.006) seconds

Test Suite 'Selected tests' started at 2024-05-10 14:58:06.905
Test Suite 'FileManagerTests' started at 2024-05-10 14:58:06.906
Test Case 'FileManagerTests.testFileSystemAttributesAtPath' started at 2024-05-10 14:58:06.906
<EXPR>:0: error: FileManagerTests.testFileSystemAttributesAtPath : threw error "CocoaError(code: FoundationEssentials.CocoaError.Code(rawValue: 512), userInfo: [:])"
Test Case 'FileManagerTests.testFileSystemAttributesAtPath' failed (0.003 seconds)
Test Suite 'FileManagerTests' failed at 2024-05-10 14:58:06.909
         Executed 1 test, with 1 failure (1 unexpected) in 0.003 (0.003) seconds
Test Suite 'Selected tests' failed at 2024-05-10 14:58:06.909
         Executed 1 test, with 1 failure (1 unexpected) in 0.003 (0.003) seconds

Test Suite 'Selected tests' started at 2024-05-10 14:58:06.930
Test Suite 'FileManagerTests' started at 2024-05-10 14:58:06.931
Test Case 'FileManagerTests.testMalformedModificationDateAttribute' started at 2024-05-10 14:58:06.931
<EXPR>:0: error: FileManagerTests.testMalformedModificationDateAttribute : threw error "CocoaError(code: FoundationEssentials.CocoaError.Code(rawValue: 512), userInfo: [:])"
Test Case 'FileManagerTests.testMalformedModificationDateAttribute' failed (0.002 seconds)
Test Suite 'FileManagerTests' failed at 2024-05-10 14:58:06.933
         Executed 1 test, with 1 failure (1 unexpected) in 0.002 (0.002) seconds
Test Suite 'Selected tests' failed at 2024-05-10 14:58:06.933
         Executed 1 test, with 1 failure (1 unexpected) in 0.002 (0.002) seconds

Test Suite 'Selected tests' started at 2024-05-10 14:58:06.927
Test Suite 'FileManagerTests' started at 2024-05-10 14:58:06.929
Test Case 'FileManagerTests.testLinkFileAtPathToPath' started at 2024-05-10 14:58:06.929
<EXPR>:0: error: FileManagerTests.testLinkFileAtPathToPath : threw error "CocoaError(code: FoundationEssentials.CocoaError.Code(rawValue: 512), userInfo: [:])"
Test Case 'FileManagerTests.testLinkFileAtPathToPath' failed (0.002 seconds)
Test Suite 'FileManagerTests' failed at 2024-05-10 14:58:06.931
         Executed 1 test, with 1 failure (1 unexpected) in 0.002 (0.002) seconds
Test Suite 'Selected tests' failed at 2024-05-10 14:58:06.931
         Executed 1 test, with 1 failure (1 unexpected) in 0.002 (0.002) seconds

Test Suite 'Selected tests' started at 2024-05-10 14:58:06.949
Test Suite 'FileManagerTests' started at 2024-05-10 14:58:06.953
Test Case 'FileManagerTests.testRemoveItemAtPath' started at 2024-05-10 14:58:06.953
<EXPR>:0: error: FileManagerTests.testRemoveItemAtPath : threw error "CocoaError(code: FoundationEssentials.CocoaError.Code(rawValue: 512), userInfo: [:])"
Test Case 'FileManagerTests.testRemoveItemAtPath' failed (0.004 seconds)
Test Suite 'FileManagerTests' failed at 2024-05-10 14:58:06.957
         Executed 1 test, with 1 failure (1 unexpected) in 0.004 (0.004) seconds
Test Suite 'Selected tests' failed at 2024-05-10 14:58:06.957
         Executed 1 test, with 1 failure (1 unexpected) in 0.004 (0.004) seconds

Test Suite 'Selected tests' started at 2024-05-10 14:58:06.949
Test Suite 'FileManagerTests' started at 2024-05-10 14:58:06.949
Test Case 'FileManagerTests.testMoveItemAtPathToPath' started at 2024-05-10 14:58:06.949
<EXPR>:0: error: FileManagerTests.testMoveItemAtPathToPath : threw error "CocoaError(code: FoundationEssentials.CocoaError.Code(rawValue: 512), userInfo: [:])"
Test Case 'FileManagerTests.testMoveItemAtPathToPath' failed (0.022 seconds)
Test Suite 'FileManagerTests' failed at 2024-05-10 14:58:06.971
         Executed 1 test, with 1 failure (1 unexpected) in 0.022 (0.022) seconds
Test Suite 'Selected tests' failed at 2024-05-10 14:58:06.971
         Executed 1 test, with 1 failure (1 unexpected) in 0.022 (0.022) seconds

Test Suite 'Selected tests' started at 2024-05-10 14:58:06.988
Test Suite 'FileManagerTests' started at 2024-05-10 14:58:06.990
Test Case 'FileManagerTests.testResolveSymlinksViaGetAttrList' started at 2024-05-10 14:58:06.990
<EXPR>:0: error: FileManagerTests.testResolveSymlinksViaGetAttrList : threw error "CocoaError(code: FoundationEssentials.CocoaError.Code(rawValue: 512), userInfo: [:])"
Test Case 'FileManagerTests.testResolveSymlinksViaGetAttrList' failed (0.002 seconds)
Test Suite 'FileManagerTests' failed at 2024-05-10 14:58:06.993
         Executed 1 test, with 1 failure (1 unexpected) in 0.002 (0.002) seconds
Test Suite 'Selected tests' failed at 2024-05-10 14:58:06.993
         Executed 1 test, with 1 failure (1 unexpected) in 0.002 (0.002) seconds

Test Suite 'Selected tests' started at 2024-05-10 14:58:07.012
Test Suite 'FileManagerTests' started at 2024-05-10 14:58:07.012
Test Case 'FileManagerTests.testSubpathsOfDirectoryAtPath' started at 2024-05-10 14:58:07.012
<EXPR>:0: error: FileManagerTests.testSubpathsOfDirectoryAtPath : threw error "CocoaError(code: FoundationEssentials.CocoaError.Code(rawValue: 512), userInfo: [:])"
Test Case 'FileManagerTests.testSubpathsOfDirectoryAtPath' failed (0.006 seconds)
Test Suite 'FileManagerTests' failed at 2024-05-10 14:58:07.018
         Executed 1 test, with 1 failure (1 unexpected) in 0.006 (0.006) seconds
Test Suite 'Selected tests' failed at 2024-05-10 14:58:07.018
         Executed 1 test, with 1 failure (1 unexpected) in 0.006 (0.006) seconds

Test Suite 'Selected tests' started at 2024-05-10 14:58:12.431
Test Suite 'URLTests' started at 2024-05-10 14:58:12.431
Test Case 'URLTests.testURLFilePathInitializer' started at 2024-05-10 14:58:12.431
S:\SourceCache\swift-project\swift-foundation\Tests\FoundationEssentialsTests\URLTests.swift:329: error: URLTests.testURLFilePathInitializer : XCTAssertTrue failed -
Test Case 'URLTests.testURLFilePathInitializer' failed (0.004 seconds)
Test Suite 'URLTests' failed at 2024-05-10 14:58:12.435
         Executed 1 test, with 1 failure (0 unexpected) in 0.004 (0.004) seconds
Test Suite 'Selected tests' failed at 2024-05-10 14:58:12.435
         Executed 1 test, with 1 failure (0 unexpected) in 0.004 (0.004) seconds

Test Suite 'Selected tests' started at 2024-05-10 14:58:04.835
Test Suite 'DataIOTests' started at 2024-05-10 14:58:04.835
Test Case 'DataIOTests.test_writeFailure' started at 2024-05-10 14:58:04.835
S:\SourceCache\swift-project\swift-foundation\Tests\FoundationEssentialsTests\DataIOTests.swift:127: error: DataIOTests.test_writeFailure : XCTAssertThrowsError failed: did not throw error -

Test Suite 'Selected tests' started at 2024-05-10 14:58:04.835
Test Suite 'DataIOTests' started at 2024-05-10 14:58:04.835
Test Case 'DataIOTests.test_slicedReadWrite' started at 2024-05-10 14:58:04.835

Test Suite 'Selected tests' started at 2024-05-10 14:58:04.831
Test Suite 'DataIOTests' started at 2024-05-10 14:58:04.831
Test Case 'DataIOTests.test_basicReadWrite' started at 2024-05-10 14:58:04.831

Test Suite 'Selected tests' started at 2024-05-10 14:58:04.831
Test Suite 'DataIOTests' started at 2024-05-10 14:58:04.831
Test Case 'DataIOTests.test_readWriteMapped' started at 2024-05-10 14:58:04.831

Test Suite 'Selected tests' started at 2024-05-10 14:58:04.831
Test Suite 'DataIOTests' started at 2024-05-10 14:58:04.831
Test Case 'DataIOTests.test_readWriteAtomic' started at 2024-05-10 14:58:04.831
<EXPR>:0: error: DataIOTests.test_readWriteAtomic : threw error "CocoaError(code: FoundationEssentials.CocoaError.Code(rawValue: 512), userInfo: ["NSUserStringVariant": "Folder", "NSFilePath": AnyHashable("/C:/Users/abdulras/AppData/Local/Temp/testfile-B445845C-89B4-428E-BD0A-2427AEA225C4"), "NSUnderlyingError": AnyHashable(FoundationEssentials.POSIXError(code: CRT.POSIXErrorCode.EINVAL)), "NSURL": AnyHashable(file:///C:/Users/abdulras/AppData/Local/Temp/testfile-B445845C-89B4-428E-BD0A-2427AEA225C4)])"
Test Case 'DataIOTests.test_readWriteAtomic' failed (0.004 seconds)
Test Suite 'DataIOTests' failed at 2024-05-10 14:58:04.835
         Executed 1 test, with 1 failure (1 unexpected) in 0.004 (0.004) seconds
Test Suite 'Selected tests' failed at 2024-05-10 14:58:04.835
         Executed 1 test, with 1 failure (1 unexpected) in 0.004 (0.004) seconds

Test Suite 'Selected tests' started at 2024-05-10 14:58:04.831
Test Suite 'DataIOTests' started at 2024-05-10 14:58:04.835
Test Case 'DataIOTests.test_largeFile' started at 2024-05-10 14:58:04.835

Test Suite 'Selected tests' started at 2024-05-10 14:58:04.831
Test Suite 'DataIOTests' started at 2024-05-10 14:58:04.831
Test Case 'DataIOTests.test_emptyFile' started at 2024-05-10 14:58:04.831

@jrflat
Copy link
Contributor Author

jrflat commented May 10, 2024

Ah, looks like the create/Protected/TemporaryFile(at:inPath:..) helpers in Data+Writing.swift still need to be modified a bit for Windows. Specifically, the line let temporaryDirectoryPath = destinationPath.deletingLastPathComponent() is likely problematic because the String helper only considers forward slashes. I'll try to rework these functions a bit (maybe operate more on the URL instead of pulling out the String in an earlier call).

@jrflat
Copy link
Contributor Author

jrflat commented May 13, 2024

I'm going to merge this to unblock other work, but I will open up a new PR to fix the Data+Writing functions for Windows mentioned above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants