Index: flang/test/CMakeLists.txt =================================================================== --- flang/test/CMakeLists.txt +++ flang/test/CMakeLists.txt @@ -100,3 +100,10 @@ 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 "") + set(LLVM_TARGET_TRIPLE_ENV "FLANG_TEST_TARGET_TRIPLE") + endif() +endif() Index: flang/test/lit.cfg.py =================================================================== --- flang/test/lit.cfg.py +++ flang/test/lit.cfg.py @@ -45,6 +45,11 @@ 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. Index: flang/test/lit.site.cfg.py.in =================================================================== --- flang/test/lit.site.cfg.py.in +++ flang/test/lit.site.cfg.py.in @@ -5,6 +5,7 @@ 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_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@