diff --git a/compiler-rt/lib/tysan/lit.cfg b/compiler-rt/lib/tysan/lit.cfg index e3ef6c9c97147..c906c03cc3fb2 100644 --- a/compiler-rt/lib/tysan/lit.cfg +++ b/compiler-rt/lib/tysan/lit.cfg @@ -27,7 +27,7 @@ config.substitutions.append( ("%clangxx_tysan ", build_invocation(clang_tysan_cx config.suffixes = ['.c', '.cc', '.cpp'] # TypeSanitizer tests are currently supported on Linux only. -if config.host_os not in ['Linux']: +if config.target_os not in ['Linux']: config.unsupported = True if config.target_arch != 'aarch64': diff --git a/compiler-rt/test/asan/lit.cfg.py b/compiler-rt/test/asan/lit.cfg.py index 3da073332c458..96201e679b0a3 100644 --- a/compiler-rt/test/asan/lit.cfg.py +++ b/compiler-rt/test/asan/lit.cfg.py @@ -28,7 +28,7 @@ def get_required_attr(config, attr_name): # tests to prevent regressions. # Currently, detect_leaks for asan tests only work on Intel MacOS. if ( - config.host_os == "Darwin" + config.target_os == "Darwin" and config.apple_platform == "osx" and config.target_arch == "x86_64" ): @@ -45,7 +45,7 @@ def get_required_attr(config, attr_name): # Setup source root. config.test_source_root = os.path.dirname(__file__) -if config.host_os not in ["FreeBSD", "NetBSD"]: +if config.target_os not in ["FreeBSD", "NetBSD"]: libdl_flag = "-ldl" else: libdl_flag = "" @@ -125,17 +125,17 @@ def build_invocation(compile_flags, with_lto=False): ("%clangxx_asan_lto ", build_invocation(clang_asan_cxxflags, True)) ) if config.asan_dynamic: - if config.host_os in ["Linux", "FreeBSD", "NetBSD", "SunOS"]: + if config.target_os in ["Linux", "FreeBSD", "NetBSD", "SunOS"]: shared_libasan_path = os.path.join( config.compiler_rt_libdir, "libclang_rt.asan{}.so".format(config.target_suffix), ) - elif config.host_os == "Darwin": + elif config.target_os == "Darwin": shared_libasan_path = os.path.join( config.compiler_rt_libdir, "libclang_rt.asan_{}_dynamic.dylib".format(config.apple_platform), ) - elif config.host_os == "Windows": + elif config.target_os == "Windows": shared_libasan_path = os.path.join( config.compiler_rt_libdir, "clang_rt.asan_dynamic-{}.lib".format(config.target_suffix), @@ -274,16 +274,16 @@ def build_invocation(compile_flags, with_lto=False): and (config.target_arch in ["x86_64", "i386", "i686", "aarch64"]) ) leak_detection_linux = ( - (config.host_os == "Linux") + (config.target_os == "Linux") and (not config.android) and (config.target_arch in ["x86_64", "i386", "riscv64", "loongarch64"]) ) leak_detection_mac = ( - (config.host_os == "Darwin") + (config.target_os == "Darwin") and (config.apple_platform == "osx") and (config.target_arch == "x86_64") ) -leak_detection_netbsd = (config.host_os == "NetBSD") and ( +leak_detection_netbsd = (config.target_os == "NetBSD") and ( config.target_arch in ["x86_64", "i386"] ) if ( @@ -296,7 +296,7 @@ def build_invocation(compile_flags, with_lto=False): # Add the RT libdir to PATH directly so that we can successfully run the gtest # binary to list its tests. -if config.host_os == "Windows": +if config.target_os == "Windows": os.environ["PATH"] = os.path.pathsep.join( [config.compiler_rt_libdir, os.environ.get("PATH", "")] ) @@ -310,10 +310,10 @@ def build_invocation(compile_flags, with_lto=False): # Default test suffixes. config.suffixes = [".c", ".cpp"] -if config.host_os == "Darwin": +if config.target_os == "Darwin": config.suffixes.append(".mm") -if config.host_os == "Windows": +if config.target_os == "Windows": config.substitutions.append(("%fPIC", "")) config.substitutions.append(("%fPIE", "")) config.substitutions.append(("%pie", "")) @@ -323,11 +323,11 @@ def build_invocation(compile_flags, with_lto=False): config.substitutions.append(("%pie", "-pie")) # Only run the tests on supported OSs. -if config.host_os not in ["Linux", "Darwin", "FreeBSD", "SunOS", "Windows", "NetBSD"]: +if config.target_os not in ["Linux", "Darwin", "FreeBSD", "SunOS", "Windows", "NetBSD"]: config.unsupported = True if not config.parallelism_group: config.parallelism_group = "shadow-memory" -if config.host_os == "NetBSD": +if config.target_os == "NetBSD": config.substitutions.insert(0, ("%run", config.netbsd_noaslr_prefix)) diff --git a/compiler-rt/test/asan_abi/lit.cfg.py b/compiler-rt/test/asan_abi/lit.cfg.py index 5bc1881ed9c32..dd99a5373e7b6 100644 --- a/compiler-rt/test/asan_abi/lit.cfg.py +++ b/compiler-rt/test/asan_abi/lit.cfg.py @@ -68,7 +68,7 @@ def build_invocation(compile_flags): config.suffixes = ['.c', '.cpp'] -if config.host_os == 'Darwin': +if config.target_os == 'Darwin': config.suffixes.append('.mm') else: config.unsupported = True diff --git a/compiler-rt/test/builtins/Unit/lit.cfg.py b/compiler-rt/test/builtins/Unit/lit.cfg.py index c030f89c66e42..59da054848f3c 100644 --- a/compiler-rt/test/builtins/Unit/lit.cfg.py +++ b/compiler-rt/test/builtins/Unit/lit.cfg.py @@ -80,10 +80,10 @@ def get_libgcc_file_name(): config.compiler_rt_libdir, "clang_rt.builtins%s.lib " % config.target_suffix ) config.substitutions.append(("%librt ", base_lib)) -elif config.host_os == "Darwin": +elif config.target_os == "Darwin": base_lib = os.path.join(config.compiler_rt_libdir, "libclang_rt.osx.a ") config.substitutions.append(("%librt ", base_lib + " -lSystem ")) -elif config.host_os == "Windows": +elif config.target_os == "Windows": base_lib = os.path.join( config.compiler_rt_libdir, "libclang_rt.builtins%s.a" % config.target_suffix ) @@ -104,7 +104,7 @@ def get_libgcc_file_name(): if sys.platform in ["win32"] and execute_external: # Don't pass dosish path separator to msys bash.exe. base_lib = base_lib.replace("\\", "/") - if config.host_os == "Haiku": + if config.target_os == "Haiku": config.substitutions.append(("%librt ", base_lib + " -lroot ")) else: config.substitutions.append(("%librt ", base_lib + " -lc -lm ")) diff --git a/compiler-rt/test/builtins/lit.cfg.py b/compiler-rt/test/builtins/lit.cfg.py index 9300488c8428d..6491f4735b9e6 100644 --- a/compiler-rt/test/builtins/lit.cfg.py +++ b/compiler-rt/test/builtins/lit.cfg.py @@ -21,7 +21,7 @@ ("%clang ", " " + config.clang + " " + " ".join(extra_flags) + " ") ) -if config.host_os == "Darwin": +if config.target_os == "Darwin": config.substitutions.append( ("%macos_version_major", str(config.darwin_osx_version[0])) ) diff --git a/compiler-rt/test/ctx_profile/lit.cfg.py b/compiler-rt/test/ctx_profile/lit.cfg.py index 74d9bfd11ae28..75367d95a47bd 100644 --- a/compiler-rt/test/ctx_profile/lit.cfg.py +++ b/compiler-rt/test/ctx_profile/lit.cfg.py @@ -7,7 +7,7 @@ import lit.formats # Only run the tests on supported OSs. -if config.host_os not in ["Linux"]: +if config.target_os not in ["Linux"]: config.unsupported = True diff --git a/compiler-rt/test/dfsan/lit.cfg.py b/compiler-rt/test/dfsan/lit.cfg.py index e947c51f99a5b..b26ff3e367942 100644 --- a/compiler-rt/test/dfsan/lit.cfg.py +++ b/compiler-rt/test/dfsan/lit.cfg.py @@ -25,5 +25,5 @@ def build_invocation(compile_flags): config.suffixes = [".c", ".cpp"] # DataFlowSanitizer tests are currently supported on Linux only. -if not (config.host_os in ["Linux"] and config.target_arch in ["aarch64", "x86_64", "loongarch64"]): +if not (config.target_os in ["Linux"] and config.target_arch in ["aarch64", "x86_64", "loongarch64"]): config.unsupported = True diff --git a/compiler-rt/test/fuzzer/lit.cfg.py b/compiler-rt/test/fuzzer/lit.cfg.py index 75d4cf2e4c529..1689f53d0b021 100644 --- a/compiler-rt/test/fuzzer/lit.cfg.py +++ b/compiler-rt/test/fuzzer/lit.cfg.py @@ -149,5 +149,5 @@ def generate_compiler_cmd(is_cpp=True, fuzzer_enabled=True, msan_enabled=False): if not config.parallelism_group: config.parallelism_group = "shadow-memory" -if config.host_os == "NetBSD": +if config.target_os == "NetBSD": config.substitutions.insert(0, ("%run", config.netbsd_noaslr_prefix)) diff --git a/compiler-rt/test/gwp_asan/lit.cfg.py b/compiler-rt/test/gwp_asan/lit.cfg.py index 7f68682162e3f..1592cf400023e 100644 --- a/compiler-rt/test/gwp_asan/lit.cfg.py +++ b/compiler-rt/test/gwp_asan/lit.cfg.py @@ -67,5 +67,5 @@ def build_invocation(compile_flags): ) # GWP-ASan tests are currently supported on Linux only. -if config.host_os not in ["Linux"]: +if config.target_os not in ["Linux"]: config.unsupported = True diff --git a/compiler-rt/test/hwasan/lit.cfg.py b/compiler-rt/test/hwasan/lit.cfg.py index bbf23e683240a..3a1c8e1466aea 100644 --- a/compiler-rt/test/hwasan/lit.cfg.py +++ b/compiler-rt/test/hwasan/lit.cfg.py @@ -86,5 +86,5 @@ def build_invocation(compile_flags): # Default test suffixes. config.suffixes = [".c", ".cpp"] -if config.host_os not in ["Linux", "Android"] or not config.has_lld: +if config.target_os not in ["Linux", "Android"] or not config.has_lld: config.unsupported = True diff --git a/compiler-rt/test/lit.common.cfg.py b/compiler-rt/test/lit.common.cfg.py index f5576ce0e013d..16edfe6213c4a 100644 --- a/compiler-rt/test/lit.common.cfg.py +++ b/compiler-rt/test/lit.common.cfg.py @@ -66,7 +66,7 @@ def find_compiler_libdir(): # Fall back for older AppleClang that doesn't support `-print-runtime-dir` # Note `-print-file-name=` was broken for Apple # platforms so we can't use that approach here (see https://reviews.llvm.org/D101682). - if config.host_os == "Darwin": + if config.target_os == "Darwin": lib_dir, _ = get_path_from_clang(["-print-file-name=lib"], allow_failure=False) runtime_dir = os.path.join(lib_dir, "darwin") if not os.path.exists(runtime_dir): @@ -312,7 +312,7 @@ def push_dynamic_library_lookup_path(config, new_path): if platform.system() == "Windows" and target_is_msvc: config.environment["LIB"] = os.environ["LIB"] -config.available_features.add(config.host_os.lower()) +config.available_features.add(config.target_os.lower()) if config.target_triple.startswith("ppc") or config.target_triple.startswith("powerpc"): config.available_features.add("ppc") @@ -344,7 +344,7 @@ def push_dynamic_library_lookup_path(config, new_path): ) ) -if config.host_os == "NetBSD": +if config.target_os == "NetBSD": nb_commands_dir = os.path.join( config.compiler_rt_src_root, "test", "sanitizer_common", "netbsd_commands" ) @@ -395,7 +395,7 @@ def get_ios_commands_dir(): if sanitizer not in config.environment: config.environment[sanitizer] = symbolizer_path -env_utility = "/opt/freeware/bin/env" if config.host_os == "AIX" else "env" +env_utility = "/opt/freeware/bin/env" if config.target_os == "AIX" else "env" env_unset_command = " ".join(f"-u {var}" for var in tool_symbolizer_path_list) config.substitutions.append( ("%env_unset_tool_symbolizer_path", f"{env_utility} {env_unset_command}") @@ -410,7 +410,7 @@ def get_ios_commands_dir(): lit_config.warning("%device_rm is not implemented") config.substitutions.append(("%device_rm", "echo ")) config.compile_wrapper = "" -elif config.host_os == "Darwin" and config.apple_platform != "osx": +elif config.target_os == "Darwin" and config.apple_platform != "osx": # Darwin tests can be targetting macOS, a device or a simulator. All devices # are declared as "ios", even for iOS derivatives (tvOS, watchOS). Similarly, # all simulators are "iossim". See the table below. @@ -498,7 +498,7 @@ def get_ios_commands_dir(): config.compile_wrapper = "" # Define CHECK-%os to check for OS-dependent output. -config.substitutions.append(("CHECK-%os", ("CHECK-" + config.host_os))) +config.substitutions.append(("CHECK-%os", ("CHECK-" + config.target_os))) # Define %arch to check for architecture-dependent output. config.substitutions.append(("%arch", (config.host_arch))) @@ -519,7 +519,7 @@ def get_ios_commands_dir(): config.available_features.add(target_arch + "-target-arch") if target_arch in ["x86_64", "i386"]: config.available_features.add("x86-target-arch") - config.available_features.add(target_arch + "-" + config.host_os.lower()) + config.available_features.add(target_arch + "-" + config.target_os.lower()) compiler_rt_debug = getattr(config, "compiler_rt_debug", False) if not compiler_rt_debug: @@ -565,7 +565,7 @@ def get_ios_commands_dir(): ("%darwin_min_target_with_tls_support", "%min_macos_deployment_target=10.12") ) -if config.host_os == "Darwin": +if config.target_os == "Darwin": osx_version = (10, 0, 0) try: osx_version = subprocess.check_output( @@ -708,7 +708,7 @@ def get_macos_aligned_version(macos_vers): config.substitutions.append(("%push_to_device", "echo ")) config.substitutions.append(("%adb_shell", "echo ")) -if config.host_os == "Linux": +if config.target_os == "Linux": def add_glibc_versions(ver_string): if config.android: return @@ -806,10 +806,10 @@ def is_windows_lto_supported(): return os.path.exists(os.path.join(config.llvm_tools_dir, "lld-link.exe")) -if config.host_os == "Darwin" and is_darwin_lto_supported(): +if config.target_os == "Darwin" and is_darwin_lto_supported(): config.lto_supported = True config.lto_flags = ["-Wl,-lto_library," + liblto_path()] -elif config.host_os in ["Linux", "FreeBSD", "NetBSD"]: +elif config.target_os in ["Linux", "FreeBSD", "NetBSD"]: config.lto_supported = False if config.use_lld and is_lld_lto_supported(): config.lto_supported = True @@ -822,7 +822,7 @@ def is_windows_lto_supported(): config.lto_flags = ["-fuse-ld=lld"] else: config.lto_flags = ["-fuse-ld=gold"] -elif config.host_os == "Windows" and is_windows_lto_supported(): +elif config.target_os == "Windows" and is_windows_lto_supported(): config.lto_supported = True config.lto_flags = ["-fuse-ld=lld"] else: @@ -871,7 +871,7 @@ def is_windows_lto_supported(): # Note that substitutions with numbers have to be defined first to avoid # being subsumed by substitutions with smaller postfix. for postfix in ["2", "1", ""]: - if config.host_os == "Darwin": + if config.target_os == "Darwin": config.substitutions.append( ( "%ld_flags_rpath_exe" + postfix, @@ -884,7 +884,7 @@ def is_windows_lto_supported(): "-install_name @rpath/`basename %dynamiclib{}`".format(postfix), ) ) - elif config.host_os in ("FreeBSD", "NetBSD", "OpenBSD"): + elif config.target_os in ("FreeBSD", "NetBSD", "OpenBSD"): config.substitutions.append( ( "%ld_flags_rpath_exe" + postfix, @@ -893,7 +893,7 @@ def is_windows_lto_supported(): ) ) config.substitutions.append(("%ld_flags_rpath_so" + postfix, "")) - elif config.host_os == "Linux": + elif config.target_os == "Linux": config.substitutions.append( ( "%ld_flags_rpath_exe" + postfix, @@ -901,7 +901,7 @@ def is_windows_lto_supported(): ) ) config.substitutions.append(("%ld_flags_rpath_so" + postfix, "")) - elif config.host_os == "SunOS": + elif config.target_os == "SunOS": config.substitutions.append( ( "%ld_flags_rpath_exe" + postfix, @@ -923,7 +923,7 @@ def is_windows_lto_supported(): config.substitutions.append(("%xdynamiclib_namespec", "%basename_t.dynamic")) config.default_sanitizer_opts = [] -if config.host_os == "Darwin": +if config.target_os == "Darwin": # On Darwin, we default to `abort_on_error=1`, which would make tests run # much slower. Let's override this and run lit tests with 'abort_on_error=0'. config.default_sanitizer_opts += ["abort_on_error=0"] @@ -983,7 +983,7 @@ def is_windows_lto_supported(): elif config.use_lld and (not config.has_lld): config.unsupported = True -if config.host_os == "Darwin": +if config.target_os == "Darwin": if getattr(config, "darwin_linker_version", None): extra_cflags += ["-mlinker-version=" + config.darwin_linker_version] @@ -998,7 +998,7 @@ def is_windows_lto_supported(): ) config.target_cflags = " " + " ".join(target_cflags + extra_cflags) + " " -if config.host_os == "Darwin": +if config.target_os == "Darwin": config.substitutions.append( ( "%get_pid_from_output", diff --git a/compiler-rt/test/lsan/lit.common.cfg.py b/compiler-rt/test/lsan/lit.common.cfg.py index 9426b7d108bbf..1e2679438b114 100644 --- a/compiler-rt/test/lsan/lit.common.cfg.py +++ b/compiler-rt/test/lsan/lit.common.cfg.py @@ -34,7 +34,7 @@ def get_required_attr(config, attr_name): config.name = "LeakSanitizer-AddressSanitizer" lsan_cflags = ["-fsanitize=address"] config.available_features.add("asan") - if config.host_os == "NetBSD": + if config.target_os == "NetBSD": config.substitutions.insert(0, ("%run", config.netbsd_noaslr_prefix)) elif lsan_lit_test_mode == "HWAddressSanitizer": config.name = "LeakSanitizer-HWAddressSanitizer" @@ -42,7 +42,7 @@ def get_required_attr(config, attr_name): if target_arch == "x86_64": lsan_cflags = lsan_cflags + ["-fsanitize-hwaddress-experimental-aliasing"] config.available_features.add("hwasan") - if config.host_os == "NetBSD": + if config.target_os == "NetBSD": config.substitutions.insert(0, ("%run", config.netbsd_noaslr_prefix)) else: lit_config.fatal("Unknown LSan test mode: %r" % lsan_lit_test_mode) @@ -51,7 +51,7 @@ def get_required_attr(config, attr_name): # Platform-specific default LSAN_OPTIONS for lit tests. default_common_opts_str = ":".join(list(config.default_sanitizer_opts)) default_lsan_opts = default_common_opts_str + ":detect_leaks=1" -if config.host_os == "Darwin": +if config.target_os == "Darwin": # On Darwin, we default to `abort_on_error=1`, which would make tests run # much slower. Let's override this and run lit tests with 'abort_on_error=0'. # Also, make sure we do not overwhelm the syslog while testing. @@ -101,7 +101,7 @@ def build_invocation(compile_flags): ) supported_linux = ( (not config.android) - and config.host_os == "Linux" + and config.target_os == "Linux" and config.host_arch in [ "aarch64", @@ -117,8 +117,8 @@ def build_invocation(compile_flags): "loongarch64", ] ) -supported_darwin = config.host_os == "Darwin" and config.target_arch in ["x86_64"] -supported_netbsd = config.host_os == "NetBSD" and config.target_arch in [ +supported_darwin = config.target_os == "Darwin" and config.target_arch in ["x86_64"] +supported_netbsd = config.target_os == "NetBSD" and config.target_arch in [ "x86_64", "i386", ] diff --git a/compiler-rt/test/memprof/lit.cfg.py b/compiler-rt/test/memprof/lit.cfg.py index 4057da0c65b51..e28507be4dc9e 100644 --- a/compiler-rt/test/memprof/lit.cfg.py +++ b/compiler-rt/test/memprof/lit.cfg.py @@ -106,7 +106,7 @@ def build_invocation(compile_flags): config.substitutions.append(("%pie", "-pie")) # Only run the tests on supported OSs. -if config.host_os not in ["Linux"]: +if config.target_os not in ["Linux"]: config.unsupported = True if not config.parallelism_group: diff --git a/compiler-rt/test/metadata/lit.cfg.py b/compiler-rt/test/metadata/lit.cfg.py index 73ba27ad3a4e2..9980e93b3a6ec 100644 --- a/compiler-rt/test/metadata/lit.cfg.py +++ b/compiler-rt/test/metadata/lit.cfg.py @@ -5,5 +5,5 @@ config.suffixes = [".cpp"] # Binary metadata is currently emitted only for ELF binaries # and sizes of stack arguments depend on the arch. -if config.host_os not in ["Linux"] or config.target_arch not in ["x86_64"]: +if config.target_os not in ["Linux"] or config.target_arch not in ["x86_64"]: config.unsupported = True diff --git a/compiler-rt/test/msan/lit.cfg.py b/compiler-rt/test/msan/lit.cfg.py index 361be79e2557e..d9e83c67b84c8 100644 --- a/compiler-rt/test/msan/lit.cfg.py +++ b/compiler-rt/test/msan/lit.cfg.py @@ -20,7 +20,7 @@ + config.debug_info_flags ) # Some Msan tests leverage backtrace() which requires libexecinfo on FreeBSD. -if config.host_os == "FreeBSD": +if config.target_os == "FreeBSD": clang_msan_cflags += ["-lexecinfo", "-fPIC"] # On SystemZ we need -mbackchain to make the fast unwinder work. if config.target_arch == "s390x": @@ -44,7 +44,7 @@ def build_invocation(compile_flags): # Default test suffixes. config.suffixes = [".c", ".cpp"] -if config.host_os not in ["Linux", "NetBSD", "FreeBSD"]: +if config.target_os not in ["Linux", "NetBSD", "FreeBSD"]: config.unsupported = True # For mips64, mips64el we have forced store_context_size to 1 because these @@ -55,5 +55,5 @@ def build_invocation(compile_flags): else: config.substitutions.append(("CHECK-%short-stack", "CHECK-FULL-STACK")) -if config.host_os == "NetBSD": +if config.target_os == "NetBSD": config.substitutions.insert(0, ("%run", config.netbsd_noaslr_prefix)) diff --git a/compiler-rt/test/nsan/lit.cfg.py b/compiler-rt/test/nsan/lit.cfg.py index 2d67911a7d5d8..8225c85c41b81 100644 --- a/compiler-rt/test/nsan/lit.cfg.py +++ b/compiler-rt/test/nsan/lit.cfg.py @@ -32,5 +32,5 @@ def build_invocation(compile_flags): ) # NSan tests are currently supported on Linux only. -if config.host_os not in ["Linux"]: +if config.target_os not in ["Linux"]: config.unsupported = True diff --git a/compiler-rt/test/orc/lit.cfg.py b/compiler-rt/test/orc/lit.cfg.py index 7a6eb4e7de325..3c3badb642ff7 100644 --- a/compiler-rt/test/orc/lit.cfg.py +++ b/compiler-rt/test/orc/lit.cfg.py @@ -18,11 +18,11 @@ config.available_features.add("host-arch-compatible") # If the target OS hasn't been set then assume host. -if not config.target_os: - config.target_os = config.host_os +if not config.orc_test_target_os: + config.orc_test_target_os = config.target_os config.test_target_is_host_executable = ( - config.target_os == config.host_os and host_arch_compatible + config.orc_test_target_os == config.target_os and host_arch_compatible ) # Assume that llvm-jitlink is in the config.llvm_tools_dir. @@ -31,7 +31,7 @@ config.compiler_rt_obj_root, "lib/orc/tests/tools/orc-rt-executor" ) lli = os.path.join(config.llvm_tools_dir, "lli") -if config.host_os == "Darwin": +if config.target_os == "Darwin": orc_rt_path = "%s/liborc_rt_osx.a" % config.compiler_rt_libdir else: orc_rt_path = "%s/liborc_rt%s.a" % (config.compiler_rt_libdir, config.target_suffix) @@ -53,7 +53,7 @@ def build_invocation(compile_flags): config.substitutions.append( ("%clang_cl ", build_invocation(["--driver-mode=cl"] + [config.target_cflags])) ) -if config.host_os == "Windows": +if config.target_os == "Windows": config.substitutions.append( ( "%llvm_jitlink", @@ -86,7 +86,7 @@ def build_invocation(compile_flags): # Exclude Inputs directories. config.excludes = ["Inputs"] -if config.host_os not in ["Darwin", "FreeBSD", "Linux", "Windows"]: +if config.target_os not in ["Darwin", "FreeBSD", "Linux", "Windows"]: config.unsupported = True # Ask llvm-config about assertion mode. diff --git a/compiler-rt/test/orc/lit.site.cfg.py.in b/compiler-rt/test/orc/lit.site.cfg.py.in index a33ef3d7d7207..d0625f6ace15c 100644 --- a/compiler-rt/test/orc/lit.site.cfg.py.in +++ b/compiler-rt/test/orc/lit.site.cfg.py.in @@ -5,7 +5,8 @@ config.name_suffix = "@ORC_TEST_CONFIG_SUFFIX@" config.orc_lit_source_dir = "@ORC_LIT_SOURCE_DIR@" config.target_cflags = "@ORC_TEST_TARGET_CFLAGS@" config.target_arch = "@ORC_TEST_TARGET_ARCH@" -config.target_os = "@ORC_TEST_TARGET_OS@" +# FIXME: Remove this variable, the target OS is available in config.target_os. +config.orc_test_target_os = "@ORC_TEST_TARGET_OS@" config.built_with_llvm = ("@COMPILER_RT_STANDALONE_BUILD@" != "TRUE") config.libunwind_shared = "@LIBUNWIND_ENABLE_SHARED@" config.libunwind_install_dir = "@LLVM_BINARY_DIR@/@LIBUNWIND_INSTALL_LIBRARY_DIR@" diff --git a/compiler-rt/test/profile/lit.cfg.py b/compiler-rt/test/profile/lit.cfg.py index c9a716abeccd8..df7f11e2b286b 100644 --- a/compiler-rt/test/profile/lit.cfg.py +++ b/compiler-rt/test/profile/lit.cfg.py @@ -30,7 +30,7 @@ def get_required_attr(config, attr_name): target_is_msvc = bool(re.match(r".*-windows-msvc$", config.target_triple)) -if config.host_os in ["Linux"]: +if config.target_os in ["Linux"]: extra_link_flags = ["-ldl"] elif target_is_msvc: # InstrProf is incompatible with incremental linking. Disable it as a @@ -154,7 +154,7 @@ def exclude_unsupported_files_for_aix(dirname): ) ) -if config.host_os not in [ +if config.target_os not in [ "Windows", "Darwin", "FreeBSD", @@ -167,10 +167,10 @@ def exclude_unsupported_files_for_aix(dirname): config.unsupported = True config.substitutions.append( - ("%shared_lib_flag", "-dynamiclib" if (config.host_os == "Darwin") else "-shared") + ("%shared_lib_flag", "-dynamiclib" if (config.target_os == "Darwin") else "-shared") ) -if config.host_os in ["AIX"]: +if config.target_os in ["AIX"]: config.available_features.add("system-aix") exclude_unsupported_files_for_aix(config.test_source_root) exclude_unsupported_files_for_aix(config.test_source_root + "/Posix") @@ -184,5 +184,5 @@ def exclude_unsupported_files_for_aix(dirname): if config.have_curl: config.available_features.add("curl") -if config.host_os in ("AIX", "Darwin", "Linux"): +if config.target_os in ("AIX", "Darwin", "Linux"): config.available_features.add("continuous-mode") diff --git a/compiler-rt/test/rtsan/Unit/lit.site.cfg.py.in b/compiler-rt/test/rtsan/Unit/lit.site.cfg.py.in index 59e1e10360b52..41fcb32e5009b 100644 --- a/compiler-rt/test/rtsan/Unit/lit.site.cfg.py.in +++ b/compiler-rt/test/rtsan/Unit/lit.site.cfg.py.in @@ -15,7 +15,7 @@ config.test_source_root = config.test_exec_root if not config.parallelism_group: config.parallelism_group = 'shadow-memory' -if config.host_os == 'Darwin': +if config.target_os == 'Darwin': # On Darwin, we default to ignore_noninstrumented_modules=1, which also # suppresses some races the tests are supposed to find. See rtsan/lit.cfg.py. if 'RTSAN_OPTIONS' in config.environment: diff --git a/compiler-rt/test/rtsan/lit.cfg.py b/compiler-rt/test/rtsan/lit.cfg.py index 7c75515a7608d..6d880c10ecd45 100644 --- a/compiler-rt/test/rtsan/lit.cfg.py +++ b/compiler-rt/test/rtsan/lit.cfg.py @@ -6,7 +6,7 @@ default_rtsan_opts = "atexit_sleep_ms=0" -if config.host_os == "Darwin": +if config.target_os == "Darwin": # On Darwin, we default to `abort_on_error=1`, which would make tests run # much slower. Let's override this and run lit tests with 'abort_on_error=0'. default_rtsan_opts += ":abort_on_error=0" @@ -36,7 +36,7 @@ def build_invocation(compile_flags): llvm_rtsan = os.path.join(config.llvm_tools_dir, "llvm-rtsan") # Setup substitutions. -if config.host_os == "Linux": +if config.target_os == "Linux": libdl_flag = "-ldl" else: libdl_flag = "" @@ -52,7 +52,7 @@ def build_invocation(compile_flags): # Default test suffixes. config.suffixes = [".c", ".cpp"] -if config.host_os not in ["Darwin", "FreeBSD", "Linux", "NetBSD", "OpenBSD"]: +if config.target_os not in ["Darwin", "FreeBSD", "Linux", "NetBSD", "OpenBSD"]: config.unsupported = True elif "64" not in config.host_arch: if "arm" in config.host_arch: @@ -61,5 +61,5 @@ def build_invocation(compile_flags): else: config.unsupported = True -if config.host_os == "NetBSD": +if config.target_os == "NetBSD": config.substitutions.insert(0, ("%run", config.netbsd_nomprotect_prefix)) diff --git a/compiler-rt/test/safestack/lit.cfg.py b/compiler-rt/test/safestack/lit.cfg.py index 4ab9c1ce70bac..3f5565caa65c6 100644 --- a/compiler-rt/test/safestack/lit.cfg.py +++ b/compiler-rt/test/safestack/lit.cfg.py @@ -33,5 +33,5 @@ ) ) -if config.host_os not in ["Linux", "FreeBSD", "NetBSD", "SunOS"]: +if config.target_os not in ["Linux", "FreeBSD", "NetBSD", "SunOS"]: config.unsupported = True diff --git a/compiler-rt/test/sanitizer_common/lit.common.cfg.py b/compiler-rt/test/sanitizer_common/lit.common.cfg.py index 88d3ea9bc5ad2..5614229d9a126 100644 --- a/compiler-rt/test/sanitizer_common/lit.common.cfg.py +++ b/compiler-rt/test/sanitizer_common/lit.common.cfg.py @@ -40,7 +40,7 @@ config.available_features.add(config.tool_name) if ( - config.host_os == "Linux" + config.target_os == "Linux" and config.tool_name == "lsan" and config.target_arch == "i386" ): @@ -49,7 +49,7 @@ if config.arm_thumb: config.available_features.add("thumb") -if config.host_os == "Darwin": +if config.target_os == "Darwin": # On Darwin, we default to `abort_on_error=1`, which would make tests run # much slower. Let's override this and run lit tests with 'abort_on_error=0'. default_tool_options += ["abort_on_error=0"] @@ -68,7 +68,7 @@ extra_link_flags = [] -if config.host_os in ["Linux"]: +if config.target_os in ["Linux"]: extra_link_flags += ["-ldl"] clang_cflags = config.debug_info_flags + tool_cflags + [config.target_cflags] @@ -92,13 +92,13 @@ def build_invocation(compile_flags): config.suffixes = [".c", ".cpp"] -if config.host_os not in ["Linux", "Darwin", "NetBSD", "FreeBSD", "SunOS"]: +if config.target_os not in ["Linux", "Darwin", "NetBSD", "FreeBSD", "SunOS"]: config.unsupported = True if not config.parallelism_group: config.parallelism_group = "shadow-memory" -if config.host_os == "NetBSD": +if config.target_os == "NetBSD": config.substitutions.insert(0, ("%run", config.netbsd_noaslr_prefix)) if os.path.exists("/etc/services"): diff --git a/compiler-rt/test/scudo/lit.cfg.py b/compiler-rt/test/scudo/lit.cfg.py index 5d45bd99804c7..b09c996e9ccc5 100644 --- a/compiler-rt/test/scudo/lit.cfg.py +++ b/compiler-rt/test/scudo/lit.cfg.py @@ -70,5 +70,5 @@ def build_invocation(compile_flags): ) # Hardened Allocator tests are currently supported on Linux only. -if config.host_os not in ["Linux"]: +if config.target_os not in ["Linux"]: config.unsupported = True diff --git a/compiler-rt/test/shadowcallstack/lit.cfg.py b/compiler-rt/test/shadowcallstack/lit.cfg.py index 70a6b16174c4b..5b95deb1b0986 100644 --- a/compiler-rt/test/shadowcallstack/lit.cfg.py +++ b/compiler-rt/test/shadowcallstack/lit.cfg.py @@ -32,5 +32,5 @@ ) ) -if config.host_os not in ["Linux"] or config.target_arch not in ["aarch64", "riscv64"]: +if config.target_os not in ["Linux"] or config.target_arch not in ["aarch64", "riscv64"]: config.unsupported = True diff --git a/compiler-rt/test/tsan/Unit/lit.site.cfg.py.in b/compiler-rt/test/tsan/Unit/lit.site.cfg.py.in index a9c6261ba48d4..b90af4f2c0d3a 100644 --- a/compiler-rt/test/tsan/Unit/lit.site.cfg.py.in +++ b/compiler-rt/test/tsan/Unit/lit.site.cfg.py.in @@ -15,7 +15,7 @@ config.test_source_root = config.test_exec_root if not config.parallelism_group: config.parallelism_group = 'shadow-memory' -if config.host_os == 'Darwin': +if config.target_os == 'Darwin': # On Darwin, we default to ignore_noninstrumented_modules=1, which also # suppresses some races the tests are supposed to find. See tsan/lit.cfg.py. if 'TSAN_OPTIONS' in config.environment: diff --git a/compiler-rt/test/tsan/libdispatch/lit.local.cfg.py b/compiler-rt/test/tsan/libdispatch/lit.local.cfg.py index a7653f4305952..27edf611a0522 100644 --- a/compiler-rt/test/tsan/libdispatch/lit.local.cfg.py +++ b/compiler-rt/test/tsan/libdispatch/lit.local.cfg.py @@ -14,5 +14,5 @@ def getRoot(config): else: config.unsupported = True -if config.host_os == "Darwin": +if config.target_os == "Darwin": config.environment["TSAN_OPTIONS"] += ":ignore_noninstrumented_modules=1" diff --git a/compiler-rt/test/tsan/lit.cfg.py b/compiler-rt/test/tsan/lit.cfg.py index a93333e2e593d..8803a7bda9aa5 100644 --- a/compiler-rt/test/tsan/lit.cfg.py +++ b/compiler-rt/test/tsan/lit.cfg.py @@ -23,7 +23,7 @@ def get_required_attr(config, attr_name): # Setup environment variables for running ThreadSanitizer. default_tsan_opts = "atexit_sleep_ms=0" -if config.host_os == "Darwin": +if config.target_os == "Darwin": # On Darwin, we default to `abort_on_error=1`, which would make tests run # much slower. Let's override this and run lit tests with 'abort_on_error=0'. default_tsan_opts += ":abort_on_error=0" @@ -61,7 +61,7 @@ def get_required_attr(config, attr_name): ) # Add additional flags if we're using instrumented libc++. # Instrumented libcxx currently not supported on Darwin. -if config.has_libcxx and config.host_os != "Darwin": +if config.has_libcxx and config.target_os != "Darwin": # FIXME: Dehardcode this path somehow. libcxx_path = os.path.join( config.compiler_rt_obj_root, @@ -86,7 +86,7 @@ def build_invocation(compile_flags): config.substitutions.append(("%clangxx_tsan ", build_invocation(clang_tsan_cxxflags))) # Define CHECK-%os to check for OS-dependent output. -config.substitutions.append(("CHECK-%os", ("CHECK-" + config.host_os))) +config.substitutions.append(("CHECK-%os", ("CHECK-" + config.target_os))) config.substitutions.append( ( @@ -101,7 +101,7 @@ def build_invocation(compile_flags): # Default test suffixes. config.suffixes = [".c", ".cpp", ".m", ".mm"] -if config.host_os not in ["FreeBSD", "Linux", "Darwin", "NetBSD"]: +if config.target_os not in ["FreeBSD", "Linux", "Darwin", "NetBSD"]: config.unsupported = True if config.android: @@ -110,5 +110,5 @@ def build_invocation(compile_flags): if not config.parallelism_group: config.parallelism_group = "shadow-memory" -if config.host_os == "NetBSD": +if config.target_os == "NetBSD": config.substitutions.insert(0, ("%run", config.netbsd_noaslr_prefix)) diff --git a/compiler-rt/test/tysan/lit.cfg.py b/compiler-rt/test/tysan/lit.cfg.py index f38e0211639da..26846017b1957 100644 --- a/compiler-rt/test/tysan/lit.cfg.py +++ b/compiler-rt/test/tysan/lit.cfg.py @@ -71,7 +71,7 @@ def push_dynamic_library_lookup_path(config, new_path): # Setup source root. config.test_source_root = os.path.dirname(__file__) -if config.host_os not in ["FreeBSD", "NetBSD"]: +if config.target_os not in ["FreeBSD", "NetBSD"]: libdl_flag = "-ldl" else: libdl_flag = "" @@ -127,10 +127,10 @@ def build_invocation(compile_flags): # Default test suffixes. config.suffixes = [".c", ".cpp"] -if config.host_os == "Darwin": +if config.target_os == "Darwin": config.suffixes.append(".mm") -if config.host_os == "Windows": +if config.target_os == "Windows": config.substitutions.append(("%fPIC", "")) config.substitutions.append(("%fPIE", "")) config.substitutions.append(("%pie", "")) @@ -140,7 +140,7 @@ def build_invocation(compile_flags): config.substitutions.append(("%pie", "-pie")) # Only run the tests on supported OSs. -if config.host_os not in [ +if config.target_os not in [ "Linux", "Darwin", ]: diff --git a/compiler-rt/test/ubsan/TestCases/TypeCheck/Function/lit.local.cfg.py b/compiler-rt/test/ubsan/TestCases/TypeCheck/Function/lit.local.cfg.py index e69d15f5b141c..4342649532865 100644 --- a/compiler-rt/test/ubsan/TestCases/TypeCheck/Function/lit.local.cfg.py +++ b/compiler-rt/test/ubsan/TestCases/TypeCheck/Function/lit.local.cfg.py @@ -1,4 +1,4 @@ -if config.host_os not in ["Darwin", "FreeBSD", "Linux", "NetBSD"]: +if config.target_os not in ["Darwin", "FreeBSD", "Linux", "NetBSD"]: config.unsupported = True # Work around "Cannot represent a difference across sections" if config.target_arch == "powerpc64": diff --git a/compiler-rt/test/ubsan/lit.common.cfg.py b/compiler-rt/test/ubsan/lit.common.cfg.py index 04d6f24de5a9f..25e527903788e 100644 --- a/compiler-rt/test/ubsan/lit.common.cfg.py +++ b/compiler-rt/test/ubsan/lit.common.cfg.py @@ -74,7 +74,7 @@ def build_invocation(compile_flags): config.suffixes = [".c", ".cpp", ".m"] # Check that the host supports UndefinedBehaviorSanitizer tests -if config.host_os not in [ +if config.target_os not in [ "Linux", "Darwin", "FreeBSD", @@ -90,5 +90,5 @@ def build_invocation(compile_flags): if ubsan_lit_test_mode in ["AddressSanitizer", "MemorySanitizer", "ThreadSanitizer"]: if not config.parallelism_group: config.parallelism_group = "shadow-memory" - if config.host_os == "NetBSD": + if config.target_os == "NetBSD": config.substitutions.insert(0, ("%run", config.netbsd_noaslr_prefix)) diff --git a/compiler-rt/test/ubsan_minimal/lit.common.cfg.py b/compiler-rt/test/ubsan_minimal/lit.common.cfg.py index 714241a580f9d..bcc0e46fbef91 100644 --- a/compiler-rt/test/ubsan_minimal/lit.common.cfg.py +++ b/compiler-rt/test/ubsan_minimal/lit.common.cfg.py @@ -35,7 +35,7 @@ def build_invocation(compile_flags): config.suffixes = [".c", ".cpp"] # Check that the host supports UndefinedBehaviorSanitizerMinimal tests -if config.host_os not in [ +if config.target_os not in [ "Linux", "FreeBSD", "NetBSD", diff --git a/compiler-rt/test/xray/lit.cfg.py b/compiler-rt/test/xray/lit.cfg.py index f73ae3acd7715..e56ed85d1d822 100644 --- a/compiler-rt/test/xray/lit.cfg.py +++ b/compiler-rt/test/xray/lit.cfg.py @@ -14,7 +14,7 @@ # If libc++ was used to build XRAY libraries, libc++ is needed. Fix applied # to Linux only since -rpath may not be portable. This can be extended to # other platforms. -if config.libcxx_used == "1" and config.host_os == "Linux": +if config.libcxx_used == "1" and config.target_os == "Linux": clang_xray_cflags = clang_xray_cflags + ( ["-L%s -lc++ -Wl,-rpath=%s" % (config.llvm_shlib_dir, config.llvm_shlib_dir)] ) @@ -30,7 +30,7 @@ def build_invocation(compile_flags): llvm_xray = os.path.join(config.llvm_tools_dir, "llvm-xray") # Setup substitutions. -if config.host_os == "Linux": +if config.target_os == "Linux": libdl_flag = "-ldl" else: libdl_flag = "" @@ -56,7 +56,7 @@ def build_invocation(compile_flags): # Default test suffixes. config.suffixes = [".c", ".cpp"] -if config.host_os not in ["FreeBSD", "Linux", "NetBSD", "OpenBSD"]: +if config.target_os not in ["FreeBSD", "Linux", "NetBSD", "OpenBSD"]: config.unsupported = True elif "64" not in config.host_arch: if "arm" in config.host_arch: @@ -65,5 +65,5 @@ def build_invocation(compile_flags): else: config.unsupported = True -if config.host_os == "NetBSD": +if config.target_os == "NetBSD": config.substitutions.insert(0, ("%run", config.netbsd_nomprotect_prefix)) diff --git a/compiler-rt/unittests/lit.common.unit.cfg.py b/compiler-rt/unittests/lit.common.unit.cfg.py index 557a42893ec15..93f417c1d50ae 100644 --- a/compiler-rt/unittests/lit.common.unit.cfg.py +++ b/compiler-rt/unittests/lit.common.unit.cfg.py @@ -42,7 +42,7 @@ def get_lit_conf(name, default=None): if "TEMP" in os.environ: config.environment["TEMP"] = os.environ["TEMP"] -if config.host_os == "Darwin": +if config.target_os == "Darwin": # Only run up to 3 processes that require shadow memory simultaneously on # 64-bit Darwin. Using more scales badly and hogs the system due to # inefficient handling of large mmap'd regions (terabytes) by the kernel. diff --git a/compiler-rt/unittests/lit.common.unit.configured.in b/compiler-rt/unittests/lit.common.unit.configured.in index 3e42e83c9e70a..30ccf452ac71f 100644 --- a/compiler-rt/unittests/lit.common.unit.configured.in +++ b/compiler-rt/unittests/lit.common.unit.configured.in @@ -10,7 +10,7 @@ config.compiler_rt_libdir = lit_config.substitute("@COMPILER_RT_RESOLVED_LIBRARY config.enable_per_target_runtime_dir = @LLVM_ENABLE_PER_TARGET_RUNTIME_DIR_PYBOOL@ config.llvm_build_mode = lit_config.substitute("@LLVM_BUILD_MODE@") config.host_arch = "@HOST_ARCH@" -config.host_os = "@HOST_OS@" +config.target_os = "@HOST_OS@" config.llvm_lib_dir = "@LLVM_LIBRARY_DIR@" config.gwp_asan = @COMPILER_RT_HAS_GWP_ASAN_PYBOOL@ config.emulator = "@COMPILER_RT_EMULATOR@" diff --git a/lldb/test/API/lit.cfg.py b/lldb/test/API/lit.cfg.py index 83713213ce1fe..7ab9749f6266d 100644 --- a/lldb/test/API/lit.cfg.py +++ b/lldb/test/API/lit.cfg.py @@ -130,14 +130,14 @@ def delete_module_cache(path): config.environment["MallocNanoZone"] = "0" if "Address" in config.llvm_use_sanitizer: config.environment["ASAN_OPTIONS"] = "detect_stack_use_after_return=1" - if "Darwin" in config.host_os: + if "Darwin" in config.target_os: config.environment["DYLD_INSERT_LIBRARIES"] = find_sanitizer_runtime( "libclang_rt.asan_osx_dynamic.dylib" ) if "Thread" in config.llvm_use_sanitizer: config.environment["TSAN_OPTIONS"] = "halt_on_error=1" - if "Darwin" in config.host_os: + if "Darwin" in config.target_os: config.environment["DYLD_INSERT_LIBRARIES"] = find_sanitizer_runtime( "libclang_rt.tsan_osx_dynamic.dylib" ) diff --git a/lldb/test/API/lit.site.cfg.py.in b/lldb/test/API/lit.site.cfg.py.in index 86d58889cc4ad..c4e4352fe7915 100644 --- a/lldb/test/API/lit.site.cfg.py.in +++ b/lldb/test/API/lit.site.cfg.py.in @@ -13,7 +13,7 @@ config.lldb_src_root = "@LLDB_SOURCE_DIR@" config.lldb_libs_dir = lit_config.substitute("@LLDB_LIBS_DIR@") config.lldb_framework_dir = lit_config.substitute("@LLDB_FRAMEWORK_DIR@") config.cmake_cxx_compiler = "@CMAKE_CXX_COMPILER@" -config.host_os = "@HOST_OS@" +config.target_os = "@HOST_OS@" config.host_triple = "@LLVM_HOST_TRIPLE@" config.shared_libs = @LLVM_ENABLE_SHARED_LIBS@ config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@" diff --git a/llvm/test/lit.cfg.py b/llvm/test/lit.cfg.py index bd6e37c848d8c..1076456a4aef0 100644 --- a/llvm/test/lit.cfg.py +++ b/llvm/test/lit.cfg.py @@ -63,7 +63,7 @@ def get_asan_rtlib(): if ( not "Address" in config.llvm_use_sanitizer - or not "Darwin" in config.host_os + or not "Darwin" in config.target_os or not "x86" in config.host_triple ): return "" diff --git a/llvm/test/lit.site.cfg.py.in b/llvm/test/lit.site.cfg.py.in index caee6c1db92ee..ee76beb51cce6 100644 --- a/llvm/test/lit.site.cfg.py.in +++ b/llvm/test/lit.site.cfg.py.in @@ -26,7 +26,7 @@ config.enable_assertions = @ENABLE_ASSERTIONS@ config.targets_to_build = "@TARGETS_TO_BUILD@" config.native_target = "@LLVM_NATIVE_ARCH@" config.llvm_bindings = "@LLVM_BINDINGS@".split(' ') -config.host_os = "@HOST_OS@" +config.target_os = "@HOST_OS@" config.host_cc = "@HOST_CC@" config.host_cxx = "@HOST_CXX@" # Note: ldflags can contain double-quoted paths, so must use single quotes here.