mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-02-26 13:26:22 +00:00
[Flang][Test] Add support to change the default target triple for tests
In this patch I added support to change the default target triple used by flang tests using the cmake variable: FLANG_TEST_TARGET_TRIPLE. This functionality is implemented using the LLVM_TARGET_TRIPLE_ENV variable, so that must be defined as well. An example use: `-DLLVM_TARGET_TRIPLE_ENV="LLVM_TARGET_TRIPLE_ENV" -DFLANG_TEST_TARGET_TRIPLE="aarch64-linux-gnu"` Differential revision: https://reviews.llvm.org/D138530 Change-Id: I38e4a46a65109d415a9b72c8a0bf8a955e937280
This commit is contained in:
parent
f6d90055fd
commit
54dc764db7
@ -109,6 +109,12 @@ cmake \
|
||||
ninja
|
||||
```
|
||||
|
||||
By default flang tests that do not specify an explicit `--target` flag use
|
||||
LLVM's default target triple. For these tests, if there is a need to test on a
|
||||
different triple by overriding the default, the following needs to be added to
|
||||
the cmake command above:
|
||||
`-DLLVM_TARGET_TRIPLE_ENV="<some string>" -DFLANG_TEST_TARGET_TRIPLE="<your triple>"`.
|
||||
|
||||
To run the flang tests on this build, execute the command in the "build"
|
||||
directory:
|
||||
```bash
|
||||
|
@ -100,3 +100,11 @@ else()
|
||||
PARAMS ${FLANG_TEST_PARAMS}
|
||||
DEPENDS ${FLANG_TEST_DEPENDS})
|
||||
endif()
|
||||
|
||||
# To modify the default target triple for flang tests.
|
||||
if (DEFINED FLANG_TEST_TARGET_TRIPLE)
|
||||
if (NOT DEFINED LLVM_TARGET_TRIPLE_ENV OR LLVM_TARGET_TRIPLE_ENV STREQUAL "")
|
||||
message(FATAL_ERROR "LLVM_TARGET_TRIPLE_ENV must also be defined in order "
|
||||
"to use FLANG_TEST_TARGET_TRIPLE.")
|
||||
endif()
|
||||
endif()
|
||||
|
@ -30,3 +30,8 @@ config.environment['LD_LIBRARY_PATH'] = path
|
||||
|
||||
# Propagate PYTHON_EXECUTABLE into the environment
|
||||
#config.environment['PYTHON_EXECUTABLE'] = sys.executable
|
||||
|
||||
# To modify the default target triple for flang tests.
|
||||
if config.flang_test_triple:
|
||||
config.target_triple = config.flang_test_triple
|
||||
config.environment[config.llvm_target_triple_env] = config.flang_test_triple
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
config.llvm_src_root = "@LLVM_SOURCE_DIR@"
|
||||
config.llvm_obj_root = "@LLVM_BINARY_DIR@"
|
||||
config.llvm_target_triple_env = "@LLVM_TARGET_TRIPLE_ENV@"
|
||||
config.llvm_tools_dir = lit_config.substitute("@LLVM_TOOLS_DIR@")
|
||||
config.llvm_libs_dir = lit_config.substitute("@LLVM_LIBS_DIR@")
|
||||
config.llvm_build_mode = lit_config.substitute("@LLVM_BUILD_MODE@")
|
||||
@ -9,6 +10,7 @@ config.lit_tools_dir = "@LLVM_LIT_TOOLS_DIR@"
|
||||
config.flang_obj_root = "@FLANG_BINARY_DIR@"
|
||||
config.flang_src_root = "@FLANG_SOURCE_DIR@"
|
||||
config.flang_libs_dir = "@LLVM_LIBRARY_OUTPUT_INTDIR@"
|
||||
config.flang_test_triple = "@FLANG_TEST_TARGET_TRIPLE@"
|
||||
config.flang_tools_dir = "@LLVM_RUNTIME_OUTPUT_INTDIR@"
|
||||
config.target_triple = "@LLVM_TARGET_TRIPLE@"
|
||||
config.python_executable = "@Python3_EXECUTABLE@"
|
||||
|
@ -45,6 +45,11 @@ config.targets = frozenset(config.targets_to_build.split())
|
||||
for arch in config.targets_to_build.split():
|
||||
config.available_features.add(arch.lower() + '-registered-target')
|
||||
|
||||
# To modify the default target triple for flang tests.
|
||||
if config.flang_test_triple:
|
||||
config.target_triple = config.flang_test_triple
|
||||
config.environment[config.llvm_target_triple_env] = config.flang_test_triple
|
||||
|
||||
# excludes: A list of directories to exclude from the testsuite. The 'Inputs'
|
||||
# subdirectories contain auxiliary inputs for various tests in their parent
|
||||
# directories.
|
||||
|
@ -5,6 +5,7 @@ import sys
|
||||
config.llvm_tools_dir = lit_config.substitute("@LLVM_TOOLS_DIR@")
|
||||
config.llvm_shlib_dir = lit_config.substitute(path(r"@SHLIBDIR@"))
|
||||
config.llvm_plugin_ext = "@LLVM_PLUGIN_EXT@"
|
||||
config.llvm_target_triple_env = "@LLVM_TARGET_TRIPLE_ENV@"
|
||||
config.lit_tools_dir = "@LLVM_LIT_TOOLS_DIR@"
|
||||
config.errc_messages = "@LLVM_LIT_ERRC_MESSAGES@"
|
||||
config.flang_obj_root = "@FLANG_BINARY_DIR@"
|
||||
@ -13,6 +14,7 @@ config.flang_tools_dir = lit_config.substitute("@FLANG_TOOLS_DIR@")
|
||||
config.flang_intrinsic_modules_dir = "@FLANG_INTRINSIC_MODULES_DIR@"
|
||||
config.flang_llvm_tools_dir = "@CMAKE_BINARY_DIR@/bin"
|
||||
config.flang_lib_dir = "@CMAKE_BINARY_DIR@/lib"
|
||||
config.flang_test_triple = "@FLANG_TEST_TARGET_TRIPLE@"
|
||||
config.flang_examples = @FLANG_BUILD_EXAMPLES@
|
||||
config.python_executable = "@PYTHON_EXECUTABLE@"
|
||||
config.flang_standalone_build = @FLANG_STANDALONE_BUILD@
|
||||
|
Loading…
x
Reference in New Issue
Block a user