mirror of
https://github.com/Kitware/CMake.git
synced 2025-12-31 02:39:48 -06:00
AndroidTestUtilities: do not require ExternalData unconditionally
Attempting to use AndroidTestUtilities to simply install some local
files on device can result in the following error:
Neither ExternalData_URL_TEMPLATES nor ExternalData_OBJECT_STORES is set
We no longer require these ExternalData-specific variables to be set if
no such remote data files are requested.
Fixes: #16529
This commit is contained in:
committed by
Brad King
parent
9d34e51cdb
commit
8a5cb84b0e
@@ -110,11 +110,18 @@ function(android_add_test_data test_name)
|
||||
endforeach()
|
||||
|
||||
set(DATA_TARGET_NAME "${test_name}")
|
||||
ExternalData_Expand_Arguments(
|
||||
${DATA_TARGET_NAME}
|
||||
extern_data_output
|
||||
${AST_FILES})
|
||||
ExternalData_Add_Target(${DATA_TARGET_NAME})
|
||||
string(FIND "${AST_FILES}" "DATA{" data_files_found)
|
||||
if(${data_files_found} GREATER "-1")
|
||||
# Use ExternalData if any DATA{} files were found.
|
||||
ExternalData_Expand_Arguments(
|
||||
${DATA_TARGET_NAME}
|
||||
extern_data_output
|
||||
${AST_FILES})
|
||||
ExternalData_Add_Target(${DATA_TARGET_NAME})
|
||||
else()
|
||||
add_custom_target(${DATA_TARGET_NAME} ALL)
|
||||
set(extern_data_output ${AST_FILES})
|
||||
endif()
|
||||
|
||||
# For regular files on Linux, just copy them directly.
|
||||
foreach(path ${AST_FILES})
|
||||
|
||||
@@ -18,3 +18,4 @@ endfunction()
|
||||
run_ATU(SetupTest1 "")
|
||||
run_ATU(SetupTest2 "tests")
|
||||
run_ATU(SetupTest3 "tests")
|
||||
run_ATU(SetupTest4 "")
|
||||
|
||||
13
Tests/RunCMake/AndroidTestUtilities/SetupTest4.cmake
Normal file
13
Tests/RunCMake/AndroidTestUtilities/SetupTest4.cmake
Normal file
@@ -0,0 +1,13 @@
|
||||
enable_testing()
|
||||
include(AndroidTestUtilities)
|
||||
|
||||
find_program(adb_executable adb)
|
||||
|
||||
set(test_files "data/a.txt")
|
||||
|
||||
set(ANDROID 1)
|
||||
|
||||
android_add_test_data(setup_test
|
||||
FILES ${test_files}
|
||||
DEVICE_TEST_DIR "/data/local/tests/example1"
|
||||
DEVICE_OBJECT_STORE "/sdcard/.ExternalData/SHA")
|
||||
@@ -0,0 +1,5 @@
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/check.cmake)
|
||||
compare_build_to_expected(FILES
|
||||
"data/a.txt"
|
||||
)
|
||||
check_for_setup_test()
|
||||
Reference in New Issue
Block a user