1# Copyright 2024 The Android Open Source Project
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# This file should be sourced from bash. Sets environment variables for
16# running tests, and also checks that a number of dependencies are present
17# (indicating that the setup is correct).
18
19
20[[ "${BASH_SOURCE[0]}" != "${0}" ]] || \
21    { echo ">> Script must be sourced with 'source $0'" >&2; exit 1; }
22
23command -v adb >/dev/null 2>&1 || \
24    echo ">> Require adb executable to be in path" >&2
25
26command -v python >/dev/null 2>&1 || \
27    echo ">> Require python executable to be in path" >&2
28
29python3 -V 2>&1 | grep -q "Python 3.*" || \
30    echo ">> Require python version 3" >&2
31
32for M in mobly
33do
34    python3 -c "import $M" >/dev/null 2>&1 || \
35        echo ">> Require Python $M module" >&2
36done
37
38export PYTHONPATH="$PWD/utils:$PYTHONPATH"
39export PYTHONPATH="$PWD/tests:$PYTHONPATH"
40
41echo -e "\n*****Please execute below adb command on your dut before running the tests*****\n"
42echo -e "adb -s <device_id> shell am compat enable ALLOW_TEST_API_ACCESS com.android.cts.verifier\n\n"
43