Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ if(ENABLE_TESTING)

find_package(Python3 COMPONENTS Interpreter REQUIRED)

string(REPLACE "\\" "\\\\" CMAKE_Swift_FLAGS_ESCAPED ${CMAKE_Swift_FLAGS})
add_custom_target(check-xctest
COMMAND
${CMAKE_COMMAND} -E env
Expand All @@ -133,7 +132,7 @@ if(ENABLE_TESTING)
LIBDISPATCH_BUILD_DIR=${XCTEST_PATH_TO_LIBDISPATCH_BUILD}
LIBDISPATCH_OVERLAY_DIR=${XCTEST_PATH_TO_LIBDISPATCH_BUILD}/src/swift
SWIFT_EXEC=${CMAKE_Swift_COMPILER}
SWIFT_FLAGS=${CMAKE_Swift_FLAGS_ESCAPED}
SDKROOT=$ENV{SDKROOT}
$<TARGET_FILE:Python3::Interpreter> ${LIT_COMMAND} -sv ${CMAKE_SOURCE_DIR}/Tests/Functional
COMMENT
"Running XCTest functional test suite"
Expand Down
62 changes: 19 additions & 43 deletions Tests/Functional/lit.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -74,56 +74,32 @@ if platform.system() == 'Darwin':
])
else:
# We need to jump through extra hoops to link swift-corelibs-foundation.
foundation_dir = _getenv('FOUNDATION_BUILT_PRODUCTS_DIR')
if platform.system() == 'Windows':
sdkroot = os.getenv('SDKROOT', None)
if sdkroot:
swift_exec.extend(['-sdk', sdkroot])
swift_exec.extend(['-Xlinker', '-nodefaultlib:libcmt'])
swift_exec.extend(["-sdk", '"' + _getenv("SDKROOT") + '"'])
else:
foundation_dir = _getenv('FOUNDATION_BUILT_PRODUCTS_DIR')
swift_exec.extend([
'-Xlinker', '-rpath', '-Xlinker', foundation_dir,
'-Xlinker', '-rpath', '-Xlinker', os.path.join(foundation_dir, 'Foundation'),
'-Xlinker', '-rpath', '-Xlinker', os.path.join(foundation_dir, 'Sources', 'Foundation'),
'-Xlinker', '-rpath', '-Xlinker', os.path.join(foundation_dir, 'Sources', 'FoundationNetworking'),
'-Xlinker', '-rpath', '-Xlinker', os.path.join(foundation_dir, 'Sources', 'FoundationXML'),
'-I', os.path.join(foundation_dir, 'swift'),
'-I', os.path.join(foundation_dir, '_CModulesForClients'),
'-L', os.path.join(foundation_dir, 'lib'),
'-Xlinker', '-rpath', '-Xlinker', os.path.join(foundation_dir, 'lib'),
])
swift_exec.extend([
'-L', foundation_dir,
'-L', os.path.join(foundation_dir, 'Foundation'),
'-L', os.path.join(foundation_dir, 'Sources', 'Foundation'),
'-L', os.path.join(foundation_dir, 'Sources', 'FoundationNetworking'),
'-L', os.path.join(foundation_dir, 'Sources', 'FoundationXML'),
'-L', os.path.join(foundation_dir, 'lib'),
'-I', foundation_dir,
'-I', os.path.join(foundation_dir, 'swift'),
'-I', os.path.join(foundation_dir, '_CModulesForClients'),
'-Xcc', '-F', '-Xcc', foundation_dir,
])

# We also need to link swift-corelibs-libdispatch, if
# swift-corelibs-foundation is using it.
libdispatch_src_dir = os.getenv('LIBDISPATCH_SRC_DIR')
libdispatch_build_dir = os.getenv('LIBDISPATCH_BUILD_DIR')
libdispatch_overlay_dir = os.getenv('LIBDISPATCH_OVERLAY_DIR')
if ((libdispatch_src_dir is not None)
and (libdispatch_build_dir is not None)
and (libdispatch_overlay_dir is not None)):
swift_exec.extend([
'-Xcc', '-fblocks',
'-I', libdispatch_src_dir,
'-I', libdispatch_overlay_dir,
'-I', os.path.join(libdispatch_overlay_dir, 'swift'),
'-L', libdispatch_build_dir,
'-L', os.path.join(libdispatch_build_dir, 'src'),
'-L', os.path.join(libdispatch_build_dir, 'src', 'BlocksRuntime'),
'-L', os.path.join(libdispatch_build_dir, 'src', 'swift'),
'-vfsoverlay', os.path.join(libdispatch_build_dir, 'dispatch-vfs-overlay.yaml'),
])

if platform.system() != 'Windows':
# We also need to link swift-corelibs-libdispatch, if
# swift-corelibs-foundation is using it.
libdispatch_src_dir = os.getenv('LIBDISPATCH_SRC_DIR')
libdispatch_build_dir = os.getenv('LIBDISPATCH_BUILD_DIR')
libdispatch_overlay_dir = os.getenv('LIBDISPATCH_OVERLAY_DIR')
if ((libdispatch_src_dir is not None)
and (libdispatch_build_dir is not None)
and (libdispatch_overlay_dir is not None)):
swift_exec.extend([
'-I', libdispatch_src_dir,
'-I', libdispatch_overlay_dir,
'-I', os.path.join(libdispatch_overlay_dir, 'swift'),
'-L', os.path.join(libdispatch_build_dir, 'src'),
'-L', os.path.join(libdispatch_build_dir, 'src', 'BlocksRuntime'),
'-L', os.path.join(libdispatch_build_dir, 'src', 'swift'),
'-Xlinker', '-rpath', '-Xlinker', libdispatch_build_dir,
])

Expand Down