Skip to content

Commit d637379

Browse files
authored
test: dont gate data wipe to only tests (#5479)
1 parent d38165b commit d637379

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

Sources/Sentry/SentryFileManager.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -786,13 +786,13 @@ - (BOOL)isDirectory:(NSString *)path
786786
return sentryStaticBasePath;
787787
}
788788

789-
#if defined(SENTRY_TEST) || defined(SENTRY_TEST_CI)
789+
#if defined(SENTRY_TEST) || defined(SENTRY_TEST_CI) || defined(DEBUG)
790790
void
791791
removeSentryStaticBasePath(void)
792792
{
793793
_non_thread_safe_removeFileAtPath(sentryStaticBasePath());
794794
}
795-
#endif // defined(SENTRY_TEST) || defined(SENTRY_TEST_CI)
795+
#endif // defined(SENTRY_TEST) || defined(SENTRY_TEST_CI) || defined(DEBUG)
796796

797797
#pragma mark - Profiling
798798

Sources/Sentry/SentryProfiler.mm

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -141,20 +141,22 @@ @implementation SentryProfiler {
141141

142142
+ (void)load
143143
{
144-
# if defined(SENTRY_TEST) || defined(SENTRY_TEST_CI)
144+
# if defined(SENTRY_TEST) || defined(SENTRY_TEST_CI) || defined(DEBUG)
145145
// we want to allow starting a launch profile from here for UI tests, but not unit tests
146146
if (NSProcessInfo.processInfo.environment[@"--io.sentry.ui-test.test-name"] == nil) {
147147
return;
148148
}
149149

150-
// the ui tests want to wipe the data before each test case runs, to remove any launch config
151-
// files that might be present before launching the app initially, however we need to make sure
152-
// to remove stale versions of the file before it gets used to potentially start a launch
153-
// profile that shouldn't have started, so we check here for this
150+
// the samples apps may want to wipe the data like before UI test case runs, or manually during
151+
// development, to remove any launch config files that might be present before launching the app
152+
// initially, however we need to make sure to remove stale versions of the file before it gets
153+
// used to potentially start a launch profile that shouldn't have started, so we check here for
154+
// this
154155
if ([NSProcessInfo.processInfo.arguments containsObject:@"--io.sentry.wipe-data"]) {
155156
removeSentryStaticBasePath();
156157
}
157-
# endif // defined(SENTRY_TEST) || defined(SENTRY_TEST_CI)
158+
# endif // defined(SENTRY_TEST) || defined(SENTRY_TEST_CI) || defined(DEBUG)
159+
158160
sentry_startLaunchProfile();
159161
}
160162

Sources/Sentry/include/SentryFileManager.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,9 @@ SENTRY_EXTERN void removeAppLaunchProfilingConfigFile(void);
174174

175175
SENTRY_EXTERN NSString *_Nullable sentryStaticBasePath(void);
176176

177-
# if defined(SENTRY_TEST) || defined(SENTRY_TEST_CI)
177+
# if defined(SENTRY_TEST) || defined(SENTRY_TEST_CI) || defined(DEBUG)
178178
SENTRY_EXTERN void removeSentryStaticBasePath(void);
179-
# endif // defined(SENTRY_TEST) || defined(SENTRY_TEST_CI)
179+
# endif // defined(SENTRY_TEST) || defined(SENTRY_TEST_CI) || defined(DEBUG)
180180

181181
#endif // SENTRY_TARGET_PROFILING_SUPPORTED
182182

0 commit comments

Comments
 (0)