Merge pull request #45222 from antmicro:renode_makefile
PiperOrigin-RevId: 348099358 Change-Id: If07c7cac5d3d6f6d250875bff02eb40330053528
This commit is contained in:
commit
d0ed3b210c
@ -13,12 +13,20 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# Parameters:
|
||||||
|
# ${1} - path to a binary to test or directory (all *_test will be run).
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
TARGET=bluepill
|
||||||
|
|
||||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
TFLM_ROOT_DIR=${SCRIPT_DIR}/..
|
TFLM_ROOT_DIR=${SCRIPT_DIR}/..
|
||||||
|
|
||||||
# The renode script for the board being emulated.
|
# The renode script for the board being emulated.
|
||||||
RESC_PATH=${TFLM_ROOT_DIR}/testing/bluepill.resc
|
RESC_PATH=${TFLM_ROOT_DIR}/testing/${TARGET}.resc
|
||||||
|
|
||||||
# Robot file with definition of custom keywords used in test suite.
|
# Robot file with definition of custom keywords used in test suite.
|
||||||
ROBOT_RESOURCE=${TFLM_ROOT_DIR}/testing/robot.resource.txt
|
ROBOT_RESOURCE=${TFLM_ROOT_DIR}/testing/robot.resource.txt
|
||||||
@ -41,8 +49,6 @@ then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exit_code=0
|
|
||||||
|
|
||||||
# Files generated by this script will go in the RESULTS_DIRECTORY. These include:
|
# Files generated by this script will go in the RESULTS_DIRECTORY. These include:
|
||||||
# 1. UART_LOG: Output log from the renode uart.
|
# 1. UART_LOG: Output log from the renode uart.
|
||||||
# 2. html and xml files generated by the Robot Framework.
|
# 2. html and xml files generated by the Robot Framework.
|
||||||
@ -52,12 +58,12 @@ exit_code=0
|
|||||||
# binaries are run in a the same test suite and UART_LOG only has logs from the last test
|
# binaries are run in a the same test suite and UART_LOG only has logs from the last test
|
||||||
# binary since it is deleted prior to running each test binary. If some test fails
|
# binary since it is deleted prior to running each test binary. If some test fails
|
||||||
# the UART_LOG will be printed to console log before being deleted.
|
# the UART_LOG will be printed to console log before being deleted.
|
||||||
RESULTS_DIRECTORY=/tmp/renode_bluepill_logs
|
RESULTS_DIRECTORY=/tmp/renode_${TARGET}_logs
|
||||||
mkdir -p ${RESULTS_DIRECTORY}
|
mkdir -p ${RESULTS_DIRECTORY}
|
||||||
|
|
||||||
UART_LOG=${RESULTS_DIRECTORY}/uart_log.txt
|
UART_LOG=${RESULTS_DIRECTORY}/uart_log.txt
|
||||||
|
|
||||||
ROBOT_SCRIPT=${RESULTS_DIRECTORY}/Bluepill.robot
|
ROBOT_SCRIPT=${RESULTS_DIRECTORY}/${TARGET}.robot
|
||||||
|
|
||||||
echo -e "*** Settings ***\n" \
|
echo -e "*** Settings ***\n" \
|
||||||
"Suite Setup Setup\n" \
|
"Suite Setup Setup\n" \
|
||||||
@ -66,7 +72,7 @@ echo -e "*** Settings ***\n" \
|
|||||||
"Test Teardown Teardown With Custom Message\n" \
|
"Test Teardown Teardown With Custom Message\n" \
|
||||||
"Resource \${RENODEKEYWORDS}\n" \
|
"Resource \${RENODEKEYWORDS}\n" \
|
||||||
"Resource ${ROBOT_RESOURCE}\n" \
|
"Resource ${ROBOT_RESOURCE}\n" \
|
||||||
"Default Tags bluepill uart tensorflow arm\n" \
|
"Default Tags tensorflow\n" \
|
||||||
"\n" \
|
"\n" \
|
||||||
"*** Variables ***\n" \
|
"*** Variables ***\n" \
|
||||||
"\${RESC} undefined_RESC\n" \
|
"\${RESC} undefined_RESC\n" \
|
||||||
@ -78,11 +84,17 @@ echo -e "*** Settings ***\n" \
|
|||||||
"Should Create Platform\n" \
|
"Should Create Platform\n" \
|
||||||
" Create Platform\n" > $ROBOT_SCRIPT
|
" Create Platform\n" > $ROBOT_SCRIPT
|
||||||
|
|
||||||
BIN_DIR=$1
|
declare -a FILES
|
||||||
for binary in `ls $BIN_DIR/*_test`;
|
if [[ -d ${1} ]]; then
|
||||||
|
FILES=`ls -1 ${1}/*_test`
|
||||||
|
else
|
||||||
|
FILES=${1}
|
||||||
|
fi
|
||||||
|
|
||||||
|
for binary in ${FILES}
|
||||||
do
|
do
|
||||||
echo -e "Should Run $(basename ${binary})\n"\
|
echo -e "Should Run $(basename ${binary})\n"\
|
||||||
" Test Binary @$(realpath ${binary})\n" >> $ROBOT_SCRIPT
|
" Test Binary @$(realpath ${binary})\n" >> ${ROBOT_SCRIPT}
|
||||||
done
|
done
|
||||||
|
|
||||||
ROBOT_COMMAND="${RENODE_TEST_SCRIPT} ${ROBOT_SCRIPT} \
|
ROBOT_COMMAND="${RENODE_TEST_SCRIPT} ${ROBOT_SCRIPT} \
|
||||||
@ -91,10 +103,5 @@ ROBOT_COMMAND="${RENODE_TEST_SCRIPT} ${ROBOT_SCRIPT} \
|
|||||||
--variable UART_LOG:${UART_LOG}"
|
--variable UART_LOG:${UART_LOG}"
|
||||||
|
|
||||||
echo "${ROBOT_COMMAND}"
|
echo "${ROBOT_COMMAND}"
|
||||||
|
echo ""
|
||||||
if ! ${ROBOT_COMMAND}
|
${ROBOT_COMMAND}
|
||||||
then
|
|
||||||
exit_code=1
|
|
||||||
fi
|
|
||||||
|
|
||||||
exit $exit_code
|
|
||||||
|
|||||||
@ -39,9 +39,4 @@ readable_run make -j8 -f tensorflow/lite/micro/tools/make/Makefile TARGET=${TARG
|
|||||||
# Next, build w/o release so that we can run the tests and get additional
|
# Next, build w/o release so that we can run the tests and get additional
|
||||||
# debugging info on failures.
|
# debugging info on failures.
|
||||||
readable_run make -f tensorflow/lite/micro/tools/make/Makefile clean
|
readable_run make -f tensorflow/lite/micro/tools/make/Makefile clean
|
||||||
readable_run make -j8 -f tensorflow/lite/micro/tools/make/Makefile TARGET=${TARGET} build
|
readable_run make -j8 -f tensorflow/lite/micro/tools/make/Makefile TARGET=${TARGET} test
|
||||||
|
|
||||||
# TODO(b/172939049): Using renode to run the tests is not currently integrated
|
|
||||||
# with the Makefile. So, we manually run the test script with the correct path
|
|
||||||
# to the bluepill generated files.
|
|
||||||
tensorflow/lite/micro/testing/test_bluepill_binary.sh tensorflow/lite/micro/tools/make/gen/bluepill_cortex-m3/bin/
|
|
||||||
|
|||||||
@ -525,6 +525,10 @@ $(HOST_OS) \
|
|||||||
arduino \
|
arduino \
|
||||||
chre
|
chre
|
||||||
|
|
||||||
|
# ${TARGET}_makefile.inc can set this to true to allow it to defined a custom
|
||||||
|
# implementation for `make test`. See bluepill_makefile as an example.
|
||||||
|
TARGET_SPECIFIC_MAKE_TEST:=0
|
||||||
|
|
||||||
ifeq ($(findstring $(TARGET),$(TARGETS_WITHOUT_MAKEFILES)),)
|
ifeq ($(findstring $(TARGET),$(TARGETS_WITHOUT_MAKEFILES)),)
|
||||||
include $(MAKEFILE_DIR)/targets/$(TARGET)_makefile.inc
|
include $(MAKEFILE_DIR)/targets/$(TARGET)_makefile.inc
|
||||||
endif
|
endif
|
||||||
@ -644,7 +648,9 @@ $(eval $(call microlite_test,$(notdir $(basename $(TEST_TARGET))),$(TEST_TARGET)
|
|||||||
$(foreach TEST_TARGET,$(filter tensorflow/lite/micro/kernels/%,$(MICROLITE_TEST_SRCS)),\
|
$(foreach TEST_TARGET,$(filter tensorflow/lite/micro/kernels/%,$(MICROLITE_TEST_SRCS)),\
|
||||||
$(eval $(call microlite_test,kernel_$(notdir $(basename $(TEST_TARGET))),$(TEST_TARGET))))
|
$(eval $(call microlite_test,kernel_$(notdir $(basename $(TEST_TARGET))),$(TEST_TARGET))))
|
||||||
|
|
||||||
|
ifeq ($(TARGET_SPECIFIC_MAKE_TEST),0)
|
||||||
test: $(MICROLITE_TEST_TARGETS)
|
test: $(MICROLITE_TEST_TARGETS)
|
||||||
|
endif
|
||||||
|
|
||||||
# Just build the test targets
|
# Just build the test targets
|
||||||
build: $(MICROLITE_BUILD_TARGETS)
|
build: $(MICROLITE_BUILD_TARGETS)
|
||||||
|
|||||||
@ -59,3 +59,10 @@ MICRO_LITE_EXAMPLE_TESTS := $(filter-out $(EXCLUDED_EXAMPLE_TESTS), $(MICRO_LITE
|
|||||||
|
|
||||||
TEST_SCRIPT := tensorflow/lite/micro/testing/test_bluepill_binary.sh
|
TEST_SCRIPT := tensorflow/lite/micro/testing/test_bluepill_binary.sh
|
||||||
|
|
||||||
|
# We are setting this variable to non-zero to allow us to have a custom
|
||||||
|
# implementation of `make test` for bluepill
|
||||||
|
TARGET_SPECIFIC_MAKE_TEST := 1
|
||||||
|
test: build
|
||||||
|
$(TEST_SCRIPT) $(BINDIR)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user