Merge pull request #44457 from antmicro:speedup_tests

PiperOrigin-RevId: 341564386
Change-Id: I968876bc819c62f5039551cff65d46bb96cd4136
This commit is contained in:
TensorFlower Gardener 2020-11-10 00:10:14 -08:00
commit c417a3048a
2 changed files with 46 additions and 23 deletions

View File

@ -1,22 +1,40 @@
*** Settings ***
Suite Setup Setup
Suite Setup Prepare Tests
Suite Teardown Teardown
Test Setup Reset Emulation
Test Teardown Test Teardown
Test Teardown Teardown With Custom Message
Resource ${RENODEKEYWORDS}
*** Variables ***
${CREATE_SNAPSHOT_ON_FAIL} False
${UART} sysbus.cpu.uartSemihosting
*** Test Cases ***
Should Run Bluepill Test
[Documentation] Runs a Bluepill test and waits for a specific string on the semihosting UART
[Tags] bluepill uart tensorflow arm
${BIN} = Get Environment Variable BIN
*** Keywords ***
Prepare Tests
[Documentation] Make environment variables avaiable in whole test suite and list files in ${BIN_DIR}
Setup
${SCRIPT} = Get Environment Variable SCRIPT
${LOGFILE} = Get Environment Variable LOGFILE
${EXPECTED} = Get Environment Variable EXPECTED
Execute Command $bin = @${BIN}
Set Suite Variable ${SCRIPT}
Set Suite Variable ${EXPECTED}
Set Suite Variable ${LOGFILE}
List All Test Binaries
Teardown With Custom Message
[Documentation] Replace robot fail message with shorter one to avoid duplicated UART output in log
Set Test Message ${file} - FAILED
Test Teardown
List All Test Binaries
[Documentation] List all files in ${BIN_DIR} and make it available from test cases
Setup
${BIN_DIR} = Get Environment Variable BIN_DIR
@{binaries} = List Files In Directory ${BIN_DIR} absolute=True
Set Suite Variable @{binaries}
Test Binary
Remove File ${LOGFILE}
Execute Command $logfile = @${LOGFILE}
Execute Script ${SCRIPT}
@ -24,3 +42,17 @@ Should Run Bluepill Test
Start Emulation
Wait For Line On Uart ${EXPECTED}
*** Test Cases ***
Should Run All Bluepill Tests
[Documentation] Runs Bluepill tests and waits for a specific string on the semihosting UART
[Tags] bluepill uart tensorflow arm
FOR ${BIN} IN @{binaries}
Execute Command $bin = @${BIN}
${_} ${file} = Split Path ${BIN}
Set Test Variable ${file}
Test Binary
Execute Command Clear
Log \t${file} - PASSED console=True
END

View File

@ -46,34 +46,25 @@ then
exit 1
fi
# This check ensures that we only have a single $MICRO_LOG_FILENAME. Without it,
# renode will do a log rotation and there will be multiple files such as
# $MICRO_LOG_FILENAME.1 $MICRO_LOG_FILENAME.2 etc.
if [ -e $MICRO_LOG_FILENAME ]; then
rm $MICRO_LOG_FILENAME &> /dev/null
fi;
exit_code=0
if ! BIN=${ROOT_DIR}/$1 \
if ! BIN_DIR=${ROOT_DIR}/$1 \
SCRIPT=${ROOT_DIR}/tensorflow/lite/micro/testing/bluepill.resc \
LOGFILE=$MICRO_LOG_FILENAME \
EXPECTED="$2" \
${RENODE_TEST_SCRIPT} \
${ROOT_DIR}/tensorflow/lite/micro/testing/bluepill.robot \
-r $TEST_TMPDIR &> ${MICRO_LOG_PATH}robot_logs.txt
-r $TEST_TMPDIR
then
exit_code=1
fi
echo "LOGS:"
# Extract output from renode log
cat ${MICRO_LOG_FILENAME} |grep 'uartSemihosting' |sed 's/^.*from start] *//g'
if [ $exit_code -eq 0 ]
then
echo "$1: PASS"
echo "PASS"
else
echo "$1: FAIL - '$2' not found in logs."
echo "UART LOGS:"
# Extract output from renode log
cat ${MICRO_LOG_FILENAME} |grep 'uartSemihosting' |sed 's/^.*from start] *//g'
fi
exit $exit_code