Skip to content

Commit 92e599f

Browse files
committed
Restructure TestFoundation directory
This moves the `TestFoundation` directory to a `Tests` directory to home all the testing infrastructure. The Foundation tests are now present under `Tests/Foundation`. The Test cases themselves are in the `Tests` directory under `Tests/Foundation` and the supporting files in the directory itself. `xdgTestHelper` has been moved into `Tests/Tools/XDGTestHelper`. This restructure allows for the emission of the `TestFoundation` binary in the top level directory for the build output. This is required to co-locate the libraries and the executables which is needed for Windows.
1 parent 13a64cd commit 92e599f

File tree

171 files changed

+199
-200
lines changed

Some content is hidden

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

171 files changed

+199
-200
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ add_subdirectory(Foundation)
4949
add_subdirectory(Tools)
5050
if(ENABLE_TESTING)
5151
find_package(XCTest CONFIG REQUIRED)
52-
add_subdirectory(TestFoundation)
52+
add_subdirectory(Tests)
5353
endif()
5454

5555
if(NOT BUILD_SHARED_LIBS)

TestFoundation/CMakeLists.txt

Lines changed: 0 additions & 187 deletions
This file was deleted.

TestFoundation/xdgTestHelper/CMakeLists.txt

Lines changed: 0 additions & 12 deletions
This file was deleted.

Tests/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
add_subdirectory(Tools)
2+
add_subdirectory(Foundation)

Tests/Foundation/CMakeLists.txt

Lines changed: 181 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,181 @@
1+
add_executable(TestFoundation
2+
main.swift
3+
HTTPServer.swift
4+
Imports.swift
5+
FTPServer.swift
6+
../../Foundation/ProgressFraction.swift
7+
Utilities.swift
8+
FixtureValues.swift)
9+
10+
# Test Cases
11+
target_sources(TestFoundation PRIVATE
12+
Tests/TestAffineTransform.swift
13+
Tests/TestBundle.swift
14+
Tests/TestByteCountFormatter.swift
15+
Tests/TestCachedURLResponse.swift
16+
Tests/TestCalendar.swift
17+
Tests/TestCharacterSet.swift
18+
Tests/TestCodable.swift
19+
Tests/TestDateComponents.swift
20+
Tests/TestDateFormatter.swift
21+
Tests/TestDateInterval.swift
22+
Tests/TestDateIntervalFormatter.swift
23+
Tests/TestDate.swift
24+
Tests/TestDecimal.swift
25+
Tests/TestDimension.swift
26+
Tests/TestEnergyFormatter.swift
27+
Tests/TestFileHandle.swift
28+
Tests/TestFileManager.swift
29+
Tests/TestHost.swift
30+
Tests/TestHTTPCookieStorage.swift
31+
Tests/TestHTTPCookie.swift
32+
Tests/TestHTTPURLResponse.swift
33+
Tests/TestIndexPath.swift
34+
Tests/TestIndexSet.swift
35+
Tests/TestISO8601DateFormatter.swift
36+
Tests/TestJSONEncoder.swift
37+
Tests/TestJSONSerialization.swift
38+
Tests/TestLengthFormatter.swift
39+
Tests/TestMassFormatter.swift
40+
Tests/TestMeasurement.swift
41+
Tests/TestNotificationCenter.swift
42+
Tests/TestNotificationQueue.swift
43+
Tests/TestNotification.swift
44+
Tests/TestNSArray.swift
45+
Tests/TestNSAttributedString.swift
46+
Tests/TestNSCache.swift
47+
Tests/TestNSCalendar.swift
48+
Tests/TestNSCompoundPredicate.swift
49+
Tests/TestNSData.swift
50+
Tests/TestNSDateComponents.swift
51+
Tests/TestNSDictionary.swift
52+
Tests/TestNSError.swift
53+
Tests/TestNSGeometry.swift
54+
Tests/TestNSKeyedArchiver.swift
55+
Tests/TestNSKeyedUnarchiver.swift
56+
Tests/TestNSLocale.swift
57+
Tests/TestNSLock.swift
58+
Tests/TestNSNull.swift
59+
Tests/TestNSNumberBridging.swift
60+
Tests/TestNSNumber.swift
61+
Tests/TestNSOrderedSet.swift
62+
Tests/TestNSPredicate.swift
63+
Tests/TestNSRange.swift
64+
Tests/TestNSRegularExpression.swift
65+
Tests/TestNSSet.swift
66+
Tests/TestNSSortDescriptor.swift
67+
Tests/TestNSString.swift
68+
Tests/TestNSTextCheckingResult.swift
69+
Tests/TestNSURLRequest.swift
70+
Tests/TestNSUUID.swift
71+
Tests/TestNSValue.swift
72+
Tests/TestNumberFormatter.swift
73+
Tests/TestObjCRuntime.swift
74+
Tests/TestOperationQueue.swift
75+
Tests/TestPersonNameComponents.swift
76+
Tests/TestPipe.swift
77+
Tests/TestProcessInfo.swift
78+
Tests/TestProcess.swift
79+
Tests/TestProgress.swift
80+
Tests/TestProgressFraction.swift
81+
Tests/TestPropertyListEncoder.swift
82+
Tests/TestPropertyListSerialization.swift
83+
Tests/TestRunLoop.swift
84+
Tests/TestScanner.swift
85+
Tests/TestSocketPort.swift
86+
Tests/TestStream.swift
87+
Tests/TestThread.swift
88+
Tests/TestTimer.swift
89+
Tests/TestTimeZone.swift
90+
Tests/TestUnitConverter.swift
91+
Tests/TestUnitVolume.swift
92+
Tests/TestUnit.swift
93+
Tests/TestURLCache.swift
94+
Tests/TestURLCredential.swift
95+
Tests/TestURLCredentialStorage.swift
96+
Tests/TestURLComponents.swift
97+
Tests/TestURLProtectionSpace.swift
98+
Tests/TestURLProtocol.swift
99+
Tests/TestURLRequest.swift
100+
Tests/TestURLResponse.swift
101+
Tests/TestURLSession.swift
102+
Tests/TestURLSessionFTP.swift
103+
Tests/TestURL.swift
104+
Tests/TestUserDefaults.swift
105+
Tests/TestUtils.swift
106+
Tests/TestUUID.swift
107+
Tests/TestXMLDocument.swift
108+
Tests/TestXMLParser.swift)
109+
110+
target_compile_definitions(TestFoundation PRIVATE
111+
$<$<BOOL:${ENABLE_TESTING}>:NS_FOUNDATION_ALLOWS_TESTABLE_IMPORT>)
112+
target_link_libraries(TestFoundation PRIVATE
113+
Foundation
114+
FoundationNetworking
115+
FoundationXML)
116+
target_link_libraries(TestFoundation PRIVATE
117+
XCTest)
118+
119+
# NOTE(compnerd) create a test "app" directory as we need the xdgTestHelper as
120+
# an executable peer and the binary will be placed in the directory with the
121+
# same name as a peer in the build tree.
122+
if(CMAKE_SYSTEM_NAME STREQUAL Windows)
123+
set(Resources TestFoundation.resources)
124+
else()
125+
set(Resources Resources)
126+
endif()
127+
128+
add_custom_command(TARGET TestFoundation POST_BUILD
129+
COMMAND
130+
${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/TestFoundation.app
131+
COMMAND
132+
${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:TestFoundation> ${CMAKE_BINARY_DIR}/TestFoundation.app
133+
COMMAND
134+
${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:plutil> ${CMAKE_BINARY_DIR}/TestFoundation.app
135+
COMMAND
136+
${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:xdgTestHelper> ${CMAKE_BINARY_DIR}/TestFoundation.app
137+
COMMAND
138+
${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/TestFoundation.app/${Resources}
139+
COMMAND
140+
${CMAKE_COMMAND} -E copy_if_different
141+
${CMAKE_CURRENT_SOURCE_DIR}/Resources/Info.plist
142+
${CMAKE_CURRENT_SOURCE_DIR}/Resources/NSURLTestData.plist
143+
${CMAKE_CURRENT_SOURCE_DIR}/Resources/Test.plist
144+
${CMAKE_CURRENT_SOURCE_DIR}/Resources/NSStringTestData.txt
145+
${CMAKE_CURRENT_SOURCE_DIR}/Resources/NSString-UTF16-BE-data.txt
146+
${CMAKE_CURRENT_SOURCE_DIR}/Resources/NSString-UTF16-LE-data.txt
147+
${CMAKE_CURRENT_SOURCE_DIR}/Resources/NSString-UTF32-BE-data.txt
148+
${CMAKE_CURRENT_SOURCE_DIR}/Resources/NSString-UTF32-LE-data.txt
149+
${CMAKE_CURRENT_SOURCE_DIR}/Resources/NSString-ISO-8859-1-data.txt
150+
${CMAKE_CURRENT_SOURCE_DIR}/Resources/NSXMLDocumentTestData.xml
151+
${CMAKE_CURRENT_SOURCE_DIR}/Resources/PropertyList-1.0.dtd
152+
${CMAKE_CURRENT_SOURCE_DIR}/Resources/NSXMLDTDTestData.xml
153+
${CMAKE_CURRENT_SOURCE_DIR}/Resources/NSKeyedUnarchiver-ArrayTest.plist
154+
${CMAKE_CURRENT_SOURCE_DIR}/Resources/NSKeyedUnarchiver-ComplexTest.plist
155+
${CMAKE_CURRENT_SOURCE_DIR}/Resources/NSKeyedUnarchiver-ConcreteValueTest.plist
156+
${CMAKE_CURRENT_SOURCE_DIR}/Resources/NSKeyedUnarchiver-EdgeInsetsTest.plist
157+
${CMAKE_CURRENT_SOURCE_DIR}/Resources/NSKeyedUnarchiver-NotificationTest.plist
158+
${CMAKE_CURRENT_SOURCE_DIR}/Resources/NSKeyedUnarchiver-RangeTest.plist
159+
${CMAKE_CURRENT_SOURCE_DIR}/Resources/NSKeyedUnarchiver-RectTest.plist
160+
${CMAKE_CURRENT_SOURCE_DIR}/Resources/NSKeyedUnarchiver-URLTest.plist
161+
${CMAKE_CURRENT_SOURCE_DIR}/Resources/NSKeyedUnarchiver-UUIDTest.plist
162+
${CMAKE_CURRENT_SOURCE_DIR}/Resources/NSKeyedUnarchiver-OrderedSetTest.plist
163+
${CMAKE_CURRENT_SOURCE_DIR}/Resources/TestFileWithZeros.txt
164+
${CMAKE_BINARY_DIR}/TestFoundation.app/${Resources}
165+
COMMAND
166+
${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/Resources/Fixtures ${CMAKE_BINARY_DIR}/TestFoundation.app/${Resources}/Fixtures
167+
COMMAND
168+
${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:Foundation> ${CMAKE_BINARY_DIR}/TestFoundation.app
169+
COMMAND
170+
${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:FoundationNetworking> ${CMAKE_BINARY_DIR}/TestFoundation.app
171+
COMMAND
172+
${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:FoundationXML> ${CMAKE_BINARY_DIR}/TestFoundation.app)
173+
174+
xctest_discover_tests(TestFoundation
175+
COMMAND
176+
${CMAKE_BINARY_DIR}/TestFoundation.app/TestFoundation${CMAKE_EXECUTABLE_SUFFIX}
177+
WORKING_DIRECTORY
178+
${CMAKE_BINARY_DIR}/TestFoundation.app
179+
PROPERTIES
180+
ENVIRONMENT
181+
LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/TestFoundation.app:$<TARGET_LINKER_FILE_DIR:XCTest>:$<TARGET_LINKER_FILE_DIR:dispatch>:$<TARGET_LINKER_FILE_DIR:swiftDispatch>:$<TARGET_LINKER_FILE_DIR:BlocksRuntime>)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

Tests/Tools/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
add_subdirectory(XDGTestHelper)

0 commit comments

Comments
 (0)