STT-tensorflow/tensorflow/lite/micro/testing/test_xtensa_binary.sh
Advait Jain 66531e40a3 Added a run_ makefile target for non-test binaries.
Also, the x86 test behavior has changed:
  * removed the unnecessary testing script for x86 with Make and bazel.
  * This change means that we no longer need a special skylark rule for tflite_micro_cc_test and can instead directly use cc_test.
  * All the logs from the test are now visible on the terminal (previously we would only see logs on errors, which can be annoying
    for debugging)

Tested that the following commands:
```
make -f tensorflow/lite/micro/tools/make/Makefile TARGET=xtensa OPTIMIZED_KERNEL_DIR=xtensa TARGET_ARCH=fusion_f1 XTENSA_CORE=F1_190305_swupgrade run_keyword_benchmark -j8
make -f tensorflow/lite/micro/tools/make/Makefile run_keyword_benchmark -j8
```
execute without any error.

The output is someting like:
```
InitializeKeywordRunner() took 39 ticks (0 ms)
KeywordRunNIerations(1) took 42 ticks (0 ms)
KeywordRunNIerations(10) took 187 ticks (0 ms)
```

Prior to this change, benchmarks would have to be run with
`make test_keyword_benchmark` which would give a confusing output:

```
InitializeKeywordRunner() took 85 ticks (0 ms)
KeywordRunNIerations(1) took 27 ticks (0 ms)
KeywordRunNIerations(10) took 276 ticks (0 ms)
make: *** [tensorflow/lite/micro/benchmarks/Makefile.inc:28: test_keyword_benchmark] Error 1
```

Fixes http://b/168123200
Another relevant bug (for the asan failures): http://b/179930607
2021-02-10 14:39:30 -08:00

41 lines
1.2 KiB
Bash
Executable File

#!/bin/bash -e
# Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
#
# Tests an Xtensa binary by parsing the log output.
#
# First argument is the binary location.
#
# Second argument is a regular expression that's required to be in the output
# logs for the test to pass.
declare -r TEST_TMPDIR=/tmp/test_xtensa_binary/
declare -r MICRO_LOG_PATH=${TEST_TMPDIR}/$1
declare -r MICRO_LOG_FILENAME=${MICRO_LOG_PATH}/logs.txt
mkdir -p ${MICRO_LOG_PATH}
xt-run $1 2>&1 | tee ${MICRO_LOG_FILENAME}
if [[ ${2} != "non_test_binary" ]]
then
if grep -q "$2" ${MICRO_LOG_FILENAME}
then
exit 0
else
exit 1
fi
fi