Skip to content

Commit 3351b93

Browse files
committed
NFC: add explainer on how to disable unit tests
1 parent 6dbe0cb commit 3351b93

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

unittests/runtime/CMakeLists.txt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,4 +159,28 @@ if(("${SWIFT_HOST_VARIANT_SDK}" STREQUAL "${SWIFT_PRIMARY_VARIANT_SDK}") AND
159159
swiftThreading${SWIFT_PRIMARY_VARIANT_SUFFIX}
160160
${PLATFORM_TARGET_LINK_LIBRARIES}
161161
)
162+
163+
###
164+
# GTEST_SKIP conditions.
165+
#
166+
# Sometimes, we need to skip running a unit test due to some bug on a specific
167+
# platform. You can add a skip like this to the test:
168+
#
169+
# #ifdef __SKIP_RDAR123__
170+
# GTEST_SKIP() << "Skipping due to rdar://123";
171+
# #endif
172+
#
173+
# and use CMake to detect the OS, such as via
174+
#
175+
# if(EXISTS "/etc/os-release")
176+
# file(READ "/etc/os-release" OS_RELEASE)
177+
# if(OS_RELEASE MATCHES "Amazon Linux 2")
178+
# ...
179+
#
180+
# and use
181+
#
182+
# target_compile_definitions(SwiftRuntimeTests PRIVATE __SKIP_RDAR123__)
183+
#
184+
# to add the preprocessor definition.
185+
162186
endif()

0 commit comments

Comments
 (0)