diff options
author | Brad King <brad.king@kitware.com> | 2017-02-06 15:29:40 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2017-02-06 15:29:40 (GMT) |
commit | a4c8ad5ed81b08e042646e132f999bebaf97a83b (patch) | |
tree | 638d99e7bed8202945c751889f51995c358c6723 | |
parent | 59c50a1d3ceb0cec1690f454bb57dc63de4d621b (diff) | |
parent | 8a5cb84b0e5ef3deac4e241d0d4f3e9932daadaa (diff) | |
download | CMake-a4c8ad5ed81b08e042646e132f999bebaf97a83b.zip CMake-a4c8ad5ed81b08e042646e132f999bebaf97a83b.tar.gz CMake-a4c8ad5ed81b08e042646e132f999bebaf97a83b.tar.bz2 |
Merge topic 'androidtestutilities_cleanup'
8a5cb84b AndroidTestUtilities: do not require ExternalData unconditionally
9d34e51c AndroidTestUtilities: ignore exit status of ls
5 files changed, 34 insertions, 6 deletions
diff --git a/Modules/AndroidTestUtilities.cmake b/Modules/AndroidTestUtilities.cmake index a0a74fa..62d04f3 100644 --- a/Modules/AndroidTestUtilities.cmake +++ b/Modules/AndroidTestUtilities.cmake @@ -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}) diff --git a/Modules/AndroidTestUtilities/PushToAndroidDevice.cmake b/Modules/AndroidTestUtilities/PushToAndroidDevice.cmake index d8ca730..04529b1 100644 --- a/Modules/AndroidTestUtilities/PushToAndroidDevice.cmake +++ b/Modules/AndroidTestUtilities/PushToAndroidDevice.cmake @@ -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() diff --git a/Tests/RunCMake/AndroidTestUtilities/RunCMakeTest.cmake b/Tests/RunCMake/AndroidTestUtilities/RunCMakeTest.cmake index f0ae24b..7d031d4 100644 --- a/Tests/RunCMake/AndroidTestUtilities/RunCMakeTest.cmake +++ b/Tests/RunCMake/AndroidTestUtilities/RunCMakeTest.cmake @@ -18,3 +18,4 @@ endfunction() run_ATU(SetupTest1 "") run_ATU(SetupTest2 "tests") run_ATU(SetupTest3 "tests") +run_ATU(SetupTest4 "") diff --git a/Tests/RunCMake/AndroidTestUtilities/SetupTest4.cmake b/Tests/RunCMake/AndroidTestUtilities/SetupTest4.cmake new file mode 100644 index 0000000..9a27266 --- /dev/null +++ b/Tests/RunCMake/AndroidTestUtilities/SetupTest4.cmake @@ -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") diff --git a/Tests/RunCMake/AndroidTestUtilities/SetupTest4Build-check.cmake b/Tests/RunCMake/AndroidTestUtilities/SetupTest4Build-check.cmake new file mode 100644 index 0000000..ef7569d --- /dev/null +++ b/Tests/RunCMake/AndroidTestUtilities/SetupTest4Build-check.cmake @@ -0,0 +1,5 @@ +include(${CMAKE_CURRENT_LIST_DIR}/check.cmake) +compare_build_to_expected(FILES + "data/a.txt" + ) +check_for_setup_test() |