Skip to content

Commit d8f78f9

Browse files
authored
Merge pull request #1038 from spevans/pr_osx_tests
2 parents 229025d + b16a89c commit d8f78f9

File tree

4 files changed

+28
-10
lines changed

4 files changed

+28
-10
lines changed

Foundation.xcodeproj/project.pbxproj

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
5B13B32B1C582D4C00651CE2 /* TestNSData.swift in Sources */ = {isa = PBXBuildFile; fileRef = DCDBB8321C1768AC00313299 /* TestNSData.swift */; };
2727
5B13B32C1C582D4C00651CE2 /* TestNSDate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 22B9C1E01C165D7A00DECFF9 /* TestNSDate.swift */; };
2828
5B13B32D1C582D4C00651CE2 /* TestNSDictionary.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA66F63D1BF1619600136161 /* TestNSDictionary.swift */; };
29-
5B13B32E1C582D4C00651CE2 /* TestFileManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 525AECEB1BF2C96400D15BB0 /* TestFileManager.swift */; };
3029
5B13B32F1C582D4C00651CE2 /* TestNSGeometry.swift in Sources */ = {isa = PBXBuildFile; fileRef = 88D28DE61C13AE9000494606 /* TestNSGeometry.swift */; };
3130
5B13B3301C582D4C00651CE2 /* TestNSHTTPCookie.swift in Sources */ = {isa = PBXBuildFile; fileRef = 848A30571C137B3500C83206 /* TestNSHTTPCookie.swift */; };
3231
5B13B3311C582D4C00651CE2 /* TestNSIndexPath.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4AE109261C17CCBF007367B5 /* TestNSIndexPath.swift */; };
@@ -51,7 +50,6 @@
5150
5B13B3441C582D4C00651CE2 /* TestNSSet.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA66F6411BF1619600136161 /* TestNSSet.swift */; };
5251
5B13B3451C582D4C00651CE2 /* TestNSString.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA66F6421BF1619600136161 /* TestNSString.swift */; };
5352
5B13B3461C582D4C00651CE2 /* TestProcess.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B6F17941C48631C00935030 /* TestProcess.swift */; };
54-
5B13B3471C582D4C00651CE2 /* TestThread.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E5835F31C20C9B500C81317 /* TestThread.swift */; };
5553
5B13B3481C582D4C00651CE2 /* TestNSTimer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61D6C9EE1C1DFE9500DEF583 /* TestNSTimer.swift */; };
5654
5B13B3491C582D4C00651CE2 /* TestNSTimeZone.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84BA558D1C16F90900F48C54 /* TestNSTimeZone.swift */; };
5755
5B13B34A1C582D4C00651CE2 /* TestNSURL.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA66F6431BF1619600136161 /* TestNSURL.swift */; };
@@ -315,6 +313,10 @@
315313
9F0DD3571ECD783500F68030 /* SwiftFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5B5D885D1BBC938800234F36 /* SwiftFoundation.framework */; };
316314
A058C2021E529CF100B07AA1 /* TestMassFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = A058C2011E529CF100B07AA1 /* TestMassFormatter.swift */; };
317315
AE35A1861CBAC85E0042DB84 /* SwiftFoundation.h in Headers */ = {isa = PBXBuildFile; fileRef = AE35A1851CBAC85E0042DB84 /* SwiftFoundation.h */; settings = {ATTRIBUTES = (Public, ); }; };
316+
B90C57BB1EEEEA5A005208AE /* TestFileManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 525AECEB1BF2C96400D15BB0 /* TestFileManager.swift */; };
317+
B90C57BC1EEEEA5A005208AE /* TestThread.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E5835F31C20C9B500C81317 /* TestThread.swift */; };
318+
B910957A1EEF237800A71930 /* NSString-UTF16-LE-data.txt in Resources */ = {isa = PBXBuildFile; fileRef = B91095781EEF237800A71930 /* NSString-UTF16-LE-data.txt */; };
319+
B910957B1EEF237800A71930 /* NSString-UTF16-BE-data.txt in Resources */ = {isa = PBXBuildFile; fileRef = B91095791EEF237800A71930 /* NSString-UTF16-BE-data.txt */; };
318320
B9974B961EDF4A22007F15B8 /* TransferState.swift in Sources */ = {isa = PBXBuildFile; fileRef = B9974B8F1EDF4A22007F15B8 /* TransferState.swift */; };
319321
B9974B971EDF4A22007F15B8 /* MultiHandle.swift in Sources */ = {isa = PBXBuildFile; fileRef = B9974B901EDF4A22007F15B8 /* MultiHandle.swift */; };
320322
B9974B981EDF4A22007F15B8 /* libcurlHelpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = B9974B911EDF4A22007F15B8 /* libcurlHelpers.swift */; };
@@ -772,6 +774,8 @@
772774
A5A34B551C18C85D00FD972B /* TestNSByteCountFormatter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestNSByteCountFormatter.swift; sourceTree = "<group>"; };
773775
AE35A1851CBAC85E0042DB84 /* SwiftFoundation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SwiftFoundation.h; sourceTree = "<group>"; };
774776
B167A6641ED7303F0040B09A /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
777+
B91095781EEF237800A71930 /* NSString-UTF16-LE-data.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "NSString-UTF16-LE-data.txt"; sourceTree = "<group>"; };
778+
B91095791EEF237800A71930 /* NSString-UTF16-BE-data.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "NSString-UTF16-BE-data.txt"; sourceTree = "<group>"; };
775779
B9974B8F1EDF4A22007F15B8 /* TransferState.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = TransferState.swift; path = http/TransferState.swift; sourceTree = "<group>"; };
776780
B9974B901EDF4A22007F15B8 /* MultiHandle.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = MultiHandle.swift; path = http/MultiHandle.swift; sourceTree = "<group>"; };
777781
B9974B911EDF4A22007F15B8 /* libcurlHelpers.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = libcurlHelpers.swift; path = http/libcurlHelpers.swift; sourceTree = "<group>"; };
@@ -1377,6 +1381,8 @@
13771381
D3A597F31C34142600295652 /* NSKeyedUnarchiver-NotificationTest.plist */,
13781382
EA66F6791BF9401E00136161 /* Info.plist */,
13791383
CE19A88B1C23AA2300B4CB6A /* NSStringTestData.txt */,
1384+
B91095781EEF237800A71930 /* NSString-UTF16-LE-data.txt */,
1385+
B91095791EEF237800A71930 /* NSString-UTF16-BE-data.txt */,
13801386
528776181BF27D9500CB0090 /* Test.plist */,
13811387
EA66F63B1BF1619600136161 /* NSURLTestData.plist */,
13821388
E1A3726E1C31EBFB0023AF4D /* NSXMLDocumentTestData.xml */,
@@ -2051,8 +2057,10 @@
20512057
528776191BF27D9500CB0090 /* Test.plist in Resources */,
20522058
EA66F6481BF1619600136161 /* NSURLTestData.plist in Resources */,
20532059
D3A597FA1C3415F000295652 /* NSKeyedUnarchiver-UUIDTest.plist in Resources */,
2060+
B910957B1EEF237800A71930 /* NSString-UTF16-BE-data.txt in Resources */,
20542061
D3A598001C341E9100295652 /* NSKeyedUnarchiver-ConcreteValueTest.plist in Resources */,
20552062
D3A597FC1C3417EA00295652 /* NSKeyedUnarchiver-ComplexTest.plist in Resources */,
2063+
B910957A1EEF237800A71930 /* NSString-UTF16-LE-data.txt in Resources */,
20562064
D3E8D6D51C36AC0C00295652 /* NSKeyedUnarchiver-RectTest.plist in Resources */,
20572065
D3A597F81C3415CC00295652 /* NSKeyedUnarchiver-URLTest.plist in Resources */,
20582066
D3E8D6D31C36982700295652 /* NSKeyedUnarchiver-EdgeInsetsTest.plist in Resources */,
@@ -2327,10 +2335,8 @@
23272335
5FE52C951D147D1C00F7D270 /* TestNSTextCheckingResult.swift in Sources */,
23282336
5B13B3451C582D4C00651CE2 /* TestNSString.swift in Sources */,
23292337
1520469B1D8AEABE00D02E36 /* HTTPServer.swift in Sources */,
2330-
5B13B3471C582D4C00651CE2 /* TestThread.swift in Sources */,
2331-
5B13B32E1C582D4C00651CE2 /* TestFileManager.swift in Sources */,
2332-
5B13B3471C582D4C00651CE2 /* TestNSThread.swift in Sources */,
2333-
5B13B32E1C582D4C00651CE2 /* TestNSFileManager.swift in Sources */,
2338+
B90C57BC1EEEEA5A005208AE /* TestThread.swift in Sources */,
2339+
B90C57BB1EEEEA5A005208AE /* TestFileManager.swift in Sources */,
23342340
A058C2021E529CF100B07AA1 /* TestMassFormatter.swift in Sources */,
23352341
5B13B3381C582D4C00651CE2 /* TestNSNotificationQueue.swift in Sources */,
23362342
CC5249C01D341D23007CB54D /* TestUnitConverter.swift in Sources */,
@@ -2763,6 +2769,7 @@
27632769
CLANG_ENABLE_MODULES = YES;
27642770
CLANG_ENABLE_OBJC_ARC = YES;
27652771
COMBINE_HIDPI_IMAGES = YES;
2772+
FRAMEWORK_SEARCH_PATHS = "../swift-corelibs-xctest/build/Debug";
27662773
HEADER_SEARCH_PATHS = (
27672774
"$(CONFIGURATION_BUILD_DIR)/usr/local/include",
27682775
/usr/include/libxml2,
@@ -2788,6 +2795,7 @@
27882795
CLANG_ENABLE_MODULES = YES;
27892796
CLANG_ENABLE_OBJC_ARC = YES;
27902797
COMBINE_HIDPI_IMAGES = YES;
2798+
FRAMEWORK_SEARCH_PATHS = "../swift-corelibs-xctest/build/Release";
27912799
HEADER_SEARCH_PATHS = (
27922800
"$(CONFIGURATION_BUILD_DIR)/usr/local/include",
27932801
/usr/include/libxml2,

Foundation/Process.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ open class Process: NSObject {
241241
if let env = environment {
242242
let nenv = env.count
243243
envp = UnsafeMutablePointer<UnsafeMutablePointer<Int8>?>.allocate(capacity: 1 + nenv)
244-
envp.initialize(from: env.map { strdup("\($0)=\($1)") }, count: 1 + nenv)
244+
envp.initialize(from: env.map { strdup("\($0)=\($1)") }, count: nenv)
245245
envp[env.count] = nil
246246
} else {
247247
envp = _CFEnviron()

TestFoundation/HTTPServer.swift

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,13 @@ class _TCPSocket {
7171
}
7272

7373
private func createSockaddr(_ port: UInt16) -> sockaddr_in {
74+
// Listen on the loopback address so that OSX doesnt pop up a dialog
75+
// asking to accept incoming connections if the firewall is enabled.
76+
let addr = UInt32(INADDR_LOOPBACK).bigEndian
7477
#if os(Linux)
75-
return sockaddr_in(sin_family: sa_family_t(AF_INET), sin_port: htons(port), sin_addr: in_addr(s_addr: INADDR_ANY), sin_zero: (0,0,0,0,0,0,0,0))
78+
return sockaddr_in(sin_family: sa_family_t(AF_INET), sin_port: htons(port), sin_addr: in_addr(s_addr: addr), sin_zero: (0,0,0,0,0,0,0,0))
7679
#else
77-
return sockaddr_in(sin_len: 0, sin_family: sa_family_t(AF_INET), sin_port: CFSwapInt16HostToBig(port), sin_addr: in_addr(s_addr: INADDR_ANY), sin_zero: (0,0,0,0,0,0,0,0) )
80+
return sockaddr_in(sin_len: 0, sin_family: sa_family_t(AF_INET), sin_port: CFSwapInt16HostToBig(port), sin_addr: in_addr(s_addr: addr), sin_zero: (0,0,0,0,0,0,0,0))
7881
#endif
7982
}
8083

TestFoundation/TestNSHTTPCookieStorage.swift

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,14 @@ class TestNSHTTPCookieStorage: XCTestCase {
244244
//Test by setting the environmental variable
245245
let pathIndex = bundlePath.range(of: "/", options: .backwards)?.lowerBound
246246
let task = Process()
247-
task.launchPath = bundlePath.substring(to: pathIndex!) + "/xdgTestHelper/xdgTestHelper"
247+
248+
#if os(OSX)
249+
let exeName = "/xdgTestHelper.app/Contents/MacOS/xdgTestHelper"
250+
#else
251+
let exeName = "/xdgTestHelper/xdgTestHelper"
252+
#endif
253+
254+
task.launchPath = bundlePath.substring(to: pathIndex!) + exeName
248255
var environment = ProcessInfo.processInfo.environment
249256
let testPath = NSHomeDirectory() + "/TestXDG"
250257
environment["XDG_DATA_HOME"] = testPath

0 commit comments

Comments
 (0)