File tree Expand file tree Collapse file tree 6 files changed +17
-1
lines changed
Expand file tree Collapse file tree 6 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -108,6 +108,7 @@ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake"
108108
109109include (CTest)
110110if (BUILD_TESTING)
111+ add_definitions (-DAWS_C_S3_ENABLE_TEST_STUBS)
111112 add_subdirectory (tests)
112113 if (NOT BYO_CRYPTO AND NOT CMAKE_CROSSCOMPILING )
113114 add_subdirectory (samples)
Original file line number Diff line number Diff line change @@ -178,8 +178,10 @@ struct aws_s3_client_vtable {
178178 struct aws_http_connection * client_connection ,
179179 const struct aws_http_make_request_options * options );
180180
181+ #ifdef AWS_C_S3_ENABLE_TEST_STUBS
181182 /********************* TEST ONLY STUB **************************/
182183 void (* after_prepare_upload_part_finish_stub )(struct aws_s3_request * request , struct aws_http_message * message );
184+ #endif
183185};
184186
185187struct aws_s3_upload_part_timeout_stats {
Original file line number Diff line number Diff line change @@ -123,9 +123,11 @@ struct aws_s3_meta_request_vtable {
123123 /* Pause the given request */
124124 int (* pause )(struct aws_s3_meta_request * meta_request , struct aws_s3_meta_request_resume_token * * resume_token );
125125
126+ #ifdef AWS_C_S3_ENABLE_TEST_STUBS
126127 /********************* TEST ONLY STUB **************************/
127128 /* A stub to the update implementation from meta request with the lock held. Only for tests. */
128129 bool (* synced_update_stub )(struct aws_s3_meta_request * meta_request );
130+ #endif
129131};
130132
131133/**
Original file line number Diff line number Diff line change @@ -202,12 +202,14 @@ static bool s_s3_auto_ranged_get_update(
202202 /* BEGIN CRITICAL SECTION */
203203 {
204204 aws_s3_meta_request_lock_synced_data (meta_request );
205+
206+ #ifdef AWS_C_S3_ENABLE_TEST_STUBS
205207 if (meta_request -> vtable -> synced_update_stub && meta_request -> vtable -> synced_update_stub (meta_request )) {
206208 /* TEST ONLY, allow test to stub here. */
207209 aws_s3_meta_request_unlock_synced_data (meta_request );
208210 return true;
209211 }
210-
212+ #endif
211213 /* If nothing has set the "finish result" then this meta request is still in progress, and we can potentially
212214 * send additional requests. */
213215 if (!aws_s3_meta_request_has_finish_result_synced (meta_request )) {
Original file line number Diff line number Diff line change @@ -486,11 +486,14 @@ static bool s_s3_auto_ranged_put_update(
486486 /* BEGIN CRITICAL SECTION */
487487 {
488488 aws_s3_meta_request_lock_synced_data (meta_request );
489+
490+ #ifdef AWS_C_S3_ENABLE_TEST_STUBS
489491 if (meta_request -> vtable -> synced_update_stub && meta_request -> vtable -> synced_update_stub (meta_request )) {
490492 /* TEST ONLY, allow test to stub here. */
491493 aws_s3_meta_request_unlock_synced_data (meta_request );
492494 return true;
493495 }
496+ #endif
494497
495498 if (!aws_s3_meta_request_has_finish_result_synced (meta_request )) {
496499 /* If resuming and list part has not been sent, do it now. */
@@ -1253,10 +1256,13 @@ static void s_s3_prepare_upload_part_finish(struct aws_s3_prepare_upload_part_jo
12531256 aws_future_http_message_set_error (part_prep -> on_complete , aws_last_error ());
12541257 goto on_done ;
12551258 }
1259+
1260+ #ifdef AWS_C_S3_ENABLE_TEST_STUBS
12561261 if (client -> vtable -> after_prepare_upload_part_finish_stub ) {
12571262 /* TEST ONLY, allow test to stub here. */
12581263 client -> vtable -> after_prepare_upload_part_finish_stub (request , message );
12591264 }
1265+ #endif
12601266
12611267 /* Success! */
12621268 aws_future_http_message_set_result_by_move (part_prep -> on_complete , & message );
Original file line number Diff line number Diff line change @@ -160,11 +160,14 @@ static bool s_s3_meta_request_default_update(
160160 /* BEGIN CRITICAL SECTION */
161161 {
162162 aws_s3_meta_request_lock_synced_data (meta_request );
163+
164+ #ifdef AWS_C_S3_ENABLE_TEST_STUBS
163165 if (meta_request -> vtable -> synced_update_stub && meta_request -> vtable -> synced_update_stub (meta_request )) {
164166 /* TEST ONLY, allow test to stub here. */
165167 aws_s3_meta_request_unlock_synced_data (meta_request );
166168 return true;
167169 }
170+ #endif
168171 if (!aws_s3_meta_request_has_finish_result_synced (meta_request )) {
169172
170173 /* If the request hasn't been sent, then create and send it now. */
You can’t perform that action at this time.
0 commit comments