Skip to content

Commit 76fbfd6

Browse files
authored
chore(tests): skip tests relying on unsupported APIs on NX and PS platforms (#1517)
* fix(tests): skip cache tests on NX and PS platforms * Skip path_rename test for NX
1 parent b372158 commit 76fbfd6

2 files changed

Lines changed: 24 additions & 2 deletions

File tree

tests/unit/test_cache.c

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
#ifdef SENTRY_PLATFORM_WINDOWS
1111
# include <windows.h>
12-
#else
12+
#elif !defined(SENTRY_PLATFORM_NX) && !defined(SENTRY_PLATFORM_PS)
1313
# include <utime.h>
1414
#endif
1515

@@ -28,14 +28,21 @@ set_file_mtime(const sentry_path_t *path, time_t mtime)
2828
BOOL rv = SetFileTime(h, NULL, NULL, &ft);
2929
CloseHandle(h);
3030
return rv ? 0 : -1;
31-
#else
31+
#elif !defined(SENTRY_PLATFORM_NX) && !defined(SENTRY_PLATFORM_PS)
3232
struct utimbuf times = { .modtime = mtime, .actime = mtime };
3333
return utime(path->path, &times);
34+
#else
35+
(void)path;
36+
(void)mtime;
37+
return -1;
3438
#endif
3539
}
3640

3741
SENTRY_TEST(cache_keep)
3842
{
43+
#if defined(SENTRY_PLATFORM_NX) || defined(SENTRY_PLATFORM_PS)
44+
SKIP_TEST();
45+
#endif
3946
SENTRY_TEST_OPTIONS_NEW(options);
4047
sentry_options_set_dsn(options, "https://foo@sentry.invalid/42");
4148
sentry_options_set_cache_keep(options, true);
@@ -87,6 +94,9 @@ SENTRY_TEST(cache_keep)
8794

8895
SENTRY_TEST(cache_max_size)
8996
{
97+
#if defined(SENTRY_PLATFORM_NX) || defined(SENTRY_PLATFORM_PS)
98+
SKIP_TEST();
99+
#endif
90100
SENTRY_TEST_OPTIONS_NEW(options);
91101
sentry_options_set_dsn(options, "https://foo@sentry.invalid/42");
92102
sentry_options_set_cache_keep(options, true);
@@ -138,6 +148,9 @@ SENTRY_TEST(cache_max_size)
138148

139149
SENTRY_TEST(cache_max_age)
140150
{
151+
#if defined(SENTRY_PLATFORM_NX) || defined(SENTRY_PLATFORM_PS)
152+
SKIP_TEST();
153+
#endif
141154
SENTRY_TEST_OPTIONS_NEW(options);
142155
sentry_options_set_dsn(options, "https://foo@sentry.invalid/42");
143156
sentry_options_set_cache_keep(options, true);
@@ -185,6 +198,9 @@ SENTRY_TEST(cache_max_age)
185198

186199
SENTRY_TEST(cache_max_items)
187200
{
201+
#if defined(SENTRY_PLATFORM_NX) || defined(SENTRY_PLATFORM_PS)
202+
SKIP_TEST();
203+
#endif
188204
SENTRY_TEST_OPTIONS_NEW(options);
189205
sentry_options_set_dsn(options, "https://foo@sentry.invalid/42");
190206
sentry_options_set_cache_keep(options, true);
@@ -229,6 +245,9 @@ SENTRY_TEST(cache_max_items)
229245

230246
SENTRY_TEST(cache_max_size_and_age)
231247
{
248+
#if defined(SENTRY_PLATFORM_NX) || defined(SENTRY_PLATFORM_PS)
249+
SKIP_TEST();
250+
#endif
232251
// Verify size pruning keeps newer entries, removes all older once limit
233252
// hit. A (5KB), B (6KB), C (3KB) newest-to-oldest, max_size=10KB A+B=11KB
234253
// exceeds limit -> B pruned, C (older) also pruned

tests/unit/test_path.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,9 @@ SENTRY_TEST(path_mtime)
288288

289289
SENTRY_TEST(path_rename)
290290
{
291+
#if defined(SENTRY_PLATFORM_NX)
292+
SKIP_TEST();
293+
#endif
291294
sentry_path_t *src
292295
= sentry__path_from_str(SENTRY_TEST_PATH_PREFIX ".rename-src");
293296
TEST_ASSERT(!!src);

0 commit comments

Comments
 (0)