1# Copyright (c) 2020-2021 Intel Corporation 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14 15set(ANDROID_DEVICE_TESTING_DIRECTORY "/data/local/tmp/tbb_testing") 16 17find_program(adb_executable adb) 18if (NOT adb_executable) 19 message(FATAL_ERROR "Could not find adb") 20endif() 21 22macro(execute_on_device cmd) 23 execute_process(COMMAND ${adb_executable} shell ${cmd} RESULT_VARIABLE CMD_RESULT) 24 if (CMD_RESULT) 25 message(FATAL_ERROR "Error while on device execution: ${cmd} error_code: ${CMD_RESULT}") 26 endif() 27endmacro() 28 29macro(transfer_data data_path) 30 execute_process(COMMAND ${adb_executable} push --sync ${data_path} ${ANDROID_DEVICE_TESTING_DIRECTORY} 31 RESULT_VARIABLE CMD_RESULT OUTPUT_QUIET) 32 if (CMD_RESULT) 33 message(FATAL_ERROR "Error while data transferring: ${data_path} error_code: ${CMD_RESULT}") 34 endif() 35endmacro() 36