Skip to content

Rename config.host_os to config.target_os. #149015

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler-rt/lib/tysan/lit.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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':
Expand Down
26 changes: 13 additions & 13 deletions compiler-rt/test/asan/lit.cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
):
Expand All @@ -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 = ""
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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 (
Expand All @@ -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", "")]
)
Expand All @@ -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", ""))
Expand All @@ -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))
2 changes: 1 addition & 1 deletion compiler-rt/test/asan_abi/lit.cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 3 additions & 3 deletions compiler-rt/test/builtins/Unit/lit.cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand All @@ -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 "))
Expand Down
2 changes: 1 addition & 1 deletion compiler-rt/test/builtins/lit.cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]))
)
Expand Down
2 changes: 1 addition & 1 deletion compiler-rt/test/ctx_profile/lit.cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
2 changes: 1 addition & 1 deletion compiler-rt/test/dfsan/lit.cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion compiler-rt/test/fuzzer/lit.cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
2 changes: 1 addition & 1 deletion compiler-rt/test/gwp_asan/lit.cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion compiler-rt/test/hwasan/lit.cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
38 changes: 19 additions & 19 deletions compiler-rt/test/lit.common.cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def find_compiler_libdir():
# Fall back for older AppleClang that doesn't support `-print-runtime-dir`
# Note `-print-file-name=<path to compiler-rt lib>` 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):
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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"
)
Expand Down Expand Up @@ -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}")
Expand All @@ -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.
Expand Down Expand Up @@ -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)))
Expand All @@ -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:
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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:
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -893,15 +893,15 @@ 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,
r"-Wl,-rpath,\$ORIGIN -L%T -l%xdynamiclib_namespec" + postfix,
)
)
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,
Expand All @@ -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"]
Expand Down Expand Up @@ -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]

Expand All @@ -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",
Expand Down
12 changes: 6 additions & 6 deletions compiler-rt/test/lsan/lit.common.cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ 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"
lsan_cflags = ["-fsanitize=hwaddress", "-fuse-ld=lld"]
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)
Expand All @@ -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.
Expand Down Expand Up @@ -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",
Expand All @@ -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",
]
Expand Down
Loading
Loading