Skip to content

Commit eac1e9a

Browse files
committed
Test: simplify the test configuration
Remove the compatibility paths in the test infrastructure. Foundation and dispatch have had evolved over the years. Remove the compatibility assuming that something within the past few years is used to build. This is now more reasonable given that the Foundation and dispatch dependencies have been made optional - this allows building XCTest against a SDK. This also reduces the setup for Windows to a very trivial skeleton of just passing along SDKROOT. This enables the windows build to run the test suite against the SDKROOT that has been built up which allows us to swap to the new runtime implementation.
1 parent 0e93ee5 commit eac1e9a

File tree

2 files changed

+28
-36
lines changed

2 files changed

+28
-36
lines changed

CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ if(ENABLE_TESTING)
123123

124124
find_package(Python3 COMPONENTS Interpreter REQUIRED)
125125

126-
string(REPLACE "\\" "\\\\" CMAKE_Swift_FLAGS_ESCAPED ${CMAKE_Swift_FLAGS})
127126
add_custom_target(check-xctest
128127
COMMAND
129128
${CMAKE_COMMAND} -E env
@@ -133,7 +132,6 @@ if(ENABLE_TESTING)
133132
LIBDISPATCH_BUILD_DIR=${XCTEST_PATH_TO_LIBDISPATCH_BUILD}
134133
LIBDISPATCH_OVERLAY_DIR=${XCTEST_PATH_TO_LIBDISPATCH_BUILD}/src/swift
135134
SWIFT_EXEC=${CMAKE_Swift_COMPILER}
136-
SWIFT_FLAGS=${CMAKE_Swift_FLAGS_ESCAPED}
137135
$<TARGET_FILE:Python3::Interpreter> ${LIT_COMMAND} -sv ${CMAKE_SOURCE_DIR}/Tests/Functional
138136
COMMENT
139137
"Running XCTest functional test suite"

Tests/Functional/lit.cfg

Lines changed: 28 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ else:
7878
if platform.system() == 'Windows':
7979
sdkroot = os.getenv('SDKROOT', None)
8080
if sdkroot:
81-
swift_exec.extend(['-sdk', sdkroot])
81+
swift_exec.extend(['-sdk', '"' + sdkroot + '"'])
8282
swift_exec.extend(['-Xlinker', '-nodefaultlib:libcmt'])
8383
else:
8484
swift_exec.extend([
@@ -88,42 +88,36 @@ else:
8888
'-Xlinker', '-rpath', '-Xlinker', os.path.join(foundation_dir, 'Sources', 'FoundationNetworking'),
8989
'-Xlinker', '-rpath', '-Xlinker', os.path.join(foundation_dir, 'Sources', 'FoundationXML'),
9090
'-Xlinker', '-rpath', '-Xlinker', os.path.join(foundation_dir, 'lib'),
91+
'-L', foundation_dir,
92+
'-L', os.path.join(foundation_dir, 'Foundation'),
93+
'-L', os.path.join(foundation_dir, 'Sources', 'Foundation'),
94+
'-L', os.path.join(foundation_dir, 'Sources', 'FoundationNetworking'),
95+
'-L', os.path.join(foundation_dir, 'Sources', 'FoundationXML'),
96+
'-L', os.path.join(foundation_dir, 'lib'),
97+
'-I', foundation_dir,
98+
'-I', os.path.join(foundation_dir, 'swift'),
99+
'-I', os.path.join(foundation_dir, '_CModulesForClients'),
100+
'-Xcc', '-F', '-Xcc', foundation_dir,
91101
])
92-
swift_exec.extend([
93-
'-L', foundation_dir,
94-
'-L', os.path.join(foundation_dir, 'Foundation'),
95-
'-L', os.path.join(foundation_dir, 'Sources', 'Foundation'),
96-
'-L', os.path.join(foundation_dir, 'Sources', 'FoundationNetworking'),
97-
'-L', os.path.join(foundation_dir, 'Sources', 'FoundationXML'),
98-
'-L', os.path.join(foundation_dir, 'lib'),
99-
'-I', foundation_dir,
100-
'-I', os.path.join(foundation_dir, 'swift'),
101-
'-I', os.path.join(foundation_dir, '_CModulesForClients'),
102-
'-Xcc', '-F', '-Xcc', foundation_dir,
103-
])
104-
105-
# We also need to link swift-corelibs-libdispatch, if
106-
# swift-corelibs-foundation is using it.
107-
libdispatch_src_dir = os.getenv('LIBDISPATCH_SRC_DIR')
108-
libdispatch_build_dir = os.getenv('LIBDISPATCH_BUILD_DIR')
109-
libdispatch_overlay_dir = os.getenv('LIBDISPATCH_OVERLAY_DIR')
110-
if ((libdispatch_src_dir is not None)
111-
and (libdispatch_build_dir is not None)
112-
and (libdispatch_overlay_dir is not None)):
113-
swift_exec.extend([
114-
'-Xcc', '-fblocks',
115-
'-I', libdispatch_src_dir,
116-
'-I', libdispatch_overlay_dir,
117-
'-I', os.path.join(libdispatch_overlay_dir, 'swift'),
118-
'-L', libdispatch_build_dir,
119-
'-L', os.path.join(libdispatch_build_dir, 'src'),
120-
'-L', os.path.join(libdispatch_build_dir, 'src', 'BlocksRuntime'),
121-
'-L', os.path.join(libdispatch_build_dir, 'src', 'swift'),
122-
'-vfsoverlay', os.path.join(libdispatch_build_dir, 'dispatch-vfs-overlay.yaml'),
123-
])
124102

125-
if platform.system() != 'Windows':
103+
# We also need to link swift-corelibs-libdispatch, if
104+
# swift-corelibs-foundation is using it.
105+
libdispatch_src_dir = os.getenv('LIBDISPATCH_SRC_DIR')
106+
libdispatch_build_dir = os.getenv('LIBDISPATCH_BUILD_DIR')
107+
libdispatch_overlay_dir = os.getenv('LIBDISPATCH_OVERLAY_DIR')
108+
if ((libdispatch_src_dir is not None)
109+
and (libdispatch_build_dir is not None)
110+
and (libdispatch_overlay_dir is not None)):
126111
swift_exec.extend([
112+
'-Xcc', '-fblocks',
113+
'-I', libdispatch_src_dir,
114+
'-I', libdispatch_overlay_dir,
115+
'-I', os.path.join(libdispatch_overlay_dir, 'swift'),
116+
'-L', libdispatch_build_dir,
117+
'-L', os.path.join(libdispatch_build_dir, 'src'),
118+
'-L', os.path.join(libdispatch_build_dir, 'src', 'BlocksRuntime'),
119+
'-L', os.path.join(libdispatch_build_dir, 'src', 'swift'),
120+
'-vfsoverlay', os.path.join(libdispatch_build_dir, 'dispatch-vfs-overlay.yaml'),
127121
'-Xlinker', '-rpath', '-Xlinker', libdispatch_build_dir,
128122
])
129123

0 commit comments

Comments
 (0)