1+ # Copyright 2025 Google LLC.
2+ #
3+ # Licensed under the Apache License, Version 2.0 (the "License");
4+ # you may not use this file except in compliance with the License.
5+ # You may obtain a copy of the License at
6+ #
7+ # http://www.apache.org/licenses/LICENSE-2.0
8+ #
9+ # Unless required by applicable law or agreed to in writing, software
10+ # distributed under the License is distributed on an "AS IS" BASIS,
11+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+ # See the License for the specific language governing permissions and
13+ # limitations under the License.
14+
15+ #! /bin/bash
16+
17+ source litert/integration_test/device_script_common.sh || exit 1
18+
19+ # TODO: Unify workdirs with other scripts.
20+ readonly work_dir=" /tmp/litert_extras"
21+ rm -rf " ${work_dir} "
22+ mkdir -p " ${work_dir} "
23+
24+ readonly cns_path=@@cns_path@@
25+
26+ if [[ " $cns_path " == " @@" * " @@" ]]; then
27+ fatal " No cns_path templated into the script."
28+ elif [[ -z " ${cns_path} " ]]; then
29+ fatal " cns_path is empty."
30+ fi
31+
32+ if fileutil test -d " ${cns_path} " ; then
33+ # Path is a directory. Copy all files in the directory.
34+ fileutil cp " ${cns_path} /*.tflite" " ${work_dir} /"
35+
36+ elif fileutil test -f " ${cns_path} " ; then
37+ # Path is a file. Copy the file.
38+ fileutil cp " ${cns_path} " " ${work_dir} /"
39+
40+ else
41+ fatal " The specified cns_path '${cns_path} ' is not a valid file or directory, or it does not exist."
42+ fi
43+
44+ for model_file in ${work_dir} /* ; do
45+ if [[ -f " ${model_file} " ]]; then
46+ echo " ${model_file} "
47+ fi
48+ done
0 commit comments