@@ -22,7 +22,7 @@ using executorch::runtime::ArrayRef;
22
22
using executorch::runtime::Error;
23
23
using executorch::runtime::BackendExecutionContext;
24
24
using executorch::runtime::EValue;
25
- using executorch::runtime::BackendUpdateContext ;
25
+ using executorch::runtime::BackendOptionContext ;
26
26
using executorch::runtime::BackendOption;
27
27
using executorch::runtime::BackendOptions;
28
28
using executorch::runtime::Backend;
@@ -55,7 +55,7 @@ class MockBackend : public BackendInterface {
55
55
}
56
56
57
57
Error set_option (
58
- BackendUpdateContext & context,
58
+ BackendOptionContext & context,
59
59
const executorch::runtime::Span<BackendOption>& backend_options) override {
60
60
set_option_count++;
61
61
int sucess_update = 0 ;
@@ -111,7 +111,7 @@ class MockBackend : public BackendInterface {
111
111
};
112
112
113
113
TEST_F (BackendInterfaceUpdateTest, HandlesInvalidOption) {
114
- BackendUpdateContext context;
114
+ BackendOptionContext context;
115
115
116
116
// Test invalid key case
117
117
BackendOption invalid_option{
@@ -126,7 +126,7 @@ TEST_F(BackendInterfaceUpdateTest, HandlesInvalidOption) {
126
126
}
127
127
128
128
TEST_F (BackendInterfaceUpdateTest, HandlesStringOption) {
129
- BackendUpdateContext context;
129
+ BackendOptionContext context;
130
130
options.set_option (StrKey (" Backend" ), " GPU" );
131
131
// // Create a backend option to pass to update
132
132
@@ -143,7 +143,7 @@ TEST_F(BackendInterfaceUpdateTest, HandlesIntOption) {
143
143
// Check the default num_threads value is 0
144
144
EXPECT_EQ (mock_backend->debug , false );
145
145
// Create a mock context (needs to be defined or mocked)
146
- BackendUpdateContext context;
146
+ BackendOptionContext context;
147
147
148
148
int expected_num_threads = 4 ;
149
149
@@ -160,7 +160,7 @@ TEST_F(BackendInterfaceUpdateTest, HandlesBoolOption) {
160
160
// Check the default num_threads value is 0
161
161
EXPECT_EQ (mock_backend->debug , false );
162
162
// Create a mock context (needs to be defined or mocked)
163
- BackendUpdateContext context;
163
+ BackendOptionContext context;
164
164
165
165
options.set_option (BoolKey (" Debug" ), true );
166
166
@@ -175,7 +175,7 @@ TEST_F(BackendInterfaceUpdateTest, HandlesMultipleOptions) {
175
175
// Check the default num_threads value is 0
176
176
EXPECT_EQ (mock_backend->debug , false );
177
177
// Create a mock context (needs to be defined or mocked)
178
- BackendUpdateContext context;
178
+ BackendOptionContext context;
179
179
180
180
options.set_option (BoolKey (" Debug" ), true );
181
181
options.set_option (IntKey (" NumberOfThreads" ), 4 );
@@ -191,7 +191,7 @@ TEST_F(BackendInterfaceUpdateTest, HandlesMultipleOptions) {
191
191
}
192
192
193
193
TEST_F (BackendInterfaceUpdateTest, UpdateBeforeInit) {
194
- BackendUpdateContext update_context ;
194
+ BackendOptionContext option_context ;
195
195
MemoryAllocator memory_allocator{MemoryAllocator (0 , nullptr )};
196
196
197
197
BackendInitContext init_context (&memory_allocator);
@@ -200,7 +200,7 @@ TEST_F(BackendInterfaceUpdateTest, UpdateBeforeInit) {
200
200
options.set_option (StrKey (" Backend" ), " GPU" );
201
201
202
202
// Update before init
203
- Error err = mock_backend->set_option (update_context , options.view ());
203
+ Error err = mock_backend->set_option (option_context , options.view ());
204
204
EXPECT_EQ (err, Error::Ok);
205
205
206
206
// Now call init
@@ -218,7 +218,7 @@ TEST_F(BackendInterfaceUpdateTest, UpdateBeforeInit) {
218
218
}
219
219
220
220
TEST_F (BackendInterfaceUpdateTest, UpdateAfterInitBeforeExecute) {
221
- BackendUpdateContext update_context ;
221
+ BackendOptionContext option_context ;
222
222
MemoryAllocator init_memory_allocator{MemoryAllocator (0 , nullptr )};
223
223
BackendInitContext init_context (&init_memory_allocator);
224
224
BackendExecutionContext execute_context;
@@ -235,7 +235,7 @@ TEST_F(BackendInterfaceUpdateTest, UpdateAfterInitBeforeExecute) {
235
235
236
236
// Now update
237
237
options.set_option (StrKey (" Backend" ), " CPU" );
238
- Error err = mock_backend->set_option (update_context , options.view ());
238
+ Error err = mock_backend->set_option (option_context , options.view ());
239
239
EXPECT_EQ (err, Error::Ok);
240
240
241
241
// Now execute
@@ -252,7 +252,7 @@ TEST_F(BackendInterfaceUpdateTest, UpdateAfterInitBeforeExecute) {
252
252
}
253
253
254
254
TEST_F (BackendInterfaceUpdateTest, UpdateBetweenExecutes) {
255
- BackendUpdateContext update_context ;
255
+ BackendOptionContext option_context ;
256
256
MemoryAllocator init_memory_allocator{MemoryAllocator (0 , nullptr )};
257
257
BackendInitContext init_context (&init_memory_allocator);
258
258
BackendExecutionContext execute_context;
@@ -271,7 +271,7 @@ TEST_F(BackendInterfaceUpdateTest, UpdateBetweenExecutes) {
271
271
272
272
// Update between executes
273
273
options.set_option (StrKey (" Backend" ), " NPU" );
274
- err = mock_backend->set_option (update_context , options.view ());
274
+ err = mock_backend->set_option (option_context , options.view ());
275
275
EXPECT_EQ (err, Error::Ok);
276
276
277
277
// Second execute
0 commit comments