1#!/bin/bash
2# Copyright (C) 2017 The Android Open Source Project
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# launcher script for vts-hc (host controller)
17# can be used from an Android build environment, or a standalone vts zip
18
19# get OS
20HOST=`uname`
21if [ "$HOST" == "Linux" ]; then
22    OS="linux-x86"
23elif [ "$HOST" == "Darwin" ]; then
24    OS="darwin-x86"
25else
26    echo "Unrecognized OS"
27    exit
28fi
29
30# check if in Android build env
31if [ ! -z "${ANDROID_BUILD_TOP}" ]; then
32    if [ ! -z "${ANDROID_HOST_OUT}" ]; then
33        VTS_ROOT=${ANDROID_HOST_OUT}/vtslab
34    else
35        VTS_ROOT=${ANDROID_BUILD_TOP}/${OUT_DIR:-out}/host/${OS}/vtslab
36    fi
37    if [ ! -d ${VTS_ROOT} ]; then
38        echo "Could not find $VTS_ROOT in Android build environment. Try 'make vts'"
39        exit
40    fi;
41fi;
42
43if [ -z ${VTS_ROOT} ]; then
44    # assume we're in an extracted vts install
45    VTS_ROOT="$(dirname $(readlink -e $0))/../.."
46fi;
47
48find ${VTS_ROOT} -name "*.pyc" -exec rm -f {} \;
49cd ${VTS_ROOT}/android-vtslab/testcases/; python -m host_controller.main "$@"
50