Skip to content

Commit 46beaa6

Browse files
authored
Merge pull request #3076 from rintaro/test-upload-stdlib-target
2 parents 058fb40 + 93f22b6 commit 46beaa6

File tree

1 file changed

+32
-28
lines changed

1 file changed

+32
-28
lines changed

test/CMakeLists.txt

Lines changed: 32 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,38 @@ if(PYTHONINTERP_FOUND)
199199
set(validation_test_dependencies
200200
"swiftStdlibCollectionUnittest-${SWIFT_SDK_${SDK}_LIB_SUBDIR}")
201201

202+
set(command_upload_stdlib)
203+
set(command_upload_swift_reflection_test)
204+
if("${SDK}" STREQUAL "IOS" OR "${SDK}" STREQUAL "TVOS" OR "${SDK}" STREQUAL "WATCHOS")
205+
# These are supported testing SDKs, but their implementation of
206+
# `command_upload_stdlib` is hidden.
207+
elseif("${SDK}" STREQUAL "ANDROID")
208+
# Warning: This step will fail if you do not have an Android device
209+
# connected via USB. See docs/Android.md for details on
210+
# how to run the test suite for Android.
211+
set(command_upload_stdlib
212+
COMMAND
213+
# Reboot the device and remove everything in its tmp
214+
# directory. Build products and test executables are pushed
215+
# to that directory when running the test suite.
216+
${PYTHON_EXECUTABLE} "${SWIFT_SOURCE_DIR}/utils/android/adb_clean.py"
217+
COMMAND
218+
${PYTHON_EXECUTABLE} "${SWIFT_SOURCE_DIR}/utils/android/adb_push_built_products.py"
219+
--ndk "${SWIFT_ANDROID_NDK_PATH}"
220+
--destination "${SWIFT_ANDROID_DEPLOY_DEVICE_PATH}"
221+
# Build products like libswiftCore.so.
222+
"${SWIFTLIB_DIR}/android"
223+
# These two directories may contain the same libraries,
224+
# but upload both to device just in case. Duplicates will be
225+
# overwritten, and uploading doesn't take very long anyway.
226+
"${SWIFT_ANDROID_ICU_UC}"
227+
"${SWIFT_ANDROID_ICU_I18N}")
228+
endif()
229+
add_custom_target("upload-stdlib${VARIANT_SUFFIX}"
230+
${command_upload_stdlib}
231+
${command_upload_swift_reflection_test}
232+
COMMENT "Uploading stdlib")
233+
202234
foreach(test_mode ${TEST_MODES})
203235
set(LIT_ARGS "${SWIFT_TEST_EXTRA_ARGS} ${LLVM_LIT_ARGS}")
204236
separate_arguments(LIT_ARGS)
@@ -210,34 +242,6 @@ if(PYTHONINTERP_FOUND)
210242

211243
list(APPEND LIT_ARGS "--xunit-xml-output=${swift_test_results_dir}/lit-tests.xml")
212244

213-
set(command_upload_stdlib)
214-
set(command_upload_swift_reflection_test)
215-
if("${SDK}" STREQUAL "IOS" OR "${SDK}" STREQUAL "TVOS" OR "${SDK}" STREQUAL "WATCHOS")
216-
# These are supported testing SDKs, but their implementation of
217-
# `command_upload_stdlib` is hidden.
218-
elseif("${SDK}" STREQUAL "ANDROID")
219-
# Warning: This step will fail if you do not have an Android device
220-
# connected via USB. See docs/Android.md for details on
221-
# how to run the test suite for Android.
222-
set(command_upload_stdlib
223-
COMMAND
224-
# Reboot the device and remove everything in its tmp
225-
# directory. Build products and test executables are pushed
226-
# to that directory when running the test suite.
227-
${PYTHON_EXECUTABLE} "${SWIFT_SOURCE_DIR}/utils/android/adb_clean.py"
228-
COMMAND
229-
${PYTHON_EXECUTABLE} "${SWIFT_SOURCE_DIR}/utils/android/adb_push_built_products.py"
230-
--ndk "${SWIFT_ANDROID_NDK_PATH}"
231-
--destination "${SWIFT_ANDROID_DEPLOY_DEVICE_PATH}"
232-
# Build products like libswiftCore.so.
233-
"${SWIFTLIB_DIR}/android"
234-
# These two directories may contain the same libraries,
235-
# but upload both to device just in case. Duplicates will be
236-
# overwritten, and uploading doesn't take very long anyway.
237-
"${SWIFT_ANDROID_ICU_UC}"
238-
"${SWIFT_ANDROID_ICU_I18N}")
239-
endif()
240-
241245
foreach(test_subset ${TEST_SUBSETS})
242246
set(directories)
243247
set(dependencies ${test_dependencies})

0 commit comments

Comments
 (0)