Skip to content

Commit 7cd209d

Browse files
authored
fix ci for device test (#19583)
Differential Revision: D105127933
1 parent a92200f commit 7cd209d

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

runtime/core/test/device_memory_buffer_test.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,12 @@ class DeviceMemoryBufferTest : public ::testing::Test {
8282
protected:
8383
static void SetUpTestSuite() {
8484
executorch::runtime::runtime_init();
85-
register_device_allocator(&g_mock_cuda);
85+
// On platforms like AppleMac xctest, the same process may be reused
86+
// across test invocations, so the static registry persists and
87+
// re-registering would abort. Only register once.
88+
if (get_device_allocator(DeviceType::CUDA) == nullptr) {
89+
register_device_allocator(&g_mock_cuda);
90+
}
8691
}
8792

8893
void SetUp() override {

0 commit comments

Comments
 (0)