1#!/usr/bin/env bash
2# Copyright 2019 The TensorFlow Authors. All Rights Reserved.
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#     http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15# ==============================================================================
16#
17# Tests the microcontroller code using native x86 execution.
18
19set -e
20
21SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
22ROOT_DIR=${SCRIPT_DIR}/../../../../..
23cd "${ROOT_DIR}"
24
25source tensorflow/lite/micro/tools/ci_build/helper_functions.sh
26
27readable_run make -f tensorflow/lite/micro/tools/make/Makefile clean
28
29# TODO(b/143715361): downloading first to allow for parallel builds.
30readable_run make -f tensorflow/lite/micro/tools/make/Makefile third_party_downloads
31
32# Next, build w/o TF_LITE_STATIC_MEMORY to catch additional errors.
33# TODO(b/160955687): We run the tests w/o TF_LITE_STATIC_MEMORY to make the
34# internal and open source CI consistent. See b/160955687#comment7 for more
35# details.
36readable_run make -f tensorflow/lite/micro/tools/make/Makefile clean
37readable_run make -j8 -f tensorflow/lite/micro/tools/make/Makefile BUILD_TYPE=no_tf_lite_static_memory test
38
39# Next, make sure that the release build succeeds.
40readable_run make -f tensorflow/lite/micro/tools/make/Makefile clean
41readable_run make -j8 -f tensorflow/lite/micro/tools/make/Makefile BUILD_TYPE=release build
42
43# Next, build wit release and logs so that we can run the tests and get
44# additional debugging info on failures.
45readable_run make -f tensorflow/lite/micro/tools/make/Makefile clean
46readable_run make -s -j8 -f tensorflow/lite/micro/tools/make/Makefile BUILD_TYPE=release_with_logs test
47
48# Next, build w/o release so that we can run the tests and get additional
49# debugging info on failures.
50readable_run make -f tensorflow/lite/micro/tools/make/Makefile clean
51readable_run make -s -j8 -f tensorflow/lite/micro/tools/make/Makefile test
52
53