Files
swift-mirror/validation-test/lit.site.cfg.in
Daniel Rodríguez Troitiño 6d5309a6c4 [android] Modify test scripts for aarch64 and modern NDKs.
Many places on the testing scripts for Android have the ARMv7
architecture hardcoded. Modify all those instances to support both ARMv7
and AArch64.

Besides the paths being modified depending on the architecture, the
script is also modified to adapt to NDK beyond r14, where the headers
are not under the SDK root, but under a unified sysroot. Two new include
paths are passed to the compiler invocations (one the general one, one
the architecture specific one).

In order to link correctly, the -tools-directory is passed to the Swift
compiler invocation. In order to use a modern linker, the selected
linker in the CMake script is written in the lit.site.cfg.in files. The
system will prefer lld, but will fallback to gold. Plain ld will not be
used, since it cannot link correctly the binaries.

There's a new CMake variable named SWIFT_ANDROID_${ARCH}_ICU_DATA that
should point to libicudataswift.so for each architecture. This part of
ICU is necessary while running the test in the host, so it needs to be
uploaded. Since it is normally side by side with other ICU products, the
linker was finding it for free.
2019-03-20 11:31:50 -07:00

92 lines
3.4 KiB
Python

# swift/validation-test/lit.site.cfg.in ---------------------------*- python -*-
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See https://swift.org/LICENSE.txt for license information
# See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
#
# -----------------------------------------------------------------------------
import sys
import platform
config.llvm_src_root = "@LLVM_MAIN_SRC_DIR@"
config.llvm_obj_root = "@LLVM_BINARY_DIR@"
config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
config.llvm_libs_dir = "@LLVM_LIBS_DIR@"
config.llvm_code_generators = "@LLVM_TARGETS_TO_BUILD@".split(";")
config.lit_tools_dir = "@LLVM_LIT_TOOLS_DIR@"
config.swift_src_root = "@SWIFT_SOURCE_DIR@"
config.swift_obj_root = "@SWIFT_BINARY_DIR@"
config.target_triple = "@TARGET_TRIPLE@"
config.variant_triple = "@VARIANT_TRIPLE@"
config.variant_suffix = "@VARIANT_SUFFIX@"
config.variant_sdk = "@VARIANT_SDK@"
config.swift_test_results_dir = \
lit_config.params.get("swift_test_results_dir", "@SWIFT_TEST_RESULTS_DIR@")
config.darwin_xcrun_toolchain = "@SWIFT_DARWIN_XCRUN_TOOLCHAIN@"
config.android_ndk_path = "@SWIFT_ANDROID_NDK_PATH@"
config.android_ndk_gcc_version = "@SWIFT_ANDROID_NDK_GCC_VERSION@"
config.coverage_mode = "@SWIFT_ANALYZE_CODE_COVERAGE@"
config.lldb_build_root = "@LLDB_BUILD_DIR@"
if "@SWIFT_ASAN_BUILD@" == "TRUE":
config.available_features.add("asan")
else:
config.available_features.add('no_asan')
if "@SWIFT_TOOLS_ENABLE_LTO@".lower() in ["full", "thin"]:
config.available_features.add("lto")
else:
config.available_features.add("no_lto")
if "@LLVM_ENABLE_ASSERTIONS@" == "TRUE":
config.available_features.add('asserts')
else:
config.available_features.add('no_asserts')
# If tools have debug info, set the tools-debuginfo flag.
if "@CMAKE_BUILD_TYPE@" in ["Debug", "RelWithDebInfo"]:
config.available_features.add('tools-debuginfo')
# If tools are release-mode, set the tools-release flag.
if "@CMAKE_BUILD_TYPE@" in ["Release", "RelWithDebInfo"]:
config.available_features.add('tools-release')
if "@SWIFT_STDLIB_ASSERTIONS@" == "TRUE":
config.available_features.add('swift_stdlib_asserts')
else:
config.available_features.add('swift_stdlib_no_asserts')
if "@SWIFT_OPTIMIZED@" == "TRUE":
config.available_features.add("optimized_stdlib")
if "@SWIFT_ENABLE_SOURCEKIT_TESTS@" == "TRUE":
config.available_features.add('sourcekit')
if "@SWIFT_STDLIB_USE_NONATOMIC_RC@" == "TRUE":
config.available_features.add("nonatomic_rc")
if "@CMAKE_GENERATOR@" == "Xcode":
xcode_bin_dir = os.path.join(config.llvm_obj_root, "@LLVM_BUILD_TYPE@",
'bin')
lit_config.note('Adding to path: ' + xcode_bin_dir)
config.environment['PATH'] = \
os.path.pathsep.join((xcode_bin_dir, config.environment['PATH']))
config.available_features.add("CMAKE_GENERATOR=@CMAKE_GENERATOR@")
if "@SWIFT_ENABLE_LLD_LINKER@" == "TRUE":
config.android_linker_name = "lld"
else:
# even if SWIFT_ENABLE_GOLD_LINKER isn't set, we cannot use BFD for Android
config.android_linker_name = "gold"
# Let the main config do the real work.
config.test_exec_root = os.path.dirname(os.path.realpath(__file__))
lit_config.load_config(config, "@SWIFT_SOURCE_DIR@/validation-test/lit.cfg")