diff --git a/src/coreclr/scripts/coreclr_arguments.py b/src/coreclr/scripts/coreclr_arguments.py index c49781bef715b..a7fb862a7c9c1 100644 --- a/src/coreclr/scripts/coreclr_arguments.py +++ b/src/coreclr/scripts/coreclr_arguments.py @@ -65,7 +65,7 @@ def __init__(self, self.valid_arches = ["x64", "x86", "arm", "arm64", "loongarch64", "riscv64", "wasm"] self.valid_build_types = ["Debug", "Checked", "Release"] - self.valid_host_os = ["windows", "osx", "linux", "illumos", "solaris", "haiku", "browser", "android", "wasi"] + self.valid_host_os = ["windows", "osx", "linux", "illumos", "solaris", "haiku", "freebsd", "browser", "android", "wasi"] self.__initialize__(args) @@ -175,7 +175,7 @@ def verify(self, def provide_default_host_os(): """ Return a string representing the current host operating system. - Returns one of: linux, osx, windows, illumos, solaris, haiku + Returns one of: linux, osx, windows, illumos, solaris, haiku, freebsd """ if sys.platform == "linux" or sys.platform == "linux2": @@ -189,6 +189,8 @@ def provide_default_host_os(): return 'illumos' if is_illumos else 'solaris' elif sys.platform == "haiku": return "haiku" + elif sys.platform.startswith("freebsd"): + return "freebsd" else: print("Unknown OS: %s" % sys.platform) sys.exit(1) diff --git a/src/tests/Common/CoreCLRTestLibrary/Utilities.cs b/src/tests/Common/CoreCLRTestLibrary/Utilities.cs index feadf19dc379d..5662db6d9f88b 100644 --- a/src/tests/Common/CoreCLRTestLibrary/Utilities.cs +++ b/src/tests/Common/CoreCLRTestLibrary/Utilities.cs @@ -67,6 +67,7 @@ public static bool Verbose public static bool IsWindows => OperatingSystem.IsWindows(); public static bool IsLinux => OperatingSystem.IsLinux(); + public static bool IsFreeBSD => OperatingSystem.IsFreeBSD(); public static bool IsMacOSX => OperatingSystem.IsMacOS(); public static bool IsWindows7 => IsWindows && Environment.OSVersion.Version.Major == 6 && Environment.OSVersion.Version.Minor == 1; public static bool IsWindowsNanoServer => (!IsWindowsIoTCore && GetInstallationType().Equals("Nano Server", StringComparison.OrdinalIgnoreCase)); diff --git a/src/tests/profiler/common/ProfilerTestRunner.cs b/src/tests/profiler/common/ProfilerTestRunner.cs index 875c89c480669..f39089713a11d 100644 --- a/src/tests/profiler/common/ProfilerTestRunner.cs +++ b/src/tests/profiler/common/ProfilerTestRunner.cs @@ -150,7 +150,7 @@ public static string GetProfilerPath() { profilerName = $"{ProfilerName}.dll"; } - else if (TestLibrary.Utilities.IsLinux) + else if ((TestLibrary.Utilities.IsLinux) || (TestLibrary.Utilities.IsFreeBSD)) { profilerName = $"lib{ProfilerName}.so"; } diff --git a/src/tests/profiler/eventpipe/reverse_startup.cs b/src/tests/profiler/eventpipe/reverse_startup.cs index d6433f1d4c4d5..5c32acb884708 100644 --- a/src/tests/profiler/eventpipe/reverse_startup.cs +++ b/src/tests/profiler/eventpipe/reverse_startup.cs @@ -125,7 +125,7 @@ public static string GetProfilerPath() { profilerName = "Profiler.dll"; } - else if (TestLibrary.Utilities.IsLinux) + else if ((TestLibrary.Utilities.IsLinux) || (TestLibrary.Utilities.IsFreeBSD)) { profilerName = "libProfiler.so"; } diff --git a/src/tests/profiler/unittest/releaseondetach.cs b/src/tests/profiler/unittest/releaseondetach.cs index 0e5ec490984cc..ae376d3fc787c 100644 --- a/src/tests/profiler/unittest/releaseondetach.cs +++ b/src/tests/profiler/unittest/releaseondetach.cs @@ -23,7 +23,7 @@ public unsafe static int RunTest(string[] args) { profilerName = "Profiler.dll"; } - else if (TestLibrary.Utilities.IsLinux) + else if ((TestLibrary.Utilities.IsLinux) || (TestLibrary.Utilities.IsFreeBSD)) { profilerName = "libProfiler.so"; } diff --git a/src/tests/run.py b/src/tests/run.py index 7947fd552837c..1eeb5a78cf008 100755 --- a/src/tests/run.py +++ b/src/tests/run.py @@ -607,7 +607,7 @@ def setup_coredump_generation(host_os): """ global coredump_pattern - if host_os == "osx": + if host_os == "osx" or "freebsd": coredump_pattern = subprocess.check_output("sysctl -n kern.corefile", shell=True).rstrip() elif host_os == "linux": with open("/proc/sys/kernel/core_pattern", "r") as f: @@ -683,7 +683,7 @@ def print_info_from_coredump_file(host_os, arch, coredump_name, executable_name) command = "" - if host_os == "osx": + if host_os == "osx" or "freebsd": command = "lldb -c %s -b -o 'bt all' -o 'disassemble -b -p'" % coredump_name elif host_os == "linux": command = "gdb --batch -ex \"thread apply all bt full\" -ex \"disassemble /r $pc\" -ex \"quit\" %s %s" % (executable_name, coredump_name)