From f28142d61efb233688e8c0496cb2441cfdcdf4e2 Mon Sep 17 00:00:00 2001 From: Dawid Jurczak Date: Thu, 8 Aug 2024 13:09:53 +0200 Subject: [PATCH] [RISC-V] Disable robust mutexes in PAL on Qemu Before this change due to https://gitlab.com/qemu-project/qemu/-/issues/2446 we get lot of System.Threading.Tests/System.IO.IsolatedStorage.Tests errors like: System.Threading.Tests.MutexTests.AbandonExisting(name: "Local\\0908829282ce40db90b073ccd04b4c62", waitType: WaitAny, waitCount: 1, notAbandonedWaitIndex: 0, isNotAbandonedWaitObjectSignaled: False, abandonDuringWait: False) [FAIL] System.AggregateException : One or more errors occurred. (Not enough storage is available to process this command. : 'Local\0908829282ce40db90b073ccd04b4c62'. One or more system calls failed: pthread_mutex_init(...) == ENOTSUP/EOPNOTSUPP;) ---- System.IO.IOException : Not enough storage is available to process this command. : 'Local\0908829282ce40db90b073ccd04b4c62'. One or more system calls failed: pthread_mutex_init(...) == ENOTSUP/EOPNOTSUPP; In this patch we force PAL to use file locks which fixes System.Threading.Tests/System.IO.IsolatedStorage.Tests on Qemu. --- eng/native/tryrun.cmake | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/eng/native/tryrun.cmake b/eng/native/tryrun.cmake index c0fe823dd78f1e..e5fb893778a3a0 100644 --- a/eng/native/tryrun.cmake +++ b/eng/native/tryrun.cmake @@ -45,6 +45,8 @@ elseif(EXISTS ${CROSS_ROOTFS}/etc/tizen-release) elseif(EXISTS ${CROSS_ROOTFS}/boot/system/develop/headers/config/HaikuConfig.h) set(HAIKU 1) set(CLR_CMAKE_TARGET_OS haiku) +elseif(DEFINED ENV{DOTNET_RUNNING_UNDER_QEMU}) + set(QEMU 1) endif() if(DARWIN) @@ -124,5 +126,9 @@ else() endif() if(TARGET_ARCH_NAME MATCHES "^(x86|x64|s390x|armv6|loongarch64|riscv64|ppc64le)$") - set_cache_value(HAVE_FUNCTIONAL_PTHREAD_ROBUST_MUTEXES_EXITCODE 0) + if (QEMU) + set_cache_value(HAVE_FUNCTIONAL_PTHREAD_ROBUST_MUTEXES_EXITCODE 1) + else() + set_cache_value(HAVE_FUNCTIONAL_PTHREAD_ROBUST_MUTEXES_EXITCODE 0) + endif() endif()