From 3351b936d38c76cf1690cfc11ab232969748aa0d Mon Sep 17 00:00:00 2001 From: Kavon Farvardin Date: Mon, 3 Nov 2025 14:42:44 -0800 Subject: [PATCH 1/2] NFC: add explainer on how to disable unit tests --- unittests/runtime/CMakeLists.txt | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/unittests/runtime/CMakeLists.txt b/unittests/runtime/CMakeLists.txt index 9c972edac4832..f75128e269598 100644 --- a/unittests/runtime/CMakeLists.txt +++ b/unittests/runtime/CMakeLists.txt @@ -159,4 +159,28 @@ if(("${SWIFT_HOST_VARIANT_SDK}" STREQUAL "${SWIFT_PRIMARY_VARIANT_SDK}") AND swiftThreading${SWIFT_PRIMARY_VARIANT_SUFFIX} ${PLATFORM_TARGET_LINK_LIBRARIES} ) + +### +# GTEST_SKIP conditions. +# +# Sometimes, we need to skip running a unit test due to some bug on a specific +# platform. You can add a skip like this to the test: +# +# #ifdef __SKIP_RDAR123__ +# GTEST_SKIP() << "Skipping due to rdar://123"; +# #endif +# +# and use CMake to detect the OS, such as via +# +# if(EXISTS "/etc/os-release") +# file(READ "/etc/os-release" OS_RELEASE) +# if(OS_RELEASE MATCHES "Amazon Linux 2") +# ... +# +# and use +# +# target_compile_definitions(SwiftRuntimeTests PRIVATE __SKIP_RDAR123__) +# +# to add the preprocessor definition. + endif() From c06c72a5108656612dce90bb7629046b5ef492b1 Mon Sep 17 00:00:00 2001 From: Kavon Farvardin Date: Mon, 3 Nov 2025 14:50:07 -0800 Subject: [PATCH 2/2] unittests: skip some tests on AL2 due to rdar://163604876 It's blocking the Swift CI job https://ci.swift.org/job/oss-swift-package-amazon-linux-2-aarch64/ --- unittests/runtime/Actor.cpp | 9 +++++++++ unittests/runtime/CMakeLists.txt | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/unittests/runtime/Actor.cpp b/unittests/runtime/Actor.cpp index 5bf35784c1a63..31f3f84b3162f 100644 --- a/unittests/runtime/Actor.cpp +++ b/unittests/runtime/Actor.cpp @@ -318,6 +318,9 @@ TEST(ActorTest, actorSwitch) { } TEST(ActorTest, actorContention) { + #ifdef __SKIP_RDAR163604876__ + GTEST_SKIP() << "Skipping due to rdar://163604876"; + #endif run([] { using Context = TupleContext; auto actor = createActor(); @@ -387,6 +390,9 @@ TEST(ActorTest, actorContention) { } TEST(ActorTest, actorPriority) { + #ifdef __SKIP_RDAR163604876__ + GTEST_SKIP() << "Skipping due to rdar://163604876"; + #endif run([] { auto actor = createActor(); @@ -430,6 +436,9 @@ TEST(ActorTest, actorPriority) { } TEST(ActorTest, actorPriority2) { + #ifdef __SKIP_RDAR163604876__ + GTEST_SKIP() << "Skipping due to rdar://163604876"; + #endif run([] { auto actor = createActor(); diff --git a/unittests/runtime/CMakeLists.txt b/unittests/runtime/CMakeLists.txt index f75128e269598..99f94565bfe81 100644 --- a/unittests/runtime/CMakeLists.txt +++ b/unittests/runtime/CMakeLists.txt @@ -183,4 +183,13 @@ if(("${SWIFT_HOST_VARIANT_SDK}" STREQUAL "${SWIFT_PRIMARY_VARIANT_SDK}") AND # # to add the preprocessor definition. + +# A few unit tests with actor scheduling are failing AL2 aarch64 (rdar://163604876) +if(EXISTS "/etc/os-release") + file(READ "/etc/os-release" OS_RELEASE) + if(OS_RELEASE MATCHES "Amazon Linux 2" AND CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|ARM64|arm64") + target_compile_definitions(SwiftRuntimeTests PRIVATE __SKIP_RDAR163604876__) + endif() +endif() + endif()