Commit 8a5cb84b authored by Zack Galbreath's avatar Zack Galbreath Committed by Brad King
Browse files

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
parent 9d34e51c
...@@ -110,11 +110,18 @@ function(android_add_test_data test_name) ...@@ -110,11 +110,18 @@ function(android_add_test_data test_name)
endforeach() endforeach()
set(DATA_TARGET_NAME "${test_name}") set(DATA_TARGET_NAME "${test_name}")
ExternalData_Expand_Arguments( string(FIND "${AST_FILES}" "DATA{" data_files_found)
${DATA_TARGET_NAME} if(${data_files_found} GREATER "-1")
extern_data_output # Use ExternalData if any DATA{} files were found.
${AST_FILES}) ExternalData_Expand_Arguments(
ExternalData_Add_Target(${DATA_TARGET_NAME}) ${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. # For regular files on Linux, just copy them directly.
foreach(path ${AST_FILES}) foreach(path ${AST_FILES})
......
...@@ -18,3 +18,4 @@ endfunction() ...@@ -18,3 +18,4 @@ endfunction()
run_ATU(SetupTest1 "") run_ATU(SetupTest1 "")
run_ATU(SetupTest2 "tests") run_ATU(SetupTest2 "tests")
run_ATU(SetupTest3 "tests") run_ATU(SetupTest3 "tests")
run_ATU(SetupTest4 "")
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")
include(${CMAKE_CURRENT_LIST_DIR}/check.cmake)
compare_build_to_expected(FILES
"data/a.txt"
)
check_for_setup_test()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment