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 99d6dfe82dde38..ead7fe3ef26319 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,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()
@@ -206,9 +204,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/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..1feb3b97b72ff4 100755
--- a/src/tests/Common/scripts/run-gc-reliability-framework.sh
+++ b/src/tests/Common/scripts/run-gc-reliability-framework.sh
@@ -1,34 +1,11 @@
#!/usr/bin/env bash
-OSName=$(uname -s | tr '[:upper:]' '[:lower:]')
-case $OSName in
- darwin)
- OS=osx
- ;;
+__RepoRootDir="$(cd "$(dirname "$0")/../../../.." && 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)