Skip to content

test: remove remaining SENTRY_TEST_FATAL macro usages #5624

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 6 additions & 11 deletions Sources/Sentry/Profiling/SentryProfiledTracerConcurrency.mm
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,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;
Expand All @@ -104,7 +99,7 @@
std::lock_guard<std::mutex> 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;
}

Expand Down Expand Up @@ -183,13 +178,13 @@
_unsafe_cleanUpContinuousProfilerV2();
} else if (internalTraceId != nil) {
if (sentry_isContinuousProfilingEnabled(hub.getClient)) {
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 = sentry_stringFromSentryID(internalTraceId);
Expand All @@ -203,8 +198,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];
Expand Down
11 changes: 0 additions & 11 deletions Sources/Sentry/include/SentryInternalDefines.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down
Loading