From 522437eab7b0cbfef2b7e3a3ae2b260eecd8ee3a Mon Sep 17 00:00:00 2001
From: Adeel <3840695+am11@users.noreply.github.com>
Date: Fri, 19 Jun 2026 18:28:40 +0300
Subject: [PATCH 1/4] Enable runtime tests on OpenBSD
---
.../Common/CoreCLRTestLibrary/Utilities.cs | 1 +
.../Common/XUnitWrapperGenerator/ITestInfo.cs | 4 +++
.../XUnitWrapperGenerator/TestPlatforms.cs | 34 ++++++++++---------
.../XUnitWrapperGenerator.cs | 1 +
src/tests/Common/scripts/bringup_runtest.sh | 2 +-
.../scripts/run-gc-reliability-framework.sh | 32 +++--------------
.../JIT/Directed/StructABI/StructABI.csproj | 2 +-
src/tests/build.sh | 2 +-
.../profiler/common/ProfilerTestRunner.cs | 6 ++--
.../profiler/eventpipe/reverse_startup.cs | 6 ++--
.../profiler/unittest/releaseondetach.cs | 6 ++--
src/tests/run.py | 4 +--
12 files changed, 43 insertions(+), 57 deletions(-)
diff --git a/src/tests/Common/CoreCLRTestLibrary/Utilities.cs b/src/tests/Common/CoreCLRTestLibrary/Utilities.cs
index f796a7769ed919..f257d4b1b9595e 100644
--- a/src/tests/Common/CoreCLRTestLibrary/Utilities.cs
+++ b/src/tests/Common/CoreCLRTestLibrary/Utilities.cs
@@ -68,6 +68,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 IsOpenBSD => OperatingSystem.IsOSPlatform("OpenBSD");
public static bool IsMacOSX => OperatingSystem.IsMacOS();
public static bool IsWindowsNanoServer => (!IsWindowsIoTCore && GetInstallationType().Equals("Nano Server", StringComparison.OrdinalIgnoreCase));
diff --git a/src/tests/Common/XUnitWrapperGenerator/ITestInfo.cs b/src/tests/Common/XUnitWrapperGenerator/ITestInfo.cs
index 3430dfce259b3d..3b6923f0285235 100644
--- a/src/tests/Common/XUnitWrapperGenerator/ITestInfo.cs
+++ b/src/tests/Common/XUnitWrapperGenerator/ITestInfo.cs
@@ -270,6 +270,10 @@ private static string GetPlatformConditionFromTestPlatform(Xunit.TestPlatforms p
{
platformCheckConditions.Add(@"global::System.OperatingSystem.IsFreeBSD()");
}
+ if (platform.HasFlag(Xunit.TestPlatforms.OpenBSD))
+ {
+ platformCheckConditions.Add(@"global::System.OperatingSystem.IsOSPlatform(""OpenBSD"")");
+ }
if (platform.HasFlag(Xunit.TestPlatforms.NetBSD))
{
platformCheckConditions.Add(@"global::System.OperatingSystem.IsOSPlatform(""NetBSD"")");
diff --git a/src/tests/Common/XUnitWrapperGenerator/TestPlatforms.cs b/src/tests/Common/XUnitWrapperGenerator/TestPlatforms.cs
index 1eaf92a2aacb52..ba10b87b08db8f 100644
--- a/src/tests/Common/XUnitWrapperGenerator/TestPlatforms.cs
+++ b/src/tests/Common/XUnitWrapperGenerator/TestPlatforms.cs
@@ -8,23 +8,25 @@ namespace Xunit
[Flags]
public enum TestPlatforms
{
- Windows = 1,
- Linux = 2,
- OSX = 4,
- FreeBSD = 8,
- NetBSD = 16,
- illumos = 32,
- Solaris = 64,
- iOS = 128,
- tvOS = 256,
- Android = 512,
- Browser = 1024,
- MacCatalyst = 2048,
- LinuxBionic = 4096,
- Wasi = 8192,
- Haiku = 16384,
- AnyUnix = FreeBSD | Linux | NetBSD | OSX | illumos | Solaris | iOS | tvOS | MacCatalyst | Android | Browser | LinuxBionic | Wasi | Haiku,
+ Windows = 1 << 0,
+ Linux = 1 << 1,
+ OSX = 1 << 2,
+ FreeBSD = 1 << 3,
+ NetBSD = 1 << 4,
+ illumos = 1 << 5,
+ Solaris = 1 << 6,
+ iOS = 1 << 7,
+ tvOS = 1 << 8,
+ Android = 1 << 9,
+ Browser = 1 << 10,
+ MacCatalyst = 1 << 11,
+ LinuxBionic = 1 << 12,
+ Wasi = 1 << 13,
+ Haiku = 1 << 14,
+ OpenBSD = 1 << 15,
+
AnyApple = OSX | iOS | tvOS | MacCatalyst,
+ AnyUnix = AnyApple | Linux | FreeBSD | NetBSD | OpenBSD | illumos | Solaris | Android | Browser | LinuxBionic | Wasi | Haiku,
Any = ~0
}
}
diff --git a/src/tests/Common/XUnitWrapperGenerator/XUnitWrapperGenerator.cs b/src/tests/Common/XUnitWrapperGenerator/XUnitWrapperGenerator.cs
index 6ff36425de25b7..dc7f6707bd1b65 100644
--- a/src/tests/Common/XUnitWrapperGenerator/XUnitWrapperGenerator.cs
+++ b/src/tests/Common/XUnitWrapperGenerator/XUnitWrapperGenerator.cs
@@ -1103,6 +1103,7 @@ private static Xunit.TestPlatforms GetPlatformForTargetOS(string? targetOS)
"browser" => Xunit.TestPlatforms.Browser,
"wasi" => Xunit.TestPlatforms.Wasi,
"freebsd" => Xunit.TestPlatforms.FreeBSD,
+ "openbsd" => Xunit.TestPlatforms.OpenBSD,
"netbsd" => Xunit.TestPlatforms.NetBSD,
null or "" or "anyos" => Xunit.TestPlatforms.Any,
_ => 0
diff --git a/src/tests/Common/scripts/bringup_runtest.sh b/src/tests/Common/scripts/bringup_runtest.sh
index 21f273cdc040b2..ee54a7ab80a664 100755
--- a/src/tests/Common/scripts/bringup_runtest.sh
+++ b/src/tests/Common/scripts/bringup_runtest.sh
@@ -716,7 +716,7 @@ function run_test {
# Get the number of processors available to the scheduler
platform="$(uname -s | tr '[:upper:]' '[:lower:]')"
-if [[ "$platform" == "freebsd" ]]; then
+if [[ "$platform" == "freebsd" || "$platform" == "openbsd" ]]; then
NumProc="$(($(sysctl -n hw.ncpu)+1))"
elif [[ "$platform" == "netbsd" || "$platform" == "sunos" ]]; then
NumProc="$(($(getconf NPROCESSORS_ONLN)+1))"
diff --git a/src/tests/Common/scripts/run-gc-reliability-framework.sh b/src/tests/Common/scripts/run-gc-reliability-framework.sh
index eda4d70bde2dab..12dc37684a66a0 100755
--- a/src/tests/Common/scripts/run-gc-reliability-framework.sh
+++ b/src/tests/Common/scripts/run-gc-reliability-framework.sh
@@ -1,34 +1,12 @@
#!/usr/bin/env bash
-OSName=$(uname -s | tr '[:upper:]' '[:lower:]')
-case $OSName in
- darwin)
- OS=osx
- ;;
+__ProjectRoot="$(cd "$(dirname "$0")"; pwd -P)"
+__RepoRootDir="$(cd "$__ProjectRoot"/../../../..; pwd -P)"
- freeBSD)
- OS=freebsd
- ;;
+. "$__RepoRootDir/eng/common/native/init-os-and-arch.sh"
- linux)
- OS=linux
- ;;
-
- netbsd)
- OS=netbsd
- ;;
-
- sunos)
- OS=sunos
- ;;
- *)
- echo "Unsupported OS $OSName detected, configuring as if for Linux"
- OS=linux
- ;;
-esac
-
-export CORE_ROOT=`pwd`/artifacts/tests/$OSName.$1.$2/Tests/Core_Root
-FRAMEWORK_DIR=`pwd`/artifacts/tests/$OSName.$1.$2/GC/Stress/Framework/ReliabilityFramework
+export CORE_ROOT=`pwd`/artifacts/tests/$os.$1.$2/Tests/Core_Root
+FRAMEWORK_DIR=`pwd`/artifacts/tests/$os.$1.$2/GC/Stress/Framework/ReliabilityFramework
$CORE_ROOT/corerun $FRAMEWORK_DIR/ReliabilityFramework.exe $FRAMEWORK_DIR/testmix_gc.config
EXIT_CODE=$?
if [ $EXIT_CODE -eq 100 ]
diff --git a/src/tests/JIT/Directed/StructABI/StructABI.csproj b/src/tests/JIT/Directed/StructABI/StructABI.csproj
index 2eb522bdf2b256..2c3ff385089a97 100644
--- a/src/tests/JIT/Directed/StructABI/StructABI.csproj
+++ b/src/tests/JIT/Directed/StructABI/StructABI.csproj
@@ -11,8 +11,8 @@
-
+
diff --git a/src/tests/build.sh b/src/tests/build.sh
index 556352b8b01342..7c7ee752a3e33f 100755
--- a/src/tests/build.sh
+++ b/src/tests/build.sh
@@ -397,7 +397,7 @@ fi
# Get the number of processors available to the scheduler
platform="$(uname -s | tr '[:upper:]' '[:lower:]')"
-if [[ "$platform" == "freebsd" ]]; then
+if [[ "$platform" == "freebsd" || "$platform" == "openbsd" ]]; then
__NumProc="$(($(sysctl -n hw.ncpu)+1))"
elif [[ "$platform" == "netbsd" || "$platform" == "sunos" ]]; then
__NumProc="$(($(getconf NPROCESSORS_ONLN)+1))"
diff --git a/src/tests/profiler/common/ProfilerTestRunner.cs b/src/tests/profiler/common/ProfilerTestRunner.cs
index 025d5c5a584f8d..8b7d50b7a69b47 100644
--- a/src/tests/profiler/common/ProfilerTestRunner.cs
+++ b/src/tests/profiler/common/ProfilerTestRunner.cs
@@ -151,13 +151,13 @@ public static string GetProfilerPath()
{
profilerName = $"{ProfilerName}.dll";
}
- else if ((TestLibrary.Utilities.IsLinux) || (TestLibrary.Utilities.IsFreeBSD))
+ else if (TestLibrary.Utilities.IsMacOSX)
{
- profilerName = $"lib{ProfilerName}.so";
+ profilerName = $"lib{ProfilerName}.dylib";
}
else
{
- profilerName = $"lib{ProfilerName}.dylib";
+ profilerName = $"lib{ProfilerName}.so";
}
string profilerPath = Path.Combine(Environment.CurrentDirectory, profilerName);
diff --git a/src/tests/profiler/eventpipe/reverse_startup.cs b/src/tests/profiler/eventpipe/reverse_startup.cs
index 5c32acb884708e..b5898559c619c3 100644
--- a/src/tests/profiler/eventpipe/reverse_startup.cs
+++ b/src/tests/profiler/eventpipe/reverse_startup.cs
@@ -125,13 +125,13 @@ public static string GetProfilerPath()
{
profilerName = "Profiler.dll";
}
- else if ((TestLibrary.Utilities.IsLinux) || (TestLibrary.Utilities.IsFreeBSD))
+ else if (TestLibrary.Utilities.IsMacOSX)
{
- profilerName = "libProfiler.so";
+ profilerName = "libProfiler.dylib";
}
else
{
- profilerName = "libProfiler.dylib";
+ profilerName = "libProfiler.so";
}
string rootPath = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
diff --git a/src/tests/profiler/unittest/releaseondetach.cs b/src/tests/profiler/unittest/releaseondetach.cs
index ae376d3fc787c1..dd5bc09ba20118 100644
--- a/src/tests/profiler/unittest/releaseondetach.cs
+++ b/src/tests/profiler/unittest/releaseondetach.cs
@@ -23,13 +23,13 @@ public unsafe static int RunTest(string[] args)
{
profilerName = "Profiler.dll";
}
- else if ((TestLibrary.Utilities.IsLinux) || (TestLibrary.Utilities.IsFreeBSD))
+ else if (TestLibrary.Utilities.IsMacOSX)
{
- profilerName = "libProfiler.so";
+ profilerName = "libProfiler.dylib";
}
else
{
- profilerName = "libProfiler.dylib";
+ profilerName = "libProfiler.so";
}
string rootPath = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
diff --git a/src/tests/run.py b/src/tests/run.py
index 7fb32639f11a45..0be0b8514259d2 100755
--- a/src/tests/run.py
+++ b/src/tests/run.py
@@ -611,7 +611,7 @@ def setup_coredump_generation(host_os):
"""
global coredump_pattern
- if host_os == "osx" or "freebsd":
+ if host_os == "osx" or "freebsd" or "openbsd":
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:
@@ -687,7 +687,7 @@ def print_info_from_coredump_file(host_os, arch, coredump_name, executable_name)
command = ""
- if host_os == "osx" or "freebsd":
+ if host_os == "osx" or "freebsd" or "openbsd":
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)
From c0143782f559522584bfa8778d08c81fddc0f6e9 Mon Sep 17 00:00:00 2001
From: Adeel Mujahid <3840695+am11@users.noreply.github.com>
Date: Fri, 19 Jun 2026 18:47:50 +0300
Subject: [PATCH 2/4] .
---
src/tests/Common/scripts/run-gc-reliability-framework.sh | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/tests/Common/scripts/run-gc-reliability-framework.sh b/src/tests/Common/scripts/run-gc-reliability-framework.sh
index 12dc37684a66a0..1feb3b97b72ff4 100755
--- a/src/tests/Common/scripts/run-gc-reliability-framework.sh
+++ b/src/tests/Common/scripts/run-gc-reliability-framework.sh
@@ -1,7 +1,6 @@
#!/usr/bin/env bash
-__ProjectRoot="$(cd "$(dirname "$0")"; pwd -P)"
-__RepoRootDir="$(cd "$__ProjectRoot"/../../../..; pwd -P)"
+__RepoRootDir="$(cd "$(dirname "$0")/../../../.." && pwd -P)"
. "$__RepoRootDir/eng/common/native/init-os-and-arch.sh"
From 5b8752355f320f1c391154ebd02783126e31646f Mon Sep 17 00:00:00 2001
From: Adeel <3840695+am11@users.noreply.github.com>
Date: Fri, 19 Jun 2026 21:37:13 +0300
Subject: [PATCH 3/4] Sync eng/common with arcade
---
eng/common/cross/build-rootfs.sh | 3 ++-
eng/common/cross/toolchain.cmake | 16 +++++++------
eng/common/native/NativeAotSupported.props | 26 ++++++++++++++++++++++
3 files changed, 37 insertions(+), 8 deletions(-)
create mode 100644 eng/common/native/NativeAotSupported.props
diff --git a/eng/common/cross/build-rootfs.sh b/eng/common/cross/build-rootfs.sh
index 273cae651a2b1e..3150ccac6fcd78 100755
--- a/eng/common/cross/build-rootfs.sh
+++ b/eng/common/cross/build-rootfs.sh
@@ -88,8 +88,9 @@ __FreeBSDPackages+=" terminfo-db"
__OpenBSDVersion="7.8"
__OpenBSDPackages="heimdal-libs"
__OpenBSDPackages+=" icu4c"
-__OpenBSDPackages+=" inotify-tools"
+__OpenBSDPackages+=" libinotify"
__OpenBSDPackages+=" openssl"
+__OpenBSDPackages+=" e2fsprogs"
__IllumosPackages="icu"
__IllumosPackages+=" mit-krb5"
diff --git a/eng/common/cross/toolchain.cmake b/eng/common/cross/toolchain.cmake
index b9488797e08afd..5ea863b79c7ded 100644
--- a/eng/common/cross/toolchain.cmake
+++ b/eng/common/cross/toolchain.cmake
@@ -59,9 +59,9 @@ elseif(TARGET_ARCH_NAME STREQUAL "arm64")
set(TIZEN_TOOLCHAIN "aarch64-tizen-linux-gnu")
endif()
elseif(FREEBSD)
- set(triple "aarch64-unknown-freebsd12")
+ set(TOOLCHAIN "aarch64-unknown-freebsd14")
elseif(OPENBSD)
- set(triple "aarch64-unknown-openbsd")
+ set(TOOLCHAIN "aarch64-unknown-openbsd")
endif()
elseif(TARGET_ARCH_NAME STREQUAL "armel")
set(CMAKE_SYSTEM_PROCESSOR armv7l)
@@ -117,9 +117,9 @@ elseif(TARGET_ARCH_NAME STREQUAL "x64")
set(TIZEN_TOOLCHAIN "x86_64-tizen-linux-gnu")
endif()
elseif(FREEBSD)
- set(triple "x86_64-unknown-freebsd12")
+ set(TOOLCHAIN "x86_64-unknown-freebsd14")
elseif(OPENBSD)
- set(triple "x86_64-unknown-openbsd")
+ set(TOOLCHAIN "x86_64-unknown-openbsd")
elseif(ILLUMOS)
set(TOOLCHAIN "x86_64-illumos")
elseif(HAIKU)
@@ -160,6 +160,8 @@ if(TIZEN)
find_toolchain_dir("${CROSS_ROOTFS}/usr/lib64/gcc/${TIZEN_TOOLCHAIN}")
endif()
+ message(STATUS "TIZEN_TOOLCHAIN_PATH set to: ${TIZEN_TOOLCHAIN_PATH}")
+
include_directories(SYSTEM ${TIZEN_TOOLCHAIN_PATH}/include/c++)
include_directories(SYSTEM ${TIZEN_TOOLCHAIN_PATH}/include/c++/${TIZEN_TOOLCHAIN})
endif()
@@ -204,9 +206,9 @@ if(ANDROID)
include(${CROSS_ROOTFS}/../build/cmake/android.toolchain.cmake)
elseif(FREEBSD OR OPENBSD)
# we cross-compile by instructing clang
- set(CMAKE_C_COMPILER_TARGET ${triple})
- set(CMAKE_CXX_COMPILER_TARGET ${triple})
- set(CMAKE_ASM_COMPILER_TARGET ${triple})
+ set(CMAKE_C_COMPILER_TARGET ${TOOLCHAIN})
+ set(CMAKE_CXX_COMPILER_TARGET ${TOOLCHAIN})
+ set(CMAKE_ASM_COMPILER_TARGET ${TOOLCHAIN})
set(CMAKE_SYSROOT "${CROSS_ROOTFS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=lld")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fuse-ld=lld")
diff --git a/eng/common/native/NativeAotSupported.props b/eng/common/native/NativeAotSupported.props
new file mode 100644
index 00000000000000..559a6663929eb4
--- /dev/null
+++ b/eng/common/native/NativeAotSupported.props
@@ -0,0 +1,26 @@
+
+
+
+
+ <_NativeAotSupportedOS Condition="
+ '$(TargetOS)' != 'browser' and
+ '$(TargetOS)' != 'haiku' and
+ '$(TargetOS)' != 'illumos' and
+ '$(TargetOS)' != 'netbsd' and
+ '$(TargetOS)' != 'solaris'
+ ">true
+
+
+ <_NativeAotSupportedArch Condition="
+ '$(TargetArchitecture)' != 'wasm' and
+ ('$(TargetArchitecture)' != 'x86' or '$(TargetOS)' == 'windows')
+ ">true
+
+ true
+
+
+
From 1ffdb1451d2c03aa16800ebae62f68619c44100a Mon Sep 17 00:00:00 2001
From: Adeel Mujahid <3840695+am11@users.noreply.github.com>
Date: Wed, 24 Jun 2026 09:56:15 +0300
Subject: [PATCH 4/4] Update toolchain.cmake
---
eng/common/cross/toolchain.cmake | 2 --
1 file changed, 2 deletions(-)
diff --git a/eng/common/cross/toolchain.cmake b/eng/common/cross/toolchain.cmake
index 5ea863b79c7ded..ead7fe3ef26319 100644
--- a/eng/common/cross/toolchain.cmake
+++ b/eng/common/cross/toolchain.cmake
@@ -160,8 +160,6 @@ if(TIZEN)
find_toolchain_dir("${CROSS_ROOTFS}/usr/lib64/gcc/${TIZEN_TOOLCHAIN}")
endif()
- message(STATUS "TIZEN_TOOLCHAIN_PATH set to: ${TIZEN_TOOLCHAIN_PATH}")
-
include_directories(SYSTEM ${TIZEN_TOOLCHAIN_PATH}/include/c++)
include_directories(SYSTEM ${TIZEN_TOOLCHAIN_PATH}/include/c++/${TIZEN_TOOLCHAIN})
endif()