1#!/bin/bash
2
3# Copyright (C) 2015 The Android Open Source Project
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9#       http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16
17# Helper script for running unit tests for compatibility libraries
18
19CTS_DIR=$(dirname ${0})
20source ${CTS_DIR}/test_defs.sh
21
22echo
23echo "---- BUILD ---- "
24echo
25
26# check if in Android build env
27if [ ! -z ${ANDROID_BUILD_TOP} ]; then
28    HOST=`uname`
29    if [ "$HOST" == "Linux" ]; then
30        OS="linux-x86"
31    elif [ "$HOST" == "Darwin" ]; then
32        OS="darwin-x86"
33    else
34        echo "Unrecognized OS"
35        exit
36    fi;
37fi;
38
39BUILD_TARGETS="
40    compatibility-common-util-tests\
41    compatibility-host-util-tests\
42    compatibility-device-util-tests\
43    compatibility-tradefed-tests\
44    cts-tradefed-tests\
45    compatibility-device-info-tests\
46    compatibility-manifest-generator-tests
47    compatibility-host-media-preconditions-tests\
48    CompatibilityTestApp"
49
50pushd ${CTS_DIR}/..
51make ${BUILD_TARGETS} -j32
52BUILD_STATUS=$?
53popd
54if [ "${BUILD_STATUS}" != "0" ]; then
55    echo "BUILD FAILED - EXIT"
56    exit 1;
57fi;
58
59
60echo
61echo "---- DEVICE-SIDE TESTS ---- "
62echo
63
64${CTS_DIR}/common/device-side/test-app/run_tests.sh
65
66echo
67echo "---- HOST TESTS ---- "
68echo
69
70############### Run the host side tests ###############
71${CTS_DIR}/common/host-side/tradefed/tests/run_tests.sh
72${CTS_DIR}/common/host-side/manifest-generator/tests/run_tests.sh
73${CTS_DIR}/common/host-side/util/tests/run_tests.sh
74${CTS_DIR}/common/util/tests/run_tests.sh
75
76${CTS_DIR}/tools/cts-tradefed/tests/run_tests.sh
77
78${CTS_DIR}/tests/tests/mediastress/preconditions/tests/run_tests.sh
79