From b3583e8b26d80741000e7539f7285336f2c024ff Mon Sep 17 00:00:00 2001 From: Andrew McKnight Date: Fri, 11 Jul 2025 17:51:25 -0800 Subject: [PATCH 1/2] test: remove remaining SENTRY_TEST_FATAL macro usages --- .../SentryProfiledTracerConcurrency.mm | 17 ++++++----------- Sources/Sentry/include/SentryInternalDefines.h | 11 ----------- 2 files changed, 6 insertions(+), 22 deletions(-) diff --git a/Sources/Sentry/Profiling/SentryProfiledTracerConcurrency.mm b/Sources/Sentry/Profiling/SentryProfiledTracerConcurrency.mm index 4d924448e48..70b17469f36 100644 --- a/Sources/Sentry/Profiling/SentryProfiledTracerConcurrency.mm +++ b/Sources/Sentry/Profiling/SentryProfiledTracerConcurrency.mm @@ -77,11 +77,6 @@ _unsafe_cleanUpContinuousProfilerV2() { if (_gInFlightRootSpans == 0) { - // This log message has been changed from an assertion failing in debug builds and tests to - // be less disruptive. This needs to be investigated because spans should not be finished - // multiple times. - // - // See https://github.com/getsentry/sentry-cocoa/pull/5363 for the full context. SENTRY_LOG_ERROR(@"Attemtpted to stop continuous profiler with no root spans in flight."); } else { _gInFlightRootSpans -= 1; @@ -101,7 +96,7 @@ std::lock_guard l(_gStateLock); if (![SentryContinuousProfiler isCurrentlyProfiling] && _gInFlightRootSpans != 0) { - SENTRY_TEST_FATAL(@"Unbalanced tracking of root spans and profiler detected."); + SENTRY_LOG_ERROR(@"Unbalanced tracking of root spans and profiler detected."); return; } @@ -179,13 +174,13 @@ _unsafe_cleanUpContinuousProfilerV2(); } else if (internalTraceId != nil) { if ([hub.getClient.options isContinuousProfilingEnabled]) { - SENTRY_TEST_FATAL(@"Tracers are not tracked with continuous profiling V1."); + SENTRY_LOG_ERROR(@"Tracers are not tracked with continuous profiling V1."); return; } if (_gTracersToProfilers == nil) { - SENTRY_TEST_FATAL(@"Tracer to profiler should have already been initialized by the " - @"time they are being queried"); + SENTRY_LOG_ERROR(@"Tracer to profiler should have already been initialized by the " + @"time they are being queried"); } const auto tracerKey = internalTraceId.sentryIdString; @@ -199,8 +194,8 @@ # if SENTRY_HAS_UIKIT if (_gProfilersToTracers == nil) { - SENTRY_TEST_FATAL(@"Profiler to tracer structure should have already been " - @"initialized by the time they are being queried"); + SENTRY_LOG_ERROR(@"Profiler to tracer structure should have already been " + @"initialized by the time they are being queried"); } if (_gProfilersToTracers.count == 0) { [SentryDependencyContainer.sharedInstance.framesTracker resetProfilingTimestamps]; diff --git a/Sources/Sentry/include/SentryInternalDefines.h b/Sources/Sentry/include/SentryInternalDefines.h index 51e2a62accb..b54acc56a85 100644 --- a/Sources/Sentry/include/SentryInternalDefines.h +++ b/Sources/Sentry/include/SentryInternalDefines.h @@ -27,17 +27,6 @@ static NSString *const SentryPlatformName = @"cocoa"; SENTRY_LOG_WARN(__VA_ARGS__); \ NSAssert(NO, __VA_ARGS__); -/** - * Abort in test, log a warning otherwise. Meant to help us fail faster in our own development, but - * never crash customers because since it's not something they can control with their own - * configuration. - */ -#if SENTRY_TEST || SENTRY_TEST_CI -# define SENTRY_TEST_FATAL(...) SENTRY_CASSERT(NO, __VA_ARGS__) -#else -# define SENTRY_TEST_FATAL(...) SENTRY_LOG_WARN(__VA_ARGS__) -#endif // SENTRY_TEST || SENTRY_TEST_CI - /** * Abort if assertion fails in debug, and log a warning if it fails in production. */ From c39698e2d75f9de2fe81608a9fe05d122b50d21a Mon Sep 17 00:00:00 2001 From: Andrew McKnight Date: Thu, 17 Jul 2025 17:39:57 -0800 Subject: [PATCH 2/2] get some missed --- Sources/Sentry/Profiling/SentryLaunchProfiling.m | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Sources/Sentry/Profiling/SentryLaunchProfiling.m b/Sources/Sentry/Profiling/SentryLaunchProfiling.m index 267c9833b74..fc6a2b657dc 100644 --- a/Sources/Sentry/Profiling/SentryLaunchProfiling.m +++ b/Sources/Sentry/Profiling/SentryLaunchProfiling.m @@ -104,8 +104,8 @@ NSNumber *sampleRand = launchConfigDict[kSentryLaunchProfileConfigKeyProfilesSampleRand]; if (sampleRand == nil) { - SENTRY_TEST_FATAL(@"Tried to start a continuous profile v2 with no configured sample " - @"rate/rand. Will not run profiler."); + SENTRY_LOG_ERROR(@"Tried to start a continuous profile v2 with no configured sample " + @"rate/rand. Will not run profiler."); return; } @@ -358,7 +358,7 @@ NSNumber *lifecycleValue = persistedLaunchConfigOptionsDict [kSentryLaunchProfileConfigKeyContinuousProfilingV2Lifecycle]; if (lifecycleValue == nil) { - SENTRY_TEST_FATAL( + SENTRY_LOG_ERROR( @"Missing expected launch profile config parameter for lifecycle. Will " @"not proceed with launch profile."); _sentry_cleanUpConfigFile();