Commit a4c8ad5e authored by Brad King's avatar Brad King Committed by Kitware Robot
Browse files

Merge topic 'androidtestutilities_cleanup'

8a5cb84b AndroidTestUtilities: do not require ExternalData unconditionally
9d34e51c AndroidTestUtilities: ignore exit status of ls
parents 59c50a1d 8a5cb84b
......@@ -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})
......
......@@ -39,7 +39,9 @@ function(android_push_test_files_to_device)
# if(file_exists) will return true.
macro(check_device_file_exists device_file file_exists)
set(${file_exists} "")
execute_adb_command(shell ls ${device_file})
execute_process(
COMMAND ${adb_executable} shell ls ${device_file}
OUTPUT_VARIABLE out_var ERROR_VARIABLE out_var)
if(NOT out_var) # when a directory exists but is empty the output is empty
set(${file_exists} "YES")
else()
......
......@@ -18,3 +18,4 @@ endfunction()
run_ATU(SetupTest1 "")
run_ATU(SetupTest2 "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