Test that person detection example binary can run

PiperOrigin-RevId: 313275958
Change-Id: Ie128cccabb6e168b85920f72618530e15477a026
This commit is contained in:
Pete Warden 2020-05-26 15:11:12 -07:00 committed by TensorFlower Gardener
parent c3ded069ab
commit 1de7105aeb
3 changed files with 48 additions and 1 deletions

View File

@ -114,6 +114,14 @@ http_archive(
],
)
http_archive(
name = "person_detect_data",
sha256 = "170542270da256994ce24d1e357f6e84a54fdaf7d28ff2b74725a40b70b082cf",
urls = [
"https://storage.googleapis.com/download.tensorflow.org/data/tf_lite_micro_person_data_grayscale_2020_05_24.zip",
],
)
# Required for dependency @com_github_grpc_grpc
load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps")

View File

@ -23,7 +23,7 @@ cc_library(
cc_library(
name = "person_detect_model_data",
srcs = [
"person_detect_model_data.cc",
"@person_detect_data//:person_detect_model_data",
],
hdrs = [
"person_detect_model_data.h",
@ -118,3 +118,9 @@ cc_binary(
"//tensorflow/lite/schema:schema_fbs",
],
)
sh_test(
name = "person_detection_binary_test",
srcs = ["person_detection_binary_test.sh"],
data = [":person_detection"],
)

View File

@ -0,0 +1,33 @@
#!/bin/bash
# Copyright 2020 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.
# ==============================================================================
#
# Bash unit tests for the example binary.
set -e
OUTPUT_LOG_FILE=${TEST_TMPDIR}/output_log.txt
# Needed for copybara compatibility.
SCRIPT_BASE_DIR=/org_"tensor"flow
${TEST_SRCDIR}${SCRIPT_BASE_DIR}/tensorflow/lite/micro/examples/person_detection/person_detection 2>&1 | head > ${OUTPUT_LOG_FILE}
if ! grep -q 'person score' ${OUTPUT_LOG_FILE}; then
echo "ERROR: Expected logs not found in output '${OUTPUT_LOG_FILE}'"
exit 1
fi
echo
echo "SUCCESS: person_detection_binary_test PASSED"