in build_script.py [0:0]
def test(args):
"""
Test the built XCTest.so library at the given 'build_dir', using the
given 'swiftc' compiler.
"""
lit_path = os.path.abspath(args.lit)
if not os.path.exists(lit_path):
raise IOError(
'Could not find lit tester tool at path: "{}". This tool is '
'requred to run the test suite. Unless you specified a custom '
'path to the tool using the "--lit" option, the lit tool will be '
'found in the LLVM source tree, which is expected to be checked '
'out in the same directory as swift-corelibs-xctest. If you do '
'not have LLVM checked out at this path, you may follow the '
'instructions for "Getting Sources for Swift and Related '
'Projects" from the Swift project README in order to fix this '
'error.'.format(lit_path))
# FIXME: Allow these to be specified by the Swift build script.
lit_flags = "-sv --no-progress-bar"
tests_path = os.path.join(SOURCE_DIR, "Tests", "Functional")
foundation_build_dir = os.path.abspath(args.foundation_build_dir)
core_foundation_build_dir = GenericUnixStrategy.core_foundation_build_dir(
foundation_build_dir, args.foundation_install_prefix)
if args.libdispatch_build_dir:
libdispatch_build_dir = os.path.abspath(args.libdispatch_build_dir)
symlink_force(os.path.join(args.libdispatch_build_dir, "src", ".libs", "libdispatch.so"),
foundation_build_dir)
if args.libdispatch_src_dir and args.libdispatch_build_dir:
libdispatch_src_args = (
"LIBDISPATCH_SRC_DIR={libdispatch_src_dir} "
"LIBDISPATCH_BUILD_DIR={libdispatch_build_dir} "
"LIBDISPATCH_OVERLAY_DIR={libdispatch_overlay_dir}".format(
libdispatch_src_dir=os.path.abspath(args.libdispatch_src_dir),
libdispatch_build_dir=os.path.join(args.libdispatch_build_dir, 'src', '.libs'),
libdispatch_overlay_dir=os.path.join(args.libdispatch_build_dir, 'src', 'swift')))
else:
libdispatch_src_args = ""
run('SWIFT_EXEC={swiftc} '
'BUILT_PRODUCTS_DIR={built_products_dir} '
'FOUNDATION_BUILT_PRODUCTS_DIR={foundation_build_dir} '
'CORE_FOUNDATION_BUILT_PRODUCTS_DIR={core_foundation_build_dir} '
'{libdispatch_src_args} '
'{lit_path} {lit_flags} '
'{tests_path}'.format(
swiftc=os.path.abspath(args.swiftc),
built_products_dir=args.build_dir,
foundation_build_dir=foundation_build_dir,
core_foundation_build_dir=core_foundation_build_dir,
libdispatch_src_args=libdispatch_src_args,
lit_path=lit_path,
lit_flags=lit_flags,
tests_path=tests_path))