Skip to content

Commit

Permalink
Add FreeBSD as valid test host. (#106302)
Browse files Browse the repository at this point in the history
* Add FreeBSD to python test runner

* More FreeBSD cases
  • Loading branch information
Thefrank committed Sep 23, 2024
1 parent e3c9281 commit 4621bb6
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 7 deletions.
6 changes: 4 additions & 2 deletions src/coreclr/scripts/coreclr_arguments.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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":
Expand All @@ -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)
Expand Down
1 change: 1 addition & 0 deletions src/tests/Common/CoreCLRTestLibrary/Utilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
2 changes: 1 addition & 1 deletion src/tests/profiler/common/ProfilerTestRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
Expand Down
2 changes: 1 addition & 1 deletion src/tests/profiler/eventpipe/reverse_startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
Expand Down
2 changes: 1 addition & 1 deletion src/tests/profiler/unittest/releaseondetach.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
Expand Down
4 changes: 2 additions & 2 deletions src/tests/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 4621bb6

Please sign in to comment.